-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·93 lines (73 loc) · 1.7 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
#!/bin/bash
clang_path="${HOME}/cbl/bin/clang"
gcc_path="${HOME}/cbl/bin/aarch64-linux-gnu-"
gcc_32_path="${HOME}/cbl/bin/arm-linux-gnueabi-"
timedatectl set-timezone Asia/Shanghai
source=`pwd`
START=$(date +"%s")
date="`date +"%m%d%H%M"`"
args="-j$(nproc --all) O=out \
ARCH=arm64 "
print (){
case ${2} in
"red")
echo -e "\033[31m $1 \033[0m";;
"blue")
echo -e "\033[34m $1 \033[0m";;
"yellow")
echo -e "\033[33m $1 \033[0m";;
"purple")
echo -e "\033[35m $1 \033[0m";;
"sky")
echo -e "\033[36m $1 \033[0m";;
"green")
echo -e "\033[32m $1 \033[0m";;
*)
echo $1
;;
esac
}
print "You are building version:$date" yellow
args+="LOCALVERSION=-$date "
args+="CC=$clang_path \
CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=$gcc_path \
AR=${HOME}/cbl/bin/llvm-ar \
NM=${HOME}/cbl/bin/llvm-nm \
OBJCOPY=${HOME}/cbl/bin/llvm-objcopy \
OBJDUMP=${HOME}/cbl/bin/llvm-objdump \
STRIP=${HOME}/cbl/bin/llvm-strip "
args+="CROSS_COMPILE_ARM32=$gcc_32_path "
clean(){
make mrproper
make $args mrproper
}
build_dipper(){
export KBUILD_BUILD_USER="dipper"
export KBUILD_BUILD_HOST="ALKALiKong"
print "Building Kernel for dipper..." blue
make $args dipper_defconfig&&make $args
if [ $? -ne 0 ]; then
echo "Error while building for dipper!"
else
mkzip "dipper-${1}"
fi
}
mkzip (){
zipname="(${1})Li-Kernel-$date.zip"
cp -f out/arch/arm64/boot/Image.gz-dtb ~/AnyKernel3
cd ~/AnyKernel3
zip -r "$zipname" *
mv -f "$zipname" ${HOME}
cd ${HOME}
cd $source
print "All done.Find it at ${HOME}/$zipname" green
tg_upload
}
tg_upload(){
cd ${HOME}
curl -s https://api.telegram.org/bot"${bot_token}"/sendDocument -F document=@"${zipname}" -F chat_id="${chat_id}"
}
./prepare.sh
clean
build_dipper