forked from dharamg3/G3MOD
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·51 lines (45 loc) · 1.11 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
#!/bin/sh
#
# Kernel build script
#
# By Mark "Hill Beast" Kennard
#
TOOLCHAIN=/usr/linaro/bin/arm-linux-gnueabi-
ARCH=arm
if [ -z $1 ]; then
if [ -z $KBUILD_BUILD_VERSION ]; then
export KBUILD_BUILD_VERSION="Test-`date '+%Y%m%d-%H%m'`"
fi
echo "Kernel will be labelled ($KBUILD_BUILD_VERSION)"
else
if [ $1 = "config" ]; then
echo "Executing menuconfig"
make menuconfig CROSS_COMPILE=$TOOLCHAIN ARCH=$ARCH
exit
fi
if [ $1 = "saveconfig" ]; then
if [ -z $2 ]; then
echo "You must specify the destination configuration (XXX_defconfig)"
else
echo "Saving configuration to arch/$ARCH/$2_defconfig"
cat .config | grep "=" > arch/$ARCH/$2_defconfig
fi
exit
fi
echo "Setting kernel name to ($1)"
export KBUILD_BUILD_VERSION=$1
fi
echo "Compiling the kernel"
if test -f arch/$ARCH/boot/zImage; then
rm arch/$ARCH/boot/zImage
fi
make -j2 CROSS_COMPILE=$TOOLCHAIN ARCH=$ARCH
if test -f arch/$ARCH/boot/zImage; then
echo "Tarballing the kernel"
cp arch/$ARCH/boot/zImage ./
tar cf $KBUILD_BUILD_VERSION-zImage.tar zImage
rm zImage
else
echo "Will not tarball as make didn't produce zImage"
fi
echo "Done"