Skip to contentSkip to conversation

package/qemu: refactor target emulator selection

PATCH Superseded [email protected] 1 participant 1 message Nov 13, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/qemu: refactor target emulator selection

From: Carlos Santos <[email protected]>

The current mechanism to select emulation targets works this way:

- BR2_PACKAGE_QEMU_SYSTEM selects the "system" (softmmu) targets. It selects FDT and creates a dependency on the "dtc" package but this is not always necessary. Only 14 system targets, out of 31, actually require FDT.

- BR2_PACKAGE_QEMU_LINUX_USER selects the "linux-user" targets. It does not select FDT, which is not required by linux-user emulators.

- Alternatively, we fill BR2_PACKAGE_QEMU_CUSTOM_TARGETS with a list of emulators (e.g. "x86_64-softmmu x86_64-linux-user"). Then we pass "--enable-system --enable-linux-user --target-list="..." to the configure script, so QEMU builds its list of default targets, from which it checks if the specified subset is valid.

Since CUSTOM_TARGETS does not select FDT, we can get build errors like this:

../meson.build:2778:2: ERROR: Problem encountered: fdt not available but required by targets x86_64-softmmu

We could select FDT when CUSTOM_TARGETS is set, but this would force an unnecessary dependency on dtc, as BR2_PACKAGE_QEMU_SYSTEM does.

In order to fix these problems, refactor the package configuration:

- Keep BR2_PACKAGE_QEMU_SYSTEM and BR2_PACKAGE_QEMU_LINUX_USER, which by default build all corresponding target emulators.

- Add a BR2_PACKAGE_QEMU_CHOOSE_TARGETS config, to permit choosing the desired emulators.

- Add configs for each supported target. They select FDT, when needed.

- Move QEMU to a separate menu, since the number of configuration itens became too large.

- Select BR2_LEGACY if BR2_PACKAGE_QEMU_CUSTOM_TARGETS is set, because this situation requires user intervention to reconfigure the package.

- Reorganize the make file accordingly. Selecting CHOOSE_TARGETS without choosing at least one emulator is considered an error.

---
 Config.in.legacy       |  13 ++
 package/qemu/Config.in | 282 ++++++++++++++++++++++++++++++++++-------
 package/qemu/qemu.mk   |  99 +++++++++++++--
 3 files changed, 334 insertions(+), 60 deletions(-)
Config.in.legacy +13 -0
index 0e63d59a98..290f4625ab 100644
@@ -144,6 +144,19 @@ endif
 
 ###############################################################################
 
+comment "Legacy options removed in 2022.02"
+
+config BR2_PACKAGE_QEMU_CUSTOM_TARGETS
+	string "the QEMU specific targets option has been removed"
+	help
+	  This option has been replaced by a list of individual targets
+	  for the many architectures supported by QEMU.
+
+config BR2_PACKAGE_QEMU_CUSTOM_TARGETS_WRAP
+	bool
+	default y if BR2_PACKAGE_QEMU_CUSTOM_TARGETS != ""
+	select BR2_LEGACY
+
 comment "Legacy options removed in 2022.11"
 
 config BR2_KERNEL_HEADERS_5_17
package/qemu/Config.in +233 -49

329 lines not on this page · raw message

package/qemu/qemu.mk +88 -11

118 lines not on this page · raw message

Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot