Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 947789 - sys-firmware/edk2-bin package not generating files for architectures other than host
Summary: sys-firmware/edk2-bin package not generating files for architectures other th...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major
Assignee: Virtualization Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-10 04:42 UTC by Bob
Modified: 2025-01-11 23:58 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bob 2025-01-10 04:42:45 UTC
This issue exists in both sys-firmware/edk2-bin and sys-firmware/edk2.

The following snippet shows some of the output files after this package gets built.

.
/usr/share/qemu/firmware/50-edk2-ovmf-x64-sb.json
/usr/share/qemu/firmware/60-edk2-ovmf-x64.json
.

While this is fine for running x86_64 VMs on my x86_64 host qemu is capable of running many other architectures such as aarch64. However I'm unable to boot any aarch64 VM with uefi due to edk2 not producing aarch64 files.

This isn't the case on other distros from what I can tell. Perhaps we can make use of the existing QEMU_SOFTMMU_TARGETS or similar to instruct the build system to produce those target architectures.
Comment 1 Greg Kubaryk 2025-01-10 05:29:38 UTC
emerge --info, affected version number(s)?
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-10 06:07:06 UTC
Chewi and I were just discussing this the other day for e.g. running an amd64 VM on arm64.

I think we probably want some sort of USE_EXPAND indeed. It may involve us then telling the user to run crossdev mnanually for the time being if a crosscompiler for that arch isn't available.

(Tangentially, we also talked about maybe having a template for mingw64-toolchain/bpf-toolchain-style ebuilds which would make some stuff easier, but that's an aside.)
Comment 3 James Le Cuirot gentoo-dev 2025-01-10 08:51:37 UTC
This isn't true for edk2-bin though, that installs for all the architectures that sys-firmware/edk2 currently supports.
Comment 4 Bob 2025-01-11 17:01:46 UTC
(In reply to James Le Cuirot from comment #3)
> This isn't true for edk2-bin though, that installs for all the architectures
> that sys-firmware/edk2 currently supports.

Certainly not the case for me.

```
root@box ~ $ equery f edk2-bin
 * Searching for edk2-bin ...
 * Contents of sys-firmware/edk2-bin-202202:
/usr
/usr/share
/usr/share/doc
/usr/share/doc/edk2-bin-202202
/usr/share/doc/edk2-bin-202202/README.gentoo.bz2
/usr/share/edk2-ovmf
/usr/share/edk2-ovmf/EnrollDefaultKeys.efi
/usr/share/edk2-ovmf/OVMF_CODE.fd
/usr/share/edk2-ovmf/OVMF_CODE.secboot.fd
/usr/share/edk2-ovmf/OVMF_VARS.fd
/usr/share/edk2-ovmf/Shell.efi
/usr/share/edk2-ovmf/UefiShell.img
/usr/share/qemu
/usr/share/qemu/firmware
/usr/share/qemu/firmware/50-edk2-ovmf-x64-sb.json
/usr/share/qemu/firmware/60-edk2-ovmf-x64.json
```
Comment 5 James Le Cuirot gentoo-dev 2025-01-11 17:05:50 UTC
Okay, but sys-firmware/edk2-202202 only supported amd64. ;) 202408 and 202411 also have arm64 and riscv.
Comment 6 James Le Cuirot gentoo-dev 2025-01-11 17:06:19 UTC
Slight correction, only 202411 has riscv.
Comment 7 Bob 2025-01-11 18:22:22 UTC
(In reply to James Le Cuirot from comment #6)
> Slight correction, only 202411 has riscv.

If you're talking about the -bin version sys-firmware/edk2-202202 "supports"
[amd64, x86, aarch64 ppc64]
source: https://packages.gentoo.org/packages/sys-firmware/edk2-bin

If you're talking about the non -bin version, it "supports"
[amd64]
but unmasked supports
[amd64, aarch64, riscv]
source: https://packages.gentoo.org/packages/sys-firmware/edk2

I think you're conflating "supports" to the host OS architecture whereas we're talking about how this package is not building artifacts for non-host architectures.

I'm all ears for how to get multiple architecture efi binaries/json configs if you know of a way to make it work. I've been using the -bin package variant.
Comment 8 James Le Cuirot gentoo-dev 2025-01-11 20:33:26 UTC
(In reply to Bob from comment #7)
> I think you're conflating "supports" to the host OS architecture whereas
> we're talking about how this package is not building artifacts for non-host
> architectures.

I'm really not. As I said, sys-firmware/edk2-202202 only supported amd64. By that, I mean it only built firmware for amd64. By extension, edk2-bin-202202 only installed firmware for amd64, regardless of which architecture you installed it on. I recently did a lot of work to bump and extend our packages beyond amd64. edk2 now builds firmware for arm64 and riscv, and edk2-bin installs these, again regardless of which architecture you're installing on. There have also been other improvements like the firmware being ready for Secure Boot out of the box.

If you want to build from source for other architectures, you can, but that requires setting up a cross toolchain with crossdev. I don't expect many users to do this. We're thinking about how we can make this work better in future.
Comment 9 Bob 2025-01-11 23:53:27 UTC
(In reply to James Le Cuirot from comment #8)
> (In reply to Bob from comment #7)
> > I think you're conflating "supports" to the host OS architecture whereas
> > we're talking about how this package is not building artifacts for non-host
> > architectures.
> 
> I'm really not. As I said, sys-firmware/edk2-202202 only supported amd64. By
> that, I mean it only built firmware for amd64. By extension, edk2-bin-202202
> only installed firmware for amd64, regardless of which architecture you
> installed it on. I recently did a lot of work to bump and extend our
> packages beyond amd64. edk2 now builds firmware for arm64 and riscv, and
> edk2-bin installs these, again regardless of which architecture you're
> installing on. There have also been other improvements like the firmware
> being ready for Secure Boot out of the box.
> 
> If you want to build from source for other architectures, you can, but that
> requires setting up a cross toolchain with crossdev. I don't expect many
> users to do this. We're thinking about how we can make this work better in
> future.

After unmasking sys-firmware/edk-bin ~amd64 to try version 202411 I'm unable to try it as app-emulation/qemu pulls in the old one. I've unmasked qemu and the latest version still pulls in 202202.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-11 23:58:09 UTC
(In reply to Bob from comment #9)
> 
> After unmasking sys-firmware/edk-bin ~amd64 to try version 202411 I'm unable
> to try it as app-emulation/qemu pulls in the old one. I've unmasked qemu and
> the latest version still pulls in 202202.

Try -pin-upstream-blobs.