Skip to contentSkip to conversation

Fixup deb-pkg target to generate separate firmware deb.

PATCH In review Jonathan McDowell 2 participants 5 messages Sep 12, 2008 – Sep 15, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixup deb-pkg target to generate separate firmware deb.

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?

-----

scripts/package/builddeb +22 -2
index ba6bf5d..d152b38 100644
@@ -15,15 +15,18 @@ set -e
 version=$KERNELRELEASE
 revision=`cat .version`
 tmpdir="$objtree/debian/tmp"
+fwdir="$objtree/debian/fwtmp"
 packagename=linux-$version
+fwpackagename=linux-firmware-image
 
 if [ "$ARCH" == "um" ] ; then
 	packagename=user-mode-linux-$version
 fi
 
 # 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"
 fi
@@ -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: any
+Description: Linux kernel firmware, version $version
+ This package contains firmware from the Linux kernel, version $version
+EOF
+
+dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir"
+dpkg --build "$fwdir" ..
+fi
+
 # Perform the final magic
-dpkg-gencontrol -isp
+dpkg-gencontrol -isp -p$packagename
 dpkg --build "$tmpdir" ..
 
 exit 0

-----

J.

Signature · 1 line
If I save time, when do I get it back?
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jonathan McDowell

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.

Quoted 1 line

scripts/package/builddeb fi · line 129

Quoted 9 lines
scripts/package/builddeb +1 -0
@@ -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

scripts/package/builddeb +3 -0
+	mv "$tmpdir/lib/firmware" "$fwdir/lib/"
+
+cat <<EOF >> debian/control

This line should be indented one level.

scripts/package/builddeb fi · line 138

Quoted 10 lines
scripts/package/builddeb +5 -0
+
+Package: $fwpackagename
+Architecture: any
+Description: Linux kernel firmware, version $version
+ This package contains firmware from the Linux kernel, version

$version

scripts/package/builddeb +4 -0
+EOF 
+
+dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir"
+dpkg --build "$fwdir" ..

Same for these two lines.

Quoted 11 lines
scripts/package/builddeb +3 -2
+fi
+
 # Perform the final magic
-dpkg-gencontrol -isp
+dpkg-gencontrol -isp -p$packagename
 dpkg --build "$tmpdir" ..
 
 exit 0
-----

J.

#2 lore raw

[Adding linux-kbuild as that seems to be the closest to a maintainer for scripts/package/]

Quoted 5 lines · Frans Pop
Quoted 4 lines · Jonathan McDowell

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.

Quoted 7 lines
Quoted 1 line

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.

Quoted 2 lines
Quoted 1 line

-----

scripts/package/builddeb +22 -2
index ba6bf5d..1264b8e 100644
@@ -15,15 +15,18 @@ set -e
 version=$KERNELRELEASE
 revision=`cat .version`
 tmpdir="$objtree/debian/tmp"
+fwdir="$objtree/debian/fwtmp"
 packagename=linux-$version
+fwpackagename=linux-firmware-image
 
 if [ "$ARCH" == "um" ] ; then
 	packagename=user-mode-linux-$version
 fi
 
 # 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"
 fi
@@ -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
+EOF
+
+	dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir"
+	dpkg --build "$fwdir" ..
+fi
+
 # Perform the final magic
-dpkg-gencontrol -isp
+dpkg-gencontrol -isp -p$packagename
 dpkg --build "$tmpdir" ..
 
 exit 0

-----

J.

Signature · 2 lines
"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
#3 lore raw
Quoted 2 lines · Jonathan McDowell

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

Although I agree that arch all is technically not incorrect, I wonder if it is the smart thing to do it here.

The pkg-deb target is probably mostly, or even exclusively - used to build custom kernels, and people might be crossbuilding kernels with different configs and thus resulting in different firmware files from the same source (thus same version) on the same system.
I build amd64, i386 and armel that way on my main desktop system, all with different configs (tuned mainly to keep the build time down).

Keeping the firmware package arch-specific would ensure that a firmware package built with the config for one arch does not get overwritten by one built for another arch with a different config.

Cheers,
FJP

#4 lore raw
Quoted 14 lines · Frans Pop
Quoted 2 lines · Jonathan McDowell

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

Although I agree that arch all is technically not incorrect, I wonder if it is the smart thing to do it here.

The pkg-deb target is probably mostly, or even exclusively - used to build custom kernels, and people might be crossbuilding kernels with different configs and thus resulting in different firmware files from the same source (thus same version) on the same system.
I build amd64, i386 and armel that way on my main desktop system, all with different configs (tuned mainly to keep the build time down).

Quoted 3 lines

Keeping the firmware package arch-specific would ensure that a firmware package built with the config for one arch does not get overwritten by one built for another arch with a different config.

There's nothing stopping you having several different configs for the same arch that don't produce all the required firmware either. I think the right answer if you're building lots of different kernels for different machines in testing is probably to build a linux-firmware-image that has everything in it, so that you don't have to worry about upgrading it most of the time.

(Technically you could make the firmware image indicate which firmware it provides, but I think that gets overly granular for not huge gain.)

J.

Signature · 3 lines
Web [                        Make friends.                         ]
site: http:// [                                          ]       Made by
www.earth.li/~noodles/  [                      ]         HuggieTag 0.0.23