package/qemu: refactor target emulator selection
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.
Notes about the list of enabled targets:
- when the user enables both system and user emulation, we provide no
way to be able to build all system bt only parts of user (or the other
way around), because the qemu build system does not allow that: when a
list of target is passed, it applies to both system and user
emulation;
- as a consequence and in the same spirit, we also do not sanity-check
that at least one system, resp. user, target is enabled when system,
resp. user, emulation is enabled; we only require that one target is
enabled, so that the list is not empty.
Signed-off-by: Carlos Santos <unixmania@gmail.com>
[yann.morin.1998@free.fr:
- always build at least user or system
- add help text to BR2_PACKAGE_QEMU_CHOOSE_TARGETS
- simplify prompt for BR2_PACKAGE_QEMU_CHOOSE_TARGETS
- simplify list of targets with unique QEMU_TARGET_LIST_y
- extend the commit log with "Notes about the list of enabled targets"
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
3 files changed