-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.sh
executable file
·129 lines (95 loc) · 2.67 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
mkdir out
GCC_ENV="CROSS_COMPILE=aarch64-linux-gnu- CROSS_COMPILE_COMPAT=arm-linux-gnueabihf-"
LLVM=/home/pascua14/llvm-16/bin/
LLVM_ENV="CROSS_COMPILE=$(echo $LLVM)aarch64-linux-gnu- CROSS_COMPILE_COMPAT=$(echo $LLVM)arm-linux-gnueabi- CLANG_DIR=$LLVM LLVM=1 LLVM_IAS=1"
KERNEL_MAKE_ENV="DTC_EXT=$(pwd)/tools/dtc CONFIG_BUILD_ARM64_DT_OVERLAY=y"
echo "**********************************"
echo "Select compiler"
echo "(1) GCC"
echo "(2) LLVM"
read -p "Selected compiler: " compiler
if [ $compiler == "1" ]; then
COMPILER_ENV=$GCC_ENV
echo "
################# Compiling with GCC #################
"
case $1 in
lto)
echo "
################# Compiling GCC LTO build #################
"
scripts/configcleaner "
CONFIG_LTO_GCC
CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
"
echo "CONFIG_LTO_GCC=y
" >> out/.config
;;
*)
echo "# CONFIG_LTO_GCC is not set
CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y
" >> out/.config
;;
esac
elif [ $compiler == "2" ]; then
COMPILER_ENV=$LLVM_ENV
echo "
################# Compiling with LLVM #################
"
case $1 in
pgo)
echo "
################# Compiling with Clang PGO #################
"
KERNEL_MAKE_ENV="$KERNEL_MAKE_ENV CONFIG_PGO_CLANG=y"
;;
esac
fi
echo "**********************************"
echo "Select load-tracking variant"
echo "(1) WALT"
echo "(2) PELT"
read -p "Selected variant: " variant
make -j8 -C $(pwd) O=$(pwd)/out $KERNEL_MAKE_ENV ARCH=arm64 $COMPILER_ENV \
r8q_defconfig > /dev/null 2>&1
if [ $variant == "1" ]; then
echo "
Compiling WALT variant
"
elif [ $variant == "2" ]; then
echo "
Compiling PELT variant
"
scripts/configcleaner "
CONFIG_SCHED_WALT
CONFIG_CFS_BANDWIDTH
CONFIG_PERF_MGR
"
echo "
# CONFIG_SCHED_WALT is not set
# CONFIG_CFS_BANDWIDTH is not set
# CONFIG_PERF_MGR is not set
" >> out/.config
fi
make -j8 -C $(pwd) O=$(pwd)/out $KERNEL_MAKE_ENV ARCH=arm64 $COMPILER_ENV \
oldconfig
DATE_START=$(date +"%s")
make -j8 -C $(pwd) O=$(pwd)/out $KERNEL_MAKE_ENV ARCH=arm64 $COMPILER_ENV
make -j8 -C $(pwd) O=$(pwd)/out $KERNEL_MAKE_ENV ARCH=arm64 $COMPILER_ENV dtbs
IMAGE="out/arch/arm64/boot/Image.gz"
DTB_OUT="out/arch/arm64/boot/dts/vendor/qcom"
cat $DTB_OUT/*.dtb > AnyKernel3/kona.dtb
patch -p1 --merge < patches/freqtable.diff
make -j8 -C $(pwd) O=$(pwd)/out $KERNEL_MAKE_ENV ARCH=arm64 $COMPILER_ENV dtbs
cat $DTB_OUT/*.dtb > AnyKernel3/kona-perf.dtb
patch -p1 -R --merge < patches/freqtable.diff
DATE_END=$(date +"%s")
DIFF=$(($DATE_END - $DATE_START))
echo "Time wasted: $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds."
if [[ -f "$IMAGE" ]]; then
rm AnyKernel3/*.zip > /dev/null 2>&1
cp $IMAGE AnyKernel3/Image.gz
cd AnyKernel3
zip -r9 Kranel-r8q.zip .
fi