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.
raspi-desktop-1
David Krauser 5 years ago
parent 1ca1330eae
commit 8a2cdec470

@ -924,4 +924,20 @@ replace_kernel () {
install --assume-yes "${new_kernel}" install --assume-yes "${new_kernel}"
env DEBIAN_FRONTEND=noninteractive chroot "${mountpoint}" apt-get \ env DEBIAN_FRONTEND=noninteractive chroot "${mountpoint}" apt-get \
autoremove --purge --assume-yes 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
} }

Loading…
Cancel
Save