[neon/neon/livecd-rootfs/Neon/release-lts] live-build: Boot without an initramfs by default if running a custom kernel
Pat Viafore
null at kde.org
Fri Mar 12 10:45:26 GMT 2021
Git commit c81f4ca2e391c0f719bb6e27be8fc161ce0e3fa4 by Pat Viafore, on behalf of David Krauser.
Committed on 18/02/2021 at 21:40.
Pushed by jriddell into branch 'Neon/release-lts'.
Boot without an initramfs by default if running a custom kernel
Initramfs-less boot, which is a boot optimization, should only be
applied where we know it could work for users and provide an improved
boot boot experience; images with custom kernels are candidates for
that.
M +16 -0 live-build/functions
https://invent.kde.org/neon/neon/livecd-rootfs/commit/c81f4ca2e391c0f719bb6e27be8fc161ce0e3fa4
diff --git a/live-build/functions b/live-build/functions
index afe82d23..e18c4097 100644
--- a/live-build/functions
+++ b/live-build/functions
@@ -987,4 +987,20 @@ replace_kernel () {
install --assume-yes "${new_kernel}"
env DEBIAN_FRONTEND=noninteractive chroot "${mountpoint}" apt-get \
autoremove --purge --assume-yes
+
+ # If running a custom kernel, we should try to boot without an initramfs
+ # We do this by setting GRUB_FORCE_PARTUUID, which forces initramfs-less boot
+ partuuid=$(blkid -s PARTUUID -o value $(findmnt -n -o SOURCE --target "${mountpoint}"))
+ if [ -n "${partuuid}" ]; then
+ echo "Force booting without an initramfs..."
+ mkdir -p "${mountpoint}/etc/default/grub.d"
+ cat << EOF >> "${mountpoint}/etc/default/grub.d/40-force-partuuid.cfg"
+# Force boot without an initramfs by setting GRUB_FORCE_PARTUUID
+# Remove this line to enable boot with an initramfs
+GRUB_FORCE_PARTUUID=${partuuid}
+EOF
+ divert_grub "${mountpoint}"
+ chroot "${mountpoint}" update-grub
+ undivert_grub "${mountpoint}"
+ fi
}
More information about the Neon-commits
mailing list