-
Notifications
You must be signed in to change notification settings - Fork 3
/
build_menu
executable file
·93 lines (76 loc) · 3.44 KB
/
build_menu
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
#!/bin/bash
# LIGHTNING-KERNEL-BUILD
# Variables
DIR="$(pwd)"
PARENT_DIR="$(pwd)"
echo "Cloning dependencies"
git clone --depth=1 --branch wi3_lightning https://github.com/prorooter007/Lightning_android_kernel_samsung_exynos2100 kernel
cd kernel
git clone --depth=1 --branch android-11.0.0_r48 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 aarch64-linux-android-4.9
git clone --depth=1 https://github.com/prorooter007/android_prebuilts_clang_host_linux-x86_clang-6877366 clang-r383902
git clone --depth=1 https://github.com/osm0sis/AnyKernel3 AnyKernel3
echo "Done"
KERNEL_DIR=$(pwd)
OUT_DIR="$(pwd)/out"
REPACK_DIR="${KERNEL_DIR}/AnyKernel3"
IMAGE="${KERNEL_DIR}/arch/arm64/boot/Image"
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
export PLATFORM_VERSION=11
export ANDROID_MAJOR_VERSION=r
export CROSS_COMPILE="$(pwd)/aarch64-linux-android-4.9/bin/aarch64-linux-android-"
export CLANG_TRIPLE="$(pwd)/clang-r383902/bin/aarch64-linux-gnu-"
export ARCH=arm64
export SEC_BUILD_CONF_VENDOR_BUILD_OS=13
export LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN="$(pwd)/aarch64-linux-android-4.9/bin"
export CLANG_PREBUILT_BIN="$(pwd)/clang-r383902/bin"
export PATH=$PATH:$LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN:$CLANG_PREBUILT_BIN
export LLVM=1
KERNEL_MAKE_ENV="LOCALVERSION=-Lightning-V4.0"
# Color
ON_BLUE=`echo -e "\033[44m"` # On Blue
BRED=`echo -e "\033[1;31m"` # Bold Red
BBLUE=`echo -e "\033[1;34m"` # Bold Blue
BGREEN=`echo -e "\033[1;32m"` # Bold Green
UNDER_LINE=`echo -e "\e[4m"` # Text Under Line
STD=`echo -e "\033[0m"` # Text Clear
build_kernel(){
echo "${BGREEN}***** Compiling kernel *****${STD}"
[ ! -d "$OUT_DIR" ] && mkdir $OUT_DIR
make -j$(nproc) -C $(pwd) $KERNEL_MAKE_ENV lightning_exynos2100-r9sxxx_defconfig
make -j$(nproc) -C $(pwd) $KERNEL_MAKE_ENV
[ -e "$(pwd)/arch/arm64/boot/Image.gz" ] && cp "$(pwd)/arch/arm64/boot/Image.gz" $OUT_DIR/Image.gz
if [ -e "$(pwd)/arch/arm64/boot/Image" ]; then
cp "$(pwd)/arch/arm64/boot/Image" $OUT_DIR/Image
DTB_DIR=$(pwd)/arch/arm64/boot/dts
$(pwd)/tools/mkdtimg cfg_create $(pwd)/out/dtb.img dt.configs/exynos2100.cfg -d ${DTB_DIR}/exynos
$(pwd)/tools/mkdtimg cfg_create $(pwd)/out/dtbo.img dt.configs/r9s.cfg -d ${DTB_DIR}/samsung/r9s
echo "${BGREEN}***** Ready to Roar *****${STD}"
fi
if [ -e "$(pwd)/arch/arm64/boot/Image" ]; then
cd "$(pwd)/AnyKernel3"
git reset --hard
cp $IMAGE zImage
cp $OUT_DIR/dtbo.img dtbo.img
sed -i "s/ExampleKernel by osm0sis/exynos2100-r9sxxx Lightning kernel by prorooter007/g" anykernel.sh
sed -i "s/=maguro/=r9s/g" anykernel.sh
sed -i "s/=toroplus/=/g" anykernel.sh
sed -i "s/=toro/=/g" anykernel.sh
sed -i "s/=tuna/=/g" anykernel.sh
sed -i "s/platform\/omap\/omap_hsmmc\.0\/by-name\/boot/bootdevice\/by-name\/boot/g" anykernel.sh
sed -i "s/backup_file/#backup_file/g" anykernel.sh
sed -i "s/replace_string/#replace_string/g" anykernel.sh
sed -i "s/insert_line/#insert_line/g" anykernel.sh
sed -i "s/append_file/#append_file/g" anykernel.sh
sed -i "s/patch_fstab/#patch_fstab/g" anykernel.sh
zip -r9 "$(pwd)/exynos2100-r9sxxx_kernel_.zip" * -x .git README.md *placeholder
curl https://bashupload.com/$REPACK_DIR/exynos2100-r9sxxx_kernel_.zip --data-binary @$REPACK_DIR/exynos2100-r9sxxx_kernel_.zip
fi
}
gsi_kernel(){
echo "${BGREEN}***** Apply GSI patch *****${STD}"
cd $KERNEL_DIR
git apply gsi-commits.patch
}
build_kernel
gsi_kernel
build_kernel