-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·180 lines (164 loc) · 4.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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/bin/bash
#
#
#
#
#
#
#
#
#
#
#
#
#
#
######################################################
echo " "
KERNEL_DIR=$(pwd)
CURRENT_BUILD_USER=$(whoami)
#
if [[ ${CURRENT_BUILD_USER} == "neel" ]]; then
export KBUILD_BUILD_USER=Neel0210
export KBUILD_BUILD_HOST=Hell
else
export KBUILD_BUILD_USER=BuildBot
export KBUILD_BUILD_HOST=KangHub
fi
# Colours
GRN='\033[01;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
RED='\033[01;31m'
RST='\033[0m'
# Arch and Android Version
export ARCH=arm64
export SUBARCH=arm64
export ANDROID_MAJOR_VERSION=s
export PLATFORM_VERSION="12"
# Kernel related Information
ZIMG=out/arch/arm64/boot/Image
KERNEL_CONFIG=exynos9810-r7_defconfig
TC=$HOME/KKRT_TC/proton
exit_script() {
kill -INT $$
}
# Compiler
if [[ -d "${TC}" ]]; then
echo -e "${CYAN}Exporting path"
export CROSS_COMPILE=$HOME/KKRT_TC/gcc49/bin/aarch64-linux-android-
export CLANG_TRIPLE=$HOME/KKRT_TC/proton/bin/aarch64-linux-gnu-
export CC=$HOME/KKRT_TC/proton/bin/clang
else
echo -e "${YELLOW}Clonning toolchain"
rm -rf $HOME/KKRT_TC/*
git clone --depth=1 https://github.com/KakarotKernel/Toolchains-for-Eureka.git -b GCC-4.9 $HOME/KKRT_TC/gcc49
git clone --depth=1 https://github.com/KakarotKernel/Toolchains-for-Eureka.git -b proton_clang_13 $HOME/KKRT_TC/proton
echo -e "${CYAN}Exporting path"
export CROSS_COMPILE=$HOME/KKRT_TC/gcc49/bin/aarch64-linux-android-
export CLANG_TRIPLE=$HOME/KKRT_TC/proton/bin/aarch64-linux-gnu-
export CC=$HOME/KKRT_TC/proton/bin/clang
fi
START(){
# Calculate compilation time
START=$(date +"%s")
}
#
END(){
if [ -f out/arch/arm64/boot/Image ];then
clear && FLEX
echo " " && echo " "
END=$(date +"%s")
DIFF=$((END - START))
echo " " && echo -e "${GRN}Kernel has been compiled successfully and it took $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s)${RST}"
else
exit_script
fi
}
FLEX(){
echo -e "${YELLOW} "
echo " _ __ _ ________ _____ _ _ "
echo "| | / /| | / /| ___ \_ _| ___ ___ _ __(_)_ __ | |_ "
echo "| |/ / | |/ / | |_/ / | | / __|/ __| '__| | '_ \| __|"
echo "| \ | \ | / | | \__ \ (__| | | | |_) | |_ "
echo "| |\ \| |\ \| |\ \ | | |___/\___|_| |_| .__/ \__|"
echo "\_| \_/\_| \_/\_| \_| \_/ |_| "
echo " "
echo -e "${GRN} coded by Neel0210 ${RST}"
}
# Device database
A50(){
DEVICE_KERNEL_BOARD='SRPRL05B009KU'
DEVICE_KERNEL_BASE=0x10000000
DEVICE_KERNEL_PAGESIZE=2048
DEVICE_RAMDISK_OFFSET=0xf0000000
DEVICE_SECOND_OFFSET=0xf0000000
PLATFORM_VERSION="11.0.0"
PLATFORM_PATCH_LEVEL="2022-07"
DEVICE_KERNEL_CMDLINE=""
DEVICE_KERNEL_HEADER=1
DEVICE_DTB_HASHTYPE='sha1'
DEVICE_KERNEL_OFFSET=0x00008000
DEVICE_TAGS_OFFSET=0x00000100
DEVICE_HEADER_SIZE=1648
}
N10L(){
DEVICE_KERNEL_BOARD='SRPSI06A008'
DEVICE_KERNEL_BASE=0x10000000
DEVICE_KERNEL_PAGESIZE=2048
DEVICE_RAMDISK_OFFSET=0x01000000
DEVICE_SECOND_OFFSET=0xf0000000
PLATFORM_VERSION="12.0.0"
PLATFORM_PATCH_LEVEL="2022-06"
DEVICE_KERNEL_CMDLINE=""
DEVICE_KERNEL_HEADER=2
DEVICE_DTB_HASHTYPE='sha1'
DEVICE_KERNEL_OFFSET=0x00008000
DEVICE_TAGS_OFFSET=0x00000100
DEVICE_HEADER_SIZE=1660
DEVICE_DTB_OFFSET=0x00000000
}
clean(){
echo " "
echo -e "${RED} Cleaning${RST}" && echo " "
make clean
make mrproper
}
build(){
echo " "
echo -e "${BOLD} Compiling${RST}" && echo " "
#
make $KERNEL_CONFIG O=out CC=clang
make -j$(nproc --all) O=out CC=clang
}
check_build(){
echo " " && echo " "
echo -e "${YELLOW} x Building Boot.img x"
N10L
#
$(pwd)/tools/make/bin/mkbootimg \
--kernel $ZIMG \
--cmdline " " --board "$DEVICE_KERNEL_BOARD" \
--base $DEVICE_KERNEL_BASE --pagesize $DEVICE_KERNEL_PAGESIZE \
--kernel_offset $DEVICE_KERNEL_OFFSET --ramdisk_offset $DEVICE_RAMDISK_OFFSET \
--second_offset $DEVICE_SECOND_OFFSET --tags_offset $DEVICE_TAGS_OFFSET \
--os_version "$PLATFORM_VERSION" --os_patch_level "$PLATFORM_PATCH_LEVEL" \
--header_version $DEVICE_KERNEL_HEADER --hashtype $DEVICE_DTB_HASHTYPE \
-o $(pwd)/boot.img
sleep 2
#
if [ -f ${KERNEL_DIR}/boot.img ];then
echo -e "${GRN}Image has been built at $(pwd)/boot.img${RST}"
else
echo -e "${RED}Check for error"
fi
}
clear
FLEX
clean
clear && FLEX && START
build
END
check_build
################ END OF LIFE ###############