[PATCH 00/17] pylibfdt: Update the U-Boot version with changes from upstream dtc
Alexey Charkov <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <[email protected]> |
U-Boot's copy of the libfdt Python bindings in
scripts/dtc/pylibfdt/libfdt.i_shipped was last synced wholesale in 2019,
by commit 903fe17aa8c8 ("pylibfdt: Sync up with upstream"), against dtc
commit 430419c28100. Since then it has only picked up individual fixes,
so it has drifted a long way behind dtc, which is now at v1.8.1-19.
Tom asked for an audit of the divergence when reviewing the FdtSw growth
patch [1]; this is the result. Bring in every missing change from upstream
as an individual commit, referencing its upstream sibling.
This adds: hasprop() and setprop_bool(), get_path(),
Property.as_stringlist() and the as_*int*_list() accessors,
address_cells()/size_cells(), add_mem_rsv()/del_mem_rsv(), geometric FdtSw
buffer growth, a missing Py_INCREF on the Py_None returned by the
fdt_getprop() typemap, correct get_mem_rsv() results on current Python,
and the SWIG 4.3+ return-value compatibility shim.
Not included is dtc commit 5008d1d6a356 ("pylibfdt: Replace removed SWIG
Python 2 compatibility macros"), which already landed independently as
commit 527115ef6783 ("pylibfdt: Replace removed SWIG Python 2
compatibility macros").
The first two patches are preparatory: they take the parts of two upstream
commits that earlier partial imports left behind, so the rest apply
verbatim. The last patch adds test coverage, since none of these bindings
have an in-tree caller yet and dtc's own tests for them live in
tests/pylibfdt_tests.py, which U-Boot does not carry.
Residual differences from upstream left untouched:
- the SPDX comment style;
- the %begin block defining PY_SSIZE_T_CLEAN, which is U-Boot's variant
of a fix dtc applies from its build system;
- the two %include paths, which follow U-Boot's directory layout;
- the retry loop in FdtSw.as_fdt(), from commit 211cfa503f6c ("libfdt:
Detected out-of-space with fdt_finish()") - U-Boot only change
CI passes all green [2]
[1] https://lore.kernel.org/u-boot/[email protected]/
[2] https://git.u-boot-project.org/u-boot/contributors/alchark/u-boot/-/pipelines/1047
Signed-off-by: Alexey Charkov <[email protected]>
---
Alexey Charkov (6):
pylibfdt: Cast property length to Py_ssize_t
pylibfdt: Restore the upstream bytearray() in getprop()
pylibfdt: Grow the FdtSw buffer geometrically
pylibfdt: Add address_cells() and size_cells()
pylibfdt: Add add_mem_rsv() and del_mem_rsv()
dtoc: Add tests for the pylibfdt bindings dtoc does not use
Brandon Maier (2):
pylibfdt: Fix get_mem_rsv for newer Python versions
pylibfdt: Fix backwards compatibility of return values
Luca Weiss (5):
pylibfdt: Fix Python crash on getprop deallocation
pylibfdt: Add Property.as_stringlist()
pylibfdt: Add Property.as_*int*_array()
pylibfdt: Add FdtRo.get_path()
pylibfdt: Add size_hint parameter for get_path
Rob Herring (1):
pylibfdt: Work-around SWIG limitations with flexible arrays
Simon Glass (2):
pylibfdt: Support boolean properties
pylibfdt: Document that FdtSw.property() takes bytes
Thomas Huth (1):
pylibfdt: Fix a typo in the next_node() docstring
scripts/dtc/pylibfdt/libfdt.i_shipped | 230 ++++++++++++++++++++++++++++++----
tools/dtoc/test_fdt.py | 175 +++++++++++++++++++++++++-
2 files changed, 380 insertions(+), 25 deletions(-)
---
base-commit: 6073c36b2c8d39afe3ecc789b281667a3ddebc70
change-id: 20260824-pylibfdt-sync-c1c11f821579
Best regards,
--
Alexey Charkov <[email protected]>