summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradrian15 <adrian15sgd@gmail.com>2019-03-09 14:49:01 +0100
committerRaphaƫl Hertzog <raphael@offensive-security.com>2020-04-23 10:56:51 +0200
commit9220bde3dfdca2f749c16789b6ca8e4e05e961fb (patch)
tree9607332e07c964de643b6c38daa127fb04447054
parent46b0d85021311ed83349a57307fae82b60a2153c (diff)
downloadvyos-live-build-9220bde3dfdca2f749c16789b6ca8e4e05e961fb.tar.gz
vyos-live-build-9220bde3dfdca2f749c16789b6ca8e4e05e961fb.zip
grub-efi: fix partial broken boot capability
when used alongside syslinux and when a single kernel flavour is used, things work correctly. otherwise booting from EFI is broken. the problem comes from the fact that syslinux, for a single kernel flavour creates the file /live/vmlinuz, which is used by the minimal EFI grub.cfg to locate the device and partition containing the live image. when multiple kernel flavours are used, it instead creates /live/vmlinuz1, /live/vmlinuz2, etc. which thus is a problem. similarly when syslinux is not used, you are left only with long filenames for the kernel files, for example /live/vmlinuz-4.19.0-8-amd64. in these situations grub cannot find the device containing the image and thus fails to display the boot menu. the solution here, instead of dynamically changing the filename searched for depending upon bootloader configuration, switches to doing a search for the file /.disk/info instead. this file is generated by binary_disk, and is present for iso, iso-hybrid and hdd images types, though grub-efi cannot be used for the hdd type. it is not created for the netboot type, but again, grub-efi is not compatible with that anyway. it is not created for the tar type, which the grub-efi script does not block as incompatible, but is this not a mistake? furthermore, switching to searching for /.disk/info helps avoid issues for systems that happen to actually include a real /live/vmlinuz path other than on a removable live disk or CD/DVD, as is the case with a HP system discussed in #924053. this patch was written by adrian15sgd@gmail.com, as per the authorship, who attached it to the #924053 bug discussion. this commit message however has been re-written by jnqnfe@gmail.com, prior to submission via an MR, as part of the fix towards the issues reported in #956131. Gbp-Dch: Short Closes: #924053
-rwxr-xr-xscripts/build/binary_grub-efi5
1 files changed, 2 insertions, 3 deletions
diff --git a/scripts/build/binary_grub-efi b/scripts/build/binary_grub-efi
index 11a80672a..c234d3769 100755
--- a/scripts/build/binary_grub-efi
+++ b/scripts/build/binary_grub-efi
@@ -222,12 +222,11 @@ esac
# look in that partition for a grub.cfg file, and even if it finds it
# it will not be able to find the vmlinuz and initrd.
# Drop a minimal grub.cfg in the EFI partition that sets the root and prefix
-# to whatever partition holds the /live/vmlinuz image, and load the grub
+# to whatever partition holds the /.disk/info file, and load the grub
# config from that same partition.
-# This is what the Ubuntu livecd already does.
mkdir -p ${_CHROOT_DIR}/grub-efi-temp-cfg
cat >${_CHROOT_DIR}/grub-efi-temp-cfg/grub.cfg <<EOF
-search --set=root --file /live/vmlinuz
+search --set=root --file /.disk/info
set prefix=(\\\$root)/boot/grub
configfile (\\\$root)/boot/grub/grub.cfg
EOF