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

Rasmus Villemoes rasmus.villemoes at prevas.dk
Thu Mar 2 09:12:20 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).

v3: Add Simon's R-b to patches 2, 4, 5, fixup whitespace in patch 5.

I don't want to duplicate the documentation, but I can see the value
in 'write' having its own entry in the TOC, so I added a stub
write.rst that just refers to the read.rst, which then explicitly
documents both.

[And now, a small rant]

Then I wanted to test that rst magic and see that the linking works,
so I ran

  make htmldocs

and was greeted with

  Running Sphinx v1.8.5
  ...
  Sphinx version error:
  This project needs at least Sphinx v2.4.4 and therefore cannot be built with this version.

Interestingly, doc/sphinx/requirements.txt says
Sphinx==3.4.3. Whatever, lemme go try and build in an official
container. So I fired up "docker run --rm -ti
trini/u-boot-gitlab-ci-runner:bionic-20200807-02Sep2020", and tried
doing the steps listed in both .azure-pipelines.yml and
.gitlab-ci.yml, namely

  virtualenv -p /usr/bin/python3 /tmp/venvhtml
  . /tmp/venvhtml/bin/activate
  pip install -r doc/sphinx/requirements.txt
  make htmldocs

but the third step fails with

  ERROR: Could not find a version that satisfies the requirement MarkupSafe==2.1.1 (from versions: 0.9, 0.9.1, 0.9.2, 0.9.3, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 1.0, 1.1.0, 1.1.1, 2.0.0a1, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1)
  ERROR: No matching distribution found for MarkupSafe==2.1.1

And then I give up.

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      |  44 +++++++++++++++
 doc/usage/cmd/write.rst     |   6 +++
 doc/usage/index.rst         |   2 +
 test/cmd/Makefile           |   1 +
 test/cmd/rw.c               | 104 ++++++++++++++++++++++++++++++++++++
 10 files changed, 195 insertions(+), 31 deletions(-)
 create mode 100644 doc/usage/cmd/read.rst
 create mode 100644 doc/usage/cmd/write.rst
 create mode 100644 test/cmd/rw.c

-- 
2.37.2



More information about the U-Boot mailing list