This repository has been archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build
executable file
·104 lines (93 loc) · 2.03 KB
/
build
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
#!/bin/bash
# Build script for Electron kernel for angler
# Based on RenderBroken's shamu script
# Variables
export ARCH=arm64
export SUBARCH=arm64
export CROSS_COMPILE="/home/frap129/android/kernel/aarch64-linaro-linux-gnu/bin/aarch64-linux-gnu-"
THREAD=-j$(bc <<< $(grep -c ^processor /proc/cpuinfo)+2)
DEFCONFIG="electron_defconfig"
KROOT="$(pwd)"
AK_DIR="$KROOT/anykernel"
PATCH_DIR="$AK_DIR/patch"
ZIP_MOVE="$KROOT/out"
IMAGE_DIR="$KROOT/arch/arm64/boot"
export REL="v15"
export TESTVER="-$1"
if [ "$TESTVER" = "-" ]; then
unset TESTVER
fi;
# Functions
function clean_all {
cd $AK_DIR
rm -rf zImage
cd $KROOT
echo
make mrproper
rm -rf $ZIP_MOVE/*
}
function make_kernel {
clear
make $DEFCONFIG
if ! make $THREAD; then exit 1; fi;
cp -vr $IMAGE_DIR/Image.gz-dtb $AK_DIR/zImage
}
function make_modules {
find $KROOT -name '*.ko' -exec cp -v {} $MODULES_DIR \;
}
function make_zip {
cd $AK_DIR
echo "$REL""$TESTVER" > VERSION;
zip -r9 Electron-Release-"$REL""$TESTVER".zip *
if ! [ -d "$ZIP_MOVE" ]; then
mkdir $ZIP_MOVE
fi;
mv Electron-Release-"$REL""$TESTVER".zip $ZIP_MOVE
cd $KERNEL_DIR
}
while read -p "Clean before build (y/n)? " cchoice
do
case "$cchoice" in
y|Y )
clean_all
echo
echo "All Cleaned now."
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done
# Compile Kernel
echo "Compiling Kernel.."
DATE_START=$(date +"%s")
make_kernel
DATE_KERNEL_END=$(date +"%s")
make_modules
make_zip
DATE_END=$(date +"%s")
echo -e "${red}"
echo "----------------------"
echo " Kernel Completed in:"
echo "----------------------"
echo -e "${restore}"
KDIFF=$(($DATE_KERNEL_END - $DATE_START))
echo "$(($KDIFF / 60)) minute(s) and $(($KDIFF % 60)) seconds."
echo
echo -e "${red}"
echo "-------------------"
echo " Zip Completed in:"
echo "-------------------"
echo -e "${restore}"
DIFF=$(($DATE_END - $DATE_START))
echo "$(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds."
echo
echo "Image size: $(du -h $IMAGE_DIR/Image.gz-dtb)"
echo
echo "Zip size: $(du -h $ZIP_MOVE/*.zip)"