forked from ivanmmj/CommunitySGS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_kernel.sh
executable file
·144 lines (103 loc) · 3.12 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
#/bin/bash
Vibrant() {
PROJECT_NAME=T959
HW_BOARD_REV=05
}
Captivate() {
PROJECT_NAME=kepler
HW_BOARD_REV=03
}
Clean() {
echo "Clean Kernel"
pushd linux-2.6.29
make clean
popd
pushd modules
make clean
popd
echo " It's done... "
exit
}
device=`zenity --title "Choose your device" --text "Please select your device from the following list." --height 380 --width 250 --list --radiolist --column "" --column " Please Select An Option" True "Vibrant" False "Captivate" False "Clean Sources"`
case $device in
"Vibrant")Vibrant;;
"Captivate")Captivate;;
"Clean Sources")Clean;;
esac
if [ "$CPU_JOB_NUM" = "" ] ; then
CPU_JOB_NUM=8
fi
TOOLCHAIN=../arm-eabi-4.4.0/bin
TOOLCHAIN_PREFIX=arm-eabi-
KERNEL_BUILD_DIR=linux-2.6.29
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 "************************************************************"
BUILD_MODULE()
{
echo "************************************************************"
echo "* BUILD_MODULE *"
echo "************************************************************"
echo
pushd modules
make ARCH=arm CROSS_COMPILE=$TOOLCHAIN/$TOOLCHAIN_PREFIX
popd
}
BUILD_KERNEL()
{
echo "************************************************************"
echo "* BUILD_KERNEL *"
echo "************************************************************"
echo
pushd $KERNEL_BUILD_DIR
export KDIR=`pwd`
make ARCH=arm $PROJECT_NAME"_rev"$HW_BOARD_REV"_defconfig"
# make kernel
make -j$CPU_JOB_NUM HOSTCFLAGS="-g -O2" ARCH=arm CROSS_COMPILE=$TOOLCHAIN/$TOOLCHAIN_PREFIX
popd
BUILD_MODULE
}
# 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_KERNEL
END_TIME=`date +%s`
let "ELAPSED_TIME=$END_TIME-$START_TIME"
echo "Total compile time is $ELAPSED_TIME seconds"
read -n1 -r -p "Press any key to finish..."