guix-devel
[Top][All Lists]
Advanced

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

Re: UEFI support in boot image


From: Ludovic Courtès
Subject: Re: UEFI support in boot image
Date: Wed, 19 Apr 2017 22:26:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hi Marius!

Marius Bakke <address@hidden> skribis:

> I've attached a few patches as a humble beginning, but currently the
> "format-partition" code in (gnu build vm) needs to learn some
> filesystem-specific parameters. So, I don't think it will be ready for
> the upcoming release.
>
> I have also done some reading and don't think we can use isolinux as it
> requires an image in ISO 9660 format. Nor does the syslinux utilities
> actually support chainloading grub from UEFI as I had hoped.

OK.

> So I think we'll have to offer UEFI as a standalone image, at least to
> begin with. Unfortunately I also believe it needs to be generated from a
> UEFI system, but this grub limitation can hopefully be lifted.

Providing a separate standalone image is reasonable IMO.

Anyway, I’m happy to see this patch set!

> From 25b01f9a219338580b6f7a7449bba8ff90c2176c Mon Sep 17 00:00:00 2001
> From: Marius Bakke <address@hidden>
> Date: Tue, 11 Apr 2017 10:47:38 +0200
> Subject: [PATCH 1/4] vm: Add support for arbitrary partition flags.
>
> * gnu/build/vm.scm (<partition>): Change BOOTABLE? to FLAGS.
> (initialize-partition-table): Pass each flag to parted.
> (initialize-hard-disk): Search for root partition by "boot" flag.
> * gnu/system/vm.scm (qemu-image): Adjust partitions accordingly.

[...]

> @@ -141,7 +141,7 @@ the #:references-graphs parameter of 'derivation'."
>    (size        partition-size)
>    (file-system partition-file-system (default "ext4"))
>    (label       partition-label (default #f))
> -  (bootable?   partition-bootable? (default #f))
> +  (flags       partition-flags (default '()))
>    (initializer partition-initializer (default (const #t))))

So ‘flags’ must be a list of strings, and each string is something
Parted recognizes, right?

It would be slightly nicer to make it a list of symbols.

> +  (define (find-root-partition partitions)
> +    "Return the first partition found with the boot flag set."
> +    ;; FIXME: This probably does not work. What's the best way to do this?
> +    (find (match-lambda
> +            (($ <partition> _ _ _ _ flags)
> +             (member "boot" flags)))
> +          partitions))

Why wouldn’t it work?  LGTM.

BTW, in this case, I’d recommend using ‘partition-flags’ instead of
‘match’ with the 4 wildcards; probably safer.  :-)

That said, it’s probably best to keep

  (define (partition-bootable? partition)
    (member "boot" (partition-flags partition)))

>    (let* ((partitions (initialize-partition-table device partitions))
> -         (root       (find partition-bootable? partitions))
> +         (root       (find-root-partition partitions))

… and keep this line unchanged (‘find-foo’ procedures are an
anti-pattern in a way.)

> From 9db90ea41a94ecbe42bba88de1c2e3ac607d5ea4 Mon Sep 17 00:00:00 2001
> From: Marius Bakke <address@hidden>
> Date: Tue, 11 Apr 2017 10:55:22 +0200
> Subject: [PATCH 2/4] vm: Unconditionally add a small ESP partition.
>
> * gnu/system/vm.scm (qemu-image): Append 20MB FAT32 partition.

[...]

>                    (partitions (list (partition
>                                       (size #$(- disk-image-size
> -                                                (* 10 (expt 2 20))))
> +                                                (* 30 (expt 2 20))))
>                                       (label #$file-system-label)
>                                       (file-system #$file-system-type)
>                                       (flags '("boot"))
> -                                     (initializer initialize)))))
> +                                     (initializer initialize))
> +                                    (partition
> +                                     ;; Append a small FAT32 partition for
> +                                     ;; use with UEFI bootloaders.
> +                                     (size (* 20 (expt 2 20)))
> +                                     (label "gnu-esp")
> +                                     (file-system "vfat")
> +                                     (flags '("esp"))))))

Should we do it conditionally, only when targeting UEFI?

(BTW, what’s “esp”?)

> From 4306bae25d6110ec52b8bbe3ad8b55f2c4c18fca Mon Sep 17 00:00:00 2001
> From: Marius Bakke <address@hidden>
> Date: Mon, 17 Apr 2017 22:21:28 +0200
> Subject: [PATCH 3/4] gnu: dosfstools: Enable compatibility symlinks.
>
> * gnu/packages/disk.scm (dosfstools)[arguments]<#:configure-flags>: New
> parameter.

LGTM.

> From d3e733739edebfd42efd70e7cc6335f3862f1ed5 Mon Sep 17 00:00:00 2001
> From: Marius Bakke <address@hidden>
> Date: Mon, 17 Apr 2017 22:25:43 +0200
> Subject: [PATCH 4/4] gnu: vm: Add FAT32 utilities in base image.
>
> * gnu/system/vm.scm (qemu-image): Add DOSFSTOOLS to the closure.

OK.

Thank you for working on it!

Ludo’.



reply via email to

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