[PATCH 0/9] Add dtget and dtput for access to fdt from build system
Simon Glass
sjg at chromium.org
Wed Jul 6 05:02:48 EST 2011
This patch set adds two new utilities:
dtget for reading properties from a device tree binary file
dtput for updating the device tree binary file
These are useful in scripts where configuration or other information must be
passed to the running system from the build system or vice versa. For example,
dtget can be used to obtain the LCD screen width/height for use with preparing
custom bitmap images for display on the screen. Going the other way, dtput can
be used to set configuration parameters known only to the build or
manufacturing test system, for example a hardware ID or the particular type
of boot EEPROM used on this PCB.
It is desirable to use these utilities rather than parsing or updating the
device tree source file, since this parsing is already implemented in dtc and
it makes no sense to reimplement it in a script. It also means that the build
system and the run-time environment see the same device tree values, so that
parsing or updating bugs do not creap in.
I believe that these utilities belong with dtc rather than libfdt since they
are more useful in the build system context rather than at run-time. At
run-time it is easier and better to use the provided library rather than
these utiltiies. But for build scripts and production automation, these
uitilites are better.
Some effort has been made to add tests and to use a sensible parameter format,
but comments are welcome on these and any other part of this patch set.
Simon Glass (9):
Split out is_printable_string() into util.c
Add dtget utility to read property values from device tree
Add basic tests for dtget
Add missing tests to .gitignore
Add utilfdt for common functions, adjust dtget
Add new dtput utility to write values to fdt
Add some tests for dtput
Add dtput to .gitignore
dtput: Support adding strings with spaces
.gitignore | 2 +
Makefile | 14 ++++
Makefile.dtget | 14 ++++
Makefile.dtput | 14 ++++
Makefile.ftdump | 3 +-
dtget.c | 166 +++++++++++++++++++++++++++++++++++++++
dtput.c | 204 ++++++++++++++++++++++++++++++++++++++++++++++++
ftdump.c | 28 +------
tests/.gitignore | 2 +
tests/dtget-runtest.sh | 30 +++++++
tests/dtget-test.dts | 63 +++++++++++++++
tests/dtput-runtest.sh | 50 ++++++++++++
tests/run_tests.sh | 73 +++++++++++++++++-
tests/tests.sh | 2 +
util.c | 28 +++++++
util.h | 11 +++
utilfdt.c | 113 ++++++++++++++++++++++++++
utilfdt.h | 58 ++++++++++++++
18 files changed, 848 insertions(+), 27 deletions(-)
create mode 100644 Makefile.dtget
create mode 100644 Makefile.dtput
create mode 100644 dtget.c
create mode 100644 dtput.c
create mode 100755 tests/dtget-runtest.sh
create mode 100644 tests/dtget-test.dts
create mode 100644 tests/dtput-runtest.sh
create mode 100644 utilfdt.c
create mode 100644 utilfdt.h
--
1.7.3.1
More information about the devicetree-discuss
mailing list