GNU bug report logs -
#26815
[PATCH 0/3] Hybrid UEFI disk image
Previous Next
Reported by: Marius Bakke <mbakke <at> fastmail.com>
Date: Sun, 7 May 2017 14:36:02 UTC
Severity: important
Tags: patch
Done: Marius Bakke <mbakke <at> fastmail.com>
Bug is archived. No further changes may be made.
Full log
Message #138 received at 26815 <at> debbugs.gnu.org (full text, mbox):
Marius Bakke <mbakke <at> fastmail.com> skribis:
> * gnu/system/vm.scm (qemu-image): Add GRUB-EFI to inputs. Append 40MiB EFI
> System Partition.
> * gnu/build/vm.scm (install-efi): New procedure.
> (initialize-hard-disk): Generate grub EFI blob when ESP is present.
[...]
> +(define (install-efi esp config-file)
> + "Write a self-contained GRUB EFI loader to the mounted ESP using CONFIG-FILE."
> + (let* ((system %host-type)
> + ;; Hard code the output location to a well-known path recognized by
> + ;; compliant firmware. See "3.5.1.1 Removable Media Boot Behaviour":
> + ;; http://www.uefi.org/sites/default/files/resources/UEFI%20Spec%202_6.pdf
> + (efi-directory (string-append esp "/EFI/BOOT"))
> + ;; Map grub target names to boot file names.
> + (efi-targets (cond ((string-prefix? "x86_64" system)
> + '("x86_64-efi" . "BOOTX64.EFI"))
> + ((string-prefix? "i686" system)
> + '("i386-efi" . "BOOTIA32.EFI"))
> + ((string-prefix? "armhf" system)
> + '("arm-efi" . "BOOTARM.EFI"))
> + ((string-prefix? "aarch64" system)
> + '("arm64-efi" . "BOOTAA64.EFI")))))
> + ;; GRUB requires a TMPDIR to prepare the firmware image.
> + (setenv "TMPDIR" esp)
> +
> + (mkdir-p efi-directory)
> + (unless (zero? (system* "grub-mkstandalone" "-O" (car efi-targets)
> + "-o" (string-append efi-directory "/"
> + (cdr efi-targets))
> + ;; Graft the configuration file onto the image.
> + (string-append "boot/grub/grub.cfg=" config-file)))
So this is where we need to make sure we’re taking ‘grub-mkstandalone’
from ‘grub-efi’ and not ‘grub’, right? How do we ensure that?
> +++ b/gnu/system/vm.scm
> @@ -3,6 +3,7 @@
> ;;; Copyright © 2016 Christopher Allan Webber <cwebber <at> dustycloud.org>
> ;;; Copyright © 2016 Leo Famulari <leo <at> famulari.name>
> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
> +;;; Copyright © 2017 Marius Bakke <mbakke <at> fastmail.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -203,7 +204,7 @@ the image."
> (guix build utils))
>
> (let ((inputs
> - '#$(append (list qemu parted e2fsprogs dosfstools)
> + '#$(append (list qemu parted e2fsprogs dosfstools grub-efi)
> (map canonical-package
> (list sed grep coreutils findutils gawk))
> (if register-closures? (list guix) '())))
> @@ -228,11 +229,23 @@ the image."
> #:system-directory #$os-drv))
> (partitions (list (partition
> (size #$(- disk-image-size
> - (* 10 (expt 2 20))))
> + (* 50 (expt 2 20))))
> (label #$file-system-label)
> (file-system #$file-system-type)
> (flags '(boot))
> - (initializer initialize)))))
> + (initializer initialize))
> + ;; Append a small EFI System Partition for
> + ;; use with UEFI bootloaders.
> + (partition
> + ;; The standalone grub image is about 10MiB, but
> + ;; leave some room for custom or multiple images.
> + (size (* 40 (expt 2 20)))
> + (label "GNU-ESP") ;cosmetic only
> + ;; Use "vfat" here since this property is used
> + ;; when mounting. The actual FAT-ness is based
> + ;; on filesystem size (16 in this case).
> + (file-system "vfat")
> + (flags '(esp))))))
> (initialize-hard-disk "/dev/vda"
> #:partitions partitions
> #:bootloader-package
I thought we’d pass something like
(initialize-hard-disk … #:grub-efi #$grub-eif)
to avoid the ambiguity?
Once we’re done with that, we’ll have to update one of the
‘operating-system’ declaration examples to show UEFI configuration, and
to update the doc to explain the installation process for UEFI.
Anyway, thanks for the updated patch series, looks like we’re almost
there! :-)
Ludo’.
This bug report was last modified 8 years and 46 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.