From 088bbc1efa8c1efe8e2714b9640055ce984aec93 Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Fri, 28 Mar 2025 17:31:15 +0100 Subject: dtc: introduce label relative path references Since introduction of OF_UPSTREAM flag, U-Boot's dtc must be able to compile Kernel's device tree. Since kernel commit 7de129f5389b ("ARM: dts: stm32: stm32mp151a-prtt1l: Fix QSPI configuration"), label relative path references has been introduced. These label relative path references is not supported by current U-Boot dtc version 1.5.0: (see mailing list discussion [1]). In order to support such label relative patch references adds following commit from upstream DTC tree: commit 651410e54cb9 ("util: introduce xstrndup helper") commit ec7986e682cf ("dtc: introduce label relative path references") [1] https://lore.kernel.org/all/20250115144428.GZ3476@bill-the-cat/T/ Signed-off-by: Patrice Chotard Cc: Tom Rini Cc: Simon Glass Reviewed-by: Tom Rini Reviewed-by: Simon Glass --- scripts/dtc/util.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'scripts/dtc/util.c') diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c index 23334d39bb6..25d4db1e8c2 100644 --- a/scripts/dtc/util.c +++ b/scripts/dtc/util.c @@ -46,6 +46,17 @@ char *xstrdup(const char *s) return d; } +char *xstrndup(const char *s, size_t n) +{ + size_t len = strnlen(s, n) + 1; + char *d = xmalloc(len); + + memcpy(d, s, len - 1); + d[len - 1] = '\0'; + + return d; +} + /* based in part from (3) vsnprintf */ int xasprintf(char **strp, const char *fmt, ...) { -- cgit v1.2.3