patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Cc: Ville Ilvonen <ville.ilvonen@unikie.com>,
	Puck Meerburg <puck@puckipedia.com>
Subject: [PATCH 2/2] img/combined: avoid chainloading in GRUB
Date: Wed, 20 Apr 2022 10:12:14 +0000	[thread overview]
Message-ID: <20220420101214.1228221-3-hi@alyssa.is> (raw)
In-Reply-To: <20220420101214.1228221-1-hi@alyssa.is>

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 <ville.ilvonen@unikie.com>
Cc: Puck Meerburg <puck@puckipedia.com>
---
 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 <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is>
 
 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" {
-- 
2.35.1


  parent reply	other threads:[~2022-04-20 10:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20 10:12 [PATCH 0/2] img/combined: avoid chainloading in GRUB Alyssa Ross
2022-04-20 10:12 ` [PATCH 1/2] img/live: switch to systemd-boot Alyssa Ross
2022-04-21 11:48   ` Alyssa Ross
2022-04-20 10:12 ` Alyssa Ross [this message]
2022-04-21 11:48   ` [PATCH 2/2] img/combined: avoid chainloading in GRUB Alyssa Ross
2022-04-21  9:57 ` [PATCH 0/2] " ville.ilvonen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220420101214.1228221-3-hi@alyssa.is \
    --to=hi@alyssa.is \
    --cc=devel@spectrum-os.org \
    --cc=puck@puckipedia.com \
    --cc=ville.ilvonen@unikie.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).