forked from xxmustafacooTR/exynos-linux-stable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildS9.sh
executable file
·96 lines (79 loc) · 2.37 KB
/
buildS9.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
94
95
96
#!/bin/bash
. variables.sh
DEVICE_NAME="starlte"
while getopts k:d:r:hn flag; do
case ${flag} in
k) # Kernel type
KERNEL_TYPE=$OPTARG;;
d) # DTB filesystem
DTB_FS_TYPE=$OPTARG;;
r) # Patch KernelSU/Magisk
ROOT_METHOD=$OPTARG;;
h) # display Help
show_help
exit;;
n)
NETHUNTER=true;;
\?) # Invalid option
echo "Error: Invalid option"
exit;;
*) # No input
help
exit;;
esac
done
shift "$((OPTIND-1))"
clean_temp
if [ ! -d $CUR_DIR/toolchain/clang ] || [ ! -f $CUR_DIR/toolchain/clang/clang ]; then
tc_setup
fi
printf "Building for device: $DEVICE_NAME\n"
cp -vr $CUR_DIR/arch/arm64/configs/exynos9810_defconfig $CUR_DIR/arch/arm64/configs/exynos9810_temp_defconfig
echo "" >> $CUR_DIR/arch/arm64/configs/exynos9810_temp_defconfig
cat $CUR_DIR/arch/arm64/configs/exynos9810-starxlte_defconfig >> $CUR_DIR/arch/arm64/configs/exynos9810_temp_defconfig
echo "" >> $CUR_DIR/arch/arm64/configs/exynos9810_temp_defconfig
cat $CUR_DIR/arch/arm64/configs/exynos9810-starlte_defconfig >> $CUR_DIR/arch/arm64/configs/exynos9810_temp_defconfig
if [ "$KERNEL_TYPE" == "stock" ]; then
enable_stock
elif [ "$KERNEL_TYPE" == "aosp" ]; then
enable_aosp
fi
if [ "$DTB_FS_TYPE" == "erofs" ]; then
dts_erofs
elif [ "$DTB_FS_TYPE" == ext4 ]; then
dts_ext4
fi
if [ "$ROOT_METHOD" == "kernelsu" ]; then
enable_kernelsu
elif [ "$ROOT_METHOD" == "magisk" ]; then
disable_kernelsu
fi
if [ "$NETHUNTER" == true ]; then
enable_nethunter
elif [ "$NETHUNTER" == false ]; then
disable_nethunter
fi
patch_wireguard
make exynos9810_temp_defconfig -j$(nproc --all)
make -j$(nproc --all)
printf $KERNEL_NAME
if [ ! -d $BUILD_DIR/$KERNEL_NAME/$DEVICE_NAME ]; then
mkdir -p $BUILD_DIR/$KERNEL_NAME/$DEVICE_NAME
fi
if [ ! -d $BUILD_DIR/$DTB_NAME/$DEVICE_NAME ]; then
mkdir -p $BUILD_DIR/$DTB_NAME/$DEVICE_NAME
fi
if [ "$NETHUNTER" == true ]; then
mkdir $ANDROID_DIR/modules
find ./ -name '*.ko' -exec cp -prv '{}' $ANDROID_DIR/modules/ ';'
fi
if [ ! -f $CUR_DIR/arch/arm64/boot/Image ] || [ ! -f $CUR_DIR/arch/arm64/boot/dtb.img ]; then
printf "\n"
printf "Operation completed with errors!\n"
exit 1
else
cp -vr $CUR_DIR/arch/arm64/boot/Image $BUILD_DIR/$KERNEL_NAME/$DEVICE_NAME/zImage
cp -vr $CUR_DIR/arch/arm64/boot/dtb.img $BUILD_DIR/$DTB_NAME/$DEVICE_NAME/dtb.img
printf "\n"
printf "Build successful!\n"
fi