From 8acf29a78654bca4fba4c708903f53ef6e4bbc46 Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Thu, 5 Sep 2024 16:25:26 -0600 Subject: [PATCH] live-server: place kernel in the minimal layer By placing the kernel in minimal, we can achieve the following improvements: 1. Space savings - there are redundant packages present in the ship-live pool and in the live layer. Adding the kernel to minimal means that the kernel is already in the live layer, and we don't then also need it in the pool. 2. Time savings - informal vm testing suggests more than a minute improvement to have the kernel preinstalled over installing it at runtime. As always, there is a cost tradeoff: 1. If a different kernel is desired, we need to be able to remove this preinstalled kernel. Relevant curtin and subiquity changes are already landed. 2. When installing that other kernel, it'll take longer than today due to still needing to install a kernel at runtime + the time cost of removing the preinstalled kernel. --- live-build/auto/config | 9 ++++++++- live-build/ubuntu-server/hooks/04-kernel-bits.binary | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) mode change 100755 => 100644 live-build/ubuntu-server/hooks/04-kernel-bits.binary diff --git a/live-build/auto/config b/live-build/auto/config index 9f70643e..325422d9 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -1005,7 +1005,14 @@ case $PROJECT in exit 1 fi - add_package ubuntu-server-minimal.ubuntu-server.installer.$flavor $kernel_metapkg + add_pass ubuntu-server-minimal.ubuntu-server.installer.$flavor + if [ $flavor == ga ]; then + kernel_layer=ubuntu-server-minimal + else + kernel_layer=ubuntu-server-minimal.ubuntu-server.installer.$flavor + fi + add_package $kernel_layer $kernel_metapkg + LIVE_PASSES="${LIVE_PASSES:+$LIVE_PASSES }ubuntu-server-minimal.ubuntu-server.installer.$flavor" done case $ARCH in diff --git a/live-build/ubuntu-server/hooks/04-kernel-bits.binary b/live-build/ubuntu-server/hooks/04-kernel-bits.binary old mode 100755 new mode 100644 index 551c7a42..60d76181 --- a/live-build/ubuntu-server/hooks/04-kernel-bits.binary +++ b/live-build/ubuntu-server/hooks/04-kernel-bits.binary @@ -15,6 +15,9 @@ esac PROJECT=$PROJECT${SUBARCH:+-$SUBARCH} +# ensure this initrd is casperized +chroot chroot update-initramfs -u + # Fish out generated kernel image and initrd mv chroot/boot/initrd.img-* ${PWD}/livecd.${PROJECT}.initrd-$flavor mv chroot/boot/vmlinu?-* ${PWD}/livecd.${PROJECT}.kernel-$flavor