mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
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>
This commit is contained in:
parent
45f3d1a095
commit
17739b7ef5
7 changed files with 18 additions and 5 deletions
5
fdtget.c
5
fdtget.c
|
@ -97,6 +97,11 @@ static int show_data(struct display_info *disp, const char *data, int len)
|
|||
if (len == 0)
|
||||
return 0;
|
||||
|
||||
if (disp->type == 'r') {
|
||||
fwrite(data, 1, len, stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
is_string = (disp->type) == 's' ||
|
||||
(!disp->type && util_is_printable_string(data, len));
|
||||
if (is_string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue