forked from BigMajster/android_kernel_lge_msm8226
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·80 lines (62 loc) · 2.14 KB
/
build.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
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
echo "this is an open source script, feel free to use and share it"
daytime=$(date +%d"-"%m"-"%Y"_"%H"-"%M)
location=.
vendor=lge
version=3.4.0
if [ -z $target ]; then
echo "choose your target device"
echo "1) 8226 for w7"
read -p "1/2/3: " choice
case "$choice" in
1 ) export target=8226 ; export defconfig=cm12_msm8226_defconfig;;
* ) echo "invalid choice"; sleep 2 ; $0;;
esac
fi
if [ -z $compiler ]; then
if [ -f ../arm-eabi-4.8/bin/arm-eabi-* ]; then
export compiler=../arm-eabi-4.8/bin/arm-eabi-
elif [ -f arm-eabi-4.8/bin/arm-eabi-* ]; then # [ -f ../arm-eabi-4.6/bin/arm-eabi-* ]
export compiler=arm-eabi-4.8/bin/arm-eabi-
else # [ -f arm-eabi-4.8/bin/arm-eabi-* ]
echo "please specify a location, including the '/bin/arm-eabi-' at the end "
read compiler
fi # [ -z $compiler ]
fi # [ -f ../arm-eabi-4.8/bin/arm-eabi-* ]
cd $location
export ARCH=arm
export CROSS_COMPILE=$compiler
if [ -z "$clean" ]; then
read -p "do make clean mrproper?(y/n)" clean
fi # [ -z "$clean" ]
case "$clean" in
y|Y ) echo "cleaning..."; make clean mrproper;;
n|N ) echo "continuing...";;
* ) echo "invalid option"; sleep 2 ; build.sh;;
esac
echo "now building the kernel"
START=$(date +%s)
make $defconfig
make -j `cat /proc/cpuinfo | grep "^processor" | wc -l` "$@"
## the zip creation
if [ -f arch/arm/boot/zImage ]; then
rm -f zip-creator/kernel/zImage
rm -rf zip-creator/system/
mkdir -p zip-creator/system/lib/modules
cp arch/arm/boot/zImage zip-creator/kernel
find . -name *.ko | xargs cp -a --target-directory=zip-creator/system/lib/modules/
zipfile="$vendor-$target-v$version-$daytime.zip"
cd zip-creator
rm -f *.zip
zip -r $zipfile * -x *kernel/.gitignore*
echo "zip saved to zip-creator/$zipfile"
else # [ -f arch/arm/boot/zImage ]
echo "the build failed so a zip won't be created"
fi # [ -f arch/arm/boot/zImage ]
END=$(date +%s)
BUILDTIME=$((END - START))
B_MIN=$((BUILDTIME / 60))
B_SEC=$((BUILDTIME - E_MIN * 60))
echo -ne "\033[32mBuildtime: "
[ $B_MIN != 0 ] && echo -ne "$B_MIN min(s) "
echo -e "$B_SEC sec(s)\033[0m"