diff --git a/pkg.info b/pkg.info index 507cb21..96da016 100644 --- a/pkg.info +++ b/pkg.info @@ -1,9 +1,11 @@ name: dtc description: Device tree compiler -version: 1.7.2 -revision: 2 +version: 1.8.1 +revision: 1 url: https://www.devicetree.org/ license: GPL2-only +maintainers: + - enumdev@enumerated.dev architecture: any type: source depends: @@ -21,4 +23,4 @@ downloads: - url: https://kernel.org/pub/software/utils/dtc/dtc-${BPM_PKG_VERSION}.tar.xz extract_to: ${BPM_SOURCE} extract_strip_components: 1 - checksum: 92d8ca769805ae1f176204230438fe52808f4e1c7944053c9eec0e649b237539 + checksum: 23526015a6f1550e0541a53fe7acea1b5a11e3697cdf3a3bdc076abc38f6045d diff --git a/source-files/9a1c801a1a3c102bf95c5339c9e985b26b823a21.patch b/source-files/9a1c801a1a3c102bf95c5339c9e985b26b823a21.patch deleted file mode 100644 index 3b8e511..0000000 --- a/source-files/9a1c801a1a3c102bf95c5339c9e985b26b823a21.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 9a1c801a1a3c102bf95c5339c9e985b26b823a21 Mon Sep 17 00:00:00 2001 -From: Stephen Gallagher -Date: Tue, 6 Jan 2026 14:19:30 -0500 -Subject: [PATCH] Fix discarded const qualifiers - -It's unsafe to implicitly discard the const qualifier on a pointer. In -overlay_fixup_phandle(), this was probably just an oversight, and making -the "sep" variable a const char * is sufficient to fix it. - -In create_node(), however, the "p" variable is directly modifying the -buffer pointed to by "const char* node_name". To fix this, we need to -actually make a duplicate of the buffer and operate on that instead. - -This introduces a malloc()/free() and an unbounded strdup() into the -operation, but fdtput isn't a long-running service and the node_name -argument comes directly from argv, so this shouldn't introduce a -significant performance impact. - -Signed-off-by: Stephen Gallagher -Signed-off-by: David Gibson ---- - fdtput.c | 8 +++++--- - libfdt/fdt_overlay.c | 3 ++- - meson.build | 1 + - 3 files changed, 8 insertions(+), 4 deletions(-) - -diff --git a/fdtput.c b/fdtput.c -index 05f2b933..fdb581a2 100644 ---- a/fdtput.c -+++ b/fdtput.c -@@ -254,19 +254,21 @@ static int create_paths(char **blob, const char *in_path) - static int create_node(char **blob, const char *node_name) - { - int node = 0; -- char *p; -+ const char *p; -+ char *path = NULL; - - p = strrchr(node_name, '/'); - if (!p) { - report_error(node_name, -1, -FDT_ERR_BADPATH); - return -1; - } -- *p = '\0'; - - *blob = realloc_node(*blob, p + 1); - - if (p > node_name) { -- node = fdt_path_offset(*blob, node_name); -+ path = xstrndup(node_name, (size_t)(p - node_name)); -+ node = fdt_path_offset(*blob, path); -+ free(path); - if (node < 0) { - report_error(node_name, -1, node); - return -1; -diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c -index e6b9eb64..51a38596 100644 ---- a/libfdt/fdt_overlay.c -+++ b/libfdt/fdt_overlay.c -@@ -407,7 +407,8 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off, - const char *fixup_str = value; - uint32_t path_len, name_len; - uint32_t fixup_len; -- char *sep, *endptr; -+ const char *sep; -+ char *endptr; - int poffset, ret; - - fixup_end = memchr(value, '\0', len); -diff --git a/meson.build b/meson.build -index 66b44e87..501b706c 100644 ---- a/meson.build -+++ b/meson.build -@@ -18,6 +18,7 @@ add_project_arguments( - '-Wshadow', - '-Wsuggest-attribute=format', - '-Wwrite-strings', -+ '-Wdiscarded-qualifiers', - ]), - language: 'c' - ) diff --git a/source-files/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch b/source-files/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch deleted file mode 100644 index fccad57..0000000 --- a/source-files/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5 Mon Sep 17 00:00:00 2001 -From: Brandon Maier -Date: Sun, 24 Nov 2024 15:48:04 -0600 -Subject: [PATCH] pylibfdt/libfdt.i: fix backwards compatibility of return - values - -When our Python functions wrap `fdt_getprop()` they return a list -containing `[*data, length]`. - -In SWIG v4.2 and earlier SWIG would discard `*data` if it is NULL/None. -Causing the return value to just be `length`. - -But starting in SWIG v4.3 it no longer discards `*data`. So the return -value is now `[None, length]`. - -Handle this compatibility issue in libfdt.i by checking if the return -value looks like the older 4.2 return value, and casting it to the newer -style. - -See https://github.com/swig/swig/pull/2907 - -Signed-off-by: Brandon Maier -Signed-off-by: David Gibson ---- - pylibfdt/libfdt.i | 25 ++++++++++++++----------- - 1 file changed, 14 insertions(+), 11 deletions(-) - -diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i -index 9f5b6a9c..bb9985c3 100644 ---- a/pylibfdt/libfdt.i -+++ b/pylibfdt/libfdt.i -@@ -114,11 +114,14 @@ def check_err_null(val, quiet=()): - FdtException if val indicates an error was reported and the error - is not in @quiet. - """ -- # Normally a list is returned which contains the data and its length. -- # If we get just an integer error code, it means the function failed. -+ # Compatibility for SWIG v4.2 and earlier. SWIG 4.2 would drop the first -+ # item from the list if it was None, returning only the second item. - if not isinstance(val, list): -- if -val not in quiet: -- raise FdtException(val) -+ val = [None, val] -+ -+ if val[0] is None: -+ if -val[1] not in quiet: -+ raise FdtException(val[1]) - return val - - class FdtRo(object): -@@ -395,8 +398,8 @@ class FdtRo(object): - """ - pdata = check_err_null( - fdt_get_property_by_offset(self._fdt, prop_offset), quiet) -- if isinstance(pdata, (int)): -- return pdata -+ if pdata[0] is None: -+ return pdata[1] - return Property(pdata[0], pdata[1]) - - def getprop(self, nodeoffset, prop_name, quiet=()): -@@ -417,8 +420,8 @@ class FdtRo(object): - """ - pdata = check_err_null(fdt_getprop(self._fdt, nodeoffset, prop_name), - quiet) -- if isinstance(pdata, (int)): -- return pdata -+ if pdata[0] is None: -+ return pdata[1] - return Property(prop_name, bytearray(pdata[0])) - - def hasprop(self, nodeoffset, prop_name, quiet=()): -@@ -444,10 +447,10 @@ class FdtRo(object): - """ - pdata = check_err_null(fdt_getprop(self._fdt, nodeoffset, prop_name), - quiet + (NOTFOUND,)) -- if isinstance(pdata, (int)): -- if pdata == -NOTFOUND: -+ if pdata[0] is None: -+ if pdata[1] == -NOTFOUND: - return False -- return pdata -+ return pdata[1] - return True - - def get_phandle(self, nodeoffset): diff --git a/source-files/add-uutils-compatibility.patch b/source-files/add-uutils-compatibility.patch deleted file mode 100644 index 45742b8..0000000 --- a/source-files/add-uutils-compatibility.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 33e66ec845b8914ad45f559a275673a2a2881576 Mon Sep 17 00:00:00 2001 -From: David Gibson -Date: Thu, 24 Jul 2025 13:26:31 +1000 -Subject: tests: Add compatibility with uutils - -In some places run_tsets.sh needs to get the size of files, which it does -with stat(1). However the syntax to do this is different between GNU -coreutils stat(1) and BSD's stat(1). We have some logic that looks for -"GNU" in the version string to figure out the correct version. - -This will break upcoming Ubuntu versions which are now using uutils, a Rust -reimplementation of coreutils. These support the same GNU syntax, but -don't have the "GNU" in the version string. - -Update the detection to simply try the GNU version and otherwise assume -BSD. - -Link: https://github.com/dgibson/dtc/issues/166 - -Signed-off-by: David Gibson ---- - tests/run_tests.sh | 13 +++++++------ - 1 file changed, 7 insertions(+), 6 deletions(-) - -diff --git a/tests/run_tests.sh b/tests/run_tests.sh -index fecfe7c..2e172d7 100755 ---- a/tests/run_tests.sh -+++ b/tests/run_tests.sh -@@ -43,13 +43,14 @@ fi - - # stat differs between platforms - if [ -z "$STATSZ" ]; then -- stat --version 2>/dev/null | grep -q 'GNU' -- GNUSTAT=$? -- if [ "$GNUSTAT" -ne 0 ]; then -- # Assume BSD stat if we can't detect as GNU stat -- STATSZ="stat -f %Uz" -- else -+ # First attempt GNU style, this is supported by both the -+ # actual GNU coreutils version, and the Rust re-implementation -+ # uutils, used in recent Ubuntu versions -+ if stat -c %s $0; then - STATSZ="stat -c %s" -+ else -+ # Otherwise assume BSD style stat -+ STATSZ="stat -f %Uz" - fi - fi - --- -cgit 1.2.3-korg - diff --git a/source.sh b/source.sh index f68e190..0be639f 100644 --- a/source.sh +++ b/source.sh @@ -2,21 +2,6 @@ # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT -# The prepare function is executed in the root of the temp directory -# This function is used for putting downloaded files to the correct location or applying patches -prepare() { - cd "$BPM_SOURCE" - - # pylibfdt/libfdt.i: fix backwards compatibility of return values - patch -Np1 -i "$BPM_WORKDIR"/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch - - # Fix discarded const qualifiers - patch -Np1 -i "$BPM_WORKDIR"/9a1c801a1a3c102bf95c5339c9e985b26b823a21.patch - - # Add uutils compatibility - patch -Np1 -i "$BPM_WORKDIR"/add-uutils-compatibility.patch -} - # The build function is executed in the source directory # This function is used to compile the source code build() {