-
Notifications
You must be signed in to change notification settings - Fork 24
/
build_kernel.sh
executable file
·152 lines (135 loc) · 4.52 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash
echo "$1 $2 $3"
case "$1" in
Clean)
echo "************************************************************"
echo "* Clean Kernel *"
echo "************************************************************"
pushd Kernel
make clean V=1 ARCH=arm CROSS_COMPILE=$TOOLCHAIN/$TOOLCHAIN_PREFIX 2>&1 | tee make.clean.out
popd
echo " Clean is done... "
exit
;;
mrproper)
echo "************************************************************"
echo "* mrproper Kernel *"
echo "************************************************************"
pushd Kernel
make clean V=1 ARCH=arm CROSS_COMPILE=$TOOLCHAIN/$TOOLCHAIN_PREFIX 2>&1 | tee make.clean.out
make mrproper 2>&1 | tee make.mrproper.out
popd
echo " mrproper is done... "
exit
;;
distclean)
echo "************************************************************"
echo "* distclean Kernel *"
echo "************************************************************"
pushd Kernel
make clean V=1 ARCH=arm CROSS_COMPILE=$TOOLCHAIN/$TOOLCHAIN_PREFIX 2>&1 | tee make.clean.out
make distclean 2>&1 | tee make.distclean.out
popd
echo " distclean is done... "
exit
;;
*)
PROJECT_NAME=SPH-D700
HW_BOARD_REV="03"
;;
esac
if [ "$CPU_JOB_NUM" = "" ] ; then
CPU_JOB_NUM=4
fi
TARGET_LOCALE="vzw"
#uncomment to add custom version string
#export KBUILD_BUILD_VERSION="nubernel-EC05_v0.0.0"
DEFCONFIG_STRING=victory_8G_defconfig
#TOOLCHAIN=`pwd`/toolchains/android-toolchain-4.4.3/bin
#TOOLCHAIN_PREFIX=arm-linux-androideabi-
TOOLCHAIN=/usr/local/toolchain/arm-2009q3/bin
TOOLCHAIN_PREFIX=arm-none-linux-gnueabi-
KERNEL_BUILD_DIR=`pwd`/Kernel
ANDROID_OUT_DIR=`pwd`/Android/out/target/product/SPH-D700
export PRJROOT=$PWD
export PROJECT_NAME
export HW_BOARD_REV
export LD_LIBRARY_PATH=.:${TOOLCHAIN}/../lib
echo "************************************************************"
echo "* EXPORT VARIABLE *"
echo "************************************************************"
echo "PRJROOT=$PRJROOT"
echo "PROJECT_NAME=$PROJECT_NAME"
echo "HW_BOARD_REV=$HW_BOARD_REV"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
echo "************************************************************"
BUILD_MODULE()
{
echo "************************************************************"
echo "* BUILD_MODULE *"
echo "************************************************************"
echo
pushd Kernel
make ARCH=arm modules
popd
}
CLEAN_ZIMAGE()
{
echo "************************************************************"
echo "* Removing old zImage *"
echo "************************************************************"
rm -f `pwd`/Kernel/arch/arm/boot/zImage
echo "* zImage removed"
echo "************************************************************"
echo
}
BUILD_KERNEL()
{
echo "************************************************************"
echo "* BUILD_KERNEL *"
echo "************************************************************"
echo
pushd $KERNEL_BUILD_DIR
export KDIR=`pwd`
make ARCH=arm $DEFCONFIG_STRING
# make -j$CPU_JOB_NUM ARCH=arm CROSS_COMPILE=$TOOLCHAIN/$TOOLCHAIN_PREFIX
make V=1 -j$CPU_JOB_NUM ARCH=arm CROSS_COMPILE=$TOOLCHAIN/$TOOLCHAIN_PREFIX 2>&1 | tee make.out
popd
}
# print title
PRINT_USAGE()
{
echo "************************************************************"
echo "* PLEASE TRY AGAIN *"
echo "************************************************************"
echo
}
PRINT_TITLE()
{
echo
echo "************************************************************"
echo "* MAKE PACKAGES *"
echo "************************************************************"
echo "* 1. kernel : zImage"
echo "* 2. modules"
echo "************************************************************"
}
##############################################################
# MAIN FUNCTION #
##############################################################
if [ $# -gt 3 ]
then
echo
echo "************************************************************"
echo "* Option Error *"
PRINT_USAGE
exit 1
fi
START_TIME=`date +%s`
PRINT_TITLE
#BUILD_MODULE
CLEAN_ZIMAGE
BUILD_KERNEL
END_TIME=`date +%s`
let "ELAPSED_TIME=$END_TIME-$START_TIME"
echo "Total compile time is $ELAPSED_TIME seconds"