devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
To: Devicetree Discuss
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Subject: [RESEND PATCH v3 0/7] Add fdtget and fdtput for access to fdt from build system
Date: Mon, 19 Sep 2011 13:21:01 -0700	[thread overview]
Message-ID: <1316463668-976-1-git-send-email-sjg@chromium.org> (raw)

This patch set adds two new utilities:

   fdtget for reading properties from a device tree binary file
   fdtput 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, fdtget 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, fdtput 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 the parameter format has been
revised after previous feedback.

Changes in v2:
- Separate arguments for node and property
- Remove limits on data size of property writting to fdt
- Remove use of getopt_long()
- Adjust tests for new fdtput arguments
- Add test for multiple strings
- Add test for exhausting fdt space
- Merge two related commits into this one
- Use structure for storing display options
- Adjust tests for new fdtget arguments
- Remove util_decode_key
- Add utilfdt_decode_type to be used by fdtget/put
- Remove limits on device tree binary size

Changes in v3:
- Squash fdtput tests into fdtput commit
- Squash fdtget test commit into fdtget
- Add a few more tests for 1- and 2-byte formats
- Change format of -t argument to be more like printf
- Change help string and make part of it common
- Add error checking for the property not being a multiple of value size
- Make testutils.c use utilfdt for load/save blobs
- Add tests for utilfdt
- Move utilfdt into its own directory and make it a library
- Use code closer to testutils.c implementation
- Use open/close instead of fopen/fclose
- Use Makefile.utils instead of separate Makefiles

Simon Glass (7):
  Create Makefile.utils and move ftdump into it
  Add utilfdt for common functions
  Add utilfdt tests
  Make testutils use utilfdt
  ftdump: use utilfdt to read blob
  Add fdtget utility to read property values from a device tree
  Add fdtput utility to write property values to a device tree

 .gitignore               |    2 +
 Makefile                 |   43 ++++++++-
 Makefile.ftdump          |   13 ---
 Makefile.utils           |   24 +++++
 fdtget.c                 |  227 ++++++++++++++++++++++++++++++++++++++++++++
 fdtput.c                 |  236 ++++++++++++++++++++++++++++++++++++++++++++++
 ftdump.c                 |   33 +------
 tests/Makefile.tests     |    9 +-
 tests/fdtget-runtest.sh  |   35 +++++++
 tests/fdtput-runtest.sh  |   55 +++++++++++
 tests/run_tests.sh       |  121 +++++++++++++++++++++++-
 tests/tests.sh           |    2 +
 tests/testutils.c        |   60 +++----------
 tests/utilfdt_test.c     |  128 +++++++++++++++++++++++++
 utilfdt/Makefile.utilfdt |    9 ++
 utilfdt/utilfdt.c        |  167 ++++++++++++++++++++++++++++++++
 utilfdt/utilfdt.h        |  101 ++++++++++++++++++++
 17 files changed, 1168 insertions(+), 97 deletions(-)
 delete mode 100644 Makefile.ftdump
 create mode 100644 Makefile.utils
 create mode 100644 fdtget.c
 create mode 100644 fdtput.c
 create mode 100755 tests/fdtget-runtest.sh
 create mode 100644 tests/fdtput-runtest.sh
 create mode 100644 tests/utilfdt_test.c
 create mode 100644 utilfdt/Makefile.utilfdt
 create mode 100644 utilfdt/utilfdt.c
 create mode 100644 utilfdt/utilfdt.h

-- 
1.7.3.1

             reply	other threads:[~2011-09-19 20:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 20:21 Simon Glass [this message]
     [not found] ` <1316463668-976-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2011-09-19 20:21   ` [RESEND PATCH v3 1/7] Create Makefile.utils and move ftdump into it Simon Glass
     [not found]     ` <1316463668-976-2-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2011-09-20  1:02       ` David Gibson
2011-09-19 20:21   ` [RESEND PATCH v3 2/7] Add utilfdt for common functions Simon Glass
     [not found]     ` <1316463668-976-3-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2011-09-20  1:08       ` David Gibson
     [not found]         ` <20110920010859.GE29197-787xzQ0H9iQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2011-09-20  3:54           ` Simon Glass
     [not found]             ` <CAPnjgZ0U_gYkQQR14UNZ0tAOT8jYxzwi_mEYXsT134m14m=8Bg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-20  8:12               ` David Gibson
2011-09-19 20:21   ` [RESEND PATCH v3 3/7] Add utilfdt tests Simon Glass
     [not found]     ` <1316463668-976-4-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2011-09-20  1:11       ` David Gibson
     [not found]         ` <20110920011147.GF29197-787xzQ0H9iQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2011-09-21 20:28           ` Simon Glass
2011-09-19 20:21   ` [RESEND PATCH v3 4/7] Make testutils use utilfdt Simon Glass
2011-09-19 20:21   ` [RESEND PATCH v3 5/7] ftdump: use utilfdt to read blob Simon Glass
2011-09-19 20:21   ` [RESEND PATCH v3 6/7] Add fdtget utility to read property values from a device tree Simon Glass
2011-09-19 20:21   ` [RESEND PATCH v3 7/7] Add fdtput utility to write property values to " Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1316463668-976-1-git-send-email-sjg@chromium.org \
    --to=sjg-f7+t8e8rja9g9huczpvpmw@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).