build/debian: Remove default kernel meta packages when deploying our own kernel
As reported in the linked bug report, FAI used to install a Debian
generic kernel, in addition to our custom patched kernel.
This is because FAI's default package_config files list linux-image meta
packages for installation during builds. For instance:
https://salsa.debian.org/cloud-team/debian-cloud-images/-/blob/master/config_space/bookworm/package_config/AMD64
In this CL, we remove the meta package name from the relevant
package_config, thereby preventing FAI from installing a generic kernel.
This also allows users to safely apt upgrade without upgrading the
kernel.
Bug: 383173744
Test: ./build_in_container.sh -a aarch64 -k
Test: then deployed and tested on Pixel 9 Pro
Change-Id: I96160e42c418b462000a868464f0e637a8b2dc5f
diff --git a/build/debian/build.sh b/build/debian/build.sh
index 7a93349..6facfcf 100755
--- a/build/debian/build.sh
+++ b/build/debian/build.sh
@@ -216,8 +216,17 @@
package_custom_kernel() {
if [[ "$use_custom_kernel" != 1 ]]; then
- echo "linux-headers-generic" >> "${config_space}/package_config/AVF"
+ # NOTE: Install generic headers for the default Debian kernel.
+ cat > "${config_space}/package_config/LAST" <<EOF
+PACKAGES install
+linux-headers-generic
+EOF
return
+ else
+ # NOTE: Prevent FAI from installing a default Debian kernel, by removing
+ # linux-image meta package names from arch-specific class files.
+ sed -i "/linux-image.*-${debian_arch}/d" \
+ "${config_space}/package_config/${debian_arch^^}"
fi
local deb_base_url="https://deb.debian.org/debian"