forked from fei-ke/android_kernel_samsung_sm8550
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·69 lines (57 loc) · 1.63 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
#!/bin/bash
#
# Tested on Ubuntu 22.04
#
# 1. Install Clang/LLVM
#
# apt install -y clang llvm lld
#
# Or get Clang/LLVM from https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/main/clang-r450784e.tar.gz
# and add bin dir to PATH
#
# 2. Install required packages
# apt install -y git zip build-essential xz-utils bison flex libz-dev libssl-dev libelf-dev bc cpio python3 pahole
#
# 3. Run build.sh to build kernel, do a clean before build is recommended
# make clean && rm -rf ./out
# ./build.sh <your defconfig>
#
# 4. Image output to out/arch/arm64/boot/Image
# AnyKernel3 zip output to out/AnyKernel3/<your defconfig>_kernel_*.zip
set -e
TARGET_DEFCONFIG=${1:-kalama_gki_defconfig}
cd "$(dirname "$0")"
LOCALVERSION=-android13-8
if [ "$LTO" == "thin" ]; then
LOCALVERSION+="-thin"
fi
ARGS="
CC=clang
ARCH=arm64
LLVM=1 LLVM_IAS=1
LOCALVERSION=$LOCALVERSION
"
# build kernel
make -j$(nproc) -C $(pwd) O=$(pwd)/out ${ARGS} $TARGET_DEFCONFIG
./scripts/config --file out/.config \
-d UH \
-d RKP \
-d KDP \
-d SECURITY_DEFEX \
-d INTEGRITY \
-d FIVE \
-d TRIM_UNUSED_KSYMS
if [ "$LTO" = "thin" ]; then
./scripts/config --file out/.config -e LTO_CLANG_THIN -d LTO_CLANG_FULL
fi
make -j$(nproc) -C $(pwd) O=$(pwd)/out ${ARGS}
# pack AnyKernel3
cd out
if [ ! -d AnyKernel3 ]; then
git clone --depth=1 https://github.com/MagicianGuo/AnyKernel3.git -b kalama
fi
cp arch/arm64/boot/Image AnyKernel3/zImage
name=${TARGET_DEFCONFIG%%_defconfig}_kernel_`cat include/config/kernel.release`_`date '+%Y_%m_%d'`
cd AnyKernel3
zip -r ${name}.zip * -x *.zip
echo "AnyKernel3 package output to $(realpath $name).zip"