From b1ff26eb27ea905357f8bf217d0f0cfbea33c37b Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 20 Apr 2022 10:01:27 +0000 Subject: img/combined: avoid chainloading in GRUB Some UEFI implementations (like the one on Ville's Thinkpad P43s) failed to chainload Spectrum from GRUB. Now that Spectrum has a proper bootloader, we can avoid that chainloading entirely, which will hopefully make the broken firmware happier. Reported-by: Ville Ilvonen Cc: Puck Meerburg Message-Id: <20220420101214.1228221-3-hi@alyssa.is> Tested-by: Ville Ilvonen --- img/combined/default.nix | 10 ++++++++++ img/combined/grub.cfg.in | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/img/combined/default.nix b/img/combined/default.nix index 86e07e2..16cd506 100644 --- a/img/combined/default.nix +++ b/img/combined/default.nix @@ -35,6 +35,16 @@ let grubCfg = substituteAll { src = ./grub.cfg.in; + + nativeBuildInputs = [ mtools ]; + + preInstall = '' + export spectrumKernelParams="$( + mcopy -i ${eosimages.image}@@1M ::/loader/entries/spectrum.conf - | + grep '^options ' | + sed 's/^options //')" + ''; + linux = removePrefix storeDir installer.kernel; initrd = removePrefix storeDir installer.initramfs; inherit (installer) kernelParams; diff --git a/img/combined/grub.cfg.in b/img/combined/grub.cfg.in index 1a91a75..31b09d6 100644 --- a/img/combined/grub.cfg.in +++ b/img/combined/grub.cfg.in @@ -1,5 +1,5 @@ # SPDX-License-Identifier: EUPL-1.2 -# SPDX-FileCopyrightText: 2021 Alyssa Ross +# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross insmod efi_gop insmod efi_uga @@ -13,7 +13,8 @@ terminal_output gfxterm menuentry "Try Spectrum" { loopback live (hd0,gpt3)/Spectrum-0.0-x86_64-generic.0.Live.img - chainloader (live,gpt1)/efi/boot/bootx64.efi + linux (live,gpt1)/spectrum/linux @spectrumKernelParams@ + initrd (live,gpt1)/spectrum/initrd } menuentry "Install Spectrum" { -- cgit 1.4.1