forked from mochenya/action_selene_seakernel_kernelsu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnormal.sh
108 lines (90 loc) · 2.63 KB
/
normal.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
#!/usr/bin/env sh
#
# GNU General Public License v3.0
# Copyright (C) 2023 MoChenYa [email protected]
#
WORKDIR="$(pwd)"
# ZyClang
ZYCLANG_DLINK="https://github.com/ZyCromerZ/Clang/releases/download/18.0.0-20231017-release/Clang-18.0.0-20231017.tar.gz"
ZYCLANG_DIR="$WORKDIR/ZyClang/bin"
# Kernel Source
KERNEL_GIT="https://github.com/vantoman/kernel_xiaomi_sm6150.git"
KERNEL_BRANCHE="13"
KERNEL_DIR="$WORKDIR/VantomDynamicKernel"
# Anykernel3
ANYKERNEL3_GIT="https://github.com/LenaTDDS/AnyKernel3.git"
ANYKERNEL3_BRANCHE="master"
# Build
DEVICES_CODE="davinci"
DEVICE_DEFCONFIG="davinci_defconfig"
DEVICE_DEFCONFIG_FILE="$KERNEL_DIR/arch/arm64/configs/$DEVICE_DEFCONFIG"
IMAGE="$KERNEL_DIR/out/arch/arm64/boot/Image.gz"
DTB="$KERNEL_DIR/out/arch/arm64/boot/dtb.img"
DTBO="$KERNEL_DIR/out/arch/arm64/boot/dtbo.img"
export KBUILD_BUILD_USER=LenaTDDS
export KBUILD_BUILD_HOST=GitHubCI
msg() {
echo
echo -e "\e[1;32m$*\e[0m"
echo
}
cd $WORKDIR
# Download ZyClang
msg " • 🌸 Work on $WORKDIR 🌸"
msg " • 🌸 Cloning Toolchain 🌸 "
rm -rf ZyClang
mkdir -p ZyClang
aria2c -s16 -x16 -k1M $ZYCLANG_DLINK -o ZyClang.tar.gz
tar -C ZyClang/ -zxvf ZyClang.tar.gz
rm -rf ZyClang.tar.gz
# CLANG LLVM VERSIONS
CLANG_VERSION="$($ZYCLANG_DIR/clang --version | head -n 1)"
LLD_VERSION="$($ZYCLANG_DIR/ld.lld --version | head -n 1)"
msg " • 🌸 Cloning Kernel Source 🌸 "
rm -rf $KERNEL_DIR
git clone --depth=1 $KERNEL_GIT -b $KERNEL_BRANCHE $KERNEL_DIR
cd $KERNEL_DIR
# BUILD KERNEL
msg " • 🌸 Started Compilation 🌸 "
args="PATH=$ZYCLANG_DIR:$PATH \
ARCH=arm64 \
SUBARCH=arm64 \
CROSS_COMPILE=aarch64-linux-gnu- \
CROSS_COMPILE_ARM32=arm-linux-gnueabi- \
CC=clang \
NM=llvm-nm \
CXX=clang++ \
AR=llvm-ar \
LD=ld.lld \
STRIP=llvm-strip \
OBJDUMP=llvm-objdump \
OBJSIZE=llvm-size \
READELF=llvm-readelf \
HOSTAR=llvm-ar \
HOSTLD=ld.lld \
HOSTCC=clang \
HOSTCXX=clang++ \
LLVM=1 \
LLVM_IAS=1"
# LINUX KERNEL VERSION
make O=out $args $DEVICE_DEFCONFIG
KERNEL_VERSION=$(make O=out $args kernelversion | grep "4.14")
msg " • 🌸 LINUX KERNEL VERSION : $KERNEL_VERSION 🌸 "
make O=out $args -j"$(nproc --all)"
msg " • 🌸 Packing Kernel 🌸 "
cd $WORKDIR
rm -rf $WORKDIR/Anykernel3
git clone --depth=1 $ANYKERNEL3_GIT -b $ANYKERNEL3_BRANCHE $WORKDIR/Anykernel3
cd $WORKDIR/Anykernel3
cp $IMAGE .
cp $DTB $WORKDIR/Anykernel3/dtb
cp $DTBO .
# PACK FILE
time=$(TZ='Europe/Moscow' date +"%Y-%m-%d %H:%M:%S")
cairo_time=$(TZ='Europe/Moscow' date +%Y%m%d%H)
ZIP_NAME="VantomDynamicKernel-$KERNEL_VERSION.zip"
find ./ * -exec touch -m -d "$time" {} \;
zip -r9 $ZIP_NAME *
mkdir -p $WORKDIR/out && cp *.zip $WORKDIR/out
cd $WORKDIR/out
msg "• 🌸 Done! 🌸 "