Move kernel ISO placement from hook into lb_binary_layered

04-kernel-bits.binary only handled ubuntu-server; desktop builds
(ubuntu, ubuntu-budgie, lubuntu, etc.) had no equivalent and so the
kernel never reached the ISO casper directory for MAKE_ISO=yes builds.

Centralise the logic in lb_binary_layered, which already knows which
passes are live passes and is where the kernel is subsequently removed
from the chroot overlay.  The flavor is determined by convention:

 - passes ending in .live (desktop builds) use LB_LINUX_FLAVOURS
 - other live passes (server installer passes such as
   "...installer.generic-hwe") encode the flavor as the final
   dot-separated component of the pass name

The netboot sub-passes (e.g. installer.generic.netboot) are never
added to LIVE_PASSES, so is_live_layer already guards against them;
the explicit exit-0 that 04-kernel-bits.binary needed is not required.

MAKE_ISO is always "yes" when lb_binary_layered runs — every code path
that sets PASSES_TO_LAYERS=true also sets MAKE_ISO=yes — so no
conditional is needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
michael.hudson@canonical.com 2026-03-24 20:26:46 +13:00
parent 816eaed015
commit eaef671f74
No known key found for this signature in database
GPG Key ID: 80E627A0AB757E23
2 changed files with 14 additions and 19 deletions

View File

@ -91,6 +91,20 @@ build_layered_squashfs () {
# Copy initrd and vmlinuz outside of chroot and remove them from the layer squashfs # Copy initrd and vmlinuz outside of chroot and remove them from the layer squashfs
if $(is_live_layer "$pass"); then if $(is_live_layer "$pass"); then
# For *.live passes (desktop builds), the kernel flavor comes from
# LB_LINUX_FLAVOURS. For other live passes (server installer passes
# like "...installer.generic-hwe"), the flavor is encoded as the
# final dot-separated component of the pass name.
case "$pass" in
*.live)
for flavor in $LB_LINUX_FLAVOURS; do
iso_install_kernel "$flavor" chroot/boot/vmlinu?-* chroot/boot/initrd.img-*
done
;;
*)
iso_install_kernel "${pass##*.}" chroot/boot/vmlinu?-* chroot/boot/initrd.img-*
;;
esac
lb binary_linux-image ${*} lb binary_linux-image ${*}
rm -f chroot/boot/initrd.img-* chroot/boot/vmlinu{x,z}-* rm -f chroot/boot/initrd.img-* chroot/boot/vmlinu{x,z}-*
fi fi

View File

@ -1,19 +0,0 @@
#!/bin/bash -eux
# vi: ts=4 noexpandtab
. config/functions
case $PASS in
ubuntu-server-minimal.ubuntu-server.installer.*.*)
exit 0
;;
ubuntu-server-minimal.ubuntu-server.installer.*)
flavor=${PASS##*.}
;;
*)
exit 0
;;
esac
# Install kernel and initrd directly into the ISO casper directory
iso_install_kernel "$flavor" chroot/boot/vmlinu?-* chroot/boot/initrd.img-*