From 46ce2e7480b936cab36cddeac98efe96e9c2ff97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Thu, 11 Sep 2025 22:27:44 +0100 Subject: [PATCH] package/qemu: introduce kvm and tcg system options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Thomas Petazzoni --- package/qemu/Config.in | 25 ++++++++++++++++++++----- package/qemu/qemu.mk | 14 +++++++++++++- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/package/qemu/Config.in b/package/qemu/Config.in index ff7423bc4c..e16eafe446 100644 --- a/package/qemu/Config.in +++ b/package/qemu/Config.in @@ -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 diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk index 1672ac8f19..97f8e22091 100644 --- a/package/qemu/qemu.mk +++ b/package/qemu/qemu.mk @@ -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 \