GNU bug report logs - #77110
[PATCH 0/2] Add UEFI firmware support in libvirt.

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Wed, 19 Mar 2025 07:17:02 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 77110 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: Vagrant Cascadian <vagrant <at> debian.org>, 77110 <at> debbugs.gnu.org
Subject: Re: [bug#77110] [PATCH 1/2] gnu: ovmf-x86-64: Install QEMU firmware
 metadata file.
Date: Wed, 19 Mar 2025 17:03:14 +0200
[Message part 1 (text/plain, inline)]
51-edk2-ovmf-2m-raw-x64-nosb.json is very similar to a file shipped by
qemu, in the sources in pc-bios/descriptors¹.

On Wed, Mar 19, 2025 at 09:45:12PM +0900, Maxim Cournoyer wrote:
> * gnu/packages/firmware.scm (ovmf-x86-64)
> [phases] {install-qemu-firmware-metadata}: New phase.
> (ovmf-aux-file): New procedure.
> * gnu/packages/aux-files/ovmf/51-edk2-ovmf-2m-raw-x64-nosb.json: New file.
> * Makefile.am (AUX_FILES): Register it.
> 
> Change-Id: I301eac8b79aed523f3b4cdedb7b3925d8fd0ad3d
> ---
> 
>  Makefile.am                                   |  1 +
>  .../ovmf/51-edk2-ovmf-2m-raw-x64-nosb.json    | 36 +++++++++++++++++++
>  gnu/packages/firmware.scm                     | 24 ++++++++++++-
>  3 files changed, 60 insertions(+), 1 deletion(-)
>  create mode 100644 gnu/packages/aux-files/ovmf/51-edk2-ovmf-2m-raw-x64-nosb.json
> 
> diff --git a/Makefile.am b/Makefile.am
> index c668b96a37..f2f4a9643e 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -472,6 +472,7 @@ AUX_FILES =						\
>    gnu/packages/aux-files/linux-libre/5.4-arm64.conf	\
>    gnu/packages/aux-files/linux-libre/5.4-i686.conf	\
>    gnu/packages/aux-files/linux-libre/5.4-x86_64.conf	\
> +  gnu/packages/aux-files/ovmf/51-edk2-ovmf-2m-raw-x64-nosb.json	\
>    gnu/packages/aux-files/pack-audit.c			\
>    gnu/packages/aux-files/python/sanity-check.py		\
>    gnu/packages/aux-files/python/sitecustomize.py	\
> diff --git a/gnu/packages/aux-files/ovmf/51-edk2-ovmf-2m-raw-x64-nosb.json b/gnu/packages/aux-files/ovmf/51-edk2-ovmf-2m-raw-x64-nosb.json
> new file mode 100644
> index 0000000000..050853e2b8
> --- /dev/null
> +++ b/gnu/packages/aux-files/ovmf/51-edk2-ovmf-2m-raw-x64-nosb.json
> @@ -0,0 +1,36 @@
> +{
> +    "description": "OVMF without SB+SMM, empty varstore",
> +    "interface-types": [
> +        "uefi"
> +    ],
> +    "mapping": {
> +        "device": "flash",
> +        "mode" : "split",
> +        "executable": {
> +            "filename": "/usr/share/edk2/ovmf/OVMF_CODE.fd",
> +            "format": "raw"
> +        },
> +        "nvram-template": {
> +            "filename": "/usr/share/edk2/ovmf/OVMF_VARS.fd",
> +            "format": "raw"
> +        }
> +    },
> +    "targets": [
> +        {
> +            "architecture": "x86_64",
> +            "machines": [
> +                "pc-i440fx-*",
> +                "pc-q35-*"
> +            ]
> +        }
> +    ],
> +    "features": [
> +        "acpi-s3",
> +        "amd-sev",
> +        "amd-sev-es",
> +        "verbose-dynamic"
> +    ],
> +    "tags": [
> +
> +    ]
> +}
> diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
> index 63f767f72b..c1d8ba3719 100644
> --- a/gnu/packages/firmware.scm
> +++ b/gnu/packages/firmware.scm
> @@ -1001,6 +1001,10 @@ (define* (make-ovmf-firmware arch)
>        (license (list license:expat
>                       license:bsd-2 license:bsd-3 license:bsd-4)))))
>  
> +(define (ovmf-aux-file name)
> +  "Return as a gexp the auxiliary OVMF file corresponding to NAME."
> +  (local-file (search-auxiliary-file (string-append "ovmf/" name))))
> +
>  (define-public ovmf-x86-64
>    (let ((base (make-ovmf-firmware "x86_64")))
>      (package
> @@ -1022,7 +1026,25 @@ (define-public ovmf-x86-64
>                          (string-append fmw "/" (string-downcase file) "_x64.bin")))
>                       (list "OVMF"
>                             "OVMF_CODE"
> -                           "OVMF_VARS"))))))))))))
> +                           "OVMF_VARS")))))

These 3 files we rename from OVMF* to ovmf*_x64.bin, but based on
roms/edk2-build.config from the qemu sources² OVMF_CODE would become
edk2-x86_64-code.fd. I think we should standardize on using Qemu's
naming scheme for the files.

Also we currently install these files to %output/share/firmware and
there are other files we install to %output/share/qemu and we should
probably standardize between them.

> +              (add-after 'install 'install-qemu-firmware-metadata
> +                (lambda _
> +                  ;; The QEMU firmware metadata files are taken from the
> +                  ;; Fedora project (see:
> +                  ;; https://src.fedoraproject.org/rpms/edk2/tree/rawhide).
> +                  (let ((51-edk2-ovmf-2m-raw-x64-nosb.json-source
> +                         #$(ovmf-aux-file "51-edk2-ovmf-2m-raw-x64-nosb.json"))
> +                        (51-edk2-ovmf-2m-raw-x64-nosb.json-dest
> +                         (string-append #$output "/share/qemu/firmware/"
> +                                        "51-edk2-ovmf-2m-raw-x64-nosb.json")))
> +                    (mkdir-p (dirname 51-edk2-ovmf-2m-raw-x64-nosb.json-dest))
> +                    (copy-file 51-edk2-ovmf-2m-raw-x64-nosb.json-source
> +                               51-edk2-ovmf-2m-raw-x64-nosb.json-dest)
> +                    (substitute* 51-edk2-ovmf-2m-raw-x64-nosb.json-dest
> +                      (("/usr/share/edk2/ovmf/OVMF_(CODE|VARS).fd" _ kind)
> +                       (string-append
> +                        #$output "/share/firmware/ovmf_"
> +                        (string-downcase kind) "_x64.bin")))))))))))))

Would it be possible to instead use the search-path to find the
firmwares or is that not really possible?

>  
>  (define-public ovmf-i686
>    (let ((base (make-ovmf-firmware "i686")))
> 
> base-commit: fa39695bbc0c5f79838cbca55d55eebd821a8efa
> -- 
> 2.48.1
> 

¹ https://gitlab.com/qemu-project/qemu/-/blob/v9.1.3/pc-bios/descriptors/60-edk2-x86_64.json
² https://gitlab.com/qemu-project/qemu/-/blob/v9.1.3/roms/edk2-build.config#L62

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 52 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.