package/qemu: introduce kvm and tcg system options

When building system binaries you may not even want TCG support if you
are only intending to use KVM. Provide the options so the user can
select only what they need.

With only KVM selected the QEMU build will generally only build the
binary for your target system. We keep TCG support on by default so as
not to break existing defconfigs.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Alex Bennée
2025-09-11 22:27:44 +01:00
committed by Thomas Petazzoni
parent 137d6e249d
commit 46ce2e7480
2 changed files with 33 additions and 6 deletions

View File

@@ -54,11 +54,27 @@ config BR2_PACKAGE_QEMU_SYSTEM
depends on !BR2_STATIC_LIBS # dtc
select BR2_PACKAGE_PIXMAN
select BR2_PACKAGE_QEMU_FDT if !BR2_PACKAGE_QEMU_CHOOSE_TARGETS
# Make sure at least one of tcg or kvm is enabled
select BR2_PACKAGE_QEMU_SYSTEM_TCG if !BR2_PACKAGE_QEMU_SYSTEM_KVM
help
Say 'y' to build system emulators/virtualisers.
if BR2_PACKAGE_QEMU_SYSTEM
config BR2_PACKAGE_QEMU_SYSTEM_KVM
bool "Enable KVM system virtualisation"
default y
help
Say 'y' here to enable a QEMU with KVM support.
If unsure, say 'y'
config BR2_PACKAGE_QEMU_SYSTEM_TCG
bool "Enable TCG system emulation"
default y
help
Say 'y' here to enable QEMU binaries which can emulate foreign
architectures using the TCG JIT.
config BR2_PACKAGE_QEMU_BLOBS
bool "Install binary blobs"
default y
@@ -130,12 +146,11 @@ config BR2_PACKAGE_QEMU_LINUX_USER
config BR2_PACKAGE_QEMU_CHOOSE_TARGETS
bool "Select individual emulator targets"
depends on BR2_PACKAGE_QEMU_SYSTEM || BR2_PACKAGE_QEMU_LINUX_USER
depends on BR2_PACKAGE_QEMU_SYSTEM_TCG || BR2_PACKAGE_QEMU_LINUX_USER
help
By default, all targets (system and/or user, subject to the
corresponding options, above) are built. If you only need a
subset of the emulated targets, say 'y' here and enable at
least one target, below.
By default, all targets system targets are built. If you
only need a subset of the emulated targets, say 'y' here and
enable at least one target, below.
if BR2_PACKAGE_QEMU_CHOOSE_TARGETS

View File

@@ -48,6 +48,19 @@ QEMU_VARS = LIBTOOL=$(HOST_DIR)/bin/libtool
ifeq ($(BR2_PACKAGE_QEMU_SYSTEM),y)
QEMU_DEPENDENCIES += pixman
QEMU_OPTS += --enable-system
ifeq ($(BR2_PACKAGE_QEMU_SYSTEM_KVM), y)
QEMU_OPTS += --enable-kvm
else
QEMU_OPTS += --disable-kvm
endif
ifeq ($(BR2_PACKAGE_QEMU_SYSTEM_TCG), y)
QEMU_OPTS += --enable-tcg
else
QEMU_OPTS += --disable-tcg
endif
QEMU_TARGET_LIST_$(BR2_PACKAGE_QEMU_TARGET_AARCH64) += aarch64-softmmu
QEMU_TARGET_LIST_$(BR2_PACKAGE_QEMU_TARGET_ALPHA) += alpha-softmmu
QEMU_TARGET_LIST_$(BR2_PACKAGE_QEMU_TARGET_ARM) += arm-softmmu
@@ -333,7 +346,6 @@ define QEMU_CONFIGURE_CMDS
--disable-whpx \
--disable-xen \
--enable-attr \
--enable-kvm \
--enable-vhost-net \
--disable-download \
--disable-hexagon-idef-parser \