From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [RFC PATCH] pc-bios/meson: split blobs by available targets
Date: Mon, 28 Jul 2025 17:16:38 +0100 [thread overview]
Message-ID: <aIeiZu57THJpFv6R@redhat.com> (raw)
In-Reply-To: <20250619111632.1076331-1-alex.bennee@linaro.org>
On Thu, Jun 19, 2025 at 12:16:32PM +0100, Alex Bennée wrote:
> While building some kvm-unit-tests inside a buildroot environment I
> noticed the QEMU installer installs all blobs regardless of the
> enabled targets. Buildroot images typically try and keep filesystem
> and thin as possible we probably should skip blobs that will never be
> used.
>
> We could also go further and refer to enabled devices to further
> filter out things like option roms.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> pc-bios/meson.build | 202 ++++++++++++++++++++++++++++----------------
> 1 file changed, 129 insertions(+), 73 deletions(-)
>
> diff --git a/pc-bios/meson.build b/pc-bios/meson.build
> index 3c41620044..cb0b59fbce 100644
> --- a/pc-bios/meson.build
> +++ b/pc-bios/meson.build
> @@ -1,19 +1,36 @@
> roms = []
> if unpack_edk2_blobs
> - fds = [
> - 'edk2-aarch64-code.fd',
> - 'edk2-arm-code.fd',
> - 'edk2-arm-vars.fd',
> - 'edk2-riscv-code.fd',
> - 'edk2-riscv-vars.fd',
> - 'edk2-i386-code.fd',
> - 'edk2-i386-secure-code.fd',
> - 'edk2-i386-vars.fd',
> - 'edk2-x86_64-code.fd',
> - 'edk2-x86_64-secure-code.fd',
> - 'edk2-loongarch64-code.fd',
> - 'edk2-loongarch64-vars.fd',
> - ]
> +
> + fds = []
> + if 'aarch64-softmmu' in target_dirs
> + fds += [ 'edk2-aarch64-code.fd' ]
> + endif
> +
> + if 'arm-softmmu' in target_dirs or 'aarch64-softmmu' in target_dirs
> + fds += [ 'edk2-arm-code.fd',
> + 'edk2-arm-vars.fd' ]
> + endif
> +
> + if 'riscv64-softmmu' in target_dirs
> + fds += [ 'edk2-riscv-code.fd',
> + 'edk2-riscv-vars.fd' ]
> + endif
Given the repeated code pattern, how about making it a bit
more metadata driven. eg something approx like
fdmap = {
'edk2-aarch64-code.fd': ["aarch64"],
'edk2-arm-code.fd': ["aarch64", "arm],
'edk2-arm-vars.fd',: ["aarch64", "arm"],
'edk2-riscv-code.fd': ["riscv64"],
'edk2-riscv-vars.fd': ["riscv64"],
....
}
fds = []
foreach fd, targets: fdmap
want = false
foreach target: targets
if target + "-softmmu" in target_dirs
want = true
endif
endforeach
if want
fds += fd
endif
endforeach
> + if 'i386-softmmu' in target_dirs
> + fds += [ 'edk2-i386-code.fd',
> + 'edk2-i386-secure-code.fd',
> + 'edk2-i386-vars.fd' ]
> + endif
I guess technically these could be used together with the x86_64
target too, as you've done with arm 32-bit edk ?
> +
> + if 'x86_64-softmmu' in target_dirs
> + fds += [ 'edk2-x86_64-code.fd',
> + 'edk2-x86_64-secure-code.fd' ]
> + endif
> +
> + if 'loongarch64' in target_dirs
> + fds += [ 'edk2-loongarch64-code.fd',
> + 'edk2-loongarch64-vars.fd' ]
> + endif
>
> foreach f : fds
> roms += custom_target(f,
> @@ -27,65 +44,104 @@ if unpack_edk2_blobs
> endforeach
> endif
>
> -blobs = [
> - 'ast27x0_bootrom.bin',
> - 'bios.bin',
> - 'bios-256k.bin',
> - 'bios-microvm.bin',
> - 'qboot.rom',
> - 'vgabios.bin',
> - 'vgabios-cirrus.bin',
> - 'vgabios-stdvga.bin',
> - 'vgabios-vmware.bin',
> - 'vgabios-qxl.bin',
> - 'vgabios-virtio.bin',
> - 'vgabios-ramfb.bin',
> - 'vgabios-bochs-display.bin',
> - 'vgabios-ati.bin',
> - 'openbios-sparc32',
> - 'openbios-sparc64',
> - 'openbios-ppc',
> - 'QEMU,tcx.bin',
> - 'QEMU,cgthree.bin',
> - 'pxe-e1000.rom',
> - 'pxe-eepro100.rom',
> - 'pxe-ne2k_pci.rom',
> - 'pxe-pcnet.rom',
> - 'pxe-rtl8139.rom',
> - 'pxe-virtio.rom',
> - 'efi-e1000.rom',
> - 'efi-eepro100.rom',
> - 'efi-ne2k_pci.rom',
> - 'efi-pcnet.rom',
> - 'efi-rtl8139.rom',
> - 'efi-virtio.rom',
> - 'efi-e1000e.rom',
> - 'efi-vmxnet3.rom',
> - 'qemu-nsis.bmp',
> - 'multiboot.bin',
> - 'multiboot_dma.bin',
> - 'linuxboot.bin',
> - 'linuxboot_dma.bin',
> - 'kvmvapic.bin',
> - 'pvh.bin',
> - 's390-ccw.img',
> - 'slof.bin',
> - 'skiboot.lid',
> - 'pnv-pnor.bin',
> - 'palcode-clipper',
> - 'u-boot.e500',
> - 'u-boot-sam460-20100605.bin',
> - 'qemu_vga.ndrv',
> - 'edk2-licenses.txt',
> - 'hppa-firmware.img',
> - 'hppa-firmware64.img',
> - 'opensbi-riscv32-generic-fw_dynamic.bin',
> - 'opensbi-riscv64-generic-fw_dynamic.bin',
> - 'npcm7xx_bootrom.bin',
> - 'npcm8xx_bootrom.bin',
> - 'vof.bin',
> - 'vof-nvram.bin',
> -]
> +blobs = []
> +
> +if 'aarch64-softmmu' in target_dirs
> + blobs += [ 'ast27x0_bootrom.bin',
> + 'npcm7xx_bootrom.bin',
> + 'npcm8xx_bootrom.bin' ]
> +endif
> +
> +# Most x86 blobs start in real mode anyway, need to check which blobs
> +# are x86_64 only. Also we could limit the option roms based on the
> +# build config.
> +if 'x86_64-softmmu' in target_dirs or 'i386-softmmu' in target_dirs
> + blobs += [ 'bios.bin',
> + 'bios-256k.bin',
> + 'bios-microvm.bin',
> + 'qboot.rom',
> + 'vgabios.bin',
> + 'vgabios-cirrus.bin',
> + 'vgabios-stdvga.bin',
> + 'vgabios-vmware.bin',
> + 'vgabios-qxl.bin',
> + 'vgabios-virtio.bin',
> + 'vgabios-ramfb.bin',
> + 'vgabios-bochs-display.bin',
> + 'vgabios-ati.bin',
> + 'pxe-e1000.rom',
> + 'pxe-eepro100.rom',
> + 'pxe-ne2k_pci.rom',
> + 'pxe-pcnet.rom',
> + 'pxe-rtl8139.rom',
> + 'pxe-virtio.rom',
> + 'efi-e1000.rom',
> + 'efi-eepro100.rom',
> + 'efi-ne2k_pci.rom',
> + 'efi-pcnet.rom',
> + 'efi-rtl8139.rom',
> + 'efi-virtio.rom',
> + 'efi-e1000e.rom',
> + 'efi-vmxnet3.rom',
> + 'multiboot.bin',
> + 'multiboot_dma.bin',
> + 'linuxboot.bin',
> + 'linuxboot_dma.bin',
> + 'kvmvapic.bin',
> + 'pvh.bin' ]
> +endif
> +
> +if 'sparc32-softmmu' in target_dirs
> + blobs += [ 'openbios-sparc32',
> + 'QEMU,tcx.bin',
> + 'QEMU,cgthree.bin' ]
> +endif
> +
> +if 'sparc64-softmmu' in target_dirs
> + blobs += [ 'openbios-sparc64' ]
> +endif
> +
> +if 'ppc64-softmmu' in target_dirs
> + blobs += [ 'openbios-ppc',
> + 'slof.bin',
> + 'skiboot.lid',
> + 'pnv-pnor.bin',
> + 'u-boot.e500',
> + 'u-boot-sam460-20100605.bin',
> + 'vof.bin',
> + 'vof-nvram.bin' ]
> +endif
> +
> +if 'ppc32-softmmu' in target_dirs
> + blobs += [ 'qemu_vga.ndrv' ]
> +endif
> +
> +if host_os == 'windows'
> + blobs += [ 'qemu-nsis.bmp' ]
> +endif
> +
> +if 's390x-softmmu' in target_dirs
> + blobs += [ 's390-ccw.img' ]
> +endif
> +
> +if 'alpha-softmmu' in target_dirs
> + blobs += [ 'palcode-clipper' ]
> +endif
> +
> +if 'hppa-softmmu' in target_dirs
> + blobs += [ 'hppa-firmware.img',
> + 'hppa-firmware64.img' ]
> +endif
> +
> +if 'riscv32-softmmu' in target_dirs
> + blobs += [ 'opensbi-riscv32-generic-fw_dynamic.bin' ]
> +endif
> +
> +if 'riscv64-softmmu' in target_dirs
> + blobs += [ 'opensbi-riscv64-generic-fw_dynamic.bin' ]
> +endif
> +
> +blobs += [ 'edk2-licenses.txt' ]
>
> if get_option('install_blobs')
> install_data(blobs, install_dir: qemu_datadir, install_mode: 'rw-r--r--')
> --
> 2.47.2
>
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
prev parent reply other threads:[~2025-07-28 16:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 11:16 [RFC PATCH] pc-bios/meson: split blobs by available targets Alex Bennée
2025-07-28 16:16 ` Daniel P. Berrangé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aIeiZu57THJpFv6R@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.