forked from 0wnerDied/Neptune_kernel_sm8150_oneplus
-
Notifications
You must be signed in to change notification settings - Fork 11
/
pack.sh
executable file
·67 lines (63 loc) · 1.88 KB
/
pack.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
#!/bin/bash
# Kernel version configuration
KNAME="NeptunePlayground"
MIN_HEAD=$(git rev-parse HEAD)
VERSION="$(cat version)-$(date +%m.%d.%y-%H%M)"
if [[ "${1}" == "k" && "${2}" == "o" ]] || [[ "${1}" == "o" && "${2}" == "k" ]] ; then
ZIPNAME="${KNAME}-$(cat version)-KSuOC-$(date +%d.%m.%Y-%H%M)"
elif [[ "${1}" == "k" ]] ; then
ZIPNAME="${KNAME}-$(cat version)-KSu-$(date +%d.%m.%Y-%H%M)"
elif [[ "${1}" == "o" || "${2}" == "o" ]] ; then
ZIPNAME="${KNAME}-$(cat version)-OC-$(date +%d.%m.%Y-%H%M)"
else
ZIPNAME="${KNAME}-$(cat version)-$(date +%d.%m.%Y-%H%M)"
fi
export LOCALVERSION="-${KNAME}-${VERSION}"
# Never dirty compile
./clean.sh
# Build with kernel SU && GPU OC
if [[ "${1}" == "k" && "${2}" == "o" ]] || [[ "${1}" == "o" && "${2}" == "k" ]] ; then
echo
echo "Building with Kernel SU"
patch -p1 < kernelsu.patch
bash kernelSU.sh
echo
echo "Applying GPUOC.patch"
patch -p1 < GPUOC.patch
elif [[ "${1}" == "k" ]] ; then
echo
echo "Building with Kernel SU"
patch -p1 < kernelsu.patch
bash kernelSU.sh
elif [[ "${1}" == "o" ]] ; then
echo
echo "Applying GPUOC.patch"
patch -p1 < GPUOC.patch
fi
# Let's build
START=$(date +"%s")
./build.sh || exit 1
# Kernel Output
if [ -e arch/arm64/boot/Image.gz ] ; then
echo
echo "Building Kernel Package"
echo
rm $ZIPNAME.zip 2>/dev/null
rm -rf kernelzip 2>/dev/null
# Import Anykernel3 folder
mkdir kernelzip
cp -rp scripts/AnyKernel3/* kernelzip/
find arch/arm64/boot/dts -name '*.dtb' -exec cat {} + > kernelzip/dtb
cd kernelzip/
7z a -mx9 $ZIPNAME-tmp.zip *
7z a -mx0 $ZIPNAME-tmp.zip ../arch/arm64/boot/Image.gz
zipalign -v 4 $ZIPNAME-tmp.zip ../$ZIPNAME.zip
rm $ZIPNAME-tmp.zip
cd ..
ls -al $ZIPNAME.zip
fi
rm -rf KernelSU
# Show compilation time
END=$(date +"%s")
DIFF=$((END - START))
echo -e "Kernel compiled successfully in $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s)"