bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67109: ‘efi32-esp’ image support pulls in host-side code


From: Ludovic Courtès
Subject: bug#67109: ‘efi32-esp’ image support pulls in host-side code
Date: Sat, 11 Nov 2023 16:45:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hello,

I noticed that 62c86c8391ceb8953ca972498fd75ea9298b85ff pulls in
host-side code on the “build side”, via (guix utils), meaning that the
closure of the (gnu build image) module would now include 80 modules.

This change also introduces uses of ‘target-x86?’ and ‘target-arm?’ on
the build side that are unlikely to have the intended effect because the
check is then done based on the native system type when running the
build process.  Last, the ‘cond’ form in that commit lacks an ‘else’
clause.

Thus I’m proposing the fix below.  How can I test it though?  I get:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix system image -t efi32-raw 
gnu/system/examples/bare-bones.tmpl
guix system: error: EFI bootloader required with GPT partitioning
--8<---------------cut here---------------end--------------->8---

Thanks in advance!

Ludo’.

diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index 49dc01c0d1..63262a4ffe 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès 
<ludo@gnu.org>
+;;; Copyright © 2013-2020, 2023 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 Christine Lemmer-Webber <cwebber@dustycloud.org>
 ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
@@ -29,7 +29,6 @@ (define-module (gnu build image)
   #:use-module (guix build syscalls)
   #:use-module (guix build utils)
   #:use-module (guix store database)
-  #:use-module (guix utils)
   #:use-module (gnu build bootloader)
   #:use-module (gnu build install)
   #:use-module (gnu build linux-boot)
@@ -191,13 +190,11 @@ (define* (initialize-efi-partition root
 (define* (initialize-efi32-partition root
                                      #:key
                                      grub-efi32
+                                     grub-targets
                                      #:allow-other-keys)
   "Install in ROOT directory, an EFI 32bit loader using GRUB-EFI32."
   (install-efi-loader grub-efi32 root
-                      #:targets (cond ((target-x86?)
-                                       '("i386-efi" . "BOOTIA32.EFI"))
-                                      ((target-arm?)
-                                       '("arm-efi" . "BOOTARM.EFI")))))
+                      #:targets grub-targets))
 
 (define* (initialize-root-partition root
                                     #:key
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index a990c4f861..49d4287a74 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -136,7 +136,17 @@ (define esp-partition
 (define esp32-partition
   (partition
    (inherit esp-partition)
-   (initializer (gexp initialize-efi32-partition))))
+   (initializer
+    (let-system (system target)
+      (let ((targets (cond ((target-x86? (or target system))
+                            #~'("i386-efi" . "BOOTIA32.EFI"))
+                           ((target-arm? (or target system))
+                            #~'("arm-efi" . "BOOTARM.EFI"))
+                           (else #f))))
+        #~(lambda (root . args)
+            (apply initialize-efi32-partition root
+                   #:grub-targets #$targets
+                   args)))))))
 
 (define root-partition
   (partition

reply via email to

[Prev in Thread] Current Thread [Next in Thread]