Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] barebox-tools: fix host contamination on libyaml
@ 2025-04-07  8:09 Hongxu Jia
  2025-04-07 10:27 ` [OE-core] " Alexander Kanavin
  0 siblings, 1 reply; 4+ messages in thread
From: Hongxu Jia @ 2025-04-07  8:09 UTC (permalink / raw)
  To: openembedded-core

The barebox-tools uses host gcc to build dtc tools, and test the existence
of /usr/include/yaml.h to build with/without libyaml

It caused host contamination if /usr/include/yaml.h existed on host.
| tmp/work/core2-64-wrs-linux/barebox-tools/2025.02.0/barebox-2025.02.0/scripts/
dtc/yamltree.c:9:10: fatal error: yaml.h: No such file or directory
|     9 | #include <yaml.h>

Explicitly define NO_YAML = 1 to disable libyaml for host dtc

No regression because the host dtc was not shipped to target or native sysroot

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/recipes-bsp/barebox/barebox-tools.bb     |  5 +++
 ...01-fix-host-contamination-on-libyaml.patch | 38 +++++++++++++++++++
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-bsp/barebox/files/0001-fix-host-contamination-on-libyaml.patch

diff --git a/meta/recipes-bsp/barebox/barebox-tools.bb b/meta/recipes-bsp/barebox/barebox-tools.bb
index 2a117bc9c08..50660bdf5c8 100644
--- a/meta/recipes-bsp/barebox/barebox-tools.bb
+++ b/meta/recipes-bsp/barebox/barebox-tools.bb
@@ -2,6 +2,10 @@ SUMMARY = "barebox bootloader tools"
 
 require barebox-common.inc
 
+SRC_URI += " \
+    file://0001-fix-host-contamination-on-libyaml.patch \
+"
+
 LICENSE = "GPL-2.0-only"
 
 DEPENDS = "bison-native flex-native libusb1"
@@ -17,6 +21,7 @@ EXTRA_OEMAKE = " \
   CROSS_PKG_CONFIG=pkg-config \
   CC='${CC}' \
   LD='${LD}' \
+  NO_YAML=1 \
   "
 
 do_compile:class-target () {
diff --git a/meta/recipes-bsp/barebox/files/0001-fix-host-contamination-on-libyaml.patch b/meta/recipes-bsp/barebox/files/0001-fix-host-contamination-on-libyaml.patch
new file mode 100644
index 00000000000..e24e47a9cfc
--- /dev/null
+++ b/meta/recipes-bsp/barebox/files/0001-fix-host-contamination-on-libyaml.patch
@@ -0,0 +1,38 @@
+From f6b529fd13af7e05bfed4471d160f1119308db2a Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Mon, 7 Apr 2025 13:13:14 +0800
+Subject: [PATCH] fix host contamination on libyaml
+
+The barebox-tools uses host gcc to build dtc tools, and test the existence
+of /usr/include/yaml.h to build with/without libyaml
+
+It caused host contamination if /usr/include/yaml.h existed on host.
+| tmp/work/core2-64-wrs-linux/barebox-tools/2025.02.0/barebox-2025.02.0/scripts/
+dtc/yamltree.c:9:10: fatal error: yaml.h: No such file or directory
+|     9 | #include <yaml.h>
+
+Explicitly define NO_YAML = 1 to disable libyaml for host dtc
+
+Upstream-Status: Inappropriate [Yocto specific]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ scripts/dtc/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
+index 721e8e2b..b7bfee1b 100644
+--- a/scripts/dtc/Makefile
++++ b/scripts/dtc/Makefile
+@@ -16,7 +16,7 @@ fdtget-objs    += fdtget.o $(libfdt-objs) util.o
+ # Source files need to get at the userspace version of libfdt_env.h to compile
+ HOST_EXTRACFLAGS += -I$(src)/libfdt
+ 
+-ifeq ($(wildcard /usr/include/yaml.h),)
++ifeq ($(NO_YAML), 1)
+ ifneq ($(CHECK_DTBS),)
+ $(error dtc needs libyaml for DT schema validation support. \
+ 	Install the necessary libyaml development package.)
+-- 
+2.34.1
+
-- 
2.34.1



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

* Re: [OE-core] [PATCH] barebox-tools: fix host contamination on libyaml
  2025-04-07  8:09 [PATCH] barebox-tools: fix host contamination on libyaml Hongxu Jia
@ 2025-04-07 10:27 ` Alexander Kanavin
  2025-04-07 11:21   ` Enrico Jörns
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Kanavin @ 2025-04-07 10:27 UTC (permalink / raw)
  To: hongxu.jia, Enrico Jörns; +Cc: openembedded-core

On Mon, 7 Apr 2025 at 10:09, hongxu via lists.openembedded.org
<hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote:
> +Subject: [PATCH] fix host contamination on libyaml
> +
> +The barebox-tools uses host gcc to build dtc tools, and test the existence
> +of /usr/include/yaml.h to build with/without libyaml
> +
> +It caused host contamination if /usr/include/yaml.h existed on host.
> +| tmp/work/core2-64-wrs-linux/barebox-tools/2025.02.0/barebox-2025.02.0/scripts/
> +dtc/yamltree.c:9:10: fatal error: yaml.h: No such file or directory
> +|     9 | #include <yaml.h>
> +
> +Explicitly define NO_YAML = 1 to disable libyaml for host dtc
> +
> +Upstream-Status: Inappropriate [Yocto specific]

Please report this to upstream, rather than just make a new patch and
mark it Inappropriate without engaging. We have barebox maintainer
present and active right here, actually.

Alex


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

* Re: [OE-core] [PATCH] barebox-tools: fix host contamination on libyaml
  2025-04-07 10:27 ` [OE-core] " Alexander Kanavin
@ 2025-04-07 11:21   ` Enrico Jörns
  2025-04-07 15:11     ` hongxu
  0 siblings, 1 reply; 4+ messages in thread
From: Enrico Jörns @ 2025-04-07 11:21 UTC (permalink / raw)
  To: hongxu.jia; +Cc: openembedded-core, Ahmad Fatoum, Alexander Kanavin

Am Montag, dem 07.04.2025 um 12:27 +0200 schrieb Alexander Kanavin:
> On Mon, 7 Apr 2025 at 10:09, hongxu via lists.openembedded.org
> <hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote:
> > +Subject: [PATCH] fix host contamination on libyaml
> > +
> > +The barebox-tools uses host gcc to build dtc tools, and test the existence
> > +of /usr/include/yaml.h to build with/without libyaml
> > +
> > +It caused host contamination if /usr/include/yaml.h existed on host.
> > +| tmp/work/core2-64-wrs-linux/barebox-tools/2025.02.0/barebox-2025.02.0/scripts/
> > +dtc/yamltree.c:9:10: fatal error: yaml.h: No such file or directory
> > +|     9 | #include <yaml.h>
> > +
> > +Explicitly define NO_YAML = 1 to disable libyaml for host dtc
> > +
> > +Upstream-Status: Inappropriate [Yocto specific]

I had a quick chat with the maintainers. Since barebox actually doesn't do any dtb binding checks at
the moment, it would be fine to just hard-code the -DNO_YAML (and omit the check).

(If that should be needed later one can use .dtb files directly without the dts->yaml conversion,
just like the kernel does: https://github.com/torvalds/linux/commit/ef8795f3f1ce )

> Please report this to upstream, rather than just make a new patch and
> mark it Inappropriate without engaging. We have barebox maintainer
> present and active right here, actually.

Thank you Alex for CC'ing me!

Regards, Enrico

> Alex
> 

-- 
Pengutronix e.K.                           | Enrico Jörns                |
Embedded Linux Consulting & Support        | https://www.pengutronix.de/ |
Steuerwalder Str. 21                       | Phone: +49-5121-206917-180  |
31137 Hildesheim, Germany                  | Fax:   +49-5121-206917-9    |


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

* Re: [PATCH] barebox-tools: fix host contamination on libyaml
  2025-04-07 11:21   ` Enrico Jörns
@ 2025-04-07 15:11     ` hongxu
  0 siblings, 0 replies; 4+ messages in thread
From: hongxu @ 2025-04-07 15:11 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

Sure, refer https://github.com/torvalds/linux/commit/ef8795f3f1ce to clean up yamltree from dtc

V2 incoming

//Hongxu

[-- Attachment #2: Type: text/html, Size: 290 bytes --]

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07  8:09 [PATCH] barebox-tools: fix host contamination on libyaml Hongxu Jia
2025-04-07 10:27 ` [OE-core] " Alexander Kanavin
2025-04-07 11:21   ` Enrico Jörns
2025-04-07 15:11     ` hongxu

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