unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 44353@debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe@gnu.org>,
	Jesse Gibbons <jgibbons2357@gmail.com>,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#44353: [PATCH version-1.2.0 v2 2/3] bootloader: grub: Skip install-grub-efi when producing a disk image.
Date: Wed, 11 Nov 2020 22:57:12 -0500	[thread overview]
Message-ID: <20201112035713.3789-2-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <20201112035713.3789-1-maxim.cournoyer@gmail.com>

Fixes <http://issues.guix.gnu.org/44353>.

Every bootloader should try their best to install themselves using only the
MOUNT-POINT and otherwise do nothing.  This requirement comes from the
necessity to call INSTALL-GRUB when installing the (non-EFI) GRUB bootloader,
which needs to populate the root file system with extra modules that cannot be
fit in the core.img file, limited in size to 491520 bytes (by the i386-pc
format required for legacy BIOS compatibility).

As introducing bootloader knowledge at the level of the image code is
undesirable, every bootloader should be adapted to support this fall-back for
their installation procedure (TODO).

* gnu/bootloader/grub.scm (install-grub-efi)[efi-dir]: Skip when the EFI-DIR
argument is set to #f.
---
 gnu/bootloader/grub.scm | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 0899fab61f..af7b7561ff 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -573,21 +573,24 @@ fi~%"))))
 
 (define install-grub-efi
   #~(lambda (bootloader efi-dir mount-point)
-      ;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the
-      ;; system whose root is mounted at MOUNT-POINT.
-      (let ((grub-install (string-append bootloader "/sbin/grub-install"))
-            (install-dir (string-append mount-point "/boot"))
-            ;; When installing Guix, it's common to mount EFI-DIR below
-            ;; MOUNT-POINT rather than /boot/efi on the live image.
-            (target-esp (if (file-exists? (string-append mount-point efi-dir))
-                            (string-append mount-point efi-dir)
-                            efi-dir)))
-        ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or
-        ;; root partition.
-        (setenv "GRUB_ENABLE_CRYPTODISK" "y")
-        (invoke/quiet grub-install "--boot-directory" install-dir
-                      "--bootloader-id=Guix"
-                      "--efi-directory" target-esp))))
+      ;; There is nothing useful to do when called in the context of a disk
+      ;; image generation.
+      (when efi-dir
+        ;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the
+        ;; system whose root is mounted at MOUNT-POINT.
+        (let ((grub-install (string-append bootloader "/sbin/grub-install"))
+              (install-dir (string-append mount-point "/boot"))
+              ;; When installing Guix, it's common to mount EFI-DIR below
+              ;; MOUNT-POINT rather than /boot/efi on the live image.
+              (target-esp (if (file-exists? (string-append mount-point efi-dir))
+                              (string-append mount-point efi-dir)
+                              efi-dir)))
+          ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or
+          ;; root partition.
+          (setenv "GRUB_ENABLE_CRYPTODISK" "y")
+          (invoke/quiet grub-install "--boot-directory" install-dir
+                        "--bootloader-id=Guix"
+                        "--efi-directory" target-esp)))))
 
 (define (install-grub-efi-netboot subdir)
   "Define a grub-efi-netboot bootloader installer for installation in SUBDIR,
-- 
2.28.0





  reply	other threads:[~2020-11-12  4:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31 16:47 bug#44353: guix system disk-image -t raw fails with grub-efi-bootloader Jesse Gibbons
2020-11-07  7:09 ` Maxim Cournoyer
2020-11-07  9:08   ` Mathieu Othacehe
2020-11-07 11:26     ` Bengt Richter
2020-11-07 20:32     ` Maxim Cournoyer
2020-11-08 11:04       ` Mathieu Othacehe
2020-11-12  3:57         ` bug#44353: [PATCH version-1.2.0 v2 1/3] image: Remove conflicting user-provided EFI file system Maxim Cournoyer
2020-11-12  3:57           ` Maxim Cournoyer [this message]
2020-11-12  8:42             ` bug#44353: [PATCH version-1.2.0 v2 2/3] bootloader: grub: Skip install-grub-efi when producing a disk image Mathieu Othacehe
2020-11-17 18:29               ` Maxim Cournoyer
2020-11-12  3:57           ` bug#44353: [PATCH version-1.2.0 v2 3/3] doc: Detail which bootloader get used with disk-image or vm-image Maxim Cournoyer
2020-11-12  8:45             ` Mathieu Othacehe
2020-11-12 21:16               ` Ludovic Courtès
2020-11-12  8:39           ` bug#44353: [PATCH version-1.2.0 v2 1/3] image: Remove conflicting user-provided EFI file system Mathieu Othacehe
2020-11-17 18:37             ` Maxim Cournoyer
2020-11-12  7:09         ` bug#44353: [PATCH version-1.2.0 v2] guix: system: Add a new '--non-volatile' option for disk-image Maxim Cournoyer
2020-11-12  8:36           ` Mathieu Othacehe
2020-11-12 14:59             ` Maxim Cournoyer
2020-11-12 17:06               ` Mathieu Othacehe
2020-11-17 14:44                 ` Maxim Cournoyer
2020-11-12 21:18             ` Ludovic Courtès
2020-11-16  2:48               ` Maxim Cournoyer
2020-11-15 21:45           ` Ludovic Courtès
2020-11-16  3:47             ` Maxim Cournoyer
2020-11-16  9:23             ` Mathieu Othacehe
2020-11-16 13:09               ` Ludovic Courtès
2020-11-16 13:34                 ` Mathieu Othacehe
2020-11-17 20:21                   ` Maxim Cournoyer

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=20201112035713.3789-2-maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=44353@debbugs.gnu.org \
    --cc=jgibbons2357@gmail.com \
    --cc=othacehe@gnu.org \
    /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://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).