Commit graph

1208 commits

Author SHA1 Message Date
Paolo Bonzini
97011d1f4e meson: use override_find_program/override_dependency
Allow projects that use dtc as a subproject to find the tools and
library via find_program() and dependency().  This way, for those
projects there is no different between system dtc and subproject dtc.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20250612053829.1037412-1-pbonzini@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-06-12 15:55:00 +10:00
Ayush Singh
b841391bbd srcpos: Define srcpos_free
srcpos can be chained together using srcpos_extend. However, in such
cases, we need to free all the chained nodes.

srcpos_free is a helper to recursively free all the linked srcpos.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Message-ID: <20250605-previous-value-v3-1-0983d0733a07@beagleboard.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-06-09 22:27:00 +10:00
Ayush Singh
e0b7749c26 Add alloc_marker
- Add helper to allocate new marker

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Message-ID: <20250311-previous-value-v2-1-e4a8611e956f@beagleboard.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-05-28 15:12:50 +10:00
Eli Schwartz
ecb21febfd meson: port python bindings to build natively via meson and meson-python
We get full build parallelism and fewer confusing ancient distutils
paths. The python wheels build fully standalone, including linking
libfdt as a static library.

For convenience, when running pip install a meson option is passed that
prevents building tools or installing headers/pkgconfig files.
meson-python would otherwise include them in the wheel itself, in case
they are needed, but this is essentially a bit useless so don't bother.

The old setuptools-based build is now redundant and goes away.

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
Message-ID: <20250430152601.43554-3-eschwartz@gentoo.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-05-01 19:27:10 +07:00
Eli Schwartz
7ebfcac852 Makefile: deprecate in favor of Meson
Building the python bindings is complicated and not very practical to do
in a Makefile. The setuptools invocations previously used are confusing
and don't work very well compared to Meson. Having two build systems
that do different things is also confusing though.

Since Meson can do everything that Make can do, but the reverse is not
true, we deprecate the latter and warn when you use it.

GNU Make can emit a $(warning) on every Makefile run, which is a bit
noisy but means we don't need to have every target depend on a PHONY
target (preventing built targets from being seen as up to date).

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
Message-ID: <20250430152601.43554-2-eschwartz@gentoo.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-05-01 19:27:10 +07:00
Thomas Huth
f4c53f4ebf Use __ASSEMBLER__ instead of __ASSEMBLY__
Both, Clang and GCC define __ASSEMBLER__ automatically when
compiling .S files, so this macro is a much better fit for
fdt.h - programs that want to use it from .S files don't have
to manually #define __ASSEMBLY__ that way.
While we're at it, also change it in testdata.h, then we don't
have to define __ASSEMBLY__ in the Makefile / meson.build file
anymore.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250313192718.1561683-1-thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-03-14 13:51:31 +11:00
Thomas Huth
205fbef17b Fix some typos
Discovered with the "codespell" utility.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250313191607.1556384-1-thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-03-14 13:50:32 +11:00
Thomas Huth
da85f91931 Remove duplicated words in documentation and comments
Let's avoid repeating single words here!

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250313190527.1556019-1-thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-03-14 13:48:10 +11:00
Brandon Maier
dd1b3e532d meson: support building libfdt without static library
Some packaging systems like NixOS don't support compiling static
libraries. However libfdt's meson.build uses `both_library()` which
forces the build to always compile shared and static libraries. Removing
`both_library()` will make packaging easier.

libfdt uses `both_libraries()` to support the 'static-build' option.
But we do not need the 'static-build' option as Meson can natively
build static using

> meson setup builddir/ -Dc_link_args='-static' --prefer-static --default-library=static

So drop 'static-build' and then replace `both_libraries()` with
`library()`.

Signed-off-by: Brandon Maier <brandon.maier@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-03-13 16:19:27 +11:00
Eli Schwartz
1ccd232709 meson: don't build test programs by default
They are only used when running tests, and are included as depedencies
of the test cases themselves already. Marking them to not build by
default, means that 291 compile edges can be skipped when only running

```
meson setup builddir/
ninja -C builddir/
meson install -C builddir/
```

resulting in an overall much faster build. Instead they will be compiled
on-demand by `meson test`, only for users that actually run the tests.

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
Message-ID: <20250302222839.2256985-1-eschwartz@gentoo.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-03-03 12:46:55 +11:00
David Gibson
ce1d858888 tests: When building .so from -O asm output mark as non-executable stack
For certain tests, we take the output from dtc -O asm and build it into
a .so shared library which we then dlopen() for further tests.  Because we
don't mark it otherwise, it's treated as requiring an executable stack,
which dlopen() refuses to open as of glibc-2.41.

Of course, the library is pure data, no code, so it certainly doesn't need
an executable stack.  Add the -znoexecstack linker option to avoid the
error.

Fixes: https://github.com/dgibson/dtc/issues/163

Reported-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: David Gibson <david@gibson.dropbear.id.a>
2025-02-05 13:39:43 +11:00
Uwe Kleine-König
915daadbb6 Start with empty __local_fixups__ and __fixups__ nodes
When the meta nodes __local_fixups__ and __fixups__ are generated, and
one of these (or both) already exist, the information contained there
is duplicated at best and stale otherwise. So remove the nodes before
starting to fill them.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-01-24 14:15:35 +11:00
Uwe Kleine-König
4ea851f5a4 Let get_subnode() not return deleted nodes
Both current callers actually don't want deleted nodes returned by
get_subnode(). So change semantics of this function to only return
"live" nodes.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-01-24 14:14:02 +11:00
Uwe Kleine-König
175d2a564c Use build_root_node() instead of open-coding it
build_root_node() does error checking (which is good!) but otherwise
behaves exactly as the code replaced here.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-01-24 14:12:53 +11:00
Marc-André Lureau
18f4f305fd build: fix -Dtools=false build
When configuring the project, meson fails with:
tests/meson.build:107:27: ERROR: Unknown variable "util_dep"

Declare the util_dep dependency regardless if 'tools' are enabled, so
tests can be built with it.

Fixes: bdc5c8793a ("meson: allow disabling tests")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-12-18 16:12:59 +11:00
Thierry Reding
267efc7d46 checks: Warn about missing #address-cells for interrupt parents
The device tree specification (v0.4) suggests that #address-cells is
mandatory for interrupt parent nodes. If this property is missing, Linux
will default to the value of 0.

A number of device tree files rely on Linux' fallback and don't specify
an explicit #address-cells as suggested by the specification. This can
cause issues when these device trees are passed to software with a more
pedantic interpretation of the DT spec.

Add a warning when this case is detected so that device tree files can
be fixed.

Reported-by: Brad Griffis <bgriffis@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Message-ID: <20241213141438.3616902-1-thierry.reding@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-12-18 15:56:51 +11:00
Ayush Singh
755db11535 libfdt: Add fdt_setprop_namelen_string()
Macro using fdt_setprop_namelen() internally similar to
`fdt_setprop_string()`.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Message-ID: <20241205-setprop-namelen-v2-4-0d85a3d2e7b1@beagleboard.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-12-06 16:42:25 +11:00
Ayush Singh
bdca861200 libfdt: Add fdt_setprop_namelen()
Allow specifying name length in setprop similar to
`fdt_get_property_namelen` functions.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Message-ID: <20241205-setprop-namelen-v2-3-0d85a3d2e7b1@beagleboard.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-12-06 16:42:25 +11:00
Ayush Singh
0f69cedc08 libfdt_internal: fdt_find_string_len_()
Allow specifying string length to `fdt_find_string_`.
fdt_find_string_() now internally uses this function.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Message-ID: <20241205-setprop-namelen-v2-2-0d85a3d2e7b1@beagleboard.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-12-06 16:42:25 +11:00
Ayush Singh
56b2b30c5b libfdt: add fdt_get_property_namelen_w()
Similar to the non-namelen variant, it is implemented in terms of
fdt_get_property_namelen()

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Message-ID: <20241205-setprop-namelen-v2-1-0d85a3d2e7b1@beagleboard.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-12-06 16:42:25 +11:00
Ayush Singh
1e8c5f60e1 Add clang-format config
Add clang-format config based on Linux kernel clang-format config.
Allows for consistent formatting rules for all future contributions.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Message-ID: <20241205-clang-format-v2-1-07d21007bdab@beagleboard.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-12-06 14:44:46 +11:00
Philipp Zabel
6f183c7d92 checks: Relax avoid_unnecessary_addr_size check to allow child ranges properties
Do not fail the unnecessary #address-cells/#size-cells check if any
children of the node have a "ranges" property.

Suggested-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/all/CAL_JsqKebRL454poAYZ9i=sCsHqGzmocLy0psQcng-79UWJB-A@mail.gmail.com/
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Message-ID: <20241106130108.852323-1-p.zabel@pengutronix.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-11-27 12:52:56 +11:00
Brandon Maier
66c7d0e6f4 tests/sw_tree1.c: fix unitialized saveptr
Building the dtc tests on the Conda build system results in the
following error.

> In function '__strtok_r_1c',                                                                                                                                     2024-11-23T19:17:20.7930512Z     inlined from 'main' at ../tests/sw_tree1.c:140:17:
> $BUILD_PREFIX/x86_64-conda-linux-gnu/sysroot/usr/include/bits/string2.h:1177:10: error: 'saveptr' may be used uninitialized [-Werror=maybe-uninitialized]
>  1177 |   while (*__s == __sep)
>       |          ^~~~
> ../tests/sw_tree1.c: In function 'main':
> ../tests/sw_tree1.c:137:39: note: 'saveptr' was declared here
>   137 |                 char *str = argv[2], *saveptr, *tok;
>       |                                       ^~~~~~~
> cc1: all warnings being treated as errors

The manpage `strtok(3)` says the following.

> VERSIONS
>   On some implementations, *saveptr is required to be NULL on the first call to strtok_r() that is being used to parse str.

So set it to NULL.

Signed-off-by: Brandon Maier <brandon.maier@gmail.com>
2024-11-25 12:52:43 +11:00
Brandon Maier
9a969f3b70 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 <brandon.maier@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-11-25 12:43:19 +11:00
Brandon Maier
4292b072a2 .github/workflows: update ubuntu runner to supported version
The Ubuntu runner fails with the following message

> E: The repository 'http://security.ubuntu.com/ubuntu mantic-security Release' does not have a Release file.

Ubuntu 23.10 is end-of-life as of July 2024 anyway. So switch to the
latest Ubuntu tag, which is currently 24.04.

See https://discourse.ubuntu.com/t/edubuntu-23-10-has-reached-end-of-life-eol/46325

Signed-off-by: Brandon Maier <brandon.maier@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-11-25 12:27:23 +11:00
Bingwu Zhang
1c745a9bd1 libfdt: Remove fdt parameter from overlay_fixup_one_phandle
When compiling with -Wall -Wextra, the unused fdt parameter becomes a
warning. With -Werror, it becomes an error and fails the build.

As the parameter is not used in the function, let's remove it.

Signed-off-by: Bingwu Zhang <xtexchooser@duck.com>
Message-ID: <20241123094814.15504-2-xtex@envs.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-11-25 12:21:00 +11:00
Richard Hughes
b3bbee6b12 libfdt: Move the SBOM authors section
I was mistaken, and another maintainer pointed out the author-of-this-file
metadata needs to be in a different place. Apologies for the churn.

Signed-off-by: Richard Hughes <richard@hughsie.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-11-20 16:16:57 +11:00
Richard Hughes
d1656730ab Add a SBOM file in CycloneDX format
Improve supply chain security by including a SBOM file with substituted values.

This will be used to construct a composite platform SBOM.

Signed-off-by: Richard Hughes <richard@hughsie.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-11-18 16:24:48 +11:00
Bingwu Zhang
b75515af45 libfdt: Remove extra semi-colons outside functions
When compiling with -Werror -Wpedantic, both GCC and Clang fails, saying
that these semi-colons are redundant, so remove them.

Signed-off-by: Bingwu Zhang <xtexchooser@duck.com>
Message-ID: <20241116101228.164707-6-xtex@envs.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-11-18 14:26:34 +11:00
David Gibson
2d10aa2afe Bump version to v1.7.2
Prepare for a new release.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-11-06 14:01:37 +11:00
David Gibson
48795c82bd pylibfdt: Don't emit warnings from swig generate C code
The swig generated code has a heap of warnings with the flags we usually
use.  These aren't helpful, since there's nothing we can do about them from
the dtc side.  So, just disable the warnings flags when compiling the
Python module.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-11-06 14:00:45 +11:00
Amjad Alsharafi
838f11e830 fdtoverlay: provide better error message for missing /__symbols__
This was added because trying to apply overlay on dtb without knowing a lot
about the subject can be frustrating with strange error messages.

Before this, it will tell you:
`Failed to apply 'overlay.dtbo': FDT_ERR_BADOFFSET`

This message is similar to what's shown in `u-boot` when
trying to apply overlay

Signed-off-by: Amjad Alsharafi <amjadsharafi10@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-10-30 16:01:37 +11:00
Markus Volk
d1e2384185 pylibfdt/libfdt.i: Use SWIG_AppendOutput
Swig has changed language specific AppendOutput functions. The helper
macro SWIG_AppendOutput remains unchanged. Use that instead
of SWIG_Python_AppendOutput, which would require an extra parameter
since swig 4.3.0.

| /home/flk/poky/build-hypr/tmp/work/x86_64-linux/python3-dtc-native/1.7.0/git/pylibfdt/libfdt_wrap.c: In function ‘_wrap_fdt_next_node’:
| /home/flk/poky/build-hypr/tmp/work/x86_64-linux/python3-dtc-native/1.7.0/git/pylibfdt/libfdt_wrap.c:5598:17: error: too few arguments to function ‘SWIG_Python_AppendOutput’
|  5598 |     resultobj = SWIG_Python_AppendOutput(resultobj, val);

Signed-off-by: Markus Volk <f_l_k@t-online.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-10-30 12:06:50 +11:00
Colin Finck
18aa49a9f6 Escape spaces in depfile with backslashes.
This matches how Linux escapes spaces in paths.
The same syntax is also used by other build tools that output depfiles,
e.g. edd36eba5e/src/cargo/core/compiler/output_depinfo.rs (L19)

Signed-off-by: Colin Finck <mail@colinfinck.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-10-24 15:44:47 +11:00
Rasmus Villemoes
f9968fa069 libfdt.h: whitespace consistency fixups
In these cases, spaces are used for indentation/alignment while the
surrounding lines use tab. Fix it up for consistency.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-10-07 19:59:18 +10:00
Rasmus Villemoes
9b5f65fb3d libfdt.h: typo and consistency fixes
Most of these are plain typos. Exceptions:

- "devicetree" is only used in that form in the grammar and in mailing
  list references; all other instances, in particular all in prose,
  use "device tree".

- I don't know what "nodeequested" was supposed to be, the sentence
  reads just fine without it.

- "inexistant" is a rare form of nonexistent.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-10-07 19:58:13 +10:00
David Gibson
99031e3a4a Bump version to v1.7.1
Prepare for a new release.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-08-17 18:22:16 +10:00
Simon Glass
3d5e376925 setup: Move setting of srcdir down to the bottom
Put this variable assignment next to the others. Pass it to
get_top_builddir() instead of relying on the global variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
Message-ID: <20240811150248.7537-5-sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-08-12 11:46:30 +10:00
Simon Glass
e277553b98 setup: Collect top-level code together
Move most of the top-level code together, with the classes and functions
above, for easier reading.

The srcdir is left where it is for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Message-ID: <20240811150248.7537-4-sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-08-12 11:45:25 +10:00
Simon Glass
7e5a889840 setup: Move version and full_description into a function
Do this processing in a function and return the result, to reduce the
amount of code at the top level.

Signed-off-by: Simon Glass <sjg@chromium.org>
Message-ID: <20240811150248.7537-3-sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-08-12 11:45:01 +10:00
Simon Glass
78b6a85c11 Tidy up some pylint warnings
Resolve all the pylint warnings currently in setup.py

Signed-off-by: Simon Glass <sjg@chromium.org>
Message-ID: <20240811150248.7537-2-sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-08-12 11:39:48 +10:00
Simon Glass
3501d373f0 Require Python 3
We don't need to support Python 2 anymore, so drop the comment and add
the minimum required version. Use version 3.8 since I am not sure that
it works on older versions and 3.7 has reached end-of-life.

Signed-off-by: Simon Glass <sjg@chromium.org>
Message-ID: <20240811150248.7537-1-sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-08-12 11:38:41 +10:00
Markus Heidelberg
bcd02b5234 fdtoverlay: remove wrong singular article in a comment
Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-08-11 11:05:29 +10:00
Michael Riesch
84b056a89d checks: relax graph checks for overlays
In device tree overlays, the following patterns occur frequently:

board.dts:
/dts-v1/;

/ {
	display-controller {
		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			vp0: port@0 {
				reg = <0>;

				vp0_out: endpoint {
				};
			};

			vp1: port@1 {
				reg = <1>;
			};
		};
	};
};

overlay-endpoint.dtso:
/dts-v1/;
/plugin/;

&{/} {
	hdmi-tx-connector {
		port {
			hdmi_tx_in: endpoint {
				remote-endpoint = <&vp0_out>;
			};
		};
	};
};

&vp0_out {
	remote-endpoint = <&hdmi_tx_in>;
};

In this case, dtc expects that the node referenced by &vp0_out is
named "endpoint", but the name cannot be inferred. Also, dtc
complains about the connections between the endpoints not being
bidirectional.

Similarly, for a different overlay overlay-port.dtso:
/dts-v1/;
/plugin/;

&{/} {
	panel {
		port {
			panel_in: endpoint {
				remote-endpoint = <&vp1_out>;
			};
		};
	};
};

&vp1 {
	vp1_out: endpoint {
		remote-endpoint = <&panel_in>;
	};
};

dtc expects that the node referenced by &vp1 is named "port", but the
name cannot be inferred.

Relax the corresponding checks and skip the parts that are not reasonable
for device tree overlays.

Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-08-01 12:56:59 +10:00
Dan Horák
1df7b047fe pylibfdt/Makefile.pylibfdt: use project's flags to compile the extension
Seems the project's CFLAGS are not used when compiling the python
extension's C code via the setup.py script. Some default flags are used
instead. Thus pass the CFLAGS explicitly. Unfortunately the SWIG generated
code is not clean and requires -Wno-error override to compile successfully,
because -Werror is used in the project's flags.

Signed-off-by: Dan Horák <dan@danny.cz>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-07-06 15:58:06 +10:00
Uwe Kleine-König
61e88fdcec libfdt: overlay: Fix phandle overwrite check for new subtrees
If the overlay's target is only created in a previous fragment, it
doesn't exist in the unmodified base device tree. For the phandle
overwrite check this can be ignored because in this case the base tree
doesn't contain a phandle that could be overwritten.

Adapt the corresponding check to not error out if that happens but just
continue with the next fragment.

This is currently triggered by
arch/arm64/boot/dts/renesas/salvator-panel-aa104xd12.dtso in the kernel
repository which creates /panel in its first fragment and modifies it in
its second.

Reported-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/all/CAL_JsqL9MPycDjqQfPNAuGfC6EMrdzUivr+fuOS7YgU3biGd4A@mail.gmail.com/
Fixes: 1fad065080 ("libfdt: overlay: ensure that existing phandles are not overwritten")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <20240626075551.2493048-2-u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-07-05 21:53:18 +10:00
Brandon Maier
49d3089446 meson: fix installation with meson-python
The meson-python backend fails to map 'dtdiff' install into Python
wheels. Removing the prefix from the install_dir path allows
meson-python to map dtdiff. The install_data(install_dir) documentation
says "If this is a relative path, it is assumed to be relative to the
prefix"[1]. So removing the prefix does not change the installation
behaviour.

[1] https://mesonbuild.com/Reference-manual_functions.html#install_data

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-07-01 12:01:52 +10:00
Brandon Maier
d54aaf9367 pylibfdt: clean up python build directory
In commit "pylibfdt/Makefile.pylibfdt: fix Python library being rebuild
during install" the build directory moved to the top level of the repo.

Signed-off-by: Brandon Maier <brandon.maier@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-07-01 11:49:27 +10:00
Brandon Maier
ab86f1e9fd pylibfdt: add VERSION.txt to Python sdist
The VERSION.txt file tells setup.py what library version to use, so we
must include it in the source distrbution.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-07-01 11:43:50 +10:00
Brandon Maier
7b8a30ecea pylibfdt: fix Python version
In commit "pylibfdt: Remove some apparently deprecated options from
setup.py" the scm version tracking was removed. But it was not replaced
with the fixed version. This causes the Python modules to be installed
as version '0.0.0'.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-07-01 11:43:43 +10:00