summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2023-03-02 11:12:23 +0300
committerTom Rini <trini@konsulko.com>2023-03-17 23:10:42 +0300
commit2bec5480522298c99d04b7600d300a83b318a0d5 (patch)
treefa27fee6e4fa53049eb2bdcf4a64d5216f907abd /doc
parent8311ac5fe0831ae26ffb68fab6b927b18d7036d2 (diff)
downloadu-boot-2bec5480522298c99d04b7600d300a83b318a0d5.tar.xz
doc: document read/write commands
The read and write commands are, deliberately, implemented in the same file, so that they stay feature-compatible (e.g. if someone implements support for "read the full partition, however large that is", that same syntax should also work for write). In order to ensure the documentation for both are similarly kept in sync, and to avoid duplication, document them both in read.rst, and add a stub write.rst referring to read.rst. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/usage/cmd/read.rst44
-rw-r--r--doc/usage/cmd/write.rst6
-rw-r--r--doc/usage/index.rst2
3 files changed, 52 insertions, 0 deletions
diff --git a/doc/usage/cmd/read.rst b/doc/usage/cmd/read.rst
new file mode 100644
index 0000000000..840846728f
--- /dev/null
+++ b/doc/usage/cmd/read.rst
@@ -0,0 +1,44 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later:
+
+read and write commands
+=======================
+
+Synopsis
+--------
+
+::
+
+ read <interface> <dev[:part|#partname]> <addr> <blk#> <cnt>
+ write <interface> <dev[:part|#partname]> <addr> <blk#> <cnt>
+
+The read and write commands can be used for raw access to data in
+block devices (or partitions therein), i.e. without going through a
+file system.
+
+read
+----
+
+The block device is specified using the <interface> (e.g. "mmc") and
+<dev> parameters. If the block device has a partition table, one can
+optionally specify a partition number (using the :part syntax) or
+partition name (using the #partname syntax). The command then reads
+the <cnt> blocks of data starting at block number <blk#> of the given
+device/partition to the memory address <addr>.
+
+write
+-----
+
+The write command is completely equivalent to the read command, except
+of course that the transfer direction is reversed.
+
+Examples
+--------
+
+ # Read 2 MiB from partition 3 of mmc device 2 to $loadaddr
+ read mmc 2.3 $loadaddr 0 0x1000
+
+ # Read 16 MiB from the partition named 'kernel' of mmc device 1 to $loadaddr
+ read mmc 1#kernel $loadaddr 0 0x8000
+
+ # Write to the third sector of the partition named 'bootdata' of mmc device 0
+ write mmc 0#bootdata $loadaddr 2 1
diff --git a/doc/usage/cmd/write.rst b/doc/usage/cmd/write.rst
new file mode 100644
index 0000000000..c16870d6dc
--- /dev/null
+++ b/doc/usage/cmd/write.rst
@@ -0,0 +1,6 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later:
+
+write command
+=============
+
+See :doc:`read`.
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index ebf5eea9f8..d01d38cbf9 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -72,6 +72,7 @@ Shell commands
cmd/printenv
cmd/pstore
cmd/qfw
+ cmd/read
cmd/reset
cmd/rng
cmd/sbi
@@ -92,6 +93,7 @@ Shell commands
cmd/ut
cmd/wdt
cmd/wget
+ cmd/write
cmd/xxd
Booting OS