@@ -46,13 +46,49 @@ create_package() {
46
46
dpkg-deb ${KDEB_COMPRESS: +-Z$KDEB_COMPRESS } --build " $pdir " ..
47
47
}
48
48
49
+ deploy_kernel_headers () {
50
+ pdir=$1
51
+
52
+ rm -rf $pdir
53
+
54
+ (
55
+ cd $srctree
56
+ find . arch/$SRCARCH -maxdepth 1 -name Makefile\*
57
+ find include scripts -type f -o -type l
58
+ find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform
59
+ find $( find arch/$SRCARCH -name include -o -name scripts -type d) -type f
60
+ ) > debian/hdrsrcfiles
61
+
62
+ {
63
+ if is_enabled CONFIG_STACK_VALIDATION; then
64
+ echo tools/objtool/objtool
65
+ fi
66
+
67
+ find arch/$SRCARCH /include Module.symvers include scripts -type f
68
+
69
+ if is_enabled CONFIG_GCC_PLUGINS; then
70
+ find scripts/gcc-plugins -name \* .so
71
+ fi
72
+ } > debian/hdrobjfiles
73
+
74
+ destdir=$pdir /usr/src/linux-headers-$version
75
+ mkdir -p $destdir
76
+ tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir
77
+ tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir
78
+ rm -f debian/hdrsrcfiles debian/hdrobjfiles
79
+
80
+ # copy .config manually to be where it's expected to be
81
+ cp $KCONFIG_CONFIG $destdir /.config
82
+
83
+ mkdir -p $pdir /lib/modules/$version /
84
+ ln -s /usr/src/linux-headers-$version $pdir /lib/modules/$version /build
85
+ }
86
+
49
87
version=$KERNELRELEASE
50
88
tmpdir=debian/linux-image
51
- kernel_headers_dir=debian/linux-headers
52
89
libc_headers_dir=debian/linux-libc-dev
53
90
dbg_dir=debian/linux-image-dbg
54
91
packagename=linux-image-$version
55
- kernel_headers_packagename=linux-headers-$version
56
92
libc_headers_packagename=linux-libc-dev
57
93
dbg_packagename=$packagename -dbg
58
94
77
113
BUILD_DEBUG=$( if_enabled_echo CONFIG_DEBUG_INFO Yes)
78
114
79
115
# Setup the directory structure
80
- rm -rf " $tmpdir " " $kernel_headers_dir " " $ libc_headers_dir" " $dbg_dir " debian/files
116
+ rm -rf " $tmpdir " " $libc_headers_dir " " $dbg_dir " debian/files
81
117
mkdir -m 755 -p " $tmpdir /DEBIAN"
82
118
mkdir -p " $tmpdir /lib" " $tmpdir /boot"
83
- mkdir -p " $kernel_headers_dir /lib/modules/$version /"
84
119
85
120
# Install the kernel
86
121
if [ " $ARCH " = " um" ] ; then
@@ -163,37 +198,10 @@ EOF
163
198
chmod 755 " $tmpdir /DEBIAN/$script "
164
199
done
165
200
166
- # Build kernel header package
167
- (
168
- cd $srctree
169
- find . arch/$SRCARCH -maxdepth 1 -name Makefile\*
170
- find include scripts -type f -o -type l
171
- find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform
172
- find $( find arch/$SRCARCH -name include -o -name scripts -type d) -type f
173
- ) > debian/hdrsrcfiles
174
-
175
- {
176
- if is_enabled CONFIG_STACK_VALIDATION; then
177
- echo tools/objtool/objtool
178
- fi
179
-
180
- find arch/$SRCARCH /include Module.symvers include scripts -type f
181
-
182
- if is_enabled CONFIG_GCC_PLUGINS; then
183
- find scripts/gcc-plugins -name \* .so
184
- fi
185
- } > debian/hdrobjfiles
186
-
187
- destdir=$kernel_headers_dir /usr/src/linux-headers-$version
188
- mkdir -p " $destdir "
189
- tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir
190
- tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir
191
- cp $KCONFIG_CONFIG $destdir /.config # copy .config manually to be where it's expected to be
192
- ln -sf " /usr/src/linux-headers-$version " " $kernel_headers_dir /lib/modules/$version /build"
193
- rm -f debian/hdrsrcfiles debian/hdrobjfiles
194
-
195
201
if [ " $ARCH " != " um" ]; then
196
- create_package " $kernel_headers_packagename " " $kernel_headers_dir "
202
+ deploy_kernel_headers debian/linux-headers
203
+ create_package linux-headers-$version debian/linux-headers
204
+
197
205
create_package " $libc_headers_packagename " " $libc_headers_dir "
198
206
fi
199
207
0 commit comments