qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>
Subject: [RFC PATCH] pc-bios/meson: split blobs by available targets
Date: Thu, 19 Jun 2025 12:16:32 +0100	[thread overview]
Message-ID: <20250619111632.1076331-1-alex.bennee@linaro.org> (raw)

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
+
+  if 'i386-softmmu' in target_dirs
+    fds += [ 'edk2-i386-code.fd',
+             'edk2-i386-secure-code.fd',
+             'edk2-i386-vars.fd' ]
+  endif
+
+  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



             reply	other threads:[~2025-06-19 11:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19 11:16 Alex Bennée [this message]
2025-07-28 16:16 ` [RFC PATCH] pc-bios/meson: split blobs by available targets Daniel P. Berrangé

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=20250619111632.1076331-1-alex.bennee@linaro.org \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).