forked from opnay/android_kernel_samsung_jalte
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·80 lines (67 loc) · 1.98 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
source build_function.sh
source build_export.sh
if [ "$1" == "" ]
then
Error "USE : build.sh <skt/kt/lg>"
exit
fi
export ARCH=arm
export CROSS_COMPILE=$TOOLCHAIN
DEVICE_CA=$1
DEFCONFIG=immortal_"$DEVICE_CA"_defconfig
RAMDISK_ORIG=$RAMDISK_ORIG/$1
echo
ShowInfo "Check Script Settings"
echo
ShowInfo "Kernel Directory :" $KERNEL_DIR
ShowInfo "Kernel Output Directory :" $KERNEL_OUT_DIR
ShowInfo "Kernel Output boot.img Directory :" $KERNEL_BOOTIMG_DIR
ShowInfo "Ramdisk Directory :" $RAMDISK_ORIG
if [ ! -e $RAMDISK_ORIG ]
then
Error "Ramdisk Directory Not Found!"
exit
fi
ShowInfo "Toolchain : " $CROSS_COMPILE
if [ ! -e "$CROSS_COMPILE"ld ]
then
Error "Toolchain Not found!"
exit
fi
ShowInfo "Number of CPU Core : " $NB_CPU
ShowInfo "Defconfig : " $DEFCONFIG
if [ ! -e $KERNEL_DIR/arch/arm/configs/$DEFCONFIG ]
then
Error "Defconfig Not Found!"
exit
fi
## Clean output Directory
rm -rf $KERNEL_BOOTIMG_DIR $KERNEL_OUT_DIR
mkdir -p $KERNEL_BOOTIMG_DIR $KERNEL_OUT_DIR $RAMDISK_OUT_DIR
## Make
ShowNoty "==Make Config"
make $DEFCONFIG -j$NB_CPU O=$KERNEL_OUT_DIR
#make menuconfig -j$NB_CPU O=$KERNEL_OUT_DIR
ShowNoty "==Start Make"
make -j$NB_CPU O=$KERNEL_OUT_DIR
if [ ! -e $KERNEL_OUT_DIR/arch/arm/boot/zImage ]
then
Error "Error occured!"
exit
fi
## Copy Ramdisk
ShowNoty "==Make Ramdisk"
cp -r $RAMDISK_ORIG/* $RAMDISK_OUT_DIR/
find $RAMDISK_OUT_DIR -name EMPTY -exec rm -rf {} \;
find $RAMDISK_OUT_DIR -name "*~" -exec rm -rf {} \;
for module_file in `find $KERNDIR_OUT -name "*.ko"`
do
echo $module_file
$STRIP --strip-unneeded $module_file
cp $module_file $RAMDISK_OUT_DIR/lib/modules/
done
ShowNoty "==Make Boot.img"
$MKBOOTFS $RAMDISK_OUT_DIR > $KERNEL_BOOTIMG_DIR/ramdisk-boot.cpio
$MINIGZIP < $KERNEL_BOOTIMG_DIR/ramdisk-boot.cpio > $KERNEL_BOOTIMG_DIR/ramdisk-boot.cpio.gz
$MKBOOTIMG --base 0x10000000 --pagesize 2048 --kernel $KERNEL_OUT_DIR/arch/arm/boot/zImage --ramdisk $KERNEL_BOOTIMG_DIR/ramdisk-boot.cpio.gz -o $KERNEL_BOOTIMG_DIR/boot.img
ShowNoty "==Complete Goto $KERNEL_BOOTIMG_DIR"