Commit cd8d60a20a4516016c117ac0f1ac7b06ff606f7e

Authored by Theodore Ts'o
Committed by Michal Marek
1 parent 55f88eccf9

kbuild: create linux-headers package in deb-pkg

Create a linux-headers-$KVER.deb package which can be used to build
external modules without having the source tree around.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Michal Marek <mmarek@suse.cz>

Showing 1 changed file with 27 additions and 1 deletions Side-by-side Diff

scripts/package/builddeb
... ... @@ -76,15 +76,17 @@
76 76 fi
77 77 tmpdir="$objtree/debian/tmp"
78 78 fwdir="$objtree/debian/fwtmp"
  79 +hdrdir="$objtree/debian/hdrtmp"
79 80 packagename=linux-image-$version
80 81 fwpackagename=linux-firmware-image
  82 +hdrpackagename=linux-headers-$version
81 83  
82 84 if [ "$ARCH" = "um" ] ; then
83 85 packagename=user-mode-linux-$version
84 86 fi
85 87  
86 88 # Setup the directory structure
87   -rm -rf "$tmpdir" "$fwdir"
  89 +rm -rf "$tmpdir" "$fwdir" "$hdrdir"
88 90 mkdir -m 755 -p "$tmpdir/DEBIAN"
89 91 mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
90 92 mkdir -m 755 -p "$fwdir/DEBIAN"
... ... @@ -225,6 +227,30 @@
225 227 EOF
226 228  
227 229 fi
  230 +
  231 +# Build header package
  232 +find . -name Makefile -o -name Kconfig\* -o -name \*.pl > /tmp/files$$
  233 +find arch/x86/include include scripts -type f >> /tmp/files$$
  234 +(cd $objtree; find .config Module.symvers include scripts -type f >> /tmp/objfiles$$)
  235 +destdir=$hdrdir/usr/src/linux-headers-$version
  236 +mkdir -p "$destdir" "$hdrdir/DEBIAN" "$hdrdir/usr/share/doc/$hdrpackagename"
  237 +tar -c -f - -T /tmp/files$$ | (cd $destdir; tar -xf -)
  238 +(cd $objtree; tar -c -f - -T /tmp/objfiles$$) | (cd $destdir; tar -xf -)
  239 +rm -f /tmp/files$$ /tmp/objfiles$$
  240 +arch=$(dpkg --print-architecture)
  241 +
  242 +cat <<EOF >> debian/control
  243 +
  244 +Package: $hdrpackagename
  245 +Provides: linux-headers, linux-headers-2.6
  246 +Architecture: $arch
  247 +Description: Linux kernel headers for $KERNELRELEASE on $arch
  248 + This package provides kernel header files for $KERNELRELEASE on $arch
  249 + .
  250 + This is useful for people who need to build external modules
  251 +EOF
  252 +
  253 +create_package "$hdrpackagename" "$hdrdir"
228 254  
229 255 # Do we have firmware? Move it out of the way and build it into a package.
230 256 if [ -e "$tmpdir/lib/firmware" ]; then