diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2021-12-09 07:14:20 +0100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2021-12-09 17:48:58 +1100 |
commit | 17739b7ef510917471409d71fb45d8eaf6a1e1fb (patch) | |
tree | be50e5b54772db89cbb688057b4e67d780fab512 /util.c | |
parent | 45f3d1a095dd3440578d5c6313eba555a791f3fb (diff) | |
download | device-tree-compiler-17739b7ef510917471409d71fb45d8eaf6a1e1fb.tar.gz |
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.c')
-rw-r--r-- | util.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -353,11 +353,11 @@ int utilfdt_decode_type(const char *fmt, int *type, int *size) } /* we should now have a type */ - if ((*fmt == '\0') || !strchr("iuxs", *fmt)) + if ((*fmt == '\0') || !strchr("iuxsr", *fmt)) return -1; /* convert qualifier (bhL) to byte size */ - if (*fmt != 's') + if (*fmt != 's' && *fmt != 'r') *size = qualifier == 'b' ? 1 : qualifier == 'h' ? 2 : qualifier == 'l' ? 4 : -1; |