[PATCH v2 0/5] improve 'read' command, add 'write' command

Rasmus Villemoes rasmus.villemoes at prevas.dk
Wed Mar 1 22:12:51 CET 2023

The first patch simplies do_read somewhat by making use of an existing
helper instead of parsing the dev_part string manually. As a bonus
(and my actual motivation), it now understands dev#partname syntax -
hard-coded partition numbers are so last decade.

I also need the symmetrical operation, being able to write to a named
raw partition, and fortunately it doesn't require that many lines of
code to implement that.

There's a very minor change in the error reporting due to using
cmdtp->name to generate the new messages, but I don't think "Error
reading blocks" offers much that "read error" doesn't.

New in v2: the last three patches add documentation, ensure CMD_WRITE
is set for sandbox and adds some basic test cases for the various ways
of accessing the partitions (by number, name, or as raw offset within
the whole disk).

Rasmus Villemoes (5):
  cmd: read: use part_get_info_by_dev_and_name_or_num() instead of
    open-coded dev_part parsing
  cmd: introduce 'write' command
  doc: document read/write commands
  sandbox: enable CMD_WRITE
  test: add tests of 'read' and 'write' shell commands

 cmd/Kconfig                 |   5 ++
 cmd/Makefile                |   1 +
 cmd/read.c                  |  61 +++++++++++----------
 configs/sandbox64_defconfig |   1 +
 configs/sandbox_defconfig   |   1 +
 doc/usage/cmd/read.rst      |  40 ++++++++++++++
 doc/usage/index.rst         |   1 +
 test/cmd/Makefile           |   1 +
 test/cmd/rw.c               | 104 ++++++++++++++++++++++++++++++++++++
 9 files changed, 184 insertions(+), 31 deletions(-)
 create mode 100644 doc/usage/cmd/read.rst
 create mode 100644 test/cmd/rw.c


More information about the U-Boot mailing list