This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sh
executable file
·99 lines (83 loc) · 2.26 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
source build_export.sh
# Export
export ARCH=arm
export CROSS_COMPILE=$TOOLCHAIN_PREFIX
function help() {
echo -e "Usage : build.sh <skt/kt/lg> <ramdisk>"
echo -e " <ramdisk> :"
echo -e "\ttw-kitkat\tSamsung Touchwiz Kitkat"
echo -e "\ttw-lollipop\tSamsung Touchwiz Lollipop"
echo -e "\trecovery\tCWM Recovery"
echo -e "\trecovery-cm\tCyanogenMod Recovery"
echo -e "\trecovery-philz\tPhilz Touch Recovery"
exit
}
# Check Usage
if [ $# != 2 ]; then
help
fi
case $1 in
skt) DEFCONFIG=jalteskt_immortal_defconfig;;
lg) DEFCONFIG=jaltelgt_immortal_defconfig;;
kt) DEFCONFIG=jaltektt_immortal_defconfig;;
*) help;;
esac
case $2 in
tw-kitkat | tw-lollipop) BOOTIMG=boot;;
recovery | recovery-cm | recovery-philz) BOOTIMG=recovery;;
*) help;;
esac
RAMDISK_DIR_ORIG=$RAMDISK_DIR_ORIG/$2
# Check Settings.
echo "Check Script Settings"
if [ $BOOTIMG == "recovery" ]; then
echo " * Recovery Build : true"
fi
echo " * Kernel Directory : $KERNEL_DIR"
echo " * Output Directory : $KERNEL_OUT"
echo " * boot.img Directory : $KERNEL_OUT_BOOTIMG"
echo " * Ramdisk Directory : $RAMDISK_DIR_ORIG"
if [ ! -e $RAMDISK_DIR_ORIG ]; then
echo " ***** Ramdisk directory was not found *****"
exit
fi
echo " * Toolchain : $CROSS_COMPILE"
if [ ! -e "$CROSS_COMPILE"ld ]; then
echo " ***** Toolchain was not found *****"
exit
fi
echo " * Make job number : $JN"
echo " * Defconfig : $DEFCONFIG"
if [ ! -e $KERNEL_DIR/arch/arm/configs/$DEFCONFIG ]; then
echo " ***** Defconfig was not found *****"
exit
fi
echo -e "\nPress [Enter] key to start build"
read
## Clean output Directory
echo " ** Clean Directory"
#rm -rf $KERNEL_OUT
mkdir -p $KERNEL_OUT
## Config
echo " ** Make Config"
make $DEFCONFIG -j$JN O=$KERNEL_OUT
sed -i 's/^CONFIG_LOCALVERSION=\"\"/CONFIG_LOCALVERSION=\"-'$IMMORTAL_VERSION'\"/g' $KERNEL_OUT/.config
echo " ** Run menuconfig"
make menuconfig -j$JN O=$KERNEL_OUT
## Make Config
echo " ** Make zImage"
make -j$JN O=$KERNEL_OUT
if [ ! -e $KERNEL_OUT/arch/arm/boot/zImage ]; then
echo " ***** Error occured *****"
exit
fi
## Make boot.img
echo " ** Make bootimg"
./build_bootimg.sh -o $BOOTIMG $RAMDISK_DIR_ORIG
if [ -e $KERNEL_OUT_BOOTIMG/$BOOTIMG.img ]; then
echo "Build Complete!!"
echo "boot.img : $KERNEL_OUT_BOOTIMG/$BOOTIMG.img"
else
echo "Couldn't make boot.img"
fi
#### End