forked from linux-rockchip/linux-rockchip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpack-kernel.sh
executable file
·186 lines (148 loc) · 4.03 KB
/
pack-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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#!/bin/bash
set -e
# ---------------------------------------------------------------------------
usage() {
echo "usage: $0 [rk2928|rk30|rk3066b]"
echo "example: $0 rk3066b"
exit
}
while getopts "h" options; do
case $options in
h ) usage;;
esac
done
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
kerndir=$(cd .; pwd) # get absolute path
[ -d $kerndir ] || usage
arch=${1}
FILES=()
DIRS=()
EXCLUDES=()
if [ "$arch" == "rk30" ]; then
EXCLUDES=(
arch/arm/mach-rk30/*rk3066b*
arch/arm/mach-rk30/include/mach/*rk3066b*
arch/arm/mach-rk29*/*.c
arch/arm/mach-rk29*/*.h
arch/arm/mach-rk29*/*.S
arch/arm/mach-rk29*/Makefile*
arch/arm/mach-rk29*/include
arch/arm/configs/rk29*
arch/arm/mach-rk30/board-rk30-phone-*
arch/arm/configs/rk30_phone_*
arch/arm/configs/rk30_phonepad_c8003*
)
defconfig=rk3066_sdk_defconfig
elif [ "$arch" == "rk2928" ]; then
EXCLUDES=(
arch/arm/mach-rk30/*.c
arch/arm/mach-rk30/*.h
arch/arm/mach-rk30/*.S
arch/arm/mach-rk30/*.inc
arch/arm/mach-rk30/Makefile*
arch/arm/mach-rk30/include
arch/arm/configs/rk30*
drivers/video/rockchip/lcdc/rk30*
drivers/video/rockchip/hdmi/chips/rk30/rk30*
drivers/video/rockchip/hdmi/chips/rk30/hdcp/rk30*
arch/arm/mach-rk2928/board-rk2928-a720*
arch/arm/configs/rk2928_a720_defconfig
arch/arm/mach-rk2928/board-rk2928.c
arch/arm/configs/rk2928_defconfig
arch/arm/mach-rk2928/board-rk2928-phonepad*
arch/arm/configs/rk2928_phonepad_defconfig
)
defconfig=rk2928_sdk_defconfig
elif [ "$arch" == "rk3066b" ]; then
EXCLUDES=(
arch/arm/mach-rk30/clock_data.c
arch/arm/mach-rk30/board-rk30-*
arch/arm/configs/rk30_*
arch/arm/configs/rk3066_*
arch/arm/mach-rk29*/*.c
arch/arm/mach-rk29*/*.h
arch/arm/mach-rk29*/*.S
arch/arm/mach-rk29*/Makefile*
arch/arm/mach-rk29*/include
arch/arm/configs/rk29*
)
defconfig=rk3066b_sdk_defconfig
else
echo "unknown arch" && usage
fi
[ -f $kerndir/arch/arm/configs/$defconfig ] || usage
COMMON_EXCLUDES=(
pack-kernel*
arch/arm/plat-rk/vpu*.c
drivers/staging/rk29/vivante
drivers/staging/rk29/ipp/rk29-ipp.c
drivers/*rk28*.c
include/*rk28*
arch/arm/mach-rk29/*.c
arch/arm/mach-rk29/*.h
arch/arm/mach-rk29/*.S
arch/arm/mach-rk29/Makefile*
arch/arm/mach-rk29/include
arch/arm/mach-rk*/*-fpga*
arch/arm/mach-rk*/*-tb*
arch/arm/configs/rk29_*
arch/arm/configs/*_fpga_*
arch/arm/configs/*_tb_*
)
# ---------------------------------------------------------------------------
# make .uu
pushd $kerndir >/dev/null
declare -a files
for file in ${FILES[@]}; do
[ -e ${file} ] && files=( ${files[@]} ${file} ) || echo No such file: ${file}
[ -f ${file/.[cS]/.uu} ] && rm -f ${file/.[cS]/.uu}
done
for dir in ${DIRS[@]}; do
[ -d $dir ] && find $dir -type f -name '*.uu' -print0 | xargs -0 rm -f
done
echo build kernel on $kerndir with $defconfig, arch is $arch
make clean >/dev/null 2>&1
make $defconfig >/dev/null 2>&1
make -j`grep 'processor' /proc/cpuinfo | wc -l` ${files[@]/.[cS]/.o} ${DIRS[@]}
for file in ${FILES[@]}; do
filename=${file##*/}
base=${filename%%.*}
dir=${file%/*}
[ -f $dir/$base.o ] && echo UU $dir/$base.uu && uuencode $dir/$base.o $base.o > $dir/$base.uu
done
for d in ${DIRS[@]}; do
for file in `find $d -type f -name '*.o'`; do
filename=${file##*/}
base=${filename%%.*}
dir=${file%/*}
echo UU $dir/$base.uu && uuencode $dir/$base.o $base.o > $dir/$base.uu
done
done
make distclean >/dev/null 2>&1
popd >/dev/null
# fix local version
echo "+" > $kerndir/.scmversion
# tar kernel
pushd $kerndir/../ >/dev/null
package=$(basename $kerndir).tar
ex=$package.ex
> $ex
for file in ${FILES[@]}; do
echo "$file" >> $ex
done
for file in ${EXCLUDES[@]}; do
echo "$file" >> $ex
done
for file in ${COMMON_EXCLUDES[@]}; do
echo "$file" >> $ex
done
echo TAR $(pwd)/$package
tar cf $package --numeric-owner --exclude-from $ex --exclude=.git $(basename $kerndir)
#tar rf $package --numeric-owner --exclude=.git prebuilt/linux-x86/toolchain/arm-eabi-4.4.0
echo GZIP $(pwd)/$package.gz
gzip -9 -c $package > $package.gz
rm $ex
popd >/dev/null
rm -f $kerndir/.scmversion
echo done