forked from EmmanuelU/wild_kernel_samsung_msm8660
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·116 lines (108 loc) · 2.81 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
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
clean=
buildargs=
fixed=
upload=
outfile=WildKernel_signed.zip
input="$1 $2 $3"
if [[ -z "$input" ]]
then
buildargs=-j4
clean=true
fi
if [[ "$1" == *"-j"* ]]; then
buildargs=$1
elif [[ "$2" == *"-j"* ]]; then
buildargs=$2
elif [[ "$3" == *"-j"* ]]; then
buildargs=$3
elif [[ "$4" == *"-j"* ]]; then
buildargs=$4
else
buildargs=-j4
fi
if [[ "$1" == *"-c"* ]]; then
clean=true
elif [[ "$2" == *"-c"* ]]; then
clean=true
elif [[ "$3" == *"-c"* ]]; then
clean=true
elif [[ "$4" == *"-c"* ]]; then
clean=true
else
clean=false
fi
if [[ "$1" == *"-p"* ]]; then
upload=true
elif [[ "$2" == *"-p"* ]]; then
upload=true
elif [[ "$3" == *"-p"* ]]; then
upload=true
elif [[ "$4" == *"-p"* ]]; then
upload=true
else
upload=false
fi
if [[ "$1" == *"-f"* ]]; then
fixed=true
elif [[ "$2" == *"-f"* ]]; then
fixed=true
elif [[ "$3" == *"-f"* ]]; then
fixed=true
elif [[ "$4" == *"-f"* ]]; then
fixed=true
else
fixed=false
fi
clear
rm build_log.txt >>build_log.txt
echo Build Jobs: $buildargs
sleep 2
echo Cleaning workspace ...
rm -rf *.zip
rm -rf flashable/zip/META-INF/com/google/android/updater-script
if [[ "$fixed" == "false" ]]; then
rm -rf flashable/zip/system
mkdir flashable/zip/system/ && mkdir flashable/zip/system/lib/ && mkdir flashable/zip/system/lib/modules/
fi
cd flashable/zip/kernel/
rm -rf zImage arch/arm/boot/zImage
cd ../../..
if [[ "$fixed" == "false" ]]; then
if [[ "$clean" == "true" ]]; then
make clean $buildargs | tee build_log.txt
fi
echo >> build_log.txt
echo Writing configs ...
make hercules_defconfig | tee -a build_log.txt
echo >> build_log.txt
make $buildargs | tee -a build_log.txt
if [ ! -f arch/arm/boot/zImage ];
then
echo
echo An error occured in the build process, aborting...
exit 1
fi
fi
clear
echo Creating Flash-able Zip ...
if [[ "$fixed" == "false" ]]; then
cp -f arch/arm/boot/zImage flashable/zip/kernel/zImage
flashable/tools/mkbootimg --kernel flashable/zip/kernel/zImage --ramdisk flashable/tools/ramdisks/4.4.2.gz --cmdline "androidboot.hardware=qcom usb_id_pin_rework=true no_console_suspend=true zcache" --base 0x40400000 --ramdisk_offset 0x01400000 --pagesize 2048 --output flashable/zip/boot.img
find -iname "*.ko" -exec cp {} flashable/zip/system/lib/modules/ \; >/dev/null
fi
if [[ "$fixed" == "false" ]]; then
cp -f flashable/zip/META-INF/com/google/android/dynamic-updater-script flashable/zip/META-INF/com/google/android/updater-script
else
cp -f flashable/zip/META-INF/com/google/android/fixed-updater-script flashable/zip/META-INF/com/google/android/updater-script
fi
cd flashable/zip/
zip -r9 ../../tmp-kernel.zip *
cd ../..
java -jar flashable/tools/signapk.jar flashable/tools/testkey.x509.pem flashable/tools/testkey.pk8 tmp-kernel.zip $outfile
rm -rf tmp-kernel.zip
if [[ "$upload" == "true" ]]; then
adb push $outfile /sdcard/
fi
echo
echo Done - Your File is $outfile