public inbox for buildroot@busybox.net
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/3] kvm-unit-tests: update deps and fine tune qemu
@ 2025-06-19 14:48 Alex Bennée
  2025-06-19 14:48 ` [Buildroot] [PATCH 1/3] package/kvm-unit-tests: assume AArch64 supports KVM Alex Bennée
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Alex Bennée @ 2025-06-19 14:48 UTC (permalink / raw)
  To: buildroot

The kvm-unit-tests recipe is a little out of date with the
dependencies it needs. With that and some tweaking of the of processor
dependencies we can now build kvm-unit-tests for arm64.

On the way I've added some new config options for QEMU so you can just
select your native, kvm-only QEMU build.

Alex.

Alex Bennée (3):
  package/kvm-unit-tests: assume AArch64 supports KVM
  package/kvm-unit-tests: add some missing deps
  package/qemu: introduce kvm and tcg system options

 package/kvm-unit-tests/Config.in         | 17 +++++++++++------
 package/kvm-unit-tests/kvm-unit-tests.mk |  1 +
 package/qemu/Config.in                   | 23 ++++++++++++++++++-----
 package/qemu/qemu.mk                     | 13 +++++++++++++
 4 files changed, 43 insertions(+), 11 deletions(-)

-- 
2.47.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/3] package/kvm-unit-tests: assume AArch64 supports KVM
  2025-06-19 14:48 [Buildroot] [PATCH 0/3] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
@ 2025-06-19 14:48 ` Alex Bennée
  2025-07-05 18:14   ` Romain Naour via buildroot
  2025-06-19 14:48 ` [Buildroot] [PATCH 2/3] package/kvm-unit-tests: add some missing deps Alex Bennée
  2025-06-19 14:48 ` [Buildroot] [PATCH 3/3] package/qemu: introduce kvm and tcg system options Alex Bennée
  2 siblings, 1 reply; 8+ messages in thread
From: Alex Bennée @ 2025-06-19 14:48 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Huth, Cyril Bur

Although it is possible to configure an AArch64 CPU without support
for EL2 in practice all the common AArch64 have supported
virtualisation from the start.

If we really wanted to be strict we could blacklist known non-EL2 CPUs
but AFAICT all the current ones in the config have EL2.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 package/kvm-unit-tests/Config.in | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
index 02ea8dd58c..000f5dcecf 100644
--- a/package/kvm-unit-tests/Config.in
+++ b/package/kvm-unit-tests/Config.in
@@ -1,13 +1,12 @@
 config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
 	bool
 	# On ARM, it needs virtualization extensions and little endian CPUs
-	default y if (BR2_arm || BR2_aarch64) && \
+	default y if BR2_arm && \
 		(BR2_cortex_a7 || BR2_cortex_a12 || \
 		BR2_cortex_a15 || BR2_cortex_a15_a7 || \
-		BR2_cortex_a17 || BR2_cortex_a17_a7 || \
-		BR2_cortex_a55 || BR2_cortex_a75 || \
-		BR2_cortex_a75_a55 || BR2_cortex_a76 || \
-		BR2_cortex_a76_a55)
+		BR2_cortex_a17 || BR2_cortex_a17_a7)
+	# For AArch64 we can assume all v8.0+ support virtualization
+	default y if BR2_aarch64
 	default y if BR2_i386 || BR2_x86_64
 	default y if BR2_powerpc64 || BR2_powerpc64le
 	default y if BR2_s390x
-- 
2.47.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 2/3] package/kvm-unit-tests: add some missing deps
  2025-06-19 14:48 [Buildroot] [PATCH 0/3] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
  2025-06-19 14:48 ` [Buildroot] [PATCH 1/3] package/kvm-unit-tests: assume AArch64 supports KVM Alex Bennée
@ 2025-06-19 14:48 ` Alex Bennée
  2025-07-05 19:09   ` Romain Naour via buildroot
  2025-06-19 14:48 ` [Buildroot] [PATCH 3/3] package/qemu: introduce kvm and tcg system options Alex Bennée
  2 siblings, 1 reply; 8+ messages in thread
From: Alex Bennée @ 2025-06-19 14:48 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Huth, Cyril Bur

To run the tests we need a system QEMU, timeout, getconf and nmap-ncat
so update the depends for them.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
TODO:
  - there doesn't seem to be a way to depend on utils for getconf
---
 package/kvm-unit-tests/Config.in         | 8 +++++++-
 package/kvm-unit-tests/kvm-unit-tests.mk | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
index 000f5dcecf..3944a224f3 100644
--- a/package/kvm-unit-tests/Config.in
+++ b/package/kvm-unit-tests/Config.in
@@ -19,6 +19,10 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
 	# x86-64 we use the host gcc (see .mk file for details)
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 || !BR2_i386
 	depends on BR2_HOSTARCH = "x86_64" || !BR2_x86_64
+	depends on BR2_PACKAGE_QEMU_SYSTEM # for qemu-system-$ARCH
+	depends on BR2_PACKAGE_COREUTILS # for timeout
+	depends on (BR2_PACKAGE_GLIBC_UTILS || BR2_UCLIBC_INSTALL_UTILS) # getconf
+	depends on BR2_PACKAGE_NMAP_NCAT # for ncat
 	select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64
 	help
 	  kvm-unit-tests is a project as old as KVM. As its name
@@ -38,6 +42,8 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
 
 	  http://www.linux-kvm.org/page/KVM-unit-tests
 
-comment "kvm-unit-tests needs a toolchain w/ gcc >= 4.5"
+comment "kvm-unit-tests needs a toolchain w/ gcc >= 4.5, qemu-system, timeout, getconf and ncat"
 	depends on BR2_i386
 	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
+	depends on !(BR2_PACKAGE_QEMU_SYSTEM && BR2_PACKAGE_COREUTILS && BR2_PACKAGE_NMAP_NCAT)
+	depends on !(BR2_PACKAGE_GLIBC_UTILS || BR2_UCLIBC_INSTALL_UTILS)
diff --git a/package/kvm-unit-tests/kvm-unit-tests.mk b/package/kvm-unit-tests/kvm-unit-tests.mk
index 73d20d6b2e..6234a9986c 100644
--- a/package/kvm-unit-tests/kvm-unit-tests.mk
+++ b/package/kvm-unit-tests/kvm-unit-tests.mk
@@ -9,6 +9,7 @@ KVM_UNIT_TESTS_SOURCE = kvm-unit-tests-v$(KVM_UNIT_TESTS_VERSION).tar.bz2
 KVM_UNIT_TESTS_SITE = https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/archive/v$(KVM_UNIT_TESTS_VERSION)
 KVM_UNIT_TESTS_LICENSE = GPL-2.0, LGPL-2.0
 KVM_UNIT_TESTS_LICENSE_FILES = COPYRIGHT LICENSE
+KVM_UNIT_TESTS_DEPENDENCIES = coreutils nmap-ncat
 
 ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)
 KVM_UNIT_TESTS_ARCH = aarch64
-- 
2.47.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 3/3] package/qemu: introduce kvm and tcg system options
  2025-06-19 14:48 [Buildroot] [PATCH 0/3] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
  2025-06-19 14:48 ` [Buildroot] [PATCH 1/3] package/kvm-unit-tests: assume AArch64 supports KVM Alex Bennée
  2025-06-19 14:48 ` [Buildroot] [PATCH 2/3] package/kvm-unit-tests: add some missing deps Alex Bennée
@ 2025-06-19 14:48 ` Alex Bennée
  2025-07-05 19:26   ` Romain Naour via buildroot
  2 siblings, 1 reply; 8+ messages in thread
From: Alex Bennée @ 2025-06-19 14:48 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

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. It also implies you cannot select
additional targets unless you enable user-mode or TCG support for
system.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 package/qemu/Config.in | 23 ++++++++++++++++++-----
 package/qemu/qemu.mk   | 13 +++++++++++++
 2 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/package/qemu/Config.in b/package/qemu/Config.in
index 2d15ab1ea9..af218583fe 100644
--- a/package/qemu/Config.in
+++ b/package/qemu/Config.in
@@ -59,6 +59,20 @@ config BR2_PACKAGE_QEMU_SYSTEM
 
 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 enabled. If unsure, say 'y'
+
+config BR2_PACKAGE_QEMU_SYSTEM_TCG
+       bool "Enable TCG system emulation"
+       default n
+       help
+         Say 'y' here to enable QEMU binarys which can emulate foriegn
+         architectures using the TCG JIT.
+
+
 config BR2_PACKAGE_QEMU_BLOBS
 	bool "Install binary blobs"
 	default y
@@ -130,12 +144,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 when TCG is
+	  enabled. 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 fdc8591e54..19703ba3e3 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
-- 
2.47.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 1/3] package/kvm-unit-tests: assume AArch64 supports KVM
  2025-06-19 14:48 ` [Buildroot] [PATCH 1/3] package/kvm-unit-tests: assume AArch64 supports KVM Alex Bennée
@ 2025-07-05 18:14   ` Romain Naour via buildroot
  0 siblings, 0 replies; 8+ messages in thread
From: Romain Naour via buildroot @ 2025-07-05 18:14 UTC (permalink / raw)
  To: Alex Bennée, buildroot; +Cc: Thomas Huth, Cyril Bur

Hello Alex,

Le 19/06/2025 à 16:48, Alex Bennée a écrit :
> Although it is possible to configure an AArch64 CPU without support
> for EL2 in practice all the common AArch64 have supported
> virtualisation from the start.
> 
> If we really wanted to be strict we could blacklist known non-EL2 CPUs
> but AFAICT all the current ones in the config have EL2.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  package/kvm-unit-tests/Config.in | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
> index 02ea8dd58c..000f5dcecf 100644
> --- a/package/kvm-unit-tests/Config.in
> +++ b/package/kvm-unit-tests/Config.in
> @@ -1,13 +1,12 @@
>  config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
>  	bool
>  	# On ARM, it needs virtualization extensions and little endian CPUs
> -	default y if (BR2_arm || BR2_aarch64) && \
> +	default y if BR2_arm && \
>  		(BR2_cortex_a7 || BR2_cortex_a12 || \
>  		BR2_cortex_a15 || BR2_cortex_a15_a7 || \
> -		BR2_cortex_a17 || BR2_cortex_a17_a7 || \
> -		BR2_cortex_a55 || BR2_cortex_a75 || \
> -		BR2_cortex_a75_a55 || BR2_cortex_a76 || \
> -		BR2_cortex_a76_a55)

BR2_cortex_a76 and BR2_cortex_a76_a55 can be used with BR2_arm=y.
Only BR2_cortex_a55 and BR2_cortex_a75 depends on BR2_ARCH_IS_64.

https://gitlab.com/buildroot.org/buildroot/-/commit/e65a173e5243bb9fdecc4e1792e473116d1de9ef

Best regards,
Romain


> +		BR2_cortex_a17 || BR2_cortex_a17_a7)
> +	# For AArch64 we can assume all v8.0+ support virtualization
> +	default y if BR2_aarch64
>  	default y if BR2_i386 || BR2_x86_64
>  	default y if BR2_powerpc64 || BR2_powerpc64le
>  	default y if BR2_s390x

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 2/3] package/kvm-unit-tests: add some missing deps
  2025-06-19 14:48 ` [Buildroot] [PATCH 2/3] package/kvm-unit-tests: add some missing deps Alex Bennée
@ 2025-07-05 19:09   ` Romain Naour via buildroot
  2025-07-11 11:30     ` Alex Bennée
  0 siblings, 1 reply; 8+ messages in thread
From: Romain Naour via buildroot @ 2025-07-05 19:09 UTC (permalink / raw)
  To: Alex Bennée, buildroot; +Cc: Thomas Huth, Cyril Bur

Hi Alex, All,

Le 19/06/2025 à 16:48, Alex Bennée a écrit :
> To run the tests we need a system QEMU, timeout, getconf and nmap-ncat
> so update the depends for them.

Ok so, they are runtime dependencies then.

> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> TODO:
>   - there doesn't seem to be a way to depend on utils for getconf
> ---
>  package/kvm-unit-tests/Config.in         | 8 +++++++-
>  package/kvm-unit-tests/kvm-unit-tests.mk | 1 +
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
> index 000f5dcecf..3944a224f3 100644
> --- a/package/kvm-unit-tests/Config.in
> +++ b/package/kvm-unit-tests/Config.in
> @@ -19,6 +19,10 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
>  	# x86-64 we use the host gcc (see .mk file for details)
>  	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 || !BR2_i386
>  	depends on BR2_HOSTARCH = "x86_64" || !BR2_x86_64
> +	depends on BR2_PACKAGE_QEMU_SYSTEM # for qemu-system-$ARCH

We use "# runtime" as keyword to remember that's a runtime dependencies (we can
keep "for qemu-system-$ARCH" part if you prefer)

But "select" keyword should be used here instead of "depends on".
kvm-unit-tests needs qemu-system-$ARCH to work but it's not yet a "big"
dependency that the user really needs to be aware of.
By selecting kvm-unit-tests the user want all required packages being selected.

See the manual: 18.2.3. Choosing depends on or select [1]

As example, libvirt package select BR2_PACKAGE_QEMU_SYSTEM for the same reason:

config BR2_PACKAGE_LIBVIRT_QEMU
	bool "qemu"
	depends on BR2_PACKAGE_LIBSECCOMP_ARCH_SUPPORTS # libseccomp
	depends on BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET
	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_8 # qemu
...
	select BR2_PACKAGE_QEMU
	select BR2_PACKAGE_QEMU_SYSTEM

[1] https://buildroot.org/downloads/manual/manual.html#_config_files

> +	depends on BR2_PACKAGE_COREUTILS # for timeout

Actually, busybox does support timeout command but this applet is not enabled in
our default busybox defconfig.

Can you try to enable the timeout applet if kvm-unit-tests package is enabled?

See how less applet is added to the busybox defconfig when systemd is used:
https://gitlab.com/buildroot.org/buildroot/-/blob/master/package/busybox/busybox.mk?ref_type=heads#L263

> +	depends on (BR2_PACKAGE_GLIBC_UTILS || BR2_UCLIBC_INSTALL_UTILS) # getconf

Both options imply building a Buildroot toolchain (internal toolchain backend).
With that, we can no longer enable kvm-unit-tests with external toolchains.

Maybe we could install getconf like we do for ldd tool [2] but what if getconf
is missing in the toolchain? Indeed getconf handling is missing...

[2]
https://gitlab.com/buildroot.org/buildroot/-/blob/master/toolchain/toolchain-external/pkg-toolchain-external.mk?ref_type=heads#L542

> +	depends on BR2_PACKAGE_NMAP_NCAT # for ncat

For ncat dependency we should use select:
	select BR2_PACKAGE_NMAP
	select BR2_PACKAGE_NMAP_NCAT

>  	select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64
>  	help
>  	  kvm-unit-tests is a project as old as KVM. As its name
> @@ -38,6 +42,8 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
>  
>  	  http://www.linux-kvm.org/page/KVM-unit-tests
>  
> -comment "kvm-unit-tests needs a toolchain w/ gcc >= 4.5"
> +comment "kvm-unit-tests needs a toolchain w/ gcc >= 4.5, qemu-system, timeout, getconf and ncat"
>  	depends on BR2_i386
>  	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
> +	depends on !(BR2_PACKAGE_QEMU_SYSTEM && BR2_PACKAGE_COREUTILS && BR2_PACKAGE_NMAP_NCAT)
> +	depends on !(BR2_PACKAGE_GLIBC_UTILS || BR2_UCLIBC_INSTALL_UTILS)
> diff --git a/package/kvm-unit-tests/kvm-unit-tests.mk b/package/kvm-unit-tests/kvm-unit-tests.mk
> index 73d20d6b2e..6234a9986c 100644
> --- a/package/kvm-unit-tests/kvm-unit-tests.mk
> +++ b/package/kvm-unit-tests/kvm-unit-tests.mk
> @@ -9,6 +9,7 @@ KVM_UNIT_TESTS_SOURCE = kvm-unit-tests-v$(KVM_UNIT_TESTS_VERSION).tar.bz2
>  KVM_UNIT_TESTS_SITE = https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/archive/v$(KVM_UNIT_TESTS_VERSION)
>  KVM_UNIT_TESTS_LICENSE = GPL-2.0, LGPL-2.0
>  KVM_UNIT_TESTS_LICENSE_FILES = COPYRIGHT LICENSE
> +KVM_UNIT_TESTS_DEPENDENCIES = coreutils nmap-ncat

For runtime dependencies, we don't need to add them in _DEPENDENCIES as build
time dependencies.

Best regards,
Romain


>  
>  ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)
>  KVM_UNIT_TESTS_ARCH = aarch64

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 3/3] package/qemu: introduce kvm and tcg system options
  2025-06-19 14:48 ` [Buildroot] [PATCH 3/3] package/qemu: introduce kvm and tcg system options Alex Bennée
@ 2025-07-05 19:26   ` Romain Naour via buildroot
  0 siblings, 0 replies; 8+ messages in thread
From: Romain Naour via buildroot @ 2025-07-05 19:26 UTC (permalink / raw)
  To: Alex Bennée, buildroot; +Cc: Romain Naour

Hello Alex, All,

Le 19/06/2025 à 16:48, Alex Bennée a écrit :
> 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. It also implies you cannot select
> additional targets unless you enable user-mode or TCG support for
> system.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  package/qemu/Config.in | 23 ++++++++++++++++++-----
>  package/qemu/qemu.mk   | 13 +++++++++++++
>  2 files changed, 31 insertions(+), 5 deletions(-)
> 
> diff --git a/package/qemu/Config.in b/package/qemu/Config.in
> index 2d15ab1ea9..af218583fe 100644
> --- a/package/qemu/Config.in
> +++ b/package/qemu/Config.in
> @@ -59,6 +59,20 @@ config BR2_PACKAGE_QEMU_SYSTEM
>  
>  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 enabled. If unsure, say 'y'

Please, use ./utils/check-package package/qemu/* to check coding style issue.

> +
> +config BR2_PACKAGE_QEMU_SYSTEM_TCG
> +       bool "Enable TCG system emulation"
> +       default n

This is the default, you can remove "default n" here.

> +       help
> +         Say 'y' here to enable QEMU binarys which can emulate foriegn

typos: binarys, foriegn

> +         architectures using the TCG JIT.
> +
> +
>  config BR2_PACKAGE_QEMU_BLOBS
>  	bool "Install binary blobs"
>  	default y
> @@ -130,12 +144,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

Maybe we should keep TCG by default. existing defconfig will now loose
qemu-system-$ARCH that were installed before this patch.

>  	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 when TCG is
> +	  enabled. 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 fdc8591e54..19703ba3e3 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

--enable-kvm is already present is QEMU_CONFIGURE_CMDS, you can remove it.

> +
> +ifeq ($(BR2_PACKAGE_QEMU_SYSTEM_TCG), y)
> +QEMU_OPTS += --enable-tcg
> +else
> +QEMU_OPTS += --disable-tcg
> +endif

Best regards,
Romain


> +
>  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

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 2/3] package/kvm-unit-tests: add some missing deps
  2025-07-05 19:09   ` Romain Naour via buildroot
@ 2025-07-11 11:30     ` Alex Bennée
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Bennée @ 2025-07-11 11:30 UTC (permalink / raw)
  To: Romain Naour; +Cc: buildroot, Thomas Huth, Cyril Bur

Romain Naour <romain.naour@smile.fr> writes:

> Hi Alex, All,
>
> Le 19/06/2025 à 16:48, Alex Bennée a écrit :
>> To run the tests we need a system QEMU, timeout, getconf and nmap-ncat
>> so update the depends for them.
>
<snip>
>
>> +	depends on BR2_PACKAGE_COREUTILS # for timeout
>
> Actually, busybox does support timeout command but this applet is not enabled in
> our default busybox defconfig.
>
> Can you try to enable the timeout applet if kvm-unit-tests package is
> enabled?

Sadly it needs the full coreutils version:

  # which timeout
  /usr/bin/timeout
  # /usr/share/kvm-unit-tests/[   11.768975] platform gpio-keys: deferred probe pending: gpio-keys: failed to get gpio
  # /usr/share/kvm-unit-tests/selftest-setup 
  BUILD_HEAD=
  timeout -k 1s --foreground 90s /usr/bin/qemu-system-aarch64 -nodefaults -machine virt,gic-version=host -accel kvm -cpu host -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd -device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 2 -m 256 -append setup smp=2 mem=256 # -initrd /tmp/tmp.SWE9W4
  timeout: unrecognized option '--foreground'
  BusyBox v1.37.0 (2025-07-10 19:55:35 BST) multi-call binary.

  Usage: timeout [-s SIG] [-k KILL_SECS] SECS PROG ARGS

  Run PROG. Send SIG to it if it is not gone in SECS seconds.
  Default SIG: TERM.If it still exists in KILL_SECS seconds, send KILL.
  SKIP selftest-setup (Default SIG: TERM.If it still exists in KILL_SECS seconds, send KILL.)

<snip>

I'm fixing up the other bits now.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-07-11 11:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19 14:48 [Buildroot] [PATCH 0/3] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
2025-06-19 14:48 ` [Buildroot] [PATCH 1/3] package/kvm-unit-tests: assume AArch64 supports KVM Alex Bennée
2025-07-05 18:14   ` Romain Naour via buildroot
2025-06-19 14:48 ` [Buildroot] [PATCH 2/3] package/kvm-unit-tests: add some missing deps Alex Bennée
2025-07-05 19:09   ` Romain Naour via buildroot
2025-07-11 11:30     ` Alex Bennée
2025-06-19 14:48 ` [Buildroot] [PATCH 3/3] package/qemu: introduce kvm and tcg system options Alex Bennée
2025-07-05 19:26   ` Romain Naour via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox