Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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: bdc5c8793a1 ("meson: allow disabling tests")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Prepare for a new release.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
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>
|
|
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>
|
|
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>
|
|
This matches how Linux escapes spaces in paths.
The same syntax is also used by other build tools that output depfiles,
e.g. https://github.com/rust-lang/cargo/blob/edd36eba5e0d6e0cfcb84bd0cc651ba8bf5e7f83/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>
|
|
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>
|
|
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>
|
|
Prepare for a new release.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
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>
|
|
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>
|
|
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: 1fad065080e6 ("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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
The Python module gets built during the 'make install' command even if
'make all' was run prior for build.
This is the same issue as described in the previous commit
"pylibfdt/meson.build: fix Python library being rebuilt during install".
Remove the '--build-lib' flag so setuptools can find the build module.
Signed-off-by: Brandon Maier <brandon.maier@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
User @sharkcz noted that when the '--quiet' flag is removed from
./setup.py, the following can be seen from the `./setup.py install`
stage.
Running custom install script 'dtc/g/pylibfdt/../setup.py --top-builddir \
dtc/g/redhat-linux-build install --prefix=/usr/local --root=$DESTDIR'
running install
...
building '_libfdt' extension
swigging dtc/g/pylibfdt/../pylibfdt/libfdt.i to \
dtc/g/pylibfdt/../pylibfdt/libfdt_wrap.c
swig -python -Idtc/g/pylibfdt/../libfdt -o \
dtc/g/pylibfdt/../pylibfdt/libfdt_wrap.c dtc/g/pylibfdt/../pylibfdt/libfdt.i
gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 \
-DNDEBUG -fexceptions -fexceptions -fexceptions -fPIC -DPY_SSIZE_T_CLEAN \
-Idtc/g/pylibfdt/../libfdt -I/usr/include/python3.12 -c \
dtc/g/pylibfdt/../pylibfdt/libfdt_wrap.c -o \
build/temp.linux-ppc64le-cpython-312dtc/g/pylibfdt/../pylibfdt/libfdt_wrap.o
creating build/lib.linux-ppc64le-cpython-312
gcc -shared build/temp.linux-ppc64le-cpython-312dtc/g/pylibfdt/../pylibfdt/libfdt_wrap.o \
-Ldtc/g/redhat-linux-build/libfdt -L/usr/lib64 -lfdt -o \
build/lib.linux-ppc64le-cpython-312/_libfdt.cpython-312-powerpc64le-linux-gnu.so
copying dtc/g/pylibfdt/../pylibfdt/libfdt.py -> build/lib.linux-ppc64le-cpython-312
Meaning the python library is getting recompiled during the `meson
install` phase. This causes build issues as Meson does not set the
compiler and linker flags during the install phase.
The reason the library is getting rebuilt is during the normal build
with "build_ext", the `--build-lib` flag gets passed which changes the
default output build directory. But there is no equivalent option for
the "install" command. Install instead looks in the default directory
"./build" and so does not find the previously built library.
Since we can't fix the "install" command, drop the --build-lib flag.
This causes setup.py to compile the libraries at
`<meson-build>/build/lib.linux-x86_64-cpython-312/`. We must also then
fix run_tests.sh to find the library build directory as it's
machine-dependent.
Fixes: #135
Signed-off-by: Brandon Maier <brandon.maier@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
Meson automatically passes in LD_LIBRARY_PATH pointing at the correct
build directory for libfdt.so. So preserve LD_LIBRARY_PATH if it's
already set.
Signed-off-by: Brandon Maier <brandon.maier@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
The run-tests.sh script attempts to detect if Python and Yaml support is
enabled in the build. This has caused false-negatives where it fails to
find the Python library even though it was compiled into the build.
Avoid this problem altogether and always set the NO_PYTHON and NO_YAML
to match if the features are enabled in Meson.
Signed-off-by: Brandon Maier <brandon.maier@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
It is possible the overall length of "interrupt-map" is shorter than
expected. A likely scenario is if "#address-cells" in the interrupt
parent is not accounted for and there is only a single map entry. With
multiple entries, one of the other tests would likely fail.
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Message-ID: <20240531133149.1498139-1-robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|