-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild
executable file
·179 lines (168 loc) · 5.09 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#!/bin/bash
clean=
buildargs=
fixed=
dynamic=
upload=
kernelversion=5reloaded
device="e98x"
defconfig="wild_defconfig"
ramdisk="5.0"
dynamic_ramdisk_override="5.0_override"
outdir="/external_SD/workspace/E980"
#outdir="/storage/sdcard1/workspace/E980"
outfile=WildKernel_signed.zip
OTALink="http://forum.xda-developers.com/optimus-g-pro/orig-development/kernel-wildkernel-build-1-featurlicous-t3069629"
outdate=$(date +%y%m%d)
outdateliteral=$(date "+%B %d %Y")
outdateliteral="'${outdateliteral}'"
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
dynamic=false
elif [[ "$2" == *"-f"* ]]; then
fixed=true
dynamic=false
elif [[ "$3" == *"-f"* ]]; then
fixed=true
dynamic=false
elif [[ "$4" == *"-f"* ]]; then
fixed=true
dynamic=false
else
fixed=false
fi
if [[ "$1" == *"-d"* ]]; then
dynamic=true
fixed=false
elif [[ "$2" == *"-d"* ]]; then
dynamic=true
fixed=false
elif [[ "$3" == *"-d"* ]]; then
dynamic=true
fixed=false
elif [[ "$4" == *"-d"* ]]; then
dynamic=true
fixed=false
else
dynamic=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/lib/modules
mkdir flashable/zip/system/
mkdir flashable/zip/system/lib/
mkdir flashable/zip/system/lib/modules/
fi
rm -rf arch/arm/boot/zImage
rm -rf flashable/zip/tools/zImage
if [[ "$fixed" == "false" ]]; then
if [[ "$clean" == "true" ]]; then
make mrproper $buildargs | tee build_log.txt
fi
echo >> build_log.txt
echo Writing configs ...
make "$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 [[ "$dynamic" == "true" ]]; then
cp -f arch/arm/boot/zImage flashable/zip/tools/zImage
rm -rf flashable/zip/boot.img
fi
if [[ "$fixed" == "false" ]]; then
cp -arf flashable/tools/ramdisks/$ramdisk flashable/tools/ramdisks/tmp
echo "ro.wild.date=$outdate" >> flashable/tools/ramdisks/tmp/default.prop
echo "ro.wild.version=$kernelversion" >> flashable/tools/ramdisks/tmp/default.prop
echo "ro.wild.device=$device" >> flashable/tools/ramdisks/tmp/default.prop
rm -rf flashable/tools/updatewild.sh
cp flashable/tools/wild.sh flashable/tools/updatewild.sh
sed -i '1i' flashable/tools/updatewild.sh
sed -i "1ilatestDL=$OTALink" flashable/tools/updatewild.sh
sed -i "1ilatestdateliteral=$outdateliteral" flashable/tools/updatewild.sh
sed -i "1ilatestdate=$outdate" flashable/tools/updatewild.sh
sed -i "1ilatestversion=$kernelversion" flashable/tools/updatewild.sh
sed -i "1i#DO NOT EDIT FILE - AUTO GENERATED FOR $device" flashable/tools/updatewild.sh
sed -i '1i#!/bin/sh' flashable/tools/updatewild.sh
find -iname "*.ko" -exec cp {} flashable/zip/system/lib/modules/ \; >/dev/null
if [[ "$dynamic" == "false" ]]; then
flashable/tools/mkbootfs flashable/tools/ramdisks/tmp/ | gzip > flashable/tools/ramdisks/ramdisk.gz
flashable/tools/mkbootimg --kernel arch/arm/boot/zImage --ramdisk flashable/tools/ramdisks/ramdisk.gz --cmdline "vmalloc=600M console=ttyHSL0,115200,n8 lpj=67677 user_debug=31 msm_rtb.filter=0x0 ehci-hcd.park=3 coresight-etm.boot_enable=0 androidboot.hardware=geefhd" --base 0x80200000 --ramdisk_offset 0x02000000 --pagesize 2048 --output flashable/zip/boot.img
fi
fi
if [[ "$dynamic" == "false" ]]; then
cp -f flashable/tools/normal-updater-script flashable/zip/META-INF/com/google/android/updater-script
else
cp -f flashable/tools/dynamic-updater-script flashable/zip/META-INF/com/google/android/updater-script
fi
rm -rf flashable/zip/tools/ramdisk_override
mkdir flashable/zip/tools/ramdisk_override
cp -arf flashable/tools/ramdisks/$dynamic_ramdisk_override/* flashable/zip/tools/ramdisk_override
rm -rf flashable/zip/tools/ramdisk_override/default.prop
cp -f flashable/tools/ramdisks/tmp/default.prop flashable/zip/tools/ramdisk_override/default.prop
rm -rf flashable/tools/ramdisks/ramdisk.gz
rm -rf flashable/tools/ramdisks/tmp
cd flashable/zip/
zip -r9 ../../tmp-kernel.zip *
cd ../..
rm -rf flashable/zip/META-INF/com/google/android/updater-script
rm -rf flashable/zip/tools/ramdisk_override
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 $outdir
fi
echo
echo Done - Your File is $outfile