Re: [PATCH] Fixup deb-pkg target to generate separate firmware deb.

From: Jonathan McDowell
Date: Sat Sep 13 2008 - 12:08:48 EST

[Adding linux-kbuild as that seems to be the closest to a maintainer for

On Sat, Sep 13, 2008 at 10:35:18AM +0200, Frans Pop wrote:
> On Friday 12 September 2008, Jonathan McDowell wrote:
> > The below is a simplistic fix for "make deb-pkg"; it splits the
> > firmware out to a linux-firmware-image package and adds an
> > (unversioned) Suggests to the linux package for this firmware.
> >
> > Frans, does this solve your problem in an acceptable manner?
> Yes it does. Thanks for the patch Jonathan.
> Tested both with kernel configs that result in firmware and that do not
> result in firmware.
> A few minor nitpicks below.

Ta, I've fixed both the indents. I've also changed the firmware package
to be arch: all.

> > Signed-Off-By: Jonathan McDowell <noodles@xxxxxxxx>
> Acked-by: Frans Pop <elendil@xxxxxxxxx>

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index ba6bf5d..1264b8e 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -15,15 +15,18 @@ set -e
revision=`cat .version`

if [ "$ARCH" == "um" ] ; then

# Setup the directory structure
-rm -rf "$tmpdir"
+rm -rf "$tmpdir" "$fwdir"
mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
+mkdir -p "$fwdir/DEBIAN" "$fwdir/lib"
if [ "$ARCH" == "um" ] ; then
mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin"
@@ -107,6 +110,7 @@ Standards-Version: 3.6.1

Package: $packagename
Provides: kernel-image-$version, linux-image-$version
+Suggests: $fwpackagename
Architecture: any
Description: Linux kernel, version $version
This package contains the Linux kernel, modules and corresponding other
@@ -118,8 +122,24 @@ fi
chown -R root:root "$tmpdir"
chmod -R go-w "$tmpdir"

+# Do we have firmware? Move it out of the way and build it into a package.
+if [ -e "$tmpdir/lib/firmware" ]; then
+ mv "$tmpdir/lib/firmware" "$fwdir/lib/"
+ cat <<EOF >> debian/control
+Package: $fwpackagename
+Architecture: all
+Description: Linux kernel firmware, version $version
+ This package contains firmware from the Linux kernel, version $version
+ dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir"
+ dpkg --build "$fwdir" ..
# Perform the final magic
-dpkg-gencontrol -isp
+dpkg-gencontrol -isp -p$packagename
dpkg --build "$tmpdir" ..

exit 0


"Just because I'll spend 4 hours automating a task that takes 4 minutes
by hand doesn't mean I'm not lazy." -- Mike Sphar, asr
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at