Skip to contentSkip to conversation

package/systemd: account for arch dependency of vmspawn support

PATCH Applied Thomas Petazzoni via buildroot 2 participants 2 messages Aug 18, 2024 – Aug 19, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/systemd: account for arch dependency of vmspawn support

Since upstream commit 5c57a8650630304d8434a348283b6b643fbc676b ("vmspawn: add support for -D/--directory"), src/vmspawn/vmspawn-util.h defines a QEMU_MACHINE_TYPE based on the architecture, and not all architectures are supported. This commit first appeared in systemd v256.

Due to this, the unsupported architectures fail with:

In file included from ../src/vmspawn/vmspawn-util.c:27:
../src/vmspawn/vmspawn-util.h:46:4: error: #error "No qemu machine defined for this architecture"

   46 | #  error "No qemu machine defined for this architecture"
      |    ^~~~~

So let's add a BR2_PACKAGE_SYSTEMD_VMSPAWN_ARCH_SUPPORTS and use it to ensure vmspawn support is only used on architectures that are supported. Even though no-one selects BR2_PACKAGE_SYSTEMD_VMSPAWN (and would therefore need to inherit the BR2_PACKAGE_SYSTEMD_VMSPAWN_ARCH_SUPPORTS dependency), we nevertheless introduce BR2_PACKAGE_SYSTEMD_VMSPAWN_ARCH_SUPPORTS to make the depency list prettier than a long "depends on A || B || C || D || ...".

Fixes:

http://autobuild.buildroot.net/results/0e614375f731f7bfe3c6041c6e89a09c31898053/

---
 package/systemd/Config.in | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
package/systemd/Config.in +14 -0
index 6708adce9b..113a8093c4 100644
@@ -599,8 +599,22 @@ config BR2_PACKAGE_SYSTEMD_VCONSOLE_DEFAULT_KEYMAP
 	  Default keymap for the system. Leave empty to not set a
 	  default keymap.
 
+# See for which architectures QEMU_MACHINE_TYPE is defined in
+# src/vmspawn/vmspawn-util.h
+config BR2_PACKAGE_SYSTEMD_VMSPAWN_ARCH_SUPPORTS
+	bool
+	default y if BR2_aarch64 || BR2_aarch64_be
+	default y if BR2_arm || BR2_armeb
+	default y if BR2_i386
+	default y if BR2_mips || BR2_mips64 || BR2_mipsel || BR2_mips64el
+	default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
+	default y if BR2_riscv
+	default y if BR2_s390x
+	default y if BR2_x86_64
+
 config BR2_PACKAGE_SYSTEMD_VMSPAWN
 	bool "enable vmspawn"
+	depends on BR2_PACKAGE_SYSTEMD_VMSPAWN_ARCH_SUPPORTS
 	help
 	  systemd-vmspawn may be used to start a virtual machine
 	  from an OS image. In many ways it is similar to
Signature · 6 lines
2.46.0

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

Thomas, All,
On 2024-08-18 14:25 +0200, Thomas Petazzoni via buildroot spake thusly:

Quoted 13 lines

Since upstream commit 5c57a8650630304d8434a348283b6b643fbc676b ("vmspawn: add support for -D/--directory"), src/vmspawn/vmspawn-util.h defines a QEMU_MACHINE_TYPE based on the architecture, and not all architectures are supported. This commit first appeared in systemd v256.

Due to this, the unsupported architectures fail with:

In file included from ../src/vmspawn/vmspawn-util.c:27:
../src/vmspawn/vmspawn-util.h:46:4: error: #error "No qemu machine defined for this architecture"

   46 | #  error "No qemu machine defined for this architecture"
      |    ^~~~~
Quoted 8 lines

So let's add a BR2_PACKAGE_SYSTEMD_VMSPAWN_ARCH_SUPPORTS and use it to ensure vmspawn support is only used on architectures that are supported. Even though no-one selects BR2_PACKAGE_SYSTEMD_VMSPAWN (and would therefore need to inherit the BR2_PACKAGE_SYSTEMD_VMSPAWN_ARCH_SUPPORTS dependency), we nevertheless introduce BR2_PACKAGE_SYSTEMD_VMSPAWN_ARCH_SUPPORTS to make the depency list prettier than a long "depends on A || B || C || D || ...".

Yes, that's much clearer that way, thanks!

Quoted 5 lines

Fixes:

http://autobuild.buildroot.net/results/0e614375f731f7bfe3c6041c6e89a09c31898053/

Applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 38 lines
---
 package/systemd/Config.in | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
package/systemd/Config.in +14 -0
index 6708adce9b..113a8093c4 100644
@@ -599,8 +599,22 @@ config BR2_PACKAGE_SYSTEMD_VCONSOLE_DEFAULT_KEYMAP
 	  Default keymap for the system. Leave empty to not set a
 	  default keymap.
 
+# See for which architectures QEMU_MACHINE_TYPE is defined in
+# src/vmspawn/vmspawn-util.h
+config BR2_PACKAGE_SYSTEMD_VMSPAWN_ARCH_SUPPORTS
+	bool
+	default y if BR2_aarch64 || BR2_aarch64_be
+	default y if BR2_arm || BR2_armeb
+	default y if BR2_i386
+	default y if BR2_mips || BR2_mips64 || BR2_mipsel || BR2_mips64el
+	default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
+	default y if BR2_riscv
+	default y if BR2_s390x
+	default y if BR2_x86_64
+
 config BR2_PACKAGE_SYSTEMD_VMSPAWN
 	bool "enable vmspawn"
+	depends on BR2_PACKAGE_SYSTEMD_VMSPAWN_ARCH_SUPPORTS
 	help
 	  systemd-vmspawn may be used to start a virtual machine
 	  from an OS image. In many ways it is similar to
Signature · 6 lines
2.46.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot