[Buildroot] [PATCH v2 1/1] package/xen: fix build error when BR2_PACKAGE_XEN_TOOLS not enabled
Neal Frager via buildroot <[email protected]> Mon, 3 Aug 2026 11:20:45 +0100
| Newsgroups | net.busybox.buildroot |
|---|---|
| Message-ID | <[email protected]> |
--===============2305972489503725841== Content-Type: text/plain; charset="y" Content-Transfer-Encoding: 8bit The 0002-Update-linker-flags.patch assumes that the qemu-xen files are included in the xen source tree. However, if BR2_PACKAGE_XEN_TOOLS is not enabled, the qemu-xen dependency will not be handled and the patch will fail to apply with the following error. Fixes: build error below Applying 0002-Update-linker-flags.patch using patch: patching file tools/Makefile Hunk #1 succeeded at 36 (offset -1 lines). Hunk #2 succeeded at 185 (offset -8 lines). can't find file to patch at input line 76 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff --git a/tools/qemu-xen/include/hw/xen/xen_native.h b/tools/qemu-xen/include/hw/xen/xen_native.h |index 6bcc83ba..2590904e 100644 |--- a/tools/qemu-xen/include/hw/xen/xen_native.h |+++ b/tools/qemu-xen/include/hw/xen/xen_native.h -------------------------- No file to patch. Skipping patch. 1 out of 1 hunk ignored make: *** [package/pkg-generic.mk:239: output/build/xen-4.21.1/.stamp_patched] Error 1 To avoid making BR2_PACKAGE_XEN_TOOLS a required option, fix the 0002-Update-linker-flags.patch so that the part that modifies the qemu-xen sources is correctly moved to a patch in the qemu-xen package. Move this: diff --git a/tools/qemu-xen/include/hw/xen/xen_native.h b/tools/qemu-xen/include/hw/xen/xen_native.h index 6bcc83ba..2590904e 100644 --- a/tools/qemu-xen/include/hw/xen/xen_native.h +++ b/tools/qemu-xen/include/hw/xen/xen_native.h @@ -2,7 +2,7 @@ #define QEMU_HW_XEN_NATIVE_H #ifdef __XEN_INTERFACE_VERSION__ -#error In Xen native files, include xen_native.h before other Xen headers +#warning In Xen native files, include xen_native.h before other Xen headers #endif /* to package/qemu-xen/0001-Update-linker-flags.patch. To test: BR2_aarch64=y BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_AARCH64_GLIBC_STABLE=y BR2_PACKAGE_XEN=y Signed-off-by: Neal Frager <[email protected]> --- .../qemu-xen/0001-Update-linker-flags.patch | 35 +++++++++++++++++++ package/xen/0002-Update-linker-flags.patch | 16 +-------- 2 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 package/qemu-xen/0001-Update-linker-flags.patch diff --git a/package/qemu-xen/0001-Update-linker-flags.patch b/package/qemu-xen/0001-Update-linker-flags.patch new file mode 100644 index 0000000000..8162a149ed --- /dev/null +++ b/package/qemu-xen/0001-Update-linker-flags.patch @@ -0,0 +1,35 @@ +From 2ba2eef5b11d81b801265ae92df91571c19cc8a3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= <[email protected]> +Date: Tue, 30 Sep 2025 11:39:54 +0200 +Subject: [PATCH] Update linker flags +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The -I$(XEN_ROOT)/tools/include added to QEMU's extra-cflags causes +__XEN_INTERFACE_VERSION__ to be defined before xen_native.h is included, +triggering an include-order assertion. Downgrade to a warning since the +version is consistent in cross-compile. +Ref: https://github.com/qemu/qemu/commit/e2abfe5ec6 + +Upstream: Buildroot specific. This is a temporary patch for an intermediate bump. +Signed-off-by: Vincent Stehlé <[email protected]> +--- + include/hw/xen/xen_native.h | 2 +- + 1 file changed, 1 insertions(+), 1 deletions(-) + +diff --git a/include/hw/xen/xen_native.h b/include/hw/xen/xen_native.h +index 6bcc83ba..2590904e 100644 +--- a/include/hw/xen/xen_native.h ++++ b/include/hw/xen/xen_native.h +@@ -2,7 +2,7 @@ + #define QEMU_HW_XEN_NATIVE_H + + #ifdef __XEN_INTERFACE_VERSION__ +-#error In Xen native files, include xen_native.h before other Xen headers ++#warning In Xen native files, include xen_native.h before other Xen headers + #endif + + /* +-- +2.51.0 diff --git a/package/xen/0002-Update-linker-flags.patch b/package/xen/0002-Update-linker-flags.patch index ac02722781..3ba678cd9b 100644 --- a/package/xen/0002-Update-linker-flags.patch +++ b/package/xen/0002-Update-linker-flags.patch @@ -16,8 +16,7 @@ Upstream: Buildroot specific. This is a temporary patch for an intermediate bump Signed-off-by: Vincent Stehlé <[email protected]> --- tools/Makefile | 29 ++++++++++++++++++++- - tools/qemu-xen/include/hw/xen/xen_native.h | 2 +- - 2 files changed, 29 insertions(+), 2 deletions(-) + 1 file changed, 28 insertions(+), 1 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index a9a3196e..5d289651 100644 @@ -69,19 +68,6 @@ index a9a3196e..5d289651 100644 --bindir=$(LIBEXEC_BIN) \ --datadir=$(SHAREDIR)/qemu-xen \ --localstatedir=$(localstatedir) \ -diff --git a/tools/qemu-xen/include/hw/xen/xen_native.h b/tools/qemu-xen/include/hw/xen/xen_native.h -index 6bcc83ba..2590904e 100644 ---- a/tools/qemu-xen/include/hw/xen/xen_native.h -+++ b/tools/qemu-xen/include/hw/xen/xen_native.h -@@ -2,7 +2,7 @@ - #define QEMU_HW_XEN_NATIVE_H - - #ifdef __XEN_INTERFACE_VERSION__ --#error In Xen native files, include xen_native.h before other Xen headers -+#warning In Xen native files, include xen_native.h before other Xen headers - #endif - - /* -- 2.51.0 -- 2.43.0 --===============2305972489503725841== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot --===============2305972489503725841==--