all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Initial vfat support.
@ 2016-11-05 12:55 Marius Bakke
  2016-11-05 12:55 ` [PATCH 1/6] gnu: Add fatfsck-static Marius Bakke
                   ` (5 more replies)
  0 siblings, 6 replies; 46+ messages in thread
From: Marius Bakke @ 2016-11-05 12:55 UTC (permalink / raw)
  To: guix-devel

Hello Guix,

These patches allow using a FAT32 /boot partition.

There are a couple of problems still:

* grub-efi tests are failing. I don't understand why, any tips here
  appreciated. This package can wait, however.

* The changes to base-initrd are only picked up if (needed-for-boot #t).
  I think this is a bug, since the initrd wants to check all defined
  file systems, and /boot is not actually needed for Linux boot.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 1/6] gnu: Add fatfsck-static.
  2016-11-05 12:55 Initial vfat support Marius Bakke
@ 2016-11-05 12:55 ` Marius Bakke
  2016-11-05 16:01   ` Hartmut Goebel
  2016-11-06 21:42   ` Ludovic Courtès
  2016-11-05 12:55 ` [PATCH 2/6] linux-initrd: Support FAT filesystems Marius Bakke
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 46+ messages in thread
From: Marius Bakke @ 2016-11-05 12:55 UTC (permalink / raw)
  To: guix-devel; +Cc: Marius Bakke

* gnu/packages/disk.scm (dosfstools/static): New private variable.
(fatfsck/static): New variable.
---
 gnu/packages/disk.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/disk.scm b/gnu/packages/disk.scm
index db050d6..477c25a 100644
--- a/gnu/packages/disk.scm
+++ b/gnu/packages/disk.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,6 +28,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
   #:use-module (gnu packages docbook)
@@ -197,6 +199,40 @@ to recover data more efficiently by only reading the necessary blocks.")
 which respectively make and check MS-DOS FAT file systems.")
     (license license:gpl3+)))
 
+(define dosfstools/static
+  (static-package
+   (package (inherit dosfstools))))
+
+(define-public fatfsck/static
+  (package
+    (name "fatfsck-static")
+    (version (package-version dosfstools))
+    (build-system trivial-build-system)
+    (source #f)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let ((source (string-append (assoc-ref %build-inputs "dosfstools")
+                                      "/sbin/"))
+               (exe "fsck.fat")
+               (bin (string-append (assoc-ref %outputs "out") "/sbin")))
+           (mkdir-p bin)
+           (with-directory-excursion bin
+             (copy-file (string-append source exe) exe)
+             (remove-store-references exe)
+             (chmod exe #o555)
+             ;; Add fsck.vfat symlink to match the Linux driver name.
+             (symlink exe "fsck.vfat")
+             #t)))))
+    (inputs `(("dosfstools" ,dosfstools/static)))
+    (home-page (package-home-page dosfstools))
+    (synopsis "Statically linked fsck.fat from dosfstools")
+    (description "This package provides a statically-linked fsck.fat
+and a fsck.vfat compatibility symlink for use in an initrd.")
+    (license (package-license dosfstools))))
+
 (define-public sdparm
   (package
     (name "sdparm")
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 2/6] linux-initrd: Support FAT filesystems.
  2016-11-05 12:55 Initial vfat support Marius Bakke
  2016-11-05 12:55 ` [PATCH 1/6] gnu: Add fatfsck-static Marius Bakke
@ 2016-11-05 12:55 ` Marius Bakke
  2016-11-06 21:44   ` Ludovic Courtès
  2016-11-05 12:55 ` [PATCH 3/6] file-systems: Suppress fsck status completion bar Marius Bakke
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-11-05 12:55 UTC (permalink / raw)
  To: guix-devel; +Cc: Marius Bakke

* gnu/system/linux-initrd.scm (base-initrd): When a FAT filesystem is
present: Add fatfsck/static in (helper-packages); and add nls_iso8859-1
in (linux-modules).
---
 gnu/system/linux-initrd.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 174239a..a787072 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -29,6 +29,7 @@
                 #:select (derivation->output-path))
   #:use-module (guix modules)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages disk)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages guile)
   #:use-module ((gnu packages make-bootstrap)
@@ -193,6 +194,9 @@ loaded at boot time in the order in which they appear."
       ,@(if (find (file-system-type-predicate "9p") file-systems)
             virtio-9p-modules
             '())
+      ,@(if (find (file-system-type-predicate "vfat") file-systems)
+            '("nls_iso8859-1")
+            '())
       ,@(if volatile-root?
             '("fuse")
             '())
@@ -205,6 +209,11 @@ loaded at boot time in the order in which they appear."
                   file-systems)
             (list e2fsck/static)
             '())
+      ,@(if (find (lambda (fs)
+                    (string-suffix? "fat" (file-system-type fs)))
+                  file-systems)
+            (list fatfsck/static)
+            '())
       ,@(if volatile-root?
             (list unionfs-fuse/static)
             '())))
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 3/6] file-systems: Suppress fsck status completion bar.
  2016-11-05 12:55 Initial vfat support Marius Bakke
  2016-11-05 12:55 ` [PATCH 1/6] gnu: Add fatfsck-static Marius Bakke
  2016-11-05 12:55 ` [PATCH 2/6] linux-initrd: Support FAT filesystems Marius Bakke
@ 2016-11-05 12:55 ` Marius Bakke
  2016-11-06 21:47   ` Ludovic Courtès
  2016-11-05 12:55 ` [PATCH 4/6] gnu: Add efivar Marius Bakke
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-11-05 12:55 UTC (permalink / raw)
  To: guix-devel; +Cc: Marius Bakke

* gnu/build/file-systems.scm (check-file-system): Drop "-C" argument
from fsck for compatibility with other fscks.
---
 gnu/build/file-systems.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index bfc353a..30abe94 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -415,7 +415,7 @@ the following:
   (define fsck
     (string-append "fsck." type))
 
-  (let ((status (system* fsck "-v" "-p" "-C" "0" device)))
+  (let ((status (system* fsck "-v" "-p" device)))
     (match (status:exit-val status)
       (0
        #t)
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 4/6] gnu: Add efivar.
  2016-11-05 12:55 Initial vfat support Marius Bakke
                   ` (2 preceding siblings ...)
  2016-11-05 12:55 ` [PATCH 3/6] file-systems: Suppress fsck status completion bar Marius Bakke
@ 2016-11-05 12:55 ` Marius Bakke
  2016-11-06 21:51   ` Ludovic Courtès
  2016-11-05 12:55 ` [PATCH 5/6] gnu: Add efibootmgr Marius Bakke
  2016-11-05 12:55 ` [PATCH 6/6] gnu: Add grub-efi Marius Bakke
  5 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-11-05 12:55 UTC (permalink / raw)
  To: guix-devel; +Cc: Marius Bakke

* gnu/packages/linux.scm (efivar): New variable.
---
 gnu/packages/linux.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 3fdce5d..86e9ff5 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,6 +63,7 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pciutils)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages popt)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
   #:use-module (gnu packages readline)
@@ -3118,3 +3120,38 @@ activity of the GPU as a whole, which is also accurate during OpenCL
 computations, as well as separate component statistics that are only meaningful
 under OpenGL graphics workloads.")
     (license license:gpl3)))
+
+(define-public efivar
+  (package
+    (name "efivar")
+    (version "30")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/rhinstaller/" name
+                                  "/releases/download/" version "/" name
+                                  "-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "12qjnm44yi55ffqxjpgrxy82s89yjziy84w2rfjjknsd8flj0mqz"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(;; Tests require a UEFI system and is not detected in the chroot.
+       #:tests? #f
+       #:make-flags (list (string-append "prefix=" %output)
+                          (string-append "libdir=" %output "/lib")
+                          (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("popt" ,popt)))
+    (home-page "https://github.com/rhinstaller/efivar")
+    (synopsis "Tool and library to manipulate EFI variables")
+    (description "This package provides a library and a command line
+interface to the UEFI variable facility.")
+    (license
+     (list license:lgpl2.1+
+           (license:non-copyleft "file://src/crc32.c"
+                                 "See src/crc32.c in the distribution.")))))
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 5/6] gnu: Add efibootmgr.
  2016-11-05 12:55 Initial vfat support Marius Bakke
                   ` (3 preceding siblings ...)
  2016-11-05 12:55 ` [PATCH 4/6] gnu: Add efivar Marius Bakke
@ 2016-11-05 12:55 ` Marius Bakke
  2016-11-06 21:52   ` Ludovic Courtès
  2016-11-05 12:55 ` [PATCH 6/6] gnu: Add grub-efi Marius Bakke
  5 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-11-05 12:55 UTC (permalink / raw)
  To: guix-devel; +Cc: Marius Bakke

* gnu/packages/linux.scm (efibootmgr): New variable.
---
 gnu/packages/linux.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 86e9ff5..5896410 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -3155,3 +3155,49 @@ interface to the UEFI variable facility.")
      (list license:lgpl2.1+
            (license:non-copyleft "file://src/crc32.c"
                                  "See src/crc32.c in the distribution.")))))
+
+(define-public efibootmgr
+  (package
+    (name "efibootmgr")
+    (version "14")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/rhinstaller/" name
+                                  "/releases/download/" version "/" name
+                                  "-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "1n3sydvpr6yl040hhf460k7mrxby7laqd9dqs6pq0js1hijc2zip"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; No tests.
+       #:make-flags
+       (list (string-append "prefix=" %output)
+             (string-append "libdir=" %output "/lib")
+             ;; Override CFLAGS to add efivar include directory.
+             (string-append "CFLAGS=-O2 -g -flto -I"
+                            (assoc-ref %build-inputs "efivar")
+                            "/include/efivar"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'branding
+           ;; Replace default loader path with something more familiar.
+           (lambda _
+             (substitute* "src/efibootmgr.c"
+               (("EFI\\\\\\\\redhat") ; Matches 'EFI\\redhat'.
+                "EFI\\\\gnu"))
+             #t))
+         (delete 'configure))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("efivar" ,efivar)
+       ("popt" ,popt)))
+    (home-page "https://github.com/rhinstaller/efibootmgr")
+    (synopsis "Modify the Extensible Firmware Interface (EFI) boot manager")
+    (description
+     "@code{efibootmgr} is a Linux user-space application to modify the
+Intel Extensible Firmware Interface (EFI) Boot Manager.  This application
+can create and destroy boot entries, change the boot order, change the next
+running boot option, and more.")
+    (license license:gpl2+)))
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 6/6] gnu: Add grub-efi.
  2016-11-05 12:55 Initial vfat support Marius Bakke
                   ` (4 preceding siblings ...)
  2016-11-05 12:55 ` [PATCH 5/6] gnu: Add efibootmgr Marius Bakke
@ 2016-11-05 12:55 ` Marius Bakke
  2016-11-05 18:58   ` Leo Famulari
  5 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-11-05 12:55 UTC (permalink / raw)
  To: guix-devel; +Cc: Marius Bakke

* gnu/packages/grub.scm (grub-efi): New variable.
---
 gnu/packages/grub.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
index ffce1bf..e06216f 100644
--- a/gnu/packages/grub.scm
+++ b/gnu/packages/grub.scm
@@ -157,3 +157,24 @@ on the same computer; upon booting the computer, the user is presented with a
 menu to select one of the installed operating systems.")
     (license gpl3+)
     (properties '((cpe-name . "grub2")))))
+
+(define-public grub-efi
+  (package
+    (inherit grub)
+    (name "grub-efi")
+    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
+    (inputs
+     `(("efibootmgr" ,efibootmgr)
+       ,@(package-inputs grub)))
+    (arguments
+     #:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
+     (substitute-keyword-arguments (package-arguments grub)
+       ((#:configure-flags flags) `(cons* "--with-platform=efi"
+                                          ,flags))
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (add-after 'patch-stuff 'patch-efibootmgr-path
+             (lambda* (#:key inputs #:allow-other-keys)
+               (substitute* "grub-core/osdep/unix/platform.c"
+                 (("efibootmgr") (string-append (assoc-ref inputs "efibootmgr")
+                                                "/sbin/efibootmgr")))))))))))
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [PATCH 1/6] gnu: Add fatfsck-static.
  2016-11-05 12:55 ` [PATCH 1/6] gnu: Add fatfsck-static Marius Bakke
@ 2016-11-05 16:01   ` Hartmut Goebel
  2016-11-05 16:11     ` Marius Bakke
  2016-11-06 21:42   ` Ludovic Courtès
  1 sibling, 1 reply; 46+ messages in thread
From: Hartmut Goebel @ 2016-11-05 16:01 UTC (permalink / raw)
  To: guix-devel

Am 05.11.2016 um 13:55 schrieb Marius Bakke:
> +(define-public fatfsck/static
> +  (package
> +    (name "fatfsck-static")

What is the reason for using a different name in "define"?

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 1/6] gnu: Add fatfsck-static.
  2016-11-05 16:01   ` Hartmut Goebel
@ 2016-11-05 16:11     ` Marius Bakke
  0 siblings, 0 replies; 46+ messages in thread
From: Marius Bakke @ 2016-11-05 16:11 UTC (permalink / raw)
  To: Hartmut Goebel, guix-devel

[-- Attachment #1: Type: text/plain, Size: 497 bytes --]

Hartmut Goebel <h.goebel@crazy-compilers.com> writes:

> Am 05.11.2016 um 13:55 schrieb Marius Bakke:
>> +(define-public fatfsck/static
>> +  (package
>> +    (name "fatfsck-static")
>
> What is the reason for using a different name in "define"?

I mostly followed the convention of the e2fsck package. I've seen this
convention elsewhere as well, but don't know the reasoning behind it :)

However fatfsck could perhaps be renamed to dosfsck to better match
the e2fsprogs->e2fsck transformation.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-11-05 12:55 ` [PATCH 6/6] gnu: Add grub-efi Marius Bakke
@ 2016-11-05 18:58   ` Leo Famulari
  2016-11-05 19:38     ` Marius Bakke
  0 siblings, 1 reply; 46+ messages in thread
From: Leo Famulari @ 2016-11-05 18:58 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

On Sat, Nov 05, 2016 at 12:55:11PM +0000, Marius Bakke wrote:
> * gnu/packages/grub.scm (grub-efi): New variable.
> ---
>  gnu/packages/grub.scm | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
> index ffce1bf..e06216f 100644
> --- a/gnu/packages/grub.scm
> +++ b/gnu/packages/grub.scm
> @@ -157,3 +157,24 @@ on the same computer; upon booting the computer, the user is presented with a
>  menu to select one of the installed operating systems.")
>      (license gpl3+)
>      (properties '((cpe-name . "grub2")))))
> +
> +(define-public grub-efi
> +  (package
> +    (inherit grub)
> +    (name "grub-efi")
> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
> +    (inputs
> +     `(("efibootmgr" ,efibootmgr)
> +       ,@(package-inputs grub)))
> +    (arguments
> +     #:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.

Does this package work for you?

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-11-05 18:58   ` Leo Famulari
@ 2016-11-05 19:38     ` Marius Bakke
  2016-11-06 22:00       ` Ludovic Courtès
  0 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-11-05 19:38 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 1269 bytes --]

Leo Famulari <leo@famulari.name> writes:

> On Sat, Nov 05, 2016 at 12:55:11PM +0000, Marius Bakke wrote:
>> * gnu/packages/grub.scm (grub-efi): New variable.
>> ---
>>  gnu/packages/grub.scm | 21 +++++++++++++++++++++
>>  1 file changed, 21 insertions(+)
>> 
>> diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
>> index ffce1bf..e06216f 100644
>> --- a/gnu/packages/grub.scm
>> +++ b/gnu/packages/grub.scm
>> @@ -157,3 +157,24 @@ on the same computer; upon booting the computer, the user is presented with a
>>  menu to select one of the installed operating systems.")
>>      (license gpl3+)
>>      (properties '((cpe-name . "grub2")))))
>> +
>> +(define-public grub-efi
>> +  (package
>> +    (inherit grub)
>> +    (name "grub-efi")
>> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
>> +    (inputs
>> +     `(("efibootmgr" ,efibootmgr)
>> +       ,@(package-inputs grub)))
>> +    (arguments
>> +     #:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
>
> Does this package work for you?

Oops, not sure what went wrong when fixing up this package for
publishing. Updated patch attached.

The tests are the same as the original grub package, so I don't get why
they are failing now.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-grub-efi.patch --]
[-- Type: text/x-patch, Size: 1642 bytes --]

From 940c03c7dcddec019e27f6eb1470aeab4db57799 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 20 Oct 2016 17:26:52 +0100
Subject: [PATCH] gnu: Add grub-efi.

* gnu/packages/grub.scm (grub-efi): New variable.
---
 gnu/packages/grub.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
index ffce1bf..7dcfc47 100644
--- a/gnu/packages/grub.scm
+++ b/gnu/packages/grub.scm
@@ -157,3 +157,24 @@ on the same computer; upon booting the computer, the user is presented with a
 menu to select one of the installed operating systems.")
     (license gpl3+)
     (properties '((cpe-name . "grub2")))))
+
+(define-public grub-efi
+  (package
+    (inherit grub)
+    (name "grub-efi")
+    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
+    (inputs
+     `(("efibootmgr" ,efibootmgr)
+       ,@(package-inputs grub)))
+    (arguments
+     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
+       ,@(substitute-keyword-arguments (package-arguments grub)
+           ((#:configure-flags flags) `(cons* "--with-platform=efi"
+                                              ,flags))
+           ((#:phases phases)
+            `(modify-phases ,phases
+               (add-after 'patch-stuff 'patch-efibootmgr-path
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (substitute* "grub-core/osdep/unix/platform.c"
+                     (("efibootmgr") (string-append (assoc-ref inputs "efibootmgr")
+                                                    "/sbin/efibootmgr"))))))))))))
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [PATCH 1/6] gnu: Add fatfsck-static.
  2016-11-05 12:55 ` [PATCH 1/6] gnu: Add fatfsck-static Marius Bakke
  2016-11-05 16:01   ` Hartmut Goebel
@ 2016-11-06 21:42   ` Ludovic Courtès
  1 sibling, 0 replies; 46+ messages in thread
From: Ludovic Courtès @ 2016-11-06 21:42 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

> * gnu/packages/disk.scm (dosfstools/static): New private variable.
> (fatfsck/static): New variable.

You could add “#:allowed-references ()” in ‘fatfsck/static’ to make sure
it doesn’t retain references to anything else.

> +    (description "This package provides a statically-linked fsck.fat
> +and a fsck.vfat compatibility symlink for use in an initrd.")

@command{fsck.fat} etc.

Otherwise LGTM, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 2/6] linux-initrd: Support FAT filesystems.
  2016-11-05 12:55 ` [PATCH 2/6] linux-initrd: Support FAT filesystems Marius Bakke
@ 2016-11-06 21:44   ` Ludovic Courtès
  0 siblings, 0 replies; 46+ messages in thread
From: Ludovic Courtès @ 2016-11-06 21:44 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

> * gnu/system/linux-initrd.scm (base-initrd): When a FAT filesystem is
> present: Add fatfsck/static in (helper-packages); and add nls_iso8859-1
> in (linux-modules).

Simply write “in 'helper-packages'” and “in 'linux-modules'”.

Otherwise LGTM, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 3/6] file-systems: Suppress fsck status completion bar.
  2016-11-05 12:55 ` [PATCH 3/6] file-systems: Suppress fsck status completion bar Marius Bakke
@ 2016-11-06 21:47   ` Ludovic Courtès
  2016-11-07  0:00     ` Marius Bakke
  0 siblings, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2016-11-06 21:47 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

> * gnu/build/file-systems.scm (check-file-system): Drop "-C" argument
> from fsck for compatibility with other fscks.

Oh so fsck.ext2 would no longer show any kind of progress report?
That’s annoying.

Could we address it differently?  Not sure how, though.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 4/6] gnu: Add efivar.
  2016-11-05 12:55 ` [PATCH 4/6] gnu: Add efivar Marius Bakke
@ 2016-11-06 21:51   ` Ludovic Courtès
  0 siblings, 0 replies; 46+ messages in thread
From: Ludovic Courtès @ 2016-11-06 21:51 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

> * gnu/packages/linux.scm (efivar): New variable.

> +    (synopsis "Tool and library to manipulate EFI variables")
> +    (description "This package provides a library and a command line
> +interface to the UEFI variable facility.")

Maybe “… to the variable facility of UEFI boot firmware.” to give a
little bit of extra context.

> +    (license
> +     (list license:lgpl2.1+
> +           (license:non-copyleft "file://src/crc32.c"
> +                                 "See src/crc32.c in the distribution.")))))

The second one can be omitted since the combination is LGPL anyway.

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 5/6] gnu: Add efibootmgr.
  2016-11-05 12:55 ` [PATCH 5/6] gnu: Add efibootmgr Marius Bakke
@ 2016-11-06 21:52   ` Ludovic Courtès
  0 siblings, 0 replies; 46+ messages in thread
From: Ludovic Courtès @ 2016-11-06 21:52 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

> * gnu/packages/linux.scm (efibootmgr): New variable.

[...]

> +    (description
> +     "@code{efibootmgr} is a Linux user-space application to modify the
> +Intel Extensible Firmware Interface (EFI) Boot Manager.  This application
> +can create and destroy boot entries, change the boot order, change the next
> +running boot option, and more.")

s/Linux//

Otherwise LGTM, thanks!  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-11-05 19:38     ` Marius Bakke
@ 2016-11-06 22:00       ` Ludovic Courtès
  2016-11-07  0:19         ` Marius Bakke
  0 siblings, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2016-11-06 22:00 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

> Leo Famulari <leo@famulari.name> writes:
>
>> On Sat, Nov 05, 2016 at 12:55:11PM +0000, Marius Bakke wrote:
>>> * gnu/packages/grub.scm (grub-efi): New variable.
>>> ---
>>>  gnu/packages/grub.scm | 21 +++++++++++++++++++++
>>>  1 file changed, 21 insertions(+)
>>> 
>>> diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
>>> index ffce1bf..e06216f 100644
>>> --- a/gnu/packages/grub.scm
>>> +++ b/gnu/packages/grub.scm
>>> @@ -157,3 +157,24 @@ on the same computer; upon booting the computer, the user is presented with a
>>>  menu to select one of the installed operating systems.")
>>>      (license gpl3+)
>>>      (properties '((cpe-name . "grub2")))))
>>> +
>>> +(define-public grub-efi
>>> +  (package
>>> +    (inherit grub)
>>> +    (name "grub-efi")
>>> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
>>> +    (inputs
>>> +     `(("efibootmgr" ,efibootmgr)
>>> +       ,@(package-inputs grub)))
>>> +    (arguments
>>> +     #:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
>>
>> Does this package work for you?
>
> Oops, not sure what went wrong when fixing up this package for
> publishing. Updated patch attached.

I think Leo was asking whether you could get a bootable system with it.
:-)

> From 940c03c7dcddec019e27f6eb1470aeab4db57799 Mon Sep 17 00:00:00 2001
> From: Marius Bakke <mbakke@fastmail.com>
> Date: Thu, 20 Oct 2016 17:26:52 +0100
> Subject: [PATCH] gnu: Add grub-efi.
>
> * gnu/packages/grub.scm (grub-efi): New variable.

[...]

> +    (name "grub-efi")
> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))

Please use a literal string for ‘synopsis’; use of ‘string-append’ like
this prevents i18n.

> +     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.

It would be good to investigate, especially if the tests pass in the
‘grub’ package.

Also, what’s the rationale for making ‘grub-efi’ separate instead of
incorporating the changes in ‘grub’ proper?  Are there issues around the
portability of ‘efibootmgr’, or an increased closure size?

Thanks for working on it!

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 3/6] file-systems: Suppress fsck status completion bar.
  2016-11-06 21:47   ` Ludovic Courtès
@ 2016-11-07  0:00     ` Marius Bakke
  2016-11-07  8:59       ` Ludovic Courtès
  0 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-11-07  0:00 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 682 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> * gnu/build/file-systems.scm (check-file-system): Drop "-C" argument
>> from fsck for compatibility with other fscks.
>
> Oh so fsck.ext2 would no longer show any kind of progress report?
> That’s annoying.
>
> Could we address it differently?  Not sure how, though.

We would have to provide a custom check-file-system procedure for each
detected file-system. That might be needed in the long run anyway, but I
think this is a worthwhile compromise for now.

I will push the okayed parts of this series tomorrow evening (with
fixes), unless there are further comments.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-11-06 22:00       ` Ludovic Courtès
@ 2016-11-07  0:19         ` Marius Bakke
  2016-11-07  9:00           ` Ludovic Courtès
  0 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-11-07  0:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3110 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Leo Famulari <leo@famulari.name> writes:
>>
>>> On Sat, Nov 05, 2016 at 12:55:11PM +0000, Marius Bakke wrote:
>>>> * gnu/packages/grub.scm (grub-efi): New variable.
>>>> ---
>>>>  gnu/packages/grub.scm | 21 +++++++++++++++++++++
>>>>  1 file changed, 21 insertions(+)
>>>> 
>>>> diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
>>>> index ffce1bf..e06216f 100644
>>>> --- a/gnu/packages/grub.scm
>>>> +++ b/gnu/packages/grub.scm
>>>> @@ -157,3 +157,24 @@ on the same computer; upon booting the computer, the user is presented with a
>>>>  menu to select one of the installed operating systems.")
>>>>      (license gpl3+)
>>>>      (properties '((cpe-name . "grub2")))))
>>>> +
>>>> +(define-public grub-efi
>>>> +  (package
>>>> +    (inherit grub)
>>>> +    (name "grub-efi")
>>>> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
>>>> +    (inputs
>>>> +     `(("efibootmgr" ,efibootmgr)
>>>> +       ,@(package-inputs grub)))
>>>> +    (arguments
>>>> +     #:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
>>>
>>> Does this package work for you?
>>
>> Oops, not sure what went wrong when fixing up this package for
>> publishing. Updated patch attached.
>
> I think Leo was asking whether you could get a bootable system with it.

Yes, I'm using this right now, on top of the recent changes to "guix
system" :) There are a couple of other changes necessary for proper UEFI
support: the grub-install command needs "--efi-directory=<boot mount>"
and optionally "--bootloader-id=GNU" (I use these as well, but did not
publish them, since I haven't tested it on a BIOS system yet, and they
probably need to be conditional somehow). 

>> From 940c03c7dcddec019e27f6eb1470aeab4db57799 Mon Sep 17 00:00:00 2001
>> From: Marius Bakke <mbakke@fastmail.com>
>> Date: Thu, 20 Oct 2016 17:26:52 +0100
>> Subject: [PATCH] gnu: Add grub-efi.
>>
>> * gnu/packages/grub.scm (grub-efi): New variable.
>
> [...]
>
>> +    (name "grub-efi")
>> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
>
> Please use a literal string for ‘synopsis’; use of ‘string-append’ like
> this prevents i18n.
>
>> +     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
>
> It would be good to investigate, especially if the tests pass in the
> ‘grub’ package.
>
> Also, what’s the rationale for making ‘grub-efi’ separate instead of
> incorporating the changes in ‘grub’ proper?  Are there issues around the
> portability of ‘efibootmgr’, or an increased closure size?

This is a good point. The only difference with "--with-platform=efi" is
that another directory is created in place of the i386-pc directory. It
is perfectly possible to build multiple platforms and copying the
platform-specific stuff to $out/lib -- grub will pick the correct
platform at runtime. This is what the Gentoo ebuild does.

I'll give this a shot and send an updated patch later this week.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 3/6] file-systems: Suppress fsck status completion bar.
  2016-11-07  0:00     ` Marius Bakke
@ 2016-11-07  8:59       ` Ludovic Courtès
  2016-11-07  9:29         ` Marius Bakke
  0 siblings, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2016-11-07  8:59 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Hey!

Marius Bakke <mbakke@fastmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Marius Bakke <mbakke@fastmail.com> skribis:
>>
>>> * gnu/build/file-systems.scm (check-file-system): Drop "-C" argument
>>> from fsck for compatibility with other fscks.
>>
>> Oh so fsck.ext2 would no longer show any kind of progress report?
>> That’s annoying.
>>
>> Could we address it differently?  Not sure how, though.
>
> We would have to provide a custom check-file-system procedure for each
> detected file-system. That might be needed in the long run anyway, but I
> think this is a worthwhile compromise for now.

What about adding a one-argument procedure as the ‘check-procedure’
field of <file-system>, with a sane default, like:

  (define (default-file-system-check file-system)
    #~(system* (string-append "fsck." #$(file-system-type file-system))
               …))

?

In fact, that would also remove the need for the special case to add
dosfstools to the initrd because we could simply write:

  (define (fat-file-system-check file-system)
    #~(system* #$(file-append vfatfsck/static "/bin/fsck.vfat")
               …))

and that would automatically bring vfatfsck/static to the initrd when
it’s needed, and only then.

WDYT?

(Same design pattern as ‘open’ in <device-mapping>.)

> I will push the okayed parts of this series tomorrow evening (with
> fixes), unless there are further comments.

Cool, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-11-07  0:19         ` Marius Bakke
@ 2016-11-07  9:00           ` Ludovic Courtès
  2016-11-07  9:23             ` Marius Bakke
  0 siblings, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2016-11-07  9:00 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:

[...]

>>> Oops, not sure what went wrong when fixing up this package for
>>> publishing. Updated patch attached.
>>
>> I think Leo was asking whether you could get a bootable system with it.
>
> Yes, I'm using this right now, on top of the recent changes to "guix
> system" :) There are a couple of other changes necessary for proper UEFI
> support: the grub-install command needs "--efi-directory=<boot mount>"
> and optionally "--bootloader-id=GNU" (I use these as well, but did not
> publish them, since I haven't tested it on a BIOS system yet, and they
> probably need to be conditional somehow). 

OK, sounds good.  :-)

>>> From 940c03c7dcddec019e27f6eb1470aeab4db57799 Mon Sep 17 00:00:00 2001
>>> From: Marius Bakke <mbakke@fastmail.com>
>>> Date: Thu, 20 Oct 2016 17:26:52 +0100
>>> Subject: [PATCH] gnu: Add grub-efi.
>>>
>>> * gnu/packages/grub.scm (grub-efi): New variable.
>>
>> [...]
>>
>>> +    (name "grub-efi")
>>> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
>>
>> Please use a literal string for ‘synopsis’; use of ‘string-append’ like
>> this prevents i18n.
>>
>>> +     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
>>
>> It would be good to investigate, especially if the tests pass in the
>> ‘grub’ package.
>>
>> Also, what’s the rationale for making ‘grub-efi’ separate instead of
>> incorporating the changes in ‘grub’ proper?  Are there issues around the
>> portability of ‘efibootmgr’, or an increased closure size?
>
> This is a good point. The only difference with "--with-platform=efi" is
> that another directory is created in place of the i386-pc directory. It
> is perfectly possible to build multiple platforms and copying the
> platform-specific stuff to $out/lib -- grub will pick the correct
> platform at runtime. This is what the Gentoo ebuild does.

Are you saying that a GRUB compiled with UEFI support will no longer
work out-of-the-box on non-UEFI machines, unless platform-specific stuff
is moved like you suggest?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-11-07  9:00           ` Ludovic Courtès
@ 2016-11-07  9:23             ` Marius Bakke
  2016-12-16 17:09               ` Ludovic Courtès
  0 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-11-07  9:23 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2036 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

>>>> From 940c03c7dcddec019e27f6eb1470aeab4db57799 Mon Sep 17 00:00:00 2001
>>>> From: Marius Bakke <mbakke@fastmail.com>
>>>> Date: Thu, 20 Oct 2016 17:26:52 +0100
>>>> Subject: [PATCH] gnu: Add grub-efi.
>>>>
>>>> * gnu/packages/grub.scm (grub-efi): New variable.
>>>
>>> [...]
>>>
>>>> +    (name "grub-efi")
>>>> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
>>>
>>> Please use a literal string for ‘synopsis’; use of ‘string-append’ like
>>> this prevents i18n.
>>>
>>>> +     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
>>>
>>> It would be good to investigate, especially if the tests pass in the
>>> ‘grub’ package.
>>>
>>> Also, what’s the rationale for making ‘grub-efi’ separate instead of
>>> incorporating the changes in ‘grub’ proper?  Are there issues around the
>>> portability of ‘efibootmgr’, or an increased closure size?
>>
>> This is a good point. The only difference with "--with-platform=efi" is
>> that another directory is created in place of the i386-pc directory. It
>> is perfectly possible to build multiple platforms and copying the
>> platform-specific stuff to $out/lib -- grub will pick the correct
>> platform at runtime. This is what the Gentoo ebuild does.
>
> Are you saying that a GRUB compiled with UEFI support will no longer
> work out-of-the-box on non-UEFI machines, unless platform-specific stuff
> is moved like you suggest?

Ha, no, it was just a long-winded and intoxicated way of saying what you
proposed should work fine. :)

The platform-specific stuff ends up in $out/lib/<platform> by default,
so there won't be any conflicts there, and grub-install will pick the
correct one automatically. That approach is better, I think. Will have a
go at it.

The tricky part is invoking the 'configure, 'build and 'install steps
with appropriate arguments for each platform in the grub expression, but
that does not sound too difficult.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 3/6] file-systems: Suppress fsck status completion bar.
  2016-11-07  8:59       ` Ludovic Courtès
@ 2016-11-07  9:29         ` Marius Bakke
  2016-11-07 10:15           ` Danny Milosavljevic
  0 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-11-07  9:29 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Hey!
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> Marius Bakke <mbakke@fastmail.com> skribis:
>>>
>>>> * gnu/build/file-systems.scm (check-file-system): Drop "-C" argument
>>>> from fsck for compatibility with other fscks.
>>>
>>> Oh so fsck.ext2 would no longer show any kind of progress report?
>>> That’s annoying.
>>>
>>> Could we address it differently?  Not sure how, though.
>>
>> We would have to provide a custom check-file-system procedure for each
>> detected file-system. That might be needed in the long run anyway, but I
>> think this is a worthwhile compromise for now.
>
> What about adding a one-argument procedure as the ‘check-procedure’
> field of <file-system>, with a sane default, like:
>
>   (define (default-file-system-check file-system)
>     #~(system* (string-append "fsck." #$(file-system-type file-system))
>                …))
>
> ?
>
> In fact, that would also remove the need for the special case to add
> dosfstools to the initrd because we could simply write:
>
>   (define (fat-file-system-check file-system)
>     #~(system* #$(file-append vfatfsck/static "/bin/fsck.vfat")
>                …))
>
> and that would automatically bring vfatfsck/static to the initrd when
> it’s needed, and only then.
>
> WDYT?
>
> (Same design pattern as ‘open’ in <device-mapping>.)

This looks very promising. Will try to make it work -- new patches
hopefully later this week! :)


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 3/6] file-systems: Suppress fsck status completion bar.
  2016-11-07  9:29         ` Marius Bakke
@ 2016-11-07 10:15           ` Danny Milosavljevic
  2016-12-17  9:40             ` Marius Bakke
  0 siblings, 1 reply; 46+ messages in thread
From: Danny Milosavljevic @ 2016-11-07 10:15 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Hi,

why not just use "fsck -t xxx" instead? It will filter out "-C" for fscks which don't support it.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-11-07  9:23             ` Marius Bakke
@ 2016-12-16 17:09               ` Ludovic Courtès
  2016-12-16 17:16                 ` Danny Milosavljevic
                                   ` (2 more replies)
  0 siblings, 3 replies; 46+ messages in thread
From: Ludovic Courtès @ 2016-12-16 17:09 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Hi Marius,

Marius Bakke <mbakke@fastmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>>>>> From 940c03c7dcddec019e27f6eb1470aeab4db57799 Mon Sep 17 00:00:00 2001
>>>>> From: Marius Bakke <mbakke@fastmail.com>
>>>>> Date: Thu, 20 Oct 2016 17:26:52 +0100
>>>>> Subject: [PATCH] gnu: Add grub-efi.
>>>>>
>>>>> * gnu/packages/grub.scm (grub-efi): New variable.
>>>>
>>>> [...]
>>>>
>>>>> +    (name "grub-efi")
>>>>> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
>>>>
>>>> Please use a literal string for ‘synopsis’; use of ‘string-append’ like
>>>> this prevents i18n.
>>>>
>>>>> +     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
>>>>
>>>> It would be good to investigate, especially if the tests pass in the
>>>> ‘grub’ package.
>>>>
>>>> Also, what’s the rationale for making ‘grub-efi’ separate instead of
>>>> incorporating the changes in ‘grub’ proper?  Are there issues around the
>>>> portability of ‘efibootmgr’, or an increased closure size?
>>>
>>> This is a good point. The only difference with "--with-platform=efi" is
>>> that another directory is created in place of the i386-pc directory. It
>>> is perfectly possible to build multiple platforms and copying the
>>> platform-specific stuff to $out/lib -- grub will pick the correct
>>> platform at runtime. This is what the Gentoo ebuild does.
>>
>> Are you saying that a GRUB compiled with UEFI support will no longer
>> work out-of-the-box on non-UEFI machines, unless platform-specific stuff
>> is moved like you suggest?
>
> Ha, no, it was just a long-winded and intoxicated way of saying what you
> proposed should work fine. :)

It turns out I have an immediate need ;-), so I pushed this as commit
3eee16130d858ae96510ec1c7d38d31290de2699.  Let me know if that doesn’t
seem right!

Now there are things I didn’t quite get.  Apparently you’re supposed to
have a /boot/efi as a vfat partition, and ‘grub-install’ is supposed to
detect it and install the EFI stuff, or so I thought (info "(grub)
Installing GRUB using grub-install").

However, ‘grub-install’ still seems to be installing for “i386-pc”
instead of EFI.

What am I missing?

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-16 17:09               ` Ludovic Courtès
@ 2016-12-16 17:16                 ` Danny Milosavljevic
  2016-12-16 17:33                 ` Marius Bakke
  2016-12-17  9:38                 ` Marius Bakke
  2 siblings, 0 replies; 46+ messages in thread
From: Danny Milosavljevic @ 2016-12-16 17:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Did you add (grub grub-efi) in your <grub-configuration> in your system config? Or another package with --with-platform=efi ?

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-16 17:09               ` Ludovic Courtès
  2016-12-16 17:16                 ` Danny Milosavljevic
@ 2016-12-16 17:33                 ` Marius Bakke
  2016-12-18 10:54                   ` Ludovic Courtès
  2016-12-17  9:38                 ` Marius Bakke
  2 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-12-16 17:33 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 3234 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Hi Marius,
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>>>>> From 940c03c7dcddec019e27f6eb1470aeab4db57799 Mon Sep 17 00:00:00 2001
>>>>>> From: Marius Bakke <mbakke@fastmail.com>
>>>>>> Date: Thu, 20 Oct 2016 17:26:52 +0100
>>>>>> Subject: [PATCH] gnu: Add grub-efi.
>>>>>>
>>>>>> * gnu/packages/grub.scm (grub-efi): New variable.
>>>>>
>>>>> [...]
>>>>>
>>>>>> +    (name "grub-efi")
>>>>>> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
>>>>>
>>>>> Please use a literal string for ‘synopsis’; use of ‘string-append’ like
>>>>> this prevents i18n.
>>>>>
>>>>>> +     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
>>>>>
>>>>> It would be good to investigate, especially if the tests pass in the
>>>>> ‘grub’ package.
>>>>>
>>>>> Also, what’s the rationale for making ‘grub-efi’ separate instead of
>>>>> incorporating the changes in ‘grub’ proper?  Are there issues around the
>>>>> portability of ‘efibootmgr’, or an increased closure size?
>>>>
>>>> This is a good point. The only difference with "--with-platform=efi" is
>>>> that another directory is created in place of the i386-pc directory. It
>>>> is perfectly possible to build multiple platforms and copying the
>>>> platform-specific stuff to $out/lib -- grub will pick the correct
>>>> platform at runtime. This is what the Gentoo ebuild does.
>>>
>>> Are you saying that a GRUB compiled with UEFI support will no longer
>>> work out-of-the-box on non-UEFI machines, unless platform-specific stuff
>>> is moved like you suggest?
>>
>> Ha, no, it was just a long-winded and intoxicated way of saying what you
>> proposed should work fine. :)
>
> It turns out I have an immediate need ;-), so I pushed this as commit
> 3eee16130d858ae96510ec1c7d38d31290de2699.  Let me know if that doesn’t
> seem right!

I think you need to compile with '--with-platform=efi' as well. Check
/gnu/store/...grub-.../lib/grub. I still use a custom 'grub-efi'
expression (attached, needs adaption to 3eee16). Otherwise grub won't
have the required install files, even if it could detect the platform.

Relatedly, I think the way to build a 'multi-grub' is to have one
expression for each supported grub platform, and then consolidate
out/lib/grub from each.

> Now there are things I didn’t quite get.  Apparently you’re supposed to
> have a /boot/efi as a vfat partition, and ‘grub-install’ is supposed to
> detect it and install the EFI stuff, or so I thought (info "(grub)
> Installing GRUB using grub-install").
>
> However, ‘grub-install’ still seems to be installing for “i386-pc”
> instead of EFI.
>
> What am I missing?

IIRC grub-install will detect and install for the running mode (pc, efi,
etc). So in a classic chicken-and-egg situation, you need to be booted
with UEFI mode for grub to select the correct installation platform!

I worked around this by installing grub from a UEFI live CD, copy and
adapt the grub.cfg from an existing (BIOS) GuixSD installation, then
coerce the GuixSD system to use EFI from that point..


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-grub-efi.patch --]
[-- Type: text/x-patch, Size: 1686 bytes --]

From 1ca87a51f55f0b05f89eed707c1485b94f3d7d16 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 20 Oct 2016 17:26:52 +0100
Subject: [PATCH] gnu: Add grub-efi.

* gnu/packages/grub.scm (grub-efi): New variable.
---
 gnu/packages/grub.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
index ef7395e95..1cb835695 100644
--- a/gnu/packages/grub.scm
+++ b/gnu/packages/grub.scm
@@ -164,3 +164,26 @@ on the same computer; upon booting the computer, the user is presented with a
 menu to select one of the installed operating systems.")
     (license gpl3+)
     (properties '((cpe-name . "grub2")))))
+
+(define-public grub-efi
+  (package
+    (inherit grub)
+    (name "grub-efi")
+    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
+    (inputs
+     `(("efibootmgr" ,efibootmgr)
+       ,@(package-inputs grub)))
+    (arguments
+     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
+       ,@(substitute-keyword-arguments (package-arguments grub)
+           ((#:configure-flags flags) `(cons* "--with-platform=efi"
+                                              ,flags))
+           ((#:phases phases)
+            `(modify-phases ,phases
+               (add-after 'patch-stuff 'use-absolute-efibootmgr-path
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (substitute* "grub-core/osdep/unix/platform.c"
+                     (("efibootmgr")
+                      (string-append (assoc-ref inputs "efibootmgr")
+                                     "/sbin/efibootmgr")))
+                   #t)))))))))
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-16 17:09               ` Ludovic Courtès
  2016-12-16 17:16                 ` Danny Milosavljevic
  2016-12-16 17:33                 ` Marius Bakke
@ 2016-12-17  9:38                 ` Marius Bakke
  2016-12-17 10:15                   ` Marius Bakke
  2 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-12-17  9:38 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 2551 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Hi Marius,
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>>>>> From 940c03c7dcddec019e27f6eb1470aeab4db57799 Mon Sep 17 00:00:00 2001
>>>>>> From: Marius Bakke <mbakke@fastmail.com>
>>>>>> Date: Thu, 20 Oct 2016 17:26:52 +0100
>>>>>> Subject: [PATCH] gnu: Add grub-efi.
>>>>>>
>>>>>> * gnu/packages/grub.scm (grub-efi): New variable.
>>>>>
>>>>> [...]
>>>>>
>>>>>> +    (name "grub-efi")
>>>>>> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
>>>>>
>>>>> Please use a literal string for ‘synopsis’; use of ‘string-append’ like
>>>>> this prevents i18n.
>>>>>
>>>>>> +     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
>>>>>
>>>>> It would be good to investigate, especially if the tests pass in the
>>>>> ‘grub’ package.
>>>>>
>>>>> Also, what’s the rationale for making ‘grub-efi’ separate instead of
>>>>> incorporating the changes in ‘grub’ proper?  Are there issues around the
>>>>> portability of ‘efibootmgr’, or an increased closure size?
>>>>
>>>> This is a good point. The only difference with "--with-platform=efi" is
>>>> that another directory is created in place of the i386-pc directory. It
>>>> is perfectly possible to build multiple platforms and copying the
>>>> platform-specific stuff to $out/lib -- grub will pick the correct
>>>> platform at runtime. This is what the Gentoo ebuild does.
>>>
>>> Are you saying that a GRUB compiled with UEFI support will no longer
>>> work out-of-the-box on non-UEFI machines, unless platform-specific stuff
>>> is moved like you suggest?
>>
>> Ha, no, it was just a long-winded and intoxicated way of saying what you
>> proposed should work fine. :)
>
> It turns out I have an immediate need ;-), so I pushed this as commit
> 3eee16130d858ae96510ec1c7d38d31290de2699.  Let me know if that doesn’t
> seem right!
>
> Now there are things I didn’t quite get.  Apparently you’re supposed to
> have a /boot/efi as a vfat partition, and ‘grub-install’ is supposed to
> detect it and install the EFI stuff, or so I thought (info "(grub)
> Installing GRUB using grub-install").
>
> However, ‘grub-install’ still seems to be installing for “i386-pc”
> instead of EFI.
>
> What am I missing?

For anyone following along at home, I've attached the patches I'm using
for UEFI GuixSD. The latter two probably won't work properly on a
non-UEFI system, needs testing.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: uefi.patch --]
[-- Type: text/x-patch, Size: 5434 bytes --]

From 0a7c923618e8323c684ac8328ea6aa498b8cb13c Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 3 Nov 2016 09:58:34 +0000
Subject: [PATCH 1/5] linux-initrd: Support FAT filesystems.

* gnu/system/linux-initrd.scm (base-initrd): When a FAT filesystem is
present: Add fatfsck/static in 'helper-packages'; and add nls_iso8859-1
in 'linux-modules'.
---
 gnu/system/linux-initrd.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 174239a56..a787072ba 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -29,6 +29,7 @@
                 #:select (derivation->output-path))
   #:use-module (guix modules)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages disk)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages guile)
   #:use-module ((gnu packages make-bootstrap)
@@ -193,6 +194,9 @@ loaded at boot time in the order in which they appear."
       ,@(if (find (file-system-type-predicate "9p") file-systems)
             virtio-9p-modules
             '())
+      ,@(if (find (file-system-type-predicate "vfat") file-systems)
+            '("nls_iso8859-1")
+            '())
       ,@(if volatile-root?
             '("fuse")
             '())
@@ -205,6 +209,11 @@ loaded at boot time in the order in which they appear."
                   file-systems)
             (list e2fsck/static)
             '())
+      ,@(if (find (lambda (fs)
+                    (string-suffix? "fat" (file-system-type fs)))
+                  file-systems)
+            (list fatfsck/static)
+            '())
       ,@(if volatile-root?
             (list unionfs-fuse/static)
             '())))
-- 
2.11.0


From fbddad884b553b6a70ae4da0ee47f29599958704 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 3 Nov 2016 11:08:57 +0000
Subject: [PATCH 2/5] file-systems: Suppress fsck status completion bar.

* gnu/build/file-systems.scm (check-file-system): Drop "-C" argument
from fsck for compatibility with other fscks.
---
 gnu/build/file-systems.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 431b287d0..b8dbe499d 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -415,7 +415,7 @@ the following:
   (define fsck
     (string-append "fsck." type))
 
-  (let ((status (system* fsck "-v" "-p" "-C" "0" device)))
+  (let ((status (system* fsck "-v" "-p" device)))
     (match (status:exit-val status)
       (0
        #t)
-- 
2.11.0


From 10d696468c3c4cb64980fa1131969e9bb42536c5 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 20 Oct 2016 17:26:52 +0100
Subject: [PATCH 3/5] gnu: Add grub-efi.

* gnu/packages/grub.scm (grub-efi): New variable.
---
 gnu/packages/grub.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
index 83304b850..8e6590e80 100644
--- a/gnu/packages/grub.scm
+++ b/gnu/packages/grub.scm
@@ -173,3 +173,14 @@ on the same computer; upon booting the computer, the user is presented with a
 menu to select one of the installed operating systems.")
     (license gpl3+)
     (properties '((cpe-name . "grub2")))))
+
+(define-public grub-efi
+  (package
+    (inherit grub)
+    (name "grub-efi")
+    (synopsis "GRand Unified Boot loader (UEFI variant)")
+    (arguments
+     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
+       ,@(substitute-keyword-arguments (package-arguments grub)
+           ((#:configure-flags flags) `(cons* "--with-platform=efi"
+                                              ,flags)))))))
-- 
2.11.0


From 1bac0d81be36a3d8c0f206acbfd16e2b61a792ac Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sun, 6 Nov 2016 17:26:06 +0000
Subject: [PATCH 4/5] build: Make grub-install command UEFI aware.

* gnu/build/install.scm (install-grub): Extend grub-install command with
'--bootloader-id' and '--efi-directory'.
---
 gnu/build/install.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/build/install.scm b/gnu/build/install.scm
index 5c2b35632..ddd95bbf6 100644
--- a/gnu/build/install.scm
+++ b/gnu/build/install.scm
@@ -54,6 +54,9 @@ GC'd."
   (unless (zero? (system* "grub-install" "--no-floppy"
                           "--boot-directory"
                           (string-append mount-point "/boot")
+			  "--bootloader-id=GNU"
+			  "--efi-directory"
+                          (string-append mount-point "/boot")
                           device))
     (error "failed to install GRUB")))
 
-- 
2.11.0


From 117859a063e99b8726c205f5d454e306a241e885 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Mon, 7 Nov 2016 12:24:01 +0000
Subject: [PATCH 5/5] system: Load efi modules in grub.cfg.

* gnu/system/grub.scm (eye-candy): Load 'efi_gop' and 'efi_uga' grub modules.
---
 gnu/system/grub.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm
index 4657b06b5..9477b2494 100644
--- a/gnu/system/grub.scm
+++ b/gnu/system/grub.scm
@@ -183,6 +183,8 @@ system string---e.g., \"x86_64-linux\"."
     (if (string-match "^(x86_64|i[3-6]86)-" system)
         "
   # Leave 'gfxmode' to 'auto'.
+  insmod efi_gop
+  insmod efi_uga
   insmod vbe
   insmod vga
   insmod video_bochs
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [PATCH 3/6] file-systems: Suppress fsck status completion bar.
  2016-11-07 10:15           ` Danny Milosavljevic
@ 2016-12-17  9:40             ` Marius Bakke
  2016-12-18 10:57               ` Ludovic Courtès
  0 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-12-17  9:40 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

Danny Milosavljevic <dannym@scratchpost.org> writes:

> Hi,
>
> why not just use "fsck -t xxx" instead? It will filter out "-C" for
> fscks which don't support it.

I think pending a proper solution for handling fsck commands, offloading
it to util-linux is a decent compromise. Ludo, WDYT?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-17  9:38                 ` Marius Bakke
@ 2016-12-17 10:15                   ` Marius Bakke
  0 siblings, 0 replies; 46+ messages in thread
From: Marius Bakke @ 2016-12-17 10:15 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]


> For anyone following along at home, I've attached the patches I'm using
> for UEFI GuixSD. The latter two probably won't work properly on a
> non-UEFI system, needs testing.

Never mind the last part, 'guix system vm-image' works fine with these
patches.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-16 17:33                 ` Marius Bakke
@ 2016-12-18 10:54                   ` Ludovic Courtès
  2016-12-18 14:36                     ` Marius Bakke
  0 siblings, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2016-12-18 10:54 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Hello Marius!

Marius Bakke <mbakke@fastmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:

[...]

>> It turns out I have an immediate need ;-), so I pushed this as commit
>> 3eee16130d858ae96510ec1c7d38d31290de2699.  Let me know if that doesn’t
>> seem right!
>
> I think you need to compile with '--with-platform=efi' as well.

Bah, silly me.

> Check /gnu/store/...grub-.../lib/grub. I still use a custom 'grub-efi'
> expression (attached, needs adaption to 3eee16). Otherwise grub won't
> have the required install files, even if it could detect the platform.
>
> Relatedly, I think the way to build a 'multi-grub' is to have one
> expression for each supported grub platform, and then consolidate
> out/lib/grub from each.

So in essence, GRUB itself supports only one platform at a time?

>> Now there are things I didn’t quite get.  Apparently you’re supposed to
>> have a /boot/efi as a vfat partition, and ‘grub-install’ is supposed to
>> detect it and install the EFI stuff, or so I thought (info "(grub)
>> Installing GRUB using grub-install").
>>
>> However, ‘grub-install’ still seems to be installing for “i386-pc”
>> instead of EFI.
>>
>> What am I missing?
>
> IIRC grub-install will detect and install for the running mode (pc, efi,
> etc). So in a classic chicken-and-egg situation, you need to be booted
> with UEFI mode for grub to select the correct installation platform!

My understanding is that it would install for UEFI if it fines
/boot/efi or if --efi-directory is passed.

BTW, as far as I’m concerned, most of the other patches are ready:

  https://lists.gnu.org/archive/html/guix-devel/2016-11/msg00303.html
  https://lists.gnu.org/archive/html/guix-devel/2016-11/msg00304.html

Could you push them?

The remaining issue is how to run fsck for vfat.

Currently I still have a preference for something like what I suggested
at:

  https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00095.html

Thoughts?

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 3/6] file-systems: Suppress fsck status completion bar.
  2016-12-17  9:40             ` Marius Bakke
@ 2016-12-18 10:57               ` Ludovic Courtès
  0 siblings, 0 replies; 46+ messages in thread
From: Ludovic Courtès @ 2016-12-18 10:57 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

> Danny Milosavljevic <dannym@scratchpost.org> writes:
>
>> Hi,
>>
>> why not just use "fsck -t xxx" instead? It will filter out "-C" for
>> fscks which don't support it.
>
> I think pending a proper solution for handling fsck commands, offloading
> it to util-linux is a decent compromise. Ludo, WDYT?

I think the problem is that until
d9804e5011a58341aafbf4fadd00947f3e5f436e (in core-updates), ‘mount’ from
util-linux could not find those programs:

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25043

I’d expect it to be the same for ‘fsck’.

But anyway, we might just as well do the dispatch ourselves like
discussed at
<https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00095.html>.

Thoughts?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-18 10:54                   ` Ludovic Courtès
@ 2016-12-18 14:36                     ` Marius Bakke
  2016-12-19 10:48                       ` Ludovic Courtès
  0 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-12-18 14:36 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2558 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

>> Relatedly, I think the way to build a 'multi-grub' is to have one
>> expression for each supported grub platform, and then consolidate
>> out/lib/grub from each.
>
> So in essence, GRUB itself supports only one platform at a time?

AFAICT yes. Gentoo works around this by running the build for each
user-specified platform and combining the outputs. Most other distros
just carry separate grub-pc and grub-efi packages.

>>> Now there are things I didn’t quite get.  Apparently you’re supposed to
>>> have a /boot/efi as a vfat partition, and ‘grub-install’ is supposed to
>>> detect it and install the EFI stuff, or so I thought (info "(grub)
>>> Installing GRUB using grub-install").
>>>
>>> However, ‘grub-install’ still seems to be installing for “i386-pc”
>>> instead of EFI.
>>>
>>> What am I missing?
>>
>> IIRC grub-install will detect and install for the running mode (pc, efi,
>> etc). So in a classic chicken-and-egg situation, you need to be booted
>> with UEFI mode for grub to select the correct installation platform!
>
> My understanding is that it would install for UEFI if it fines
> /boot/efi or if --efi-directory is passed.

I'm not so sure, but it's been a while since I played around with this.
At least building the 'gnu/system/install.scm' image works fine when
passing --efi-directory (see the bottom two patches from
https://lists.gnu.org/archive/html/guix-devel/2016-12/txtchTym4QVKr.txt ),
and I think it would choose i386-pc even if x86_64-efi was available
since the VM boots in BIOS mode.

Tangentially, I'm not aware of any way to build a "hybrid" ISO image
using only grub. I've started work on packaging syslinux/isolinux which
is what Debian uses for their hybrid UEFI/BIOS install image.

> BTW, as far as I’m concerned, most of the other patches are ready:
>
>   https://lists.gnu.org/archive/html/guix-devel/2016-11/msg00303.html
>   https://lists.gnu.org/archive/html/guix-devel/2016-11/msg00304.html
>
> Could you push them?

Done.

> The remaining issue is how to run fsck for vfat.
>
> Currently I still have a preference for something like what I suggested
> at:
>
>   https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00095.html
>
> Thoughts?

This approach looks better than the one I started working on. It's not
clear to me how to pass the device to these procedures, or how
'check-file-system' will know which checker to use. We should try to
have this in place before 0.13 :-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-18 14:36                     ` Marius Bakke
@ 2016-12-19 10:48                       ` Ludovic Courtès
  2016-12-19 15:49                         ` Marius Bakke
  0 siblings, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2016-12-19 10:48 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Hi Marius,

Marius Bakke <mbakke@fastmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>>> Relatedly, I think the way to build a 'multi-grub' is to have one
>>> expression for each supported grub platform, and then consolidate
>>> out/lib/grub from each.
>>
>> So in essence, GRUB itself supports only one platform at a time?
>
> AFAICT yes. Gentoo works around this by running the build for each
> user-specified platform and combining the outputs. Most other distros
> just carry separate grub-pc and grub-efi packages.
>
>>>> Now there are things I didn’t quite get.  Apparently you’re supposed to
>>>> have a /boot/efi as a vfat partition, and ‘grub-install’ is supposed to
>>>> detect it and install the EFI stuff, or so I thought (info "(grub)
>>>> Installing GRUB using grub-install").
>>>>
>>>> However, ‘grub-install’ still seems to be installing for “i386-pc”
>>>> instead of EFI.
>>>>
>>>> What am I missing?
>>>
>>> IIRC grub-install will detect and install for the running mode (pc, efi,
>>> etc). So in a classic chicken-and-egg situation, you need to be booted
>>> with UEFI mode for grub to select the correct installation platform!
>>
>> My understanding is that it would install for UEFI if it fines
>> /boot/efi or if --efi-directory is passed.
>
> I'm not so sure, but it's been a while since I played around with this.
> At least building the 'gnu/system/install.scm' image works fine when
> passing --efi-directory (see the bottom two patches from
> https://lists.gnu.org/archive/html/guix-devel/2016-12/txtchTym4QVKr.txt ),
> and I think it would choose i386-pc even if x86_64-efi was available
> since the VM boots in BIOS mode.
>
> Tangentially, I'm not aware of any way to build a "hybrid" ISO image
> using only grub. I've started work on packaging syslinux/isolinux which
> is what Debian uses for their hybrid UEFI/BIOS install image.

OK.

Having checked GRUB’s configure.ac etc., I realize that my suggestion of
having one ‘grub’ package doing both EFI and “PC” cannot work.  What you
suggested initially (a separate ‘grub-efi’ package) is the only thing we
can do (we could perhaps merge the lib/grub directories as you
suggested, but it’s not even clear that this would work.)

Thus, I think we need to revert 3eee16130d858ae96510ec1c7d38d31290de2699
and install your initial ‘grub-efi’ patch.  How does that sound?

If that’s fine with you, please go ahead.

Apologies for the misguided suggestion!

>> The remaining issue is how to run fsck for vfat.
>>
>> Currently I still have a preference for something like what I suggested
>> at:
>>
>>   https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00095.html
>>
>> Thoughts?
>
> This approach looks better than the one I started working on. It's not
> clear to me how to pass the device to these procedures, or how
> 'check-file-system' will know which checker to use. We should try to
> have this in place before 0.13 :-)

I’ll see if I can work on it if nobody beats me at it!

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-19 10:48                       ` Ludovic Courtès
@ 2016-12-19 15:49                         ` Marius Bakke
  2016-12-19 21:16                           ` Ludovic Courtès
  0 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-12-19 15:49 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2742 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Hi Marius,
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>>> Relatedly, I think the way to build a 'multi-grub' is to have one
>>>> expression for each supported grub platform, and then consolidate
>>>> out/lib/grub from each.
>>>
>>> So in essence, GRUB itself supports only one platform at a time?
>>
>> AFAICT yes. Gentoo works around this by running the build for each
>> user-specified platform and combining the outputs. Most other distros
>> just carry separate grub-pc and grub-efi packages.
>>
>>>>> Now there are things I didn’t quite get.  Apparently you’re supposed to
>>>>> have a /boot/efi as a vfat partition, and ‘grub-install’ is supposed to
>>>>> detect it and install the EFI stuff, or so I thought (info "(grub)
>>>>> Installing GRUB using grub-install").
>>>>>
>>>>> However, ‘grub-install’ still seems to be installing for “i386-pc”
>>>>> instead of EFI.
>>>>>
>>>>> What am I missing?
>>>>
>>>> IIRC grub-install will detect and install for the running mode (pc, efi,
>>>> etc). So in a classic chicken-and-egg situation, you need to be booted
>>>> with UEFI mode for grub to select the correct installation platform!
>>>
>>> My understanding is that it would install for UEFI if it fines
>>> /boot/efi or if --efi-directory is passed.
>>
>> I'm not so sure, but it's been a while since I played around with this.
>> At least building the 'gnu/system/install.scm' image works fine when
>> passing --efi-directory (see the bottom two patches from
>> https://lists.gnu.org/archive/html/guix-devel/2016-12/txtchTym4QVKr.txt ),
>> and I think it would choose i386-pc even if x86_64-efi was available
>> since the VM boots in BIOS mode.
>>
>> Tangentially, I'm not aware of any way to build a "hybrid" ISO image
>> using only grub. I've started work on packaging syslinux/isolinux which
>> is what Debian uses for their hybrid UEFI/BIOS install image.
>
> OK.
>
> Having checked GRUB’s configure.ac etc., I realize that my suggestion of
> having one ‘grub’ package doing both EFI and “PC” cannot work.  What you
> suggested initially (a separate ‘grub-efi’ package) is the only thing we
> can do (we could perhaps merge the lib/grub directories as you
> suggested, but it’s not even clear that this would work.)
>
> Thus, I think we need to revert 3eee16130d858ae96510ec1c7d38d31290de2699
> and install your initial ‘grub-efi’ patch.  How does that sound?

OK. I'll try to find out why tests don't work with the UEFI variant
first in order to at least write a meaningful comment. Maybe qemu needs
UEFI support or something like that.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-19 15:49                         ` Marius Bakke
@ 2016-12-19 21:16                           ` Ludovic Courtès
  2016-12-19 22:48                             ` Marius Bakke
  0 siblings, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2016-12-19 21:16 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hi Marius,
>>
>> Marius Bakke <mbakke@fastmail.com> skribis:
>>
>>> Ludovic Courtès <ludo@gnu.org> writes:
>>>
>>>>> Relatedly, I think the way to build a 'multi-grub' is to have one
>>>>> expression for each supported grub platform, and then consolidate
>>>>> out/lib/grub from each.
>>>>
>>>> So in essence, GRUB itself supports only one platform at a time?
>>>
>>> AFAICT yes. Gentoo works around this by running the build for each
>>> user-specified platform and combining the outputs. Most other distros
>>> just carry separate grub-pc and grub-efi packages.
>>>
>>>>>> Now there are things I didn’t quite get.  Apparently you’re supposed to
>>>>>> have a /boot/efi as a vfat partition, and ‘grub-install’ is supposed to
>>>>>> detect it and install the EFI stuff, or so I thought (info "(grub)
>>>>>> Installing GRUB using grub-install").
>>>>>>
>>>>>> However, ‘grub-install’ still seems to be installing for “i386-pc”
>>>>>> instead of EFI.
>>>>>>
>>>>>> What am I missing?
>>>>>
>>>>> IIRC grub-install will detect and install for the running mode (pc, efi,
>>>>> etc). So in a classic chicken-and-egg situation, you need to be booted
>>>>> with UEFI mode for grub to select the correct installation platform!
>>>>
>>>> My understanding is that it would install for UEFI if it fines
>>>> /boot/efi or if --efi-directory is passed.
>>>
>>> I'm not so sure, but it's been a while since I played around with this.
>>> At least building the 'gnu/system/install.scm' image works fine when
>>> passing --efi-directory (see the bottom two patches from
>>> https://lists.gnu.org/archive/html/guix-devel/2016-12/txtchTym4QVKr.txt ),
>>> and I think it would choose i386-pc even if x86_64-efi was available
>>> since the VM boots in BIOS mode.
>>>
>>> Tangentially, I'm not aware of any way to build a "hybrid" ISO image
>>> using only grub. I've started work on packaging syslinux/isolinux which
>>> is what Debian uses for their hybrid UEFI/BIOS install image.
>>
>> OK.
>>
>> Having checked GRUB’s configure.ac etc., I realize that my suggestion of
>> having one ‘grub’ package doing both EFI and “PC” cannot work.  What you
>> suggested initially (a separate ‘grub-efi’ package) is the only thing we
>> can do (we could perhaps merge the lib/grub directories as you
>> suggested, but it’s not even clear that this would work.)
>>
>> Thus, I think we need to revert 3eee16130d858ae96510ec1c7d38d31290de2699
>> and install your initial ‘grub-efi’ patch.  How does that sound?
>
> OK. I'll try to find out why tests don't work with the UEFI variant
> first in order to at least write a meaningful comment. Maybe qemu needs
> UEFI support or something like that.

It might be that we no longer need QEMU 1.3.1 to run the tests (see the
top of gnu/packages/grub.scm)?

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-19 21:16                           ` Ludovic Courtès
@ 2016-12-19 22:48                             ` Marius Bakke
  2016-12-20 13:53                               ` Ludovic Courtès
  0 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-12-19 22:48 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3251 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> Hi Marius,
>>>
>>> Marius Bakke <mbakke@fastmail.com> skribis:
>>>
>>>> Ludovic Courtès <ludo@gnu.org> writes:
>>>>
>>>>>> Relatedly, I think the way to build a 'multi-grub' is to have one
>>>>>> expression for each supported grub platform, and then consolidate
>>>>>> out/lib/grub from each.
>>>>>
>>>>> So in essence, GRUB itself supports only one platform at a time?
>>>>
>>>> AFAICT yes. Gentoo works around this by running the build for each
>>>> user-specified platform and combining the outputs. Most other distros
>>>> just carry separate grub-pc and grub-efi packages.
>>>>
>>>>>>> Now there are things I didn’t quite get.  Apparently you’re supposed to
>>>>>>> have a /boot/efi as a vfat partition, and ‘grub-install’ is supposed to
>>>>>>> detect it and install the EFI stuff, or so I thought (info "(grub)
>>>>>>> Installing GRUB using grub-install").
>>>>>>>
>>>>>>> However, ‘grub-install’ still seems to be installing for “i386-pc”
>>>>>>> instead of EFI.
>>>>>>>
>>>>>>> What am I missing?
>>>>>>
>>>>>> IIRC grub-install will detect and install for the running mode (pc, efi,
>>>>>> etc). So in a classic chicken-and-egg situation, you need to be booted
>>>>>> with UEFI mode for grub to select the correct installation platform!
>>>>>
>>>>> My understanding is that it would install for UEFI if it fines
>>>>> /boot/efi or if --efi-directory is passed.
>>>>
>>>> I'm not so sure, but it's been a while since I played around with this.
>>>> At least building the 'gnu/system/install.scm' image works fine when
>>>> passing --efi-directory (see the bottom two patches from
>>>> https://lists.gnu.org/archive/html/guix-devel/2016-12/txtchTym4QVKr.txt ),
>>>> and I think it would choose i386-pc even if x86_64-efi was available
>>>> since the VM boots in BIOS mode.
>>>>
>>>> Tangentially, I'm not aware of any way to build a "hybrid" ISO image
>>>> using only grub. I've started work on packaging syslinux/isolinux which
>>>> is what Debian uses for their hybrid UEFI/BIOS install image.
>>>
>>> OK.
>>>
>>> Having checked GRUB’s configure.ac etc., I realize that my suggestion of
>>> having one ‘grub’ package doing both EFI and “PC” cannot work.  What you
>>> suggested initially (a separate ‘grub-efi’ package) is the only thing we
>>> can do (we could perhaps merge the lib/grub directories as you
>>> suggested, but it’s not even clear that this would work.)
>>>
>>> Thus, I think we need to revert 3eee16130d858ae96510ec1c7d38d31290de2699
>>> and install your initial ‘grub-efi’ patch.  How does that sound?
>>
>> OK. I'll try to find out why tests don't work with the UEFI variant
>> first in order to at least write a meaningful comment. Maybe qemu needs
>> UEFI support or something like that.
>
> It might be that we no longer need QEMU 1.3.1 to run the tests (see the
> top of gnu/packages/grub.scm)?

The problem is missing UEFI firmware for the qemu calls. But we indeed
no longer need qemu@1.3.1 for the tests, at least on x86_64. I replaced
it with 'qemu-minimal'. Pushed!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-19 22:48                             ` Marius Bakke
@ 2016-12-20 13:53                               ` Ludovic Courtès
  2016-12-20 14:42                                 ` Marius Bakke
  2017-01-03 16:06                                 ` Ludovic Courtès
  0 siblings, 2 replies; 46+ messages in thread
From: Ludovic Courtès @ 2016-12-20 13:53 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Hello!

Marius Bakke <mbakke@fastmail.com> skribis:

>>> OK. I'll try to find out why tests don't work with the UEFI variant
>>> first in order to at least write a meaningful comment. Maybe qemu needs
>>> UEFI support or something like that.
>>
>> It might be that we no longer need QEMU 1.3.1 to run the tests (see the
>> top of gnu/packages/grub.scm)?
>
> The problem is missing UEFI firmware for the qemu calls. But we indeed
> no longer need qemu@1.3.1 for the tests, at least on x86_64. I replaced
> it with 'qemu-minimal'. Pushed!

Great!

I’m failing at installing GuixSD on a new laptop I have here.
‘efibootmgr’ exits with code 2 and this message:

  EFI variables are not supported on this system.

(which ‘grub-install’ happily ignores.)

This is because /sys/firmware/efi is missing, which apparently is
because I booted off the GuixSD USB image (“legacy”) and not in EFI
mode.

What would you suggest?  :-)

TIA,
Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-20 13:53                               ` Ludovic Courtès
@ 2016-12-20 14:42                                 ` Marius Bakke
  2016-12-20 16:53                                   ` Ludovic Courtès
  2017-01-03 16:06                                 ` Ludovic Courtès
  1 sibling, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-12-20 14:42 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 1775 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Hello!
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>>>> OK. I'll try to find out why tests don't work with the UEFI variant
>>>> first in order to at least write a meaningful comment. Maybe qemu needs
>>>> UEFI support or something like that.
>>>
>>> It might be that we no longer need QEMU 1.3.1 to run the tests (see the
>>> top of gnu/packages/grub.scm)?
>>
>> The problem is missing UEFI firmware for the qemu calls. But we indeed
>> no longer need qemu@1.3.1 for the tests, at least on x86_64. I replaced
>> it with 'qemu-minimal'. Pushed!
>
> Great!
>
> I’m failing at installing GuixSD on a new laptop I have here.
> ‘efibootmgr’ exits with code 2 and this message:
>
>   EFI variables are not supported on this system.
>
> (which ‘grub-install’ happily ignores.)
>
> This is because /sys/firmware/efi is missing, which apparently is
> because I booted off the GuixSD USB image (“legacy”) and not in EFI
> mode.
>
> What would you suggest?  :-)

What I did was a normal BIOS install, backup the grub.cfg, switch laptop
to UEFI (only) and boot a Debian live CD. From there "apt-get install
grub-efi; grub-install /dev/sda" and afterwards copy grub.cfg in place.

You may want to add "insmod efi_gop" and "insmod efi_uga" to grub.cfg,
otherwise you won't get a framebuffer until the proper video driver is
loaded (which may require unlocking root partition etc).

Not the most user friendly installation instructions! I'm researching
methods to make the base install image hybrid BIOS/UEFI.

Once booted, you should apply the following two patches when
reconfiguring the system. I think they are safe for BIOS systems too,
but haven't done extensive testing.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-build-Make-grub-install-command-UEFI-aware.patch --]
[-- Type: text/x-patch, Size: 943 bytes --]

From fa12cd92a2e4eead22f640d6231813e50b8191bf Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sun, 6 Nov 2016 17:26:06 +0000
Subject: [PATCH 1/2] build: Make grub-install command UEFI aware.

* gnu/build/install.scm (install-grub): Extend grub-install command with
'--bootloader-id' and '--efi-directory'.
---
 gnu/build/install.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/build/install.scm b/gnu/build/install.scm
index 5c2b35632..ddd95bbf6 100644
--- a/gnu/build/install.scm
+++ b/gnu/build/install.scm
@@ -54,6 +54,9 @@ GC'd."
   (unless (zero? (system* "grub-install" "--no-floppy"
                           "--boot-directory"
                           (string-append mount-point "/boot")
+			  "--bootloader-id=GNU"
+			  "--efi-directory"
+                          (string-append mount-point "/boot")
                           device))
     (error "failed to install GRUB")))
 
-- 
2.11.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-system-Load-efi-modules-in-grub.cfg.patch --]
[-- Type: text/x-patch, Size: 749 bytes --]

From dd71d9b334ceccc09cd42484c6deac2079c44c70 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Mon, 7 Nov 2016 12:24:01 +0000
Subject: [PATCH 2/2] system: Load efi modules in grub.cfg.

* gnu/system/grub.scm (eye-candy): Load 'efi_gop' and 'efi_uga' grub modules.
---
 gnu/system/grub.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm
index 4657b06b5..9477b2494 100644
--- a/gnu/system/grub.scm
+++ b/gnu/system/grub.scm
@@ -183,6 +183,8 @@ system string---e.g., \"x86_64-linux\"."
     (if (string-match "^(x86_64|i[3-6]86)-" system)
         "
   # Leave 'gfxmode' to 'auto'.
+  insmod efi_gop
+  insmod efi_uga
   insmod vbe
   insmod vga
   insmod video_bochs
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-20 14:42                                 ` Marius Bakke
@ 2016-12-20 16:53                                   ` Ludovic Courtès
  2016-12-20 18:43                                     ` Marius Bakke
  0 siblings, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2016-12-20 16:53 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hello!
>>
>> Marius Bakke <mbakke@fastmail.com> skribis:
>>
>>>>> OK. I'll try to find out why tests don't work with the UEFI variant
>>>>> first in order to at least write a meaningful comment. Maybe qemu needs
>>>>> UEFI support or something like that.
>>>>
>>>> It might be that we no longer need QEMU 1.3.1 to run the tests (see the
>>>> top of gnu/packages/grub.scm)?
>>>
>>> The problem is missing UEFI firmware for the qemu calls. But we indeed
>>> no longer need qemu@1.3.1 for the tests, at least on x86_64. I replaced
>>> it with 'qemu-minimal'. Pushed!
>>
>> Great!
>>
>> I’m failing at installing GuixSD on a new laptop I have here.
>> ‘efibootmgr’ exits with code 2 and this message:
>>
>>   EFI variables are not supported on this system.
>>
>> (which ‘grub-install’ happily ignores.)
>>
>> This is because /sys/firmware/efi is missing, which apparently is
>> because I booted off the GuixSD USB image (“legacy”) and not in EFI
>> mode.
>>
>> What would you suggest?  :-)
>
> What I did was a normal BIOS install, backup the grub.cfg, switch laptop
> to UEFI (only) and boot a Debian live CD. From there "apt-get install
> grub-efi; grub-install /dev/sda" and afterwards copy grub.cfg in place.
>
> You may want to add "insmod efi_gop" and "insmod efi_uga" to grub.cfg,
> otherwise you won't get a framebuffer until the proper video driver is
> loaded (which may require unlocking root partition etc).

Wait, all I need is /sys/firmware/efi in the install image.  Is it
impossible?

> Not the most user friendly installation instructions! I'm researching
> methods to make the base install image hybrid BIOS/UEFI.

What would it take?

Woow, I didn’t expect UEFI to be that much of a pain.  :-/

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-20 16:53                                   ` Ludovic Courtès
@ 2016-12-20 18:43                                     ` Marius Bakke
  2016-12-21  9:12                                       ` Ludovic Courtès
  0 siblings, 1 reply; 46+ messages in thread
From: Marius Bakke @ 2016-12-20 18:43 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2438 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> Hello!
>>>
>>> Marius Bakke <mbakke@fastmail.com> skribis:
>>>
>>>>>> OK. I'll try to find out why tests don't work with the UEFI variant
>>>>>> first in order to at least write a meaningful comment. Maybe qemu needs
>>>>>> UEFI support or something like that.
>>>>>
>>>>> It might be that we no longer need QEMU 1.3.1 to run the tests (see the
>>>>> top of gnu/packages/grub.scm)?
>>>>
>>>> The problem is missing UEFI firmware for the qemu calls. But we indeed
>>>> no longer need qemu@1.3.1 for the tests, at least on x86_64. I replaced
>>>> it with 'qemu-minimal'. Pushed!
>>>
>>> Great!
>>>
>>> I’m failing at installing GuixSD on a new laptop I have here.
>>> ‘efibootmgr’ exits with code 2 and this message:
>>>
>>>   EFI variables are not supported on this system.
>>>
>>> (which ‘grub-install’ happily ignores.)
>>>
>>> This is because /sys/firmware/efi is missing, which apparently is
>>> because I booted off the GuixSD USB image (“legacy”) and not in EFI
>>> mode.
>>>
>>> What would you suggest?  :-)
>>
>> What I did was a normal BIOS install, backup the grub.cfg, switch laptop
>> to UEFI (only) and boot a Debian live CD. From there "apt-get install
>> grub-efi; grub-install /dev/sda" and afterwards copy grub.cfg in place.
>>
>> You may want to add "insmod efi_gop" and "insmod efi_uga" to grub.cfg,
>> otherwise you won't get a framebuffer until the proper video driver is
>> loaded (which may require unlocking root partition etc).
>
> Wait, all I need is /sys/firmware/efi in the install image.  Is it
> impossible?

Perhaps you can trick Linux into creating it without booting UEFI mode.
Not sure if grub/efibootmgr actually need to read or write there.

>> Not the most user friendly installation instructions! I'm researching
>> methods to make the base install image hybrid BIOS/UEFI.
>
> What would it take?

The scripts I've looked at so far seems to use ISOLINUX as the initial
bootloader and then chainload to grub. Didn't experiment much, haven't
been able to get syslinux packaged yet.

It's *probably* possible do it with grub only, by partitioning the
installation image and create both a "bios_grub" GPT partition and an
EFI system partition and install to both with a different --target.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-20 18:43                                     ` Marius Bakke
@ 2016-12-21  9:12                                       ` Ludovic Courtès
  2016-12-21 18:55                                         ` Danny Milosavljevic
  0 siblings, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2016-12-21  9:12 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Marius Bakke <mbakke@fastmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:

[...]

>>>> I’m failing at installing GuixSD on a new laptop I have here.
>>>> ‘efibootmgr’ exits with code 2 and this message:
>>>>
>>>>   EFI variables are not supported on this system.
>>>>
>>>> (which ‘grub-install’ happily ignores.)
>>>>
>>>> This is because /sys/firmware/efi is missing, which apparently is
>>>> because I booted off the GuixSD USB image (“legacy”) and not in EFI
>>>> mode.
>>>>
>>>> What would you suggest?  :-)
>>>
>>> What I did was a normal BIOS install, backup the grub.cfg, switch laptop
>>> to UEFI (only) and boot a Debian live CD. From there "apt-get install
>>> grub-efi; grub-install /dev/sda" and afterwards copy grub.cfg in place.
>>>
>>> You may want to add "insmod efi_gop" and "insmod efi_uga" to grub.cfg,
>>> otherwise you won't get a framebuffer until the proper video driver is
>>> loaded (which may require unlocking root partition etc).
>>
>> Wait, all I need is /sys/firmware/efi in the install image.  Is it
>> impossible?
>
> Perhaps you can trick Linux into creating it without booting UEFI mode.
> Not sure if grub/efibootmgr actually need to read or write there.

‘efivar’ (used by ‘efibootmgr’) uses it, and otherwise bails out with
the error message shown above.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-21  9:12                                       ` Ludovic Courtès
@ 2016-12-21 18:55                                         ` Danny Milosavljevic
  0 siblings, 0 replies; 46+ messages in thread
From: Danny Milosavljevic @ 2016-12-21 18:55 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Hi,

efibootmgr is trying to add an entry for Linux to the EFI bootmanager and set the boot priority order. It won't usefully autoboot without it. That said, depending on how good the UEFI implementation on your laptop is you might be able to hit a function key on POST and select the image file manually. (There has to be a FAT partition which is supposed to contain all the things that the bootloader can boot)

The problem is when you boot in legacy BIOS mode you don't have UEFI functionality available, including the calls that would modify the boot order and boot menu.

The best way would to also boot the GuixSD USB image via UEFI and not MBR. I think all you need for that is the image file on the USB stick on a FAT partition under \EFI\BOOT\BOOTX64.EFI . So it should be easy to have a dual ISO image.

That said, I only have Libreboot personally so I can't help much with it. I just had to fix UEFI problems for a customer of mine (two months ago) so it's still fresh in my mind.

Note that many UEFI setups have a "Lock Boot Order" option. Make sure it's not locked, otherwise it doesn't matter what efibootmgr does - it will just be cleared on next reboot.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2016-12-20 13:53                               ` Ludovic Courtès
  2016-12-20 14:42                                 ` Marius Bakke
@ 2017-01-03 16:06                                 ` Ludovic Courtès
  2017-01-03 16:16                                   ` Chris Marusich
  1 sibling, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2017-01-03 16:06 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

Howdy!

ludo@gnu.org (Ludovic Courtès) skribis:

> Marius Bakke <mbakke@fastmail.com> skribis:
>
>>>> OK. I'll try to find out why tests don't work with the UEFI variant
>>>> first in order to at least write a meaningful comment. Maybe qemu needs
>>>> UEFI support or something like that.
>>>
>>> It might be that we no longer need QEMU 1.3.1 to run the tests (see the
>>> top of gnu/packages/grub.scm)?
>>
>> The problem is missing UEFI firmware for the qemu calls. But we indeed
>> no longer need qemu@1.3.1 for the tests, at least on x86_64. I replaced
>> it with 'qemu-minimal'. Pushed!
>
> Great!
>
> I’m failing at installing GuixSD on a new laptop I have here.
> ‘efibootmgr’ exits with code 2 and this message:
>
>   EFI variables are not supported on this system.
>
> (which ‘grub-install’ happily ignores.)
>
> This is because /sys/firmware/efi is missing, which apparently is
> because I booted off the GuixSD USB image (“legacy”) and not in EFI
> mode.

So it turns out that GRUB was properly installed in the EFI partition,
but the effect of the efivar failure above was that the computer would
not boot it automatically.

I found a “Boot from file” menu entry in HP’s BIOS, under “EFI boot”,
and from there I could select ‘grubx64.efi’ and boot GRUB.

There I typed at the GRUB command prompt:

  insmod efi_gop
  insmod efi_uga
  cat /var/guix/gcroots/grub.cfg

and typed the ‘search.file’, ‘linux’, and ‘initrd’ that appear
‘grub.cfg’ (“source /…/grub.cfg” did not work.)

That actually booted GuixSD.  This time it had /sys/firmware/efi.  Thus
I re-run ‘grub-install’ from there and upon reboot, the thing would
immediately boot GRUB!  \o/

I still need to sort out a few shenanigans but I’m getting there.

To be continued…

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2017-01-03 16:06                                 ` Ludovic Courtès
@ 2017-01-03 16:16                                   ` Chris Marusich
  2017-01-04 22:18                                     ` Ludovic Courtès
  0 siblings, 1 reply; 46+ messages in thread
From: Chris Marusich @ 2017-01-03 16:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

ludo@gnu.org (Ludovic Courtès) writes:

> Howdy!
>
> There I typed at the GRUB command prompt:
>
>   insmod efi_gop
>   insmod efi_uga
>   cat /var/guix/gcroots/grub.cfg

Slightly off-topic question: how does one find out what the possible
values for X are in a command like "insmod X"?  I've searched before and
I couldn't find a list in the manual, so I presume it's something you
have to "just know" at runtime, somehow.

> and typed the ‘search.file’, ‘linux’, and ‘initrd’ that appear
> ‘grub.cfg’ (“source /…/grub.cfg” did not work.)
>
> That actually booted GuixSD.  This time it had /sys/firmware/efi.  Thus
> I re-run ‘grub-install’ from there and upon reboot, the thing would
> immediately boot GRUB!  \o/
>
> I still need to sort out a few shenanigans but I’m getting there.

Sweet!  I've been tentatively following this thread; glad to see you're
making progress.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 6/6] gnu: Add grub-efi.
  2017-01-03 16:16                                   ` Chris Marusich
@ 2017-01-04 22:18                                     ` Ludovic Courtès
  0 siblings, 0 replies; 46+ messages in thread
From: Ludovic Courtès @ 2017-01-04 22:18 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel

Chris Marusich <cmmarusich@gmail.com> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Howdy!
>>
>> There I typed at the GRUB command prompt:
>>
>>   insmod efi_gop
>>   insmod efi_uga
>>   cat /var/guix/gcroots/grub.cfg
>
> Slightly off-topic question: how does one find out what the possible
> values for X are in a command like "insmod X"?  I've searched before and
> I couldn't find a list in the manual, so I presume it's something you
> have to "just know" at runtime, somehow.

Yeah, I run “ls /boot/grub/x86_64-efi” too.  :-)

>> and typed the ‘search.file’, ‘linux’, and ‘initrd’ that appear
>> ‘grub.cfg’ (“source /…/grub.cfg” did not work.)
>>
>> That actually booted GuixSD.  This time it had /sys/firmware/efi.  Thus
>> I re-run ‘grub-install’ from there and upon reboot, the thing would
>> immediately boot GRUB!  \o/
>>
>> I still need to sort out a few shenanigans but I’m getting there.
>
> Sweet!  I've been tentatively following this thread; glad to see you're
> making progress.

So the last bit was to add this to ‘file-systems’:

  (file-system
    (title 'device)
    (device "/dev/sda1")
    (mount-point "/boot/efi")
    (type "vfat")
    (check? #f))   ;work around lack of fsck support for vfat

That allows ‘grub-install’ to do its thing when I run ‘guix system
reconfigure’.

Essentially, what remains to be done is:

  1. fsck support for vfat (discussed with David C. and Marius);
  2. produce an EFI installation image;
  3. document it, add an example config probably.

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2017-01-04 22:18 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-05 12:55 Initial vfat support Marius Bakke
2016-11-05 12:55 ` [PATCH 1/6] gnu: Add fatfsck-static Marius Bakke
2016-11-05 16:01   ` Hartmut Goebel
2016-11-05 16:11     ` Marius Bakke
2016-11-06 21:42   ` Ludovic Courtès
2016-11-05 12:55 ` [PATCH 2/6] linux-initrd: Support FAT filesystems Marius Bakke
2016-11-06 21:44   ` Ludovic Courtès
2016-11-05 12:55 ` [PATCH 3/6] file-systems: Suppress fsck status completion bar Marius Bakke
2016-11-06 21:47   ` Ludovic Courtès
2016-11-07  0:00     ` Marius Bakke
2016-11-07  8:59       ` Ludovic Courtès
2016-11-07  9:29         ` Marius Bakke
2016-11-07 10:15           ` Danny Milosavljevic
2016-12-17  9:40             ` Marius Bakke
2016-12-18 10:57               ` Ludovic Courtès
2016-11-05 12:55 ` [PATCH 4/6] gnu: Add efivar Marius Bakke
2016-11-06 21:51   ` Ludovic Courtès
2016-11-05 12:55 ` [PATCH 5/6] gnu: Add efibootmgr Marius Bakke
2016-11-06 21:52   ` Ludovic Courtès
2016-11-05 12:55 ` [PATCH 6/6] gnu: Add grub-efi Marius Bakke
2016-11-05 18:58   ` Leo Famulari
2016-11-05 19:38     ` Marius Bakke
2016-11-06 22:00       ` Ludovic Courtès
2016-11-07  0:19         ` Marius Bakke
2016-11-07  9:00           ` Ludovic Courtès
2016-11-07  9:23             ` Marius Bakke
2016-12-16 17:09               ` Ludovic Courtès
2016-12-16 17:16                 ` Danny Milosavljevic
2016-12-16 17:33                 ` Marius Bakke
2016-12-18 10:54                   ` Ludovic Courtès
2016-12-18 14:36                     ` Marius Bakke
2016-12-19 10:48                       ` Ludovic Courtès
2016-12-19 15:49                         ` Marius Bakke
2016-12-19 21:16                           ` Ludovic Courtès
2016-12-19 22:48                             ` Marius Bakke
2016-12-20 13:53                               ` Ludovic Courtès
2016-12-20 14:42                                 ` Marius Bakke
2016-12-20 16:53                                   ` Ludovic Courtès
2016-12-20 18:43                                     ` Marius Bakke
2016-12-21  9:12                                       ` Ludovic Courtès
2016-12-21 18:55                                         ` Danny Milosavljevic
2017-01-03 16:06                                 ` Ludovic Courtès
2017-01-03 16:16                                   ` Chris Marusich
2017-01-04 22:18                                     ` Ludovic Courtès
2016-12-17  9:38                 ` Marius Bakke
2016-12-17 10:15                   ` Marius Bakke

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.