-
Notifications
You must be signed in to change notification settings - Fork 4
/
miuibuild.sh
executable file
·74 lines (63 loc) · 2.08 KB
/
miuibuild.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
#!/bin/bash
kernel_dir=$PWD
export V="$(date +'%d%m-%H%M')"
export CONFIG_FILE="octopus_defconfig"
date=`date +"%Y%m%d-%H%M"`
DATE=`date +"%Y%m%d"`
BUILD_START=$(date +"%s")
# Coloring
blue='\033[0;34m'
cyan='\033[0;36m'
purple='\e[0;35m'
yellow='\033[0;33m'
red='\033[0;31m'
nocol='\033[0m'
sudo make clean && sudo make mrproper && rm -rf out/ && rm -rf build/*.zip
export ARCH=arm64
export SUBARCH=arm64
export KBUILD_BUILD_USER="octo21" # Build Host
export KBUILD_BUILD_HOST="lineageOS" # Build Name
export CROSS_COMPILE="/home/octo/android/aarch64-linux-android/bin/aarch64-linux-android-"
export PATH=$PATH:${TOOL_CHAIN_PATH}
export out_dir="${kernel_dir}/out/"
export builddir="${kernel_dir}/Builds"
export ANY_KERNEL2_DIR="/home/octo/android/octopus_miui_mido/AnyKernel2"
export ZIP_NAME="miui-octopus-${DATE}.zip"
export IMAGE="${out_dir}arch/arm64/boot/Image.gz-dtb";
export STRIP_KO="/home/octo/android/aarch64-linux-android/aarch64-unknown-linux-android/bin/strip"
JOBS="-j$(nproc --all)"
cd $kernel_dir
make_defconfig() {
make O=${out_dir} $CONFIG_FILE
}
compile() {
make \
O=${out_dir} \
$JOBS
}
zipit () {
if [[ ! -f "${IMAGE}" ]]; then
echo -e "Build failed :P";
exit 1;
else
echo -e "Build Succesful!";
fi
echo "**** Copying Image ****"
cp ${out_dir}arch/arm64/boot/Image.gz-dtb ${ANY_KERNEL2_DIR}/
echo "**** Copying Modules for MIUI ROM ****"
find ${out_dir} -name '*.ko' -exec ${STRIP_KO} -g {} \;
find ${out_dir} -name '*.ko' -exec cp {} ${ANY_KERNEL2_DIR}/modules/system/lib/modules/ \;
cp ${ANY_KERNEL2_DIR}/modules/system/lib/modules/wlan.ko ${ANY_KERNEL2_DIR}/modules/system/lib/modules/pronto/pronto_wlan.ko
cd ${ANY_KERNEL2_DIR}/
echo "**** Zipping ****"
zip -r9 ${ZIP_NAME} * -x README ${ZIP_NAME}
rm -rf ${kernel_dir}/build/${ZIP_NAME}
mv ${ANY_KERNEL2_DIR}/${ZIP_NAME} ${kernel_dir}/build/${ZIP_NAME}
}
make_defconfig
compile
zipit
cd ${kernel_dir}
BUILD_END=$(date +"%s")
DIFF=$(($BUILD_END - $BUILD_START))
echo -e "$yellow Build completed in $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds."