-
Notifications
You must be signed in to change notification settings - Fork 2
/
buildzen.sh
executable file
·49 lines (38 loc) · 1.18 KB
/
buildzen.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
#!/bin/bash
if [[ ! $# -ge 2 ]] ; then
echo "Usage: buildzen.sh {GCC Path} {Version Code} {CleanFirst}"
echo "e.g: ./buildzen.sh /opt/ndk/bin/arm-linux-gnueabi- 0 true"
echo "Use version 0 if not an official build!"
exit 1
fi
if [[ ! ${2} =~ ^[0-9]+$ ]] ; then
echo "ERROR: Version must be an integer"
exit 1
fi
if [[ ! ${2} -eq 0 ]] ; then
echo -n "Are you bbedward? (Y/N): "
read answer
answer=`echo $answer | tr '[A-Z]' '[a-z]'`
if [[ $answer != 'y' ]] ; then
echo "Use version code 0 not ${2}!"
exit 1;
fi
fi
cleanFirst=${3}
cleanFirst=`echo $cleanFirst | tr '[A-Z]' '[a-z]'`
if [[ $cleanFirst == "true" ]]; then
ARCH=arm CROSS_COMPILE=${1} make clean
fi
if [[ ! -f .config ]] ; then
ARCH=arm CROSS_COMPILE=${1} make herring_zen_defconfig
fi
sed -i s/CONFIG_ZEN_INFO_VERSION_CODE=.*/CONFIG_ZEN_INFO_VERSION_CODE=${2}/ .config
ARCH=arm CROSS_COMPILE=${1} make -j2
if [[ $? -ne 0 ]] ; then
echo "Kernel build failed"
exit 1
fi
cp arch/arm/boot/zImage zip_template/kernel/
find . -name "*\.ko" -exec cp {} zip_template/system/lib/modules/ \;
zip -r9 zen_unofficial_${2}.zip zip_template/*
echo "zen_${2}.zip created"