-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-kernel.sh
executable file
·69 lines (59 loc) · 1.63 KB
/
build-kernel.sh
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
#!/usr/bin/env bash
set -e
while [ $# -ge 1 ]; do
case $1 in
-d) shift && DEVICE=$1 ;;
esac
shift
done
case $DEVICE in
citrus) TARGET=citrus ;;
lime) TARGET=lime ;;
*) exit 1 ;;
esac
ROOT=$(pwd)
ZIPNAME=Nbr-kernel-4.19-$TARGET-$(date +"%F")
JOBS=$(nproc --all)
export PATH=$ROOT/arm64-gcc/bin:$ROOT/arm-gcc/bin:$PATH
export KBUILD_BUILD_USER=mamles
clone() {
if ! [ -a AnyKernel3 ]; then
git clone --depth=1 https://github.com/nbr-project/AnyKernel3 -b juice AnyKernel3
fi
if ! [ -a arm64-gcc ]; then
git clone --depth=1 https://github.com/nbr-project/arm64-gcc -b master arm64-gcc
fi
if ! [ -a arm-gcc ]; then
git clone --depth=1 https://github.com/nbr-project/arm-gcc -b master arm-gcc
fi
}
compile() {
if [ -a out ]; then
rm -rf out
fi
make O=out ARCH=arm64 vendor/${TARGET}-perf_defconfig -j"$JOBS" \
CROSS_COMPILE=aarch64-elf- \
CROSS_COMPILE_ARM32=arm-eabi-
make O=out ARCH=arm64 -j"$JOBS" \
CROSS_COMPILE=aarch64-elf- \
CROSS_COMPILE_ARM32=arm-eabi-
}
repack() {
cp out/arch/arm64/boot/Image.gz AnyKernel3
cp out/arch/arm64/boot/dtb.img AnyKernel3
cp out/arch/arm64/boot/dtbo.img AnyKernel3
cd AnyKernel3
if [ -a "${ZIPNAME}".zip ]; then
rm -rf "${ZIPNAME}".zip
fi
if [ -a "${ZIPNAME}"-signed.zip ]; then
rm -rf "${ZIPNAME}"-signed.zip
fi
zip -r9 "${ZIPNAME}".zip ./* -x .git README.md ./*placeholder zipsigner-3.0.jar ./*.zip
java -jar zipsigner-3.0.jar "${ZIPNAME}".zip "${ZIPNAME}"-signed.zip
rm -rf Image.gz dtb.img dtbo.img
cd "$ROOT"
}
clone
compile
repack