[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images.
From: |
Ludovic Courtès |
Subject: |
bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images. |
Date: |
Wed, 17 May 2017 23:28:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Marius Bakke <address@hidden> 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 <address@hidden>
> ;;; Copyright © 2016 Leo Famulari <address@hidden>
> ;;; Copyright © 2017 Mathieu Othacehe <address@hidden>
> +;;; Copyright © 2017 Marius Bakke <address@hidden>
> ;;;
> ;;; 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’.
- bug#26815: [PATCH 3/3] vm: Support EFI boot in base image., (continued)
- bug#26815: [PATCH 3/3] vm: Support EFI boot in base image., Marius Bakke, 2017/05/13
- bug#26815: [PATCH 3/3] vm: Support EFI boot in base image., Ludovic Courtès, 2017/05/13
- bug#26815: [PATCH 3/3] vm: Support EFI boot in base image., Ludovic Courtès, 2017/05/16
- bug#26815: [PATCH 3/3] vm: Support EFI boot in base image., Marius Bakke, 2017/05/17
- bug#26815: [PATCH 3/3] vm: Support EFI boot in base image., Marius Bakke, 2017/05/17
- bug#26815: [PATCH 3/3] vm: Support EFI boot in base image., Ricardo Wurmus, 2017/05/17
- bug#26815: [PATCH 3/3] vm: Support EFI boot in base image., Ludovic Courtès, 2017/05/17
- bug#26815: [PATCH v4 1/3] vm: Support arbitrary partition flags., Marius Bakke, 2017/05/17
- bug#26815: [PATCH v4 2/3] vm: Support creating FAT partitions., Marius Bakke, 2017/05/17
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images., Marius Bakke, 2017/05/17
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images.,
Ludovic Courtès <=
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images., Marius Bakke, 2017/05/18
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images., Marius Bakke, 2017/05/18
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images., Ludovic Courtès, 2017/05/18
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images., Marius Bakke, 2017/05/19
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images., Mathieu Othacehe, 2017/05/19
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images., Marius Bakke, 2017/05/19
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images., Ludovic Courtès, 2017/05/20
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images., Mathieu Othacehe, 2017/05/20
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images., Marius Bakke, 2017/05/20
- bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images., Ludovic Courtès, 2017/05/20