-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
93 lines (78 loc) · 2.39 KB
/
build.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Cleanup Out dir
rm -rf out
#clone or update clang if its alreay exists
set -e
if [ -r clang ]; then
echo clang found!
cd clang
git config pull.rebase false
cd ..
else
echo clang not found!, git cloning it now....
git clone --depth=1 https://github.com/kdrag0n/proton-clang.git clang
fi
KERNEL_DEFCONFIG=phoenix_defconfig
ANYKERNEL3_DIR=$PWD/AnyKernel3/
KERNELDIR=$PWD/
FINAL_KERNEL_ZIP=Redcliff-3.0-phoenix.zip
export PATH="${PWD}/clang/bin:${PATH}"
export ARCH=arm64
export SUBARCH=arm64
export KBUILD_COMPILER_STRING="$(${PWD}/clang/bin/clang --version | head -n 1 | perl -pe 's/\(http.*?\)//gs' | sed -e 's/ */ /g' -e 's/[[:space:]]*$//')"
IMAGE_GZ=$PWD/out/arch/arm64/boot/Image.gz
DTB=$PWD/out/arch/arm64/boot/dts/qcom/sdmmagpie.dtb
DTBO_IMG=$PWD/out/arch/arm64/boot/dtbo.img
# Speed up build process
MAKE="./makeparallel"
BUILD_START=$(date +"%s")
blue='\033[0;34m'
cyan='\033[0;36m'
yellow='\033[0;33m'
red='\033[0;31m'
nocol='\033[0m'
# Clean build always lol
echo "**** Cleaning ****"
mkdir -p out
make O=out clean
echo "**** Kernel defconfig is set to $KERNEL_DEFCONFIG ****"
echo -e "$blue***********************************************"
echo " BUILDING KERNEL "
echo -e "***********************************************$nocol"
make $KERNEL_DEFCONFIG O=out
make -j$(nproc --all) O=out \
ARCH=arm64 \
CC=clang \
CROSS_COMPILE=aarch64-linux-gnu- \
CROSS_COMPILE_ARM32=arm-linux-gnueabi- \
CROSS_COMPILE_ARM32=arm-linux-gnueabi- \
NM=llvm-nm \
OBJCOPY=llvm-objcopy \
OBJDUMP=llvm-objdump \
STRIP=llvm-strip
echo "**** Verify target files ****"
if [ ! -f "$IMAGE_GZ" ]; then
echo "!!! Image.gz not found"
exit 1
fi
if [ ! -f "$DTB" ]; then
echo "!!! dtb not found"
exit 1
fi
if [ ! -f "$DTBO_IMG" ]; then
echo "!!! dtbo.img not found"
exit 1
fi
echo "**** Moving target files ****"
mv $IMAGE_GZ $ANYKERNEL3_DIR/Image.gz
mv $DTB $ANYKERNEL3_DIR/dtb
mv $DTBO_IMG $ANYKERNEL3_DIR/dtbo.img
echo "**** Time to zip up! ****"
cd $ANYKERNEL3_DIR/
zip -r9 $FINAL_KERNEL_ZIP *
echo "**** Removing leftovers ****"
cd ..
rm $ANYKERNEL3_DIR/Image.gz
rm $ANYKERNEL3_DIR/dtb
rm $ANYKERNEL3_DIR/dtbo.img
mv -f $ANYKERNEL3_DIR/$FINAL_KERNEL_ZIP out/
echo "Check out/$FINAL_KERNEL_ZIP"