forked from project-voodoo-fascinate/linux_sch-r910
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_kernel.sh
executable file
·126 lines (97 loc) · 1.94 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
#!/bin/bash
#Set CPU Environment Variable
if [ "$CPU_JOB_NUM" = "" ] ; then
CPU_JOB_NUM=8
fi
Usage()
{
echo "build_kernel.sh - building script android kernel"
echo " Usage: ./build_kernel.sh "
echo
exit 1
}
OPTION=-k
PRODUCT=r910
case "$PRODUCT" in
r910)
MODULES="onedram_svn onedram dpram_recovery samsung"
KERNEL_DEF_CONFIG=forte_01_defconfig
;;
*)
Usage
;;
esac
if [ ! $PWD_DIR ] ; then
PWD_DIR=$(pwd)
fi
KERNEL_DIR=$PWD_DIR/Kernel
MODULES_DIR=$PWD_DIR/modules
prepare_kernel()
{
echo "*************************************"
echo "* prepare kernel *"
echo "*************************************"
echo
make distclean
make -C $KERNEL_DIR ARCH=arm $KERNEL_DEF_CONFIG
if [ $? != 0 ] ; then
exit 1
fi
make -C $KERNEL_DIR ARCH=arm prepare
if [ $? != 0 ] ; then
exit 1
fi
}
build_modules()
{
echo "*************************************"
echo "* build modules *"
echo "*************************************"
echo
make -C $KERNEL_DIR ARCH=arm $KERNEL_DEF_CONFIG
if [ $? != 0 ] ; then
exit 1
fi
make -C $KERNEL_DIR ARCH=arm KBUILD_MODPOST_WARN=1 modules
if [ $? != 0 ] ; then
exit 1
fi
for module in $MODULES
do
echo cd $MODULES_DIR/$module
cd $MODULES_DIR/$module
make KDIR=$KERNEL_DIR
done
}
build_kernel()
{
if [ ! -f $KERNEL_DIR/.config ] ; then
if [ ! -f $KERNEL_DIR/scripts/mod/modprobe ] ; then
prepare_kernel
fi
fi
echo "make " -C $KERNEL_DIR ARCH=arm $KERNEL_DEF_CONFIG
make -C $KERNEL_DIR ARCH=arm $KERNEL_DEF_CONFIG
if [ $? != 0 ] ; then
exit 1
fi
build_modules
echo "*************************************"
echo "* build kernel *"
echo "*************************************"
echo
cd $KERNEL_DIR
make -j$CPU_JOB_NUM
if [ $? != 0 ] ; then
exit $?
fi
}
case "$OPTION" in
-k)
build_kernel
;;
*)
Usage
;;
esac
exit 0