From eaef671f74e20dbc574f33b6c8c02814115aa89f Mon Sep 17 00:00:00 2001 From: "michael.hudson@canonical.com" Date: Tue, 24 Mar 2026 20:26:46 +1300 Subject: [PATCH] Move kernel ISO placement from hook into lb_binary_layered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- live-build/lb_binary_layered | 14 ++++++++++++++ .../ubuntu-server/hooks/04-kernel-bits.binary | 19 ------------------- 2 files changed, 14 insertions(+), 19 deletions(-) delete mode 100755 live-build/ubuntu-server/hooks/04-kernel-bits.binary diff --git a/live-build/lb_binary_layered b/live-build/lb_binary_layered index 60b5dd05..869b12f3 100755 --- a/live-build/lb_binary_layered +++ b/live-build/lb_binary_layered @@ -91,6 +91,20 @@ build_layered_squashfs () { # Copy initrd and vmlinuz outside of chroot and remove them from the layer squashfs 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 ${*} rm -f chroot/boot/initrd.img-* chroot/boot/vmlinu{x,z}-* fi diff --git a/live-build/ubuntu-server/hooks/04-kernel-bits.binary b/live-build/ubuntu-server/hooks/04-kernel-bits.binary deleted file mode 100755 index cf38b36b..00000000 --- a/live-build/ubuntu-server/hooks/04-kernel-bits.binary +++ /dev/null @@ -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-*