[PATCH 00/11] Combine edk2-tools and ovmf firmware

  • Done
  • quality assurance status badge
Details
One participant
  • Efraim Flashner
Owner
unassigned
Submitted by
Efraim Flashner
Severity
normal
E
E
Efraim Flashner wrote on 13 May 10:19 +0200
(address . guix-patches@gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
cover.1715588342.git.efraim@flashner.co.il
This patch set aims to combine the edk2-tools and the ovmf firmware
sources, so that they're built out of the same sources and share the
same version. I was able to test some of the system tests requiring the
UEFI firmware for x86_64 after also applying the patch in bug#70912. I
did some work to try to get the %test-gui-uefi-installed-os system test
to pass on aarch64, but it's not quite there yet.

In theory edk2-tools (and make-ovmf-firmware) should be more limited in
the supported-systems, but I haven't made any changes there yet. Also,
the ovmf-x86-64 and ovmf-i686 packages add CFLAGS that only allow it to
be built on x86_64 or i686 systems, but I haven't investigated if it
would be ok to remove those flags or if we should limit the
supported-systems to those two.

Efraim Flashner (11):
gnu: edk2-tools: Update to 202402.
gnu: edk2-tools: Enable submodules.
gnu: Add ovmf-x86-64.
gnu: Add ovmf-i686.
gnu: ovmf-aarch64: Update to 202402.
gnu: ovmf-arm: Update to 202402.
gnu: ovmf-riscv64: Update to 202402.
gnu: Use new ovmf firmware packages.
tests: install: Add support for aarch64 UEFI tests.
gnu: ovmf: Deprecate in favor of ovmf-x86-64.
tests: install: Use a default qemu machine for arm architectures.

doc/guix.texi | 2 +-
gnu/packages/firmware.scm | 307 ++++++++++++++++----------------
gnu/packages/virtualization.scm | 2 +-
gnu/tests/install.scm | 18 +-
4 files changed, 168 insertions(+), 161 deletions(-)


base-commit: 109679cdfaab645d2f35afec9bf1cb1b0d24f767
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 13 May 10:21 +0200
[PATCH 01/11] gnu: edk2-tools: Update to 202402.
(address . 70913@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
514375552dab803e7f23d31d2ffcb5c004beb0f5.1715588342.git.efraim@flashner.co.il
* gnu/packages/firmware.scm (edk2-tools): Update to 202402.

Change-Id: I3ab7d75a8193faea2b3b3649f9b14bba48611187
---
gnu/packages/firmware.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (35 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 6f0c2da806..62753e3769 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -2,7 +2,7 @@
;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2017 David Craven <david@craven.ch>
-;;; Copyright © 2017, 2018, 2022, 2023 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2018, 2022-2024 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
@@ -814,7 +814,7 @@ (define-public sgabios
(define-public edk2-tools
(package
(name "edk2-tools")
- (version "202308")
+ (version "202402")
(source (origin
(method git-fetch)
(uri (git-reference
@@ -823,7 +823,7 @@ (define-public edk2-tools
(file-name (git-file-name name version))
(sha256
(base32
- "19g3g94hayvcwmn6sjs6mghq0qf5nsd785k5j8szcrj2p0vjh54f"))))
+ "1x0h89cz3ihihcp4n93bw708q9r3icprb8cjsrrfcgq10clavdzx"))))
(build-system gnu-build-system)
(arguments
(list #:make-flags
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 13 May 10:21 +0200
[PATCH 02/11] gnu: edk2-tools: Enable submodules.
(address . 70913@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
a30ff9235726df67f90dba40bbccb4da634f329f.1715588342.git.efraim@flashner.co.il
* gnu/packages/firmware.scm (edk2-tools)[source]: Checkout submodules.
[arguments]: Don't disable building brotli or xz compression.

Change-Id: I8b318373e38767e1a309e9e385f1626429bfbb20
---
gnu/packages/firmware.scm | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)

Toggle diff (40 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 62753e3769..f3bb51bcb1 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -819,11 +819,13 @@ (define-public edk2-tools
(method git-fetch)
(uri (git-reference
(url "https://github.com/tianocore/edk2")
- (commit (string-append "edk2-stable" version))))
+ (commit (string-append "edk2-stable" version))
+ ;; EDK2 makes extensive use of submodules.
+ (recursive? #t)))
(file-name (git-file-name name version))
(sha256
(base32
- "1x0h89cz3ihihcp4n93bw708q9r3icprb8cjsrrfcgq10clavdzx"))))
+ "0y7jfpijgi099znhzjklnsczn0k0vm1d1qznq9x2a2sa0glydsin"))))
(build-system gnu-build-system)
(arguments
(list #:make-flags
@@ -835,15 +837,6 @@ (define-public edk2-tools
(add-after 'unpack 'change-directory
(lambda _
(chdir "BaseTools")))
- (add-after 'change-directory 'disable-some-tools
- (lambda _
- ;; Disable building brotli and xz, since we package them
- ;; separately, and it would require fetching submodules.
- (substitute* "Source/C/GNUmakefile"
- (("^[[:blank:]]+BrotliCompress[[:blank:]]+\\\\")
- "\\")
- (("^[[:blank:]]+LzmaCompress[[:blank:]]+\\\\")
- "\\"))))
(replace 'build
(lambda* (#:key (make-flags #~'()) #:allow-other-keys)
;; The default build target also runs tests.
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 13 May 10:21 +0200
[PATCH 04/11] gnu: Add ovmf-i686.
(address . 70913@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
12604f2b2e1d9c21d687e71b532f245bcc5913d4.1715588342.git.efraim@flashner.co.il
* gnu/packages/firmware.scm (ovmf-i686): New variable.

Change-Id: Ie5702435695e24ed1d2731152a89b0aeb9a050dd
---
gnu/packages/firmware.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 40ca541437..ab39f8d0d2 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1002,6 +1002,28 @@ (define-public ovmf-x86-64
"OVMF_CODE"
"OVMF_VARS"))))))))))))
+(define-public ovmf-i686
+ (let ((base (make-ovmf-firmware "i686")))
+ (package
+ (inherit base)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (replace 'install
+ (lambda _
+ (let ((fmw (string-append #$output "/share/firmware")))
+ (mkdir-p fmw)
+ (for-each
+ (lambda (file)
+ (copy-file
+ (string-append "Build/OvmfIa32/RELEASE_GCC"
+ "/FV/" file ".fd")
+ (string-append fmw "/" (string-downcase file) "_ia32.bin")))
+ (list "OVMF"
+ "OVMF_CODE"
+ "OVMF_VARS"))))))))))))
+
(define-public ovmf
(let ((toolchain-ver "GCC5"))
(package
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 13 May 10:21 +0200
[PATCH 05/11] gnu: ovmf-aarch64: Update to 202402.
(address . 70913@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
01a983b348c27fa91f69a950f1a622de8bf2ca62.1715588342.git.efraim@flashner.co.il
* gnu/packages/firmware.scm (ovmf-aarch64): Update to 202402. Build
using make-ovmf-firmware.

Change-Id: I270bd8fa79f2df3d73bdf8d5685d27a3cc0cef6a
---
gnu/packages/firmware.scm | 51 ++++++++++++---------------------------
1 file changed, 16 insertions(+), 35 deletions(-)

Toggle diff (73 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index ab39f8d0d2..ae11c82d1a 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1024,6 +1024,22 @@ (define-public ovmf-i686
"OVMF_CODE"
"OVMF_VARS"))))))))))))
+(define-public ovmf-aarch64
+ (let ((base (make-ovmf-firmware "aarch64")))
+ (package
+ (inherit base)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (replace 'install
+ (lambda _
+ (let ((fmw (string-append #$output "/share/firmware")))
+ (mkdir-p fmw)
+ (copy-file (string-append "Build/ArmVirtQemu-AARCH64/"
+ "RELEASE_GCC/FV/QEMU_EFI.fd")
+ (string-append fmw "/ovmf_aarch64.bin"))))))))))))
+
(define-public ovmf
(let ((toolchain-ver "GCC5"))
(package
@@ -1124,41 +1140,6 @@ (define-public ovmf
(license (list license:expat
license:bsd-2 license:bsd-3 license:bsd-4)))))
-(define-public ovmf-aarch64
- (let ((toolchain-ver "GCC5"))
- (package
- (inherit ovmf)
- (name "ovmf-aarch64")
- (native-inputs
- (append (package-native-inputs ovmf)
- (if (not (string-prefix? "aarch64" (%current-system)))
- `(("cross-gcc" ,(cross-gcc "aarch64-linux-gnu"))
- ("cross-binutils" ,(cross-binutils "aarch64-linux-gnu")))
- '())))
- (arguments
- (substitute-keyword-arguments (package-arguments ovmf)
- ((#:phases phases)
- #~(modify-phases #$phases
- #$@(if (string-prefix? "aarch64" (%current-system))
- '()
- #~((add-before 'configure 'set-env
- (lambda _
- (setenv (string-append #$toolchain-ver "_AARCH64_PREFIX")
- "aarch64-linux-gnu-")))))
- (replace 'build
- (lambda _
- (invoke "build" "-a" "AARCH64" "-t" #$toolchain-ver
- "-p" "ArmVirtPkg/ArmVirtQemu.dsc")))
- (delete 'build-x64)
- (replace 'install
- (lambda _
- (let ((fmw (string-append #$output "/share/firmware")))
- (mkdir-p fmw)
- (copy-file (string-append "Build/ArmVirtQemu-AARCH64/RELEASE_"
- #$toolchain-ver "/FV/QEMU_EFI.fd")
- (string-append fmw "/ovmf_aarch64.bin")))))))))
- (supported-systems %supported-systems))))
-
(define-public ovmf-arm
(let ((toolchain-ver "GCC5"))
(package
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 13 May 10:21 +0200
[PATCH 06/11] gnu: ovmf-arm: Update to 202402.
(address . 70913@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
2a36840df037dc831a74879954f9d7407a57fc0a.1715588342.git.efraim@flashner.co.il
* gnu/packages/firmware.scm (ovmf-arm): Update to 202402. Build using
make-ovmf-firmware.

Change-Id: I1adf1afc9ceb29db373c2e0d05d42a3c68232cb5
---
gnu/packages/firmware.scm | 52 +++++++++++++--------------------------
1 file changed, 17 insertions(+), 35 deletions(-)

Toggle diff (74 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index ae11c82d1a..f660c21712 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1040,6 +1040,23 @@ (define-public ovmf-aarch64
"RELEASE_GCC/FV/QEMU_EFI.fd")
(string-append fmw "/ovmf_aarch64.bin"))))))))))))
+(define-public ovmf-arm
+ (let ((base (make-ovmf-firmware "armhf")))
+ (package
+ (inherit base)
+ (name "ovmf-arm")
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (replace 'install
+ (lambda _
+ (let ((fmw (string-append #$output "/share/firmware")))
+ (mkdir-p fmw)
+ (copy-file (string-append "Build/ArmVirtQemu-ARM/"
+ "RELEASE_GCC/FV/QEMU_EFI.fd")
+ (string-append fmw "/ovmf_arm.bin"))))))))))))
+
(define-public ovmf
(let ((toolchain-ver "GCC5"))
(package
@@ -1140,41 +1157,6 @@ (define-public ovmf
(license (list license:expat
license:bsd-2 license:bsd-3 license:bsd-4)))))
-(define-public ovmf-arm
- (let ((toolchain-ver "GCC5"))
- (package
- (inherit ovmf)
- (name "ovmf-arm")
- (native-inputs
- (append (package-native-inputs ovmf)
- (if (not (string-prefix? "armhf" (%current-system)))
- `(("cross-gcc" ,(cross-gcc "arm-linux-gnueabihf"))
- ("cross-binutils" ,(cross-binutils "arm-linux-gnueabihf")))
- '())))
- (arguments
- (substitute-keyword-arguments (package-arguments ovmf)
- ((#:phases phases)
- #~(modify-phases #$phases
- #$@(if (string-prefix? "armhf" (%current-system))
- '()
- #~((add-before 'configure 'set-env
- (lambda _
- (setenv (string-append #$toolchain-ver "_ARM_PREFIX")
- "arm-linux-gnueabihf-")))))
- (replace 'build
- (lambda _
- (invoke "build" "-a" "ARM" "-t" #$toolchain-ver
- "-p" "ArmVirtPkg/ArmVirtQemu.dsc")))
- (delete 'build-x64)
- (replace 'install
- (lambda _
- (let ((fmw (string-append #$output "/share/firmware")))
- (mkdir-p fmw)
- (copy-file (string-append "Build/ArmVirtQemu-ARM/RELEASE_"
- #$toolchain-ver "/FV/QEMU_EFI.fd")
- (string-append fmw "/ovmf_arm.bin")))))))))
- (supported-systems %supported-systems))))
-
(define-public ovmf-riscv64
(let ((toolchain-ver "GCC5"))
(package
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 13 May 10:21 +0200
[PATCH 07/11] gnu: ovmf-riscv64: Update to 202402.
(address . 70913@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
899f250b0d2b215959f359be6ba238f36b33ad1b.1715588342.git.efraim@flashner.co.il
* gnu/packages/firmware.scm (ovmf-riscv64): Update to 202402. Build
using make-ovmf-firmware.

Change-Id: I1a7dcaac3975669a61723b929162ad33affa1619
---
gnu/packages/firmware.scm | 54 ++++++++++++---------------------------
1 file changed, 16 insertions(+), 38 deletions(-)

Toggle diff (76 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index f660c21712..b0638382cb 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1057,6 +1057,22 @@ (define-public ovmf-arm
"RELEASE_GCC/FV/QEMU_EFI.fd")
(string-append fmw "/ovmf_arm.bin"))))))))))))
+(define-public ovmf-riscv64
+ (let ((base (make-ovmf-firmware "riscv64")))
+ (package
+ (inherit base)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (replace 'install
+ (lambda _
+ (let ((fmw (string-append #$output "/share/firmware")))
+ (mkdir-p fmw)
+ (with-directory-excursion "Build/RiscVVirtQemu/RELEASE_GCC/FV"
+ (install-file "RISCV_VIRT_CODE.fd" fmw)
+ (install-file "RISCV_VIRT_VARS.fd" fmw))))))))))))
+
(define-public ovmf
(let ((toolchain-ver "GCC5"))
(package
@@ -1157,44 +1173,6 @@ (define-public ovmf
(license (list license:expat
license:bsd-2 license:bsd-3 license:bsd-4)))))
-(define-public ovmf-riscv64
- (let ((toolchain-ver "GCC5"))
- (package
- (inherit ovmf)
- (name "ovmf-riscv64")
- (native-inputs
- (append (package-native-inputs ovmf)
- (if (not (string-prefix? "riscv64" (%current-system)))
- `(("cross-gcc" ,(cross-gcc "riscv64-linux-gnu"))
- ("cross-binutils" ,(cross-binutils "riscv64-linux-gnu")))
- '())))
- (arguments
- (substitute-keyword-arguments (package-arguments ovmf)
- ((#:phases phases)
- #~(modify-phases #$phases
- #$@(if (string-prefix? "riscv64" (%current-system))
- '()
- #~((add-before 'configure 'set-env
- (lambda _
- (setenv (string-append #$toolchain-ver "_RISCV64_PREFIX")
- "riscv64-linux-gnu-")))))
- (replace 'build
- (lambda _
- (invoke "build" "-a" "RISCV64" "-t" #$toolchain-ver
- "-p" "OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc")))
- (delete 'build-x64)
- (replace 'install
- (lambda _
- (let ((fmw (string-append #$output "/share/firmware")))
- (mkdir-p fmw)
- (copy-file (string-append "Build/RiscVVirtQemu/RELEASE_"
- #$toolchain-ver "/FV/RISCV_VIRT_CODE.fd")
- (string-append fmw "/RISCV_VIRT_CODE.fd"))
- (copy-file (string-append "Build/RiscVVirtQemu/RELEASE_"
- #$toolchain-ver "/FV/RISCV_VIRT_VARS.fd")
- (string-append fmw "/RISCV_VIRT_VARS.fd")))))))))
- (supported-systems %supported-systems))))
-
(define* (make-arm-trusted-firmware platform
#:key (triplet "aarch64-linux-gnu"))
(let ((native-build? (lambda ()
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 13 May 10:21 +0200
[PATCH 08/11] gnu: Use new ovmf firmware packages.
(address . 70913@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
fe535026b8c786267f5438151f8162c44add4ffb.1715588342.git.efraim@flashner.co.il
* doc/guix.texi (Invoking guix system): Update qemu command to use
ovmf-x86-64.
* gnu/packages/virtualization.scm (xen)[inputs]: Replace ovmf with
ovmf-i686.
* gnu/tests/install.scm (uefi-firmware): Use system appropriate ovmf
firmware.

Change-Id: Ia2ff76eaf766c8d4fb0be4a7cc7b8941574433d0
---
doc/guix.texi | 2 +-
gnu/packages/virtualization.scm | 2 +-
gnu/tests/install.scm | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)

Toggle diff (46 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index ce1a06747c..6058658996 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -42250,7 +42250,7 @@ Invoking guix system
cp $image /tmp/my-image.qcow2
chmod +w /tmp/my-image.qcow2
qemu-system-x86_64 -enable-kvm -hda /tmp/my-image.qcow2 -m 1000 \
- -bios $(guix build ovmf)/share/firmware/ovmf_x64.bin
+ -bios $(guix build ovmf-x86-64)/share/firmware/ovmf_x64.bin
@end example
When using the @code{mbr-hybrid-raw} image type, a raw disk image is
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 34cccd6550..c701ae2d45 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -2670,7 +2670,7 @@ (define-public xen
yajl
ncurses
openssl
- ovmf
+ ovmf-i686
pixman
qemu-minimal
seabios
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 16da320000..6248faed9b 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -210,9 +210,9 @@ (define (uefi-firmware system)
"Return the appropriate QEMU OVMF UEFI firmware for the given SYSTEM."
(cond
((string-prefix? "x86_64" system)
- (file-append ovmf "/share/firmware/ovmf_x64.bin"))
+ (file-append ovmf-x86-64 "/share/firmware/ovmf_x64.bin"))
((string-prefix? "i686" system)
- (file-append ovmf "/share/firmware/ovmf_ia32.bin"))
+ (file-append ovmf-i686 "/share/firmware/ovmf_ia32.bin"))
(else #f)))
(define* (run-install target-os target-os-source
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 13 May 10:21 +0200
[PATCH 09/11] tests: install: Add support for aarch64 UEFI tests.
(address . 70913@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
3b23c3994ff90a2adda71f564269926093e889cb.1715588342.git.efraim@flashner.co.il
* gnu/tests/install.scm (uefi-firmware): Add case for aarch64.

Change-Id: I77a506f792790954a289eda5a7a395a2b37c19c7
---
gnu/tests/install.scm | 2 ++
1 file changed, 2 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 6248faed9b..90e1ca6e75 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -213,6 +213,8 @@ (define (uefi-firmware system)
(file-append ovmf-x86-64 "/share/firmware/ovmf_x64.bin"))
((string-prefix? "i686" system)
(file-append ovmf-i686 "/share/firmware/ovmf_ia32.bin"))
+ ((string-prefix? "aarch64" system)
+ (file-append ovmf-aarch64 "/share/firmware/ovmf_aarch64.bin"))
(else #f)))
(define* (run-install target-os target-os-source
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 13 May 10:21 +0200
[PATCH 03/11] gnu: Add ovmf-x86-64.
(address . 70913@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
95a7a669b300c7f80a703e08c4027ed56fee47d0.1715588342.git.efraim@flashner.co.il
* gnu/packages/firmware.scm (make-ovmf-firmware): New procedure.
(ovmf-x86-64): New variable.

Change-Id: I283065577b5507f3b7d695eaa67a6d248174bcf5
---
gnu/packages/firmware.scm | 133 ++++++++++++++++++++++++++++++++++++++
1 file changed, 133 insertions(+)

Toggle diff (148 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index f3bb51bcb1..40ca541437 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -869,6 +869,139 @@ (define-public edk2-tools
@end itemize")
(license license:bsd-2)))
+(define* (make-ovmf-firmware arch)
+ (let ((toolchain "GCC")
+ (arch-string (match arch
+ ("x86_64" "X64")
+ ("i686" "IA32")
+ ("aarch64" "AARCH64")
+ ("armhf" "ARM")
+ ("riscv64" "RISCV64")
+ ("loongarch64" "LOONGARCH64")
+ (_ "NONE"))))
+ (package
+ (inherit edk2-tools)
+ (name (string-append "ovmf-" arch))
+ (arguments
+ (list
+ #:tests? #f ; No check target.
+ #:target #f ; Package produces firmware.
+ #:modules '((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 match))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-source
+ (lambda _
+ (substitute* "edksetup.sh"
+ (("^return \\$\\?")
+ "exit $?"))))
+ (add-before 'configure 'set-env
+ (lambda _
+ (unless (string-prefix? #$arch #$(%current-system))
+ (setenv (string-append #$toolchain "_X64_PREFIX")
+ "x86_64-linux-gnu-")
+ (setenv (string-append #$toolchain "_IA32_PREFIX")
+ "i686-linux-gnu-")
+ (setenv (string-append #$toolchain "_AARCH64_PREFIX")
+ "aarch64-linux-gnu-")
+ (setenv (string-append #$toolchain "_ARM_PREFIX")
+ "arm-linux-gnueabihf-")
+ (setenv (string-append #$toolchain "_RISCV64_PREFIX")
+ "riscv64-linux-gnu-")
+ (setenv (string-append #$toolchain "_LOONGARCH64_PREFIX")
+ "loongarch64-linux-gnu-"))))
+ (replace 'configure
+ (lambda _
+ (let* ((cwd (getcwd))
+ (tools (string-append cwd "/BaseTools"))
+ (bin (string-append tools "/BinWrappers/PosixLike")))
+ (setenv "WORKSPACE" cwd)
+ (setenv "EDK_TOOLS_PATH" tools)
+ (setenv "PYTHON3_ENABLE" "TRUE")
+ (setenv "PYTHON_COMMAND" "python3")
+ (setenv "PATH" (string-append (getenv "PATH") ":" bin))
+ (invoke "bash" "edksetup.sh")
+ (substitute* "Conf/target.txt"
+ (("^TARGET[ ]*=.*$") "TARGET = RELEASE\n")
+ (("^TOOL_CHAIN_TAG[ ]*=.*$")
+ (string-append "TOOL_CHAIN_TAG = " #$toolchain "\n"))
+ (("^TARGET_ARCH[ ]*=.*$")
+ (string-append "TARGET_ARCH = " #$arch-string
+ "\n"))
+ (("^MAX_CONCURRENT_THREAD_NUMBER[ ]*=.*$")
+ (format #f "MAX_CONCURRENT_THREAD_NUMBER = ~a~%"
+ (number->string (parallel-job-count)))))
+ ;; Build build support.
+ (setenv "CC" "gcc")
+ (invoke "make" "-C" tools))))
+ (replace 'build
+ (lambda _
+ (invoke "build" "-a" #$arch-string "-t" #$toolchain "-p"
+ (match #$arch
+ ("x86_64"
+ "OvmfPkg/OvmfPkgX64.dsc")
+ ("i686"
+ "OvmfPkg/OvmfPkgIa32.dsc")
+ ((or "aarch64" "armhf")
+ "ArmVirtPkg/ArmVirtQemu.dsc")
+ ("riscv64"
+ "OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc")
+ (_ #t)))))
+ (add-before 'install 'install-efi-shell
+ (lambda _
+ (let ((fmw (string-append #$output "/share/firmware")))
+ (mkdir-p fmw)
+ (for-each
+ (lambda (file)
+ (copy-file file
+ (string-append fmw "/Shell_"
+ (string-downcase #$arch-string)
+ ".efi")))
+ (find-files "Build" "Shell\\.efi"))))))))
+ (native-inputs
+ (append
+ (list acpica
+ nasm
+ perl
+ python-3
+ (list util-linux "lib"))
+ (if (not (string-prefix? arch (%current-system)))
+ (if (string=? arch "armhf")
+ (list (cross-gcc "arm-linux-gnueabihf")
+ (cross-binutils "arm-linux-gnueabihf"))
+ (list (cross-gcc (string-append arch "-linux-gnu"))
+ (cross-binutils (string-append arch "-linux-gnu"))))
+ '())))
+ (synopsis "UEFI firmware for QEMU")
+ (description "OVMF is an EDK II based project to enable UEFI support for
+Virtual Machines. OVMF contains a sample UEFI firmware for QEMU and KVM.")
+ (license (list license:expat
+ license:bsd-2 license:bsd-3 license:bsd-4)))))
+
+(define-public ovmf-x86-64
+ (let ((base (make-ovmf-firmware "x86_64")))
+ (package
+ (inherit base)
+ (name "ovmf-x86-64")
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (replace 'install
+ (lambda _
+ (let ((fmw (string-append #$output "/share/firmware")))
+ (mkdir-p fmw)
+ (for-each
+ (lambda (file)
+ (copy-file
+ (string-append "Build/OvmfX64/RELEASE_GCC"
+ "/FV/" file ".fd")
+ (string-append fmw "/" (string-downcase file) "_x64.bin")))
+ (list "OVMF"
+ "OVMF_CODE"
+ "OVMF_VARS"))))))))))))
+
(define-public ovmf
(let ((toolchain-ver "GCC5"))
(package
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 13 May 10:21 +0200
[PATCH 10/11] gnu: ovmf: Deprecate in favor of ovmf-x86-64.
(address . 70913@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
cab204022de91856bbe93c01920af17e58ddb4da.1715588342.git.efraim@flashner.co.il
* gnu/packages/firmware.scm (ovmf): Deprecate package in favor of
ovmf-x86-64.

Change-Id: I912c2b122f80a7f3fd473b8d91ae6e714b27808f
---
gnu/packages/firmware.scm | 100 +-------------------------------------
1 file changed, 2 insertions(+), 98 deletions(-)

Toggle diff (122 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index b0638382cb..55f78c3da6 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -30,6 +30,7 @@
(define-module (gnu packages firmware)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix memoization)
+ #:use-module (guix deprecation)
#:use-module (guix packages)
#:use-module (guix platform)
#:use-module (guix download)
@@ -1074,104 +1075,7 @@ (define-public ovmf-riscv64
(install-file "RISCV_VIRT_VARS.fd" fmw))))))))))))
(define-public ovmf
- (let ((toolchain-ver "GCC5"))
- (package
- (name "ovmf")
- (version "202311")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- ;; OVMF is part of the edk2 source tree.
- (url "https://github.com/tianocore/edk2")
- (recursive? #t) ;edk2 now uses a lot of submodules
- (commit (string-append "edk2-stable" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "136dl5cxpjpg37whzlqq7jrrjsgybmwrgkbbmks8xaixqmzwhbw0"))))
- (build-system gnu-build-system)
- (arguments
- (list
- #:tests? #f ; No check target.
- #:target #f ; Package produces firmware.
- #:phases
- #~(modify-phases %standard-phases
- (add-after 'unpack 'patch-source
- (lambda _
- (substitute* "edksetup.sh"
- (("^return \\$\\?")
- "exit $?"))))
- (replace 'configure
- (lambda _
- (let* ((cwd (getcwd))
- (tools (string-append cwd "/BaseTools"))
- (bin (string-append tools "/BinWrappers/PosixLike")))
- (setenv "WORKSPACE" cwd)
- (setenv "EDK_TOOLS_PATH" tools)
- (setenv "PYTHON3_ENABLE" "TRUE")
- (setenv "PYTHON_COMMAND" "python3")
- (setenv "PATH" (string-append (getenv "PATH") ":" bin))
- (invoke "bash" "edksetup.sh")
- (substitute* "Conf/tools_def.txt"
- ;; Guix gcc is compiled without pie
- ;; The -no-pie flag causes the Ia32 build to fail
- (("-no-pie") ""))
- (substitute* "Conf/target.txt"
- (("^TARGET[ ]*=.*$") "TARGET = RELEASE\n")
- (("^TOOL_CHAIN_TAG[ ]*=.*$")
- (string-append "TOOL_CHAIN_TAG = " #$toolchain-ver "\n"))
- (("^TARGET_ARCH[ ]*=.*$")
- (string-append "TARGET_ARCH = IA32"
- #$@(if (string=? "x86_64-linux" (%current-system))
- '(", X64")
- '())
- "\n"))
- (("^MAX_CONCURRENT_THREAD_NUMBER[ ]*=.*$")
- (format #f "MAX_CONCURRENT_THREAD_NUMBER = ~a~%"
- (number->string (parallel-job-count)))))
- ;; Build build support.
- (setenv "CC" "gcc")
- (invoke "make" "-C" tools))))
- (replace 'build
- (lambda _
- (invoke "build" "-a" "IA32" "-t" #$toolchain-ver
- "-p" "OvmfPkg/OvmfPkgIa32.dsc")))
- #$@(if (string=? "x86_64-linux" (%current-system))
- #~((add-after 'build 'build-x64
- (lambda _
- (invoke "build" "-a" "X64" "-t" #$toolchain-ver
- "-p" "OvmfPkg/OvmfPkgX64.dsc"))))
- #~())
- (replace 'install
- (lambda _
- (let ((fmw (string-append #$output "/share/firmware")))
- (mkdir-p fmw)
- (for-each
- (lambda (file)
- (copy-file (string-append "Build/OvmfIa32/RELEASE_"
- #$toolchain-ver "/FV/" file ".fd")
- (string-append fmw "/" (string-downcase file) "_ia32.bin"))
- #$@(if (string=? "x86_64-linux" (%current-system))
- #~((copy-file (string-append "Build/OvmfX64/RELEASE_"
- #$toolchain-ver "/FV/" file ".fd")
- (string-append fmw "/" (string-downcase file) "_x64.bin")))
- #~()))
- (list "OVMF"
- "OVMF_CODE"
- "OVMF_VARS"))))))))
- (native-inputs
- `(("acpica" ,acpica)
- ("nasm" ,nasm)
- ("perl" ,perl)
- ("python-3" ,python-3)
- ("util-linux" ,util-linux "lib")))
- (supported-systems '("x86_64-linux" "i686-linux"))
- (home-page "https://www.tianocore.org")
- (synopsis "UEFI firmware for QEMU")
- (description "OVMF is an EDK II based project to enable UEFI support for
-Virtual Machines. OVMF contains a sample UEFI firmware for QEMU and KVM.")
- (license (list license:expat
- license:bsd-2 license:bsd-3 license:bsd-4)))))
+ (deprecated-package "ovmf" ovmf-x86-64))
(define* (make-arm-trusted-firmware platform
#:key (triplet "aarch64-linux-gnu"))
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 13 May 10:22 +0200
[PATCH 11/11] tests: install: Use a default qemu machine for arm architectures.
(address . 70913@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
86a554995ba7ef5847407df4f034df06c8b35041.1715588342.git.efraim@flashner.co.il
* gnu/tests/install.scm (qemu-command*): Adjust qemu command when run on
armhf-linux or aarch64-linux to include a machine type.
(run-install): Same.

Change-Id: I32f85183cd8ec39c6a2e66624954743fd5983582
---
gnu/tests/install.scm | 12 ++++++++++++
1 file changed, 12 insertions(+)

Toggle diff (34 lines)
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 90e1ca6e75..36dbd9111f 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -289,6 +289,12 @@ (define* (run-install target-os target-os-source
(define marionette
(make-marionette
`(,(which #$(qemu-command system))
+ ;; Neither of these architectures have a default machine.
+ ,@(if (or (string=? "aarch64-linux" #$system)
+ (string=? "armhf-linux" #$system))
+ '("-machine" "virt"
+ "-cpu" "host")
+ '())
"-no-reboot"
"-m" "1200"
,@(if #$uefi-firmware
@@ -363,6 +369,12 @@ (define* (qemu-command* images #:key (uefi-support? #f) (memory-size 256))
(use-modules (srfi srfi-1))
`(,(string-append #$qemu-minimal "/bin/"
#$(qemu-command system))
+ ;; Neither of these architectures have a default machine.
+ ,@(if (or (string=? "aarch64-linux" #$system)
+ (string=? "armhf-linux" #$system))
+ '("-machine" "virt"
+ "-cpu" "host")
+ '())
"-snapshot" ;for the volatile, writable overlay
,@(if (file-exists? "/dev/kvm")
'("-enable-kvm")
--
Efraim Flashner <efraim@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
E
E
Efraim Flashner wrote on 27 May 10:44 +0200
Re: bug#70913: Acknowledgement ([PATCH 00/11] Combine edk2-tools and ovmf firmware)
(address . 70913-done@debbugs.gnu.org)
ZlRH42bGUZHAhZ_w@3900XT
Patches applied

--
Efraim Flashner <efraim@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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmZUR+MACgkQQarn3Mo9
g1FWfQ//ZrVxiQnbycCKt4zaETyzc+cBrSqfwAAgzp8kpO4G+8Zv0Eke5n6W+1uY
5nrGBF79YmHGM2AdFmCTrHLteI6KLTXPDef0uUM/58paaskP0liIjAn8XNe/+xIg
E/J6D+LOVEwC+PXiwl/PbeWjJK2vOmbjQAAwCNBc82zVquz5eKff1Dy+gE/Yq/R0
2V0q3Z9f/FgonaflT1dWeHECOCnbG8SLP9WQeQfpKI5Ol84eQIUUYPFIkh0CIrqJ
pWrh3ARIAcE2Bgymizi7OigNxWnqORuKXOugb02oNXT99HmO7Qzj9UPsfkBR3qAM
B38VWb1KI0xTsnecgeeblR7HNBwLf2/+G6nkijmMz/A3ciwHQ4gO1s1uq7H0/M4y
4P4VTRBIRpWtmkeQrFANUibATiPgB2LPAjsCqYRyYwgbFOaYFIZFVz97rqhw1lgl
kD/a2QRHW6bmYSCHzJElPZGKXeKBsQ6IqK7PXvKcVKA0K3NJBal+so338oVJVeIe
XgKjJuP55Y2Rmljk9Cda3n2OKGWS+ThA5QIcchifVPyun/PZWZQT/GQv7FLAKO7K
hj3PCgSwBLruLFod2vLTqKI2AMFdGyTNiy3+6Ciyriaov1UOY0Sxa2hpceetEX1M
QEU3rdj/0LyUqCunCr3auRajaNBz8LbQ7gHfWZfeobrVOL2KZS0=
=xCRZ
-----END PGP SIGNATURE-----


Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 70913@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 70913
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch