From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marius Bakke Subject: Re: [PATCH 6/6] gnu: Add grub-efi. Date: Sat, 17 Dec 2016 10:38:15 +0100 Message-ID: <877f6y3ng8.fsf@kirby.i-did-not-set--mail-host-address--so-tickle-me> References: <20161105125511.29383-1-mbakke@fastmail.com> <20161105125511.29383-7-mbakke@fastmail.com> <20161105185803.GA11667@jasmine> <87h97l67kz.fsf@kirby.i-did-not-set--mail-host-address--so-tickle-me> <878tsww9ov.fsf@gnu.org> <87vaw087kr.fsf@kirby.i-did-not-set--mail-host-address--so-tickle-me> <871syny88o.fsf@gnu.org> <87oa1r8wyv.fsf@kirby.i-did-not-set--mail-host-address--so-tickle-me> <871sx73ink.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cIBRd-0004qn-L0 for guix-devel@gnu.org; Sat, 17 Dec 2016 04:38:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cIBRa-0006XS-GT for guix-devel@gnu.org; Sat, 17 Dec 2016 04:38:21 -0500 In-Reply-To: <871sx73ink.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Hi Marius, > > Marius Bakke skribis: > >> Ludovic Court=C3=A8s writes: >> >>>>>> From 940c03c7dcddec019e27f6eb1470aeab4db57799 Mon Sep 17 00:00:00 20= 01 >>>>>> From: Marius Bakke >>>>>> 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 versio= n)")) >>>>> >>>>> Please use a literal string for =E2=80=98synopsis=E2=80=99; use of = =E2=80=98string-append=E2=80=99 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 >>>>> =E2=80=98grub=E2=80=99 package. >>>>> >>>>> Also, what=E2=80=99s the rationale for making =E2=80=98grub-efi=E2=80= =99 separate instead of >>>>> incorporating the changes in =E2=80=98grub=E2=80=99 proper? Are ther= e issues around the >>>>> portability of =E2=80=98efibootmgr=E2=80=99, or an increased closure = size? >>>> >>>> This is a good point. The only difference with "--with-platform=3Defi"= 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=E2= =80=99t > seem right! > > Now there are things I didn=E2=80=99t quite get. Apparently you=E2=80=99= re supposed to > have a /boot/efi as a vfat partition, and =E2=80=98grub-install=E2=80=99 = is supposed to > detect it and install the EFI stuff, or so I thought (info "(grub) > Installing GRUB using grub-install"). > > However, =E2=80=98grub-install=E2=80=99 still seems to be installing for = =E2=80=9Ci386-pc=E2=80=9D > 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. --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlhVB4cACgkQoqBt8qM6 VPpXVggAiQ25qXqjQ4zGXw9nn1QTSyJIe+YolG+wvUzpWElQyqzrrdB5EFfqklpz 6QmZTPW/6ogKjIb7xWgksAJgqGvQr3qedoaPXe1wDta8SzF+mNuCQV7Kp+8INYUt 9xmkPquGsavgEM97a0U6sU3n3jFUwAx40nAOUPFbgZFHAVh1oYLCoM3M8wkPLP2M Y7rSnvL4gJzMYY8fn2cNj4h2rUqccK/aoOZxZ3/AONZsttQZXVehxI3vDT67MnwT mvNUG4Ht4K+toNWUcTxVPdbfR+rlqZwKQr5LCBPkWZjS4hJ4Ldd1Z9wpMcCzcDFg arJ5VpWYGrB03Pnw+3xo5kQ3hrcQbg== =ED7p -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=uefi.patch >From 0a7c923618e8323c684ac8328ea6aa498b8cb13c Mon Sep 17 00:00:00 2001 From: Marius Bakke 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 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 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 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 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 --=-=-=--