aboutsummaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2021-12-09 07:14:20 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2021-12-09 17:48:58 +1100
commit17739b7ef510917471409d71fb45d8eaf6a1e1fb (patch)
treebe50e5b54772db89cbb688057b4e67d780fab512 /util.h
parent45f3d1a095dd3440578d5c6313eba555a791f3fb (diff)
downloaddtc-17739b7ef510917471409d71fb45d8eaf6a1e1fb.zip
dtc-17739b7ef510917471409d71fb45d8eaf6a1e1fb.tar.gz
dtc-17739b7ef510917471409d71fb45d8eaf6a1e1fb.tar.bz2
Support 'r' format for printing raw bytes with fdtget
FT is sometimes used for storing raw data. That is quite common for U-Boot FIT images. Extracting such data is not trivial currently. Using type 's' (string) will replace every 0x00 (NUL) with 0x20 (space). Using type 'x' will print bytes but in xxd incompatible format. This commit adds support for 'r' (raw) format. Example usage: fdtget -t r firmware.itb /images/foo data > image.raw Support for encoding isn't added as there isn't any clean way of passing binary data as command line argument. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Message-Id: <20211209061420.29466-1-zajec5@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'util.h')
-rw-r--r--util.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/util.h b/util.h
index c45b2c2..7a4e910 100644
--- a/util.h
+++ b/util.h
@@ -143,6 +143,7 @@ int utilfdt_write_err(const char *filename, const void *blob);
* i signed integer
* u unsigned integer
* x hex
+ * r raw
*
* TODO: Implement ll modifier (8 bytes)
* TODO: Implement o type (octal)
@@ -160,7 +161,7 @@ int utilfdt_decode_type(const char *fmt, int *type, int *size);
*/
#define USAGE_TYPE_MSG \
- "<type>\ts=string, i=int, u=unsigned, x=hex\n" \
+ "<type>\ts=string, i=int, u=unsigned, x=hex, r=raw\n" \
"\tOptional modifier prefix:\n" \
"\t\thh or b=byte, h=2 byte, l=4 byte (default)";