forked from msdx321/android_kernel_samsung_heroXqltechn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_kernel.sh
executable file
·77 lines (63 loc) · 1.71 KB
/
build_kernel.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
#!/bin/bash
export ARCH=arm64
export SEC_BUILD_OPTION_HW_REVISION=02
ROOT_DIR=$(pwd)
OUT_DIR=$ROOT_DIR/out
BUILDING_DIR=$OUT_DIR/kernel_obj
JOB_NUMBER=`grep processor /proc/cpuinfo|wc -l`
#CROSS_COMPILER=$ROOT_DIR/lazy-prebuilt/aarch64-linux-android-4.9/bin/aarch64-linux-android-
CROSS_COMPILER=$ROOT_DIR/lazy-prebuilt/aarch64-linaro-4.9/bin/aarch64-linux-gnu-
DTBTOOL=$ROOT_DIR/lazy-prebuilt/bin/dtbTool
DTS_DIR=$BUILDING_DIR/arch/arm64/boot/dts/samsung
ANYKERNEL_DIR=$ROOT_DIR/anykernel-prebuilt
TEMP_DIR=$OUT_DIR/temp
DEFCONFIG=$1/travis_hero2qlte_chnzc_defconfig
FUNC_PRINT()
{
echo ""
echo "=============================================="
echo $1
echo "=============================================="
echo ""
}
FUNC_CLEAN()
{
FUNC_PRINT "Cleaning All"
rm -rf $OUT_DIR
mkdir $OUT_DIR
mkdir -p $BUILDING_DIR
mkdir -p $TEMP_DIR
}
FUNC_COMPILE_KERNEL()
{
FUNC_PRINT "Start Compiling Kernel"
make -C $ROOT_DIR O=$BUILDING_DIR $DEFCONFIG
make -C $ROOT_DIR O=$BUILDING_DIR -j$JOB_NUMBER ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILER
FUNC_PRINT "Finish Compiling Kernel"
}
FUNC_BUILD_DTB()
{
FUNC_PRINT "Building DTB"
$DTBTOOL -v -s 2048 -o $TEMP_DIR/dtb $DTS_DIR/
}
FUNC_PACK()
{
FUNC_PRINT "Start Packing"
cp -r $ANYKERNEL_DIR/* $TEMP_DIR
cp $BUILDING_DIR/arch/arm64/boot/Image.gz $TEMP_DIR/zImage
mkdir $TEMP_DIR/modules
find . -type f -name "*.ko" | xargs cp -t $TEMP_DIR/modules
cd $TEMP_DIR
zip -r HKernel.zip ./*
mv HKernel.zip $OUT_DIR/HKernel.zip
cd $ROOT_DIR
FUNC_PRINT "Finish Packing"
}
START_TIME=`date +%s`
FUNC_CLEAN
FUNC_COMPILE_KERNEL
FUNC_BUILD_DTB
FUNC_PACK
END_TIME=`date +%s`
let "ELAPSED_TIME=$END_TIME-$START_TIME"
echo "Total compile time is $ELAPSED_TIME seconds"