-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathcompile_with_gcc.sh
45 lines (38 loc) · 1.1 KB
/
compile_with_gcc.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
#!/bin/bash
# Copyright cc 2023 sirnewbies
# setup color
red='\033[0;31m'
green='\e[0;32m'
white='\033[0m'
yellow='\033[0;33m'
WORK_DIR=$(pwd)
KERN_IMG="${WORK_DIR}/out/arch/arm64/boot/Image-gz.dtb"
KERN_IMG2="${WORK_DIR}/out/arch/arm64/boot/Image.gz"
function clean() {
echo -e "\n"
echo -e "$red << cleaning up >> \n$white"
echo -e "\n"
rm -rf out
}
function build_kernel() {
echo -e "\n"
echo -e "$yellow << building kernel >> \n$white"
echo -e "\n"
make -j$(nproc --all) O=out ARCH=arm64 <DEVICE>_defconfig
make -j$(nproc --all) ARCH=arm64 O=out \
CROSS_COMPILE=aarch64-linux-gnu- \
CROSS_COMPILE_ARM32=arm-linux-gnueabi- \
CROSS_COMPILE_COMPAT=arm-linux-gnueabi-
if [ -e "$KERN_IMG" ] || [ -e "$KERN_IMG2" ]; then
echo -e "\n"
echo -e "$green << compile kernel success! >> \n$white"
echo -e "\n"
else
echo -e "\n"
echo -e "$red << compile kernel failed! >> \n$white"
echo -e "\n"
fi
}
# execute
clean
build_kernel