-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernmake
More file actions
executable file
·94 lines (91 loc) · 2.38 KB
/
kernmake
File metadata and controls
executable file
·94 lines (91 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
if [ "${UID}" != 1000 ]; then
echo "Switching to user"
exec sudo -u kyle $0 $@;
fi
cd ~kyle/pi/linux
#export CHOST=armv7a-unknown-linux-gnueabihf
export CHOST=aarch64-unknown-linux-gnu
#export CC=armv7a-unknown-linux-gnu-clang
#export CXX=armv7a-unknown-linux-gnu-clang++
export ARCH=arm64
export LLVM=0
export LLVM_IAS="${LLVM}"
export TMPFS=${TMPFS:-0}
export TDIR="/home/kyle/pi"
export CFLAGS="-mcpu=cortex-a76+crypto"
#export CFLAGS="-march=armv7-a -mtune=cortex-a72 -mfpu=neon-fp-armv8"
#CFLAGS="-mcpu=cortex-a72 -mfpu=neon-fp-armv8"
if [ "${LLVM}" == 0 ]; then
# CFLAGS="${CFLAGS} -march=armv8-a+crc"
true
else
LLVM_PREFIX="${CHOST}-"
CFLAGS="${CFLAGS}"
fi
echo "${CFLAGS}"
sleep 0.5
#export CFLAGS="-mtune=cortex-a72"
# -mfloat-abi=hard"
#export CFLAGS="${KBUILD_CFLAGS}"
unset CCACHE_PREFIX
#nodistcc
#export PATH=$(echo "${PATH}" | sed -e s#/usr/lib/distcc/bin:##)
#distcc
DPATH="/usr/lib/distcc/bin"
if ping -c2 192.168.1.2 &>/dev/null; then
export PATH="/usr/local/bin:${DPATH}:/usr/bin:${PATH}"
else
export PATH="${PATH/${DPATH}/}"
fi
set -e
if [ "${LLVM}" = 0 ]; then
unset LLVM LLVM_IAS
fi
function int_cleanup() {
echo "Cleaning up!"
rsync -ahp /home/kyle/pi/linux-build "${TDIR}"/
rm -Rf "${TDIR}"
exit 1
}
do_tmpfs() {
if [[ "${TMPFS}" == "1" ]]; then
export TDIR=$(mktemp -d)
trap int_cleanup SIGINT
else
export TDIR=/home/kyle/pi/
fi
}
sync_tmpfs() {
if [[ "${TMPFS}" == "1" ]]; then
if [ "${COMPLETE}" != 1 ]; then
#setup initial tmpfs
do_tmpfs
echo "Copying source into ram (or not)..."
rsync -ahpz --exclude=.git /home/kyle/pi/linux/ "${TDIR}/linux"
cd "${TDIR}/linux"
rsync -ahp /home/kyle/pi/linux-build "${TDIR}"/
else
rsync -ahp --del "${TDIR}/linux-build" /home/kyle/pi/
cd /home/kyle/pi/linux
if [[ "${TDIR}" == *"/tmp"* ]]; then
rm /home/kyle/pi/linux-build/source
ln -sf /home/kyle/pi/linux /home/kyle/pi/linux-build/source
cd /home/kyle/pi/linux-build
../linux/scripts/mkmakefile /home/kyle/pi/linux
rm -R "${TDIR}" >/dev/null &
trap - SIGINT # Done with tmpfs, no need to clean it up on control+c
fi
fi
fi
}
if [[ "${0}" == *"make"* ]]; then
make CFLAGS="${CFLAGS}" KCFLAGS="${CFLAGS}" O=../linux-build oldconfig
sync_tmpfs
make "V=${V}" CFLAGS="${CFLAGS}" KCFLAGS="${CFLAGS}" O="${TDIR}/linux-build" -j32 -l3 $@
export COMPLETE=1
sync_tmpfs
else
make KERNEL=kernel7l O=../linux-build oldconfig
make O=../linux-build menuconfig
fi