fdt: Check error codes returned from fdtlib when loading ITB
PATCH 1/6 fdt: Check error codes returned from fdtlib when loading ITB
Before this patch, error codes returned from fdtlib were ignored and continued access would cause a crash. Now just check if the image is truncated and error if so.
--- common/image.c | 5 +++++ 1 file changed, 5 insertions(+)
common/image.c +5 -0
@@ -2818,6 +2818,11 @@ int fit_image_check_hashes(const void *fit, int image_noffset) } } +if (noffset == -FDT_ERR_TRUNCATED || noffset == -FDT_ERR_BADSTRUCTURE ) { + err_msg =" error!\nCorrupted or truncated tree" ; + goto error; + } +return 1 ; error:
Signature · 1 line
1.7.11.5
PATCH 2/6 fdt: Limit printed hex in fdt print and list commands
Prevent printing the entire image in a itb. It is most likely unhelpful to have the hex of the entire image scroll for minutes on your slow serial console.
--- common/cmd_fdt.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-)
common/cmd_fdt.c +24 -12
@@ -35,6 +35,9 @@#define MAX_LEVEL 32/* how deeply nested we will go */ #define SCRATCHPAD 1024/* bytes of scratchpad memory */ +#ifndef CONFIG_CMD_FDT_MAX_DUMP +#define CONFIG_CMD_FDT_MAX_DUMP 64 +#endif /* * Global data (for the gd->bd)
@@ -661,19 +664,28 @@ static void print_data(const void *data, int len) }if ((len %4 ) ==0 ) { -const u32 *p; - -printf ("<" ); -for (j =0 , p = data; j < len/4 ; j ++) -printf ("0x%x%s" ,fdt32_to_cpu (p[j]), j < (len/4 -1 ) ?" " :"" ); -printf (">" ); +if (len >CONFIG_CMD_FDT_MAX_DUMP ) +printf ("* 0x%08x [0x%08x]" , (unsigned int )data, len); +else { +const u32 *p; + +printf ("<" ); +for (j =0 , p = data; j < len/4 ; j++) +printf ("0x%08x%s" ,fdt32_to_cpu (p[j]), + j < (len/4 -1 ) ?" " :"" ); +printf (">" ); + } }else {/* anything else... hexdump */ -const u8 *s; - -printf ("[" ); -for (j =0 , s = data; j < len; j++) -printf ("%02x%s" , s[j], j < len -1 ?" " :"" ); -printf ("]" ); +if (len >CONFIG_CMD_FDT_MAX_DUMP ) +printf ("* 0x%08x [0x%08x]" , (unsigned int )data, len); +else { +const u8 *s; + +printf ("[" ); +for (j =0 , s = data; j < len; j++) +printf ("%02x%s" , s[j], j < len -1 ?" " :"" ); +printf ("]" ); + } } }
Signature · 1 line
1.7.11.5
PATCH 2/6 fdt: Limit printed hex in fdt print and list commands
Quoted 5 lines · Joe Hershberger
Prevent printing the entire image in a itb. It is most likely unhelpful to have the hex of the entire image scroll for minutes on your slow serial console.
Signed-off-by Joe Hershberger <[email protected]>
This causes:
$ uboot-build.sh sandboxTesting sandbox on -00004-gf0a29d4 Thu Oct 25 13:59:03 MST 2012 Configuring for sandbox board... text data bss dec hex filename 140245 6332 28472 175049 2abc9 sandbox/u-boot cmd_fdt.c: In function 'print_data': cmd_fdt.c:679:32: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] cmd_fdt.c:691:32: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121025/2b654459/attachment.pgp>
PATCH 2/6 fdt: Limit printed hex in fdt print and list commands
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Tom, Joe,
Quoted 8 lines · Tom Rini
Quoted 5 lines · Joe Hershberger
Prevent printing the entire image in a itb. It is most likely unhelpful to have the hex of the entire image scroll for minutes on your slow serial console.
Signed-off-by Joe Hershberger <[email protected]>
Quoted 8 lines
This causes: $
uboot-build.shsandboxTesting sandbox on -00004-gf0a29d4 Thu Oct 25 13:59:03 MST 2012 Configuring for
sandbox board... text data bss dec hex filename
140245 6332 28472 175049 2abc9 sandbox/u-bootcmd_fdt.c:
In function 'print_data': cmd_fdt.c:679:32: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] cmd_fdt.c:691:32: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
Sorry, I should have caught that and the 3/6 warning. :-(
I'm tied up with a flight test through Friday (Nov 2) which has been consuming all my available time. Joe, can you look at fixing the warnings?
Thanks,
gvb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iQEcBAEBAgAGBQJQjdPPAAoJEGOcKeGailWqeSMH/itjpDTCi/dNf3wdDHImpTev r9A7Ygk01eLhPWlLX5sV9+GziO1x1s8Z9mRbpdIBz4NeA5vaB79wS3D2/S06dxh8 DeSlk3U8eo4tNiI9OysDDp5IyxNXEmje4KkOD8snLIeYKV3/1RDPQYzsLrzlGVJ6 dFjPGNHmjLWzMi4kOSR34b6SIl1xPCUtBUgMfMTN6R8S5JLuJKSn/WUUcXtHpras yKYfvs1ULkmMg4aEbKzCWFa/a/JJK+XlxU4XQX2Xd7HSISg0eIoOJSV5khTCG8gR SVCkbF89+XO749a9xL3jyTEz1xMPqFO3KugbnyZGtsOm87VWyuZ/qzR4KdC2rJA= =ox6g
-----END PGP SIGNATURE-----
PATCH 3/6 fdt: Add get commands to fdt
In reply to Joe HershbergerAdd commands to access data in the fdt. This allows data from a dtb or itb to be accessed from the shell scripts.
--- common/cmd_fdt.c | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+)
common/cmd_fdt.c +144 -0
@@ -47,6 +47,7 @@ DECLARE_GLOBAL_DATA_PTR;static int fdt_valid (void );static int fdt_parse_prop (char *const *newval,int count,char *data,int *len);static int fdt_print (const char *pathp,char *prop,int depth); +static int is_printable_string (const void *data,int len);/* * The working_fdt points to our working flattened device tree.
@@ -64,6 +65,34 @@ void set_working_fdt_addr(void *addr) }/* +* Get a value from the fdt and format it to be set in the environment +*/ +static int fdt_value_setenv (const void *nodep,int len,const char *var) +{ +if (is_printable_string (nodep, len)) +setenv (var, (void *)nodep); +else if (len ==4 ) { +char buf[11 ]; + +sprintf (buf,"0x%08X" , *(uint32_t *)nodep); +setenv (var, buf); + }else if (len%4 ==0 && len <=20 ) { +/* Needed to print things like sha1 hashes. */ +char buf[41 ]; +int i; + +for (i =0 ; i < len; i +=sizeof (unsigned int )) +sprintf (buf + (i *2 ),"%08x" , + *(unsigned int *)(nodep + i)); +setenv (var, buf); + }else { +printf ("error: unprintable value\n" ); +return 1 ; + } +return 0 ; +} + +/* * Flattened Device Tree command, see the help for parameter definitions. */ int do_fdt (cmd_tbl_t * cmdtp,int flag,int argc,char *const argv[])
@@ -242,6 +271,117 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])return 1 ; } +/******************************************************************** +* Get the value of a property in the working_fdt. +********************************************************************/ + }else if (argv[1 ][0 ] =='g' ) { +char *subcmd;/* sub-command */ +char *pathp;/* path */ +char *prop;/* property */ +char *var;/* variable to store result */ +int nodeoffset;/* node offset from libfdt */ +const void *nodep;/* property node pointer */ +int len =0 ;/* new length of the property */ + +/* +* Parameters: Node path, property, optional value. +*/ +if (argc <5 ) +return CMD_RET_USAGE ; + + subcmd = argv[2 ]; + +if (argc <6 && subcmd[0 ] !='s' ) +return CMD_RET_USAGE ; + + var = argv[3 ]; + pathp = argv[4 ]; + prop = argv[5 ]; + + nodeoffset =fdt_path_offset (working_fdt, pathp); +if (nodeoffset <0 ) { +/* +* Not found or something else bad happened. +*/ +printf ("libfdt fdt_path_offset() returned %s\n" , +fdt_strerror (nodeoffset)); +return 1 ; + } + +if (subcmd[0 ] =='n' || (subcmd[0 ] =='s' && argc ==5 )) { +int reqIndex =-1 ; +int startDepth =fdt_node_depth ( + working_fdt, nodeoffset); +int curDepth = startDepth; +int curIndex =-1 ; +int nextNodeOffset =fdt_next_node ( + working_fdt, nodeoffset, &curDepth); + +if (subcmd[0 ] =='n' ) + reqIndex =simple_strtoul (argv[5 ],NULL ,16 ); + +while (curDepth > startDepth) { +if (curDepth == startDepth +1 ) + curIndex++; +if (subcmd[0 ] =='n' && curIndex == reqIndex) { +const char *nodeName =fdt_get_name ( + working_fdt, nextNodeOffset,NULL ); + +setenv (var, (char *)nodeName); +return 0 ; + } + nextNodeOffset =fdt_next_node ( + working_fdt, nextNodeOffset, &curDepth); +if (nextNodeOffset <0 ) +break ; + } +if (subcmd[0 ] =='s' ) { +/* get the num nodes@this level */ +char buf[11 ]; + +sprintf (buf,"%d" , curIndex +1 ); +setenv (var, buf); + }else { +/* node index not found */ +printf ("libfdt node not found\n" ); +return 1 ; + } + }else { + nodep =fdt_getprop ( + working_fdt, nodeoffset, prop, &len); +if (len ==0 ) { +/* no property value */ +setenv (var,"" ); +return 0 ; + }else if (len >0 ) { +if (subcmd[0 ] =='v' ) { +int ret; + + ret =fdt_value_setenv (nodep, len, var); +if (ret !=0 ) +return ret; + }else if (subcmd[0 ] =='a' ) { +/* Get address */ +char buf[11 ]; + +sprintf (buf,"0x%08X" , (uint32_t )nodep); +setenv (var, buf); + }else if (subcmd[0 ] =='s' ) { +/* Get size */ +char buf[11 ]; + +sprintf (buf,"0x%08X" , len); +setenv (var, buf); + }else +return CMD_RET_USAGE ; +return 0 ; + }else { +printf ("libfdt fdt_getprop(): %s\n" , +fdt_strerror (len)); +return 1 ; + } + } +/* * Print (recursive) / List (single level) */
@@ -825,6 +965,10 @@ U_BOOT_CMD("fdt resize - Resize fdt to size + padding to 4k addr\n" "fdt print <path> [<prop>] - Recursive print starting at <path>\n" "fdt list <path> [<prop>] - Print one level starting at <path>\n" +"fdt get value <var> <path> <prop> - Get <property> and store in <var>\n" +"fdt get name <var> <path> <index> - Get name of node <index> and store in <var>\n" +"fdt get addr <var> <path> <prop> - Get start address of <property> and store in <var>\n" +"fdt get size <var> <path> [<prop>] - Get size of [<property>] or num nodes and store in <var>\n" "fdt set <path> <prop> [<val>] - Set <property> [to <val>]\n" "fdt mknode <path> <node> - Create a new node after <path>\n" "fdt rm <path> [<prop>] - Delete the node or <property>\n"
Signature · 1 line
1.7.11.5
PATCH 3/6 fdt: Add get commands to fdt
Quoted 4 lines · Joe Hershberger
Add commands to access data in the fdt. This allows data from a dtb or itb to be accessed from the shell scripts.
Signed-off-by Joe Hershberger <[email protected]>
This adds:
$ uboot-build.sh sandbox Testing sandbox on -00386-g5e8f983 Thu Oct 25 14:07:28 MST 2012 Configuring for sandbox board... text data bss dec hex filename 143101 6424 28488 178013 2b75d sandbox/u-boot cmd_fdt.c: In function 'do_fdt': cmd_fdt.c:378:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121025/147cb716/attachment.pgp>
PATCH 4/6 fdt: Identify scripts in ITBs as printable strings
In reply to Joe HershbergerScripts in the ITB format will have spaces in them and will end in a newline charachter. Make sure that these are considered printable.
--- common/cmd_fdt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
common/cmd_fdt.c +3 -3
@@ -743,12 +743,12 @@ static int is_printable_string(const void *data, int len)if (len ==0 )return 0 ; -/* must terminate with zero */ -if (s[len -1 ] !='\0' ) +/* must terminate with zero or '\n' */ +if (s[len -1 ] !='\0' && s[len -1 ] !='\n' )return 0 ;/* printable or a null byte (concatenated strings) */ -while (((*s =='\0' ) ||isprint (*s)) && (len >0 )) { +while (((*s =='\0' ) ||isprint (*s) ||isspace (*s)) && (len >0 )) {/* * If we see a null, there are three possibilities: * 1) If len == 1, it is the end of the string, printable
Signature · 1 line
1.7.11.5
PATCH 5/6 fdt: Check for a token to skip auto-hash validation
In reply to Joe HershbergerAllow the itb file to declare to u-boot that its hash should not be checked automatically on bootm or iminfo. This allows an image to either be checked automatically or to include a script which may check it otherwise (such as after part of the itb has been relocated to RAM by the script).
--- common/image.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/image.h | 4 ++++ 2 files changed, 45 insertions(+)
common/image.c +41 -0
@@ -2494,6 +2494,36 @@ int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,return 0 ; } +#ifndef USE_HOSTCC +/** +* fit_image_hash_get_ignore - get hash ignore flag +* @fit: pointer to the FIT format image header +* @noffset: hash node offset +* @ignore: pointer to an int, will hold hash ignore flag +* +* fit_image_hash_get_ignore() finds hash ignore property in a given hash node. +* If the property is found and non-zero, the hash algorithm is not verified by +* u-boot automatically. +* +* returns: +* 0, on ignore not found +* value, on ignore found +*/ +int fit_image_hash_get_ignore (const void *fit,int noffset,int *ignore) +{ +int len; +int *value; + + value = (int *)fdt_getprop (fit, noffset,FIT_IGNORE_PROP , &len); +if (value ==NULL || len !=sizeof (int )) + *ignore =0 ; +else + *ignore = *value; + +return 0 ; +} +#endif +/** * fit_set_timestamp - set node timestamp property * @fit: pointer to the FIT format image header
@@ -2757,6 +2787,9 @@ int fit_image_check_hashes(const void *fit, int image_noffset)char *algo;uint8_t *fit_value;int fit_value_len; +#ifndef USE_HOSTCC +int ignore; +#endif uint8_t value[FIT_MAX_HASH_LEN ];int value_len;int noffset;
@@ -2793,6 +2826,14 @@ int fit_image_check_hashes(const void *fit, int image_noffset) }printf ("%s" , algo); +#ifndef USE_HOSTCC +fit_image_hash_get_ignore (fit, noffset, &ignore); +if (ignore) { +printf ("-skipped " ); +continue ; + } +#endif +if (fit_image_hash_get_value (fit, noffset, &fit_value, &fit_value_len)) { err_msg =" error!\nCan't get hash value "
include/image.h +4 -0
@@ -510,6 +510,7 @@ static inline int image_check_target_arch(const image_header_t *hdr)#define FIT_HASH_NODENAME "hash"#define FIT_ALGO_PROP "algo"#define FIT_VALUE_PROP "value" +#define FIT_IGNORE_PROP "uboot-ignore"/* image node */ #define FIT_DATA_PROP "data"
@@ -594,6 +595,9 @@ int fit_image_get_data(const void *fit, int noffset,int fit_image_hash_get_algo (const void *fit,int noffset,char **algo);int fit_image_hash_get_value (const void *fit,int noffset,uint8_t **value,int *value_len); +#ifndef USE_HOSTCC +int fit_image_hash_get_ignore (const void *fit,int noffset,int *ignore); +#endif int fit_set_timestamp (void *fit,int noffset,time_t timestamp);int fit_set_hashes (void *fit);
Signature · 1 line
1.7.11.5
PATCH 6/6 fdt: Add a Linux tool for reading values from FDT files
In reply to Joe HershbergerDesigned to be able to access itb files on a filesystem or an mtd partition.
Supports print and list (like the fdt command) and also offset for finding the offset and size of a given property in an FDT file.
This is especially helpful when reading properties from an ITB file.
--- Makefile | 2 +- tools/fdtview/Makefile | 52 ++++++ tools/fdtview/fdtview.c | 483 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 536 insertions(+), 1 deletion(-) create mode 100644 tools/fdtview/Makefile create mode 100644 tools/fdtview/fdtview.c
Makefile +1 -1
@@ -659,7 +659,7 @@ $(TIMESTAMP_FILE): @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> [email protected] @cmp -s $@ [email protected] && rm -f [email protected] || mv -f [email protected] $@ -easylogo env gdb: +easylogo env fdtview gdb: $(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION} gdbtools: gdb
tools/fdtview/Makefile new file +52 -0
52 lines not on this page · raw message
tools/fdtview/fdtview.c new file +483 -0
483 lines not on this page · raw message
Signature · 1 line
1.7.11.5
PATCH 6/6 fdt: Add a Linux tool for reading values from FDT files
Quoted 7 lines · On Friday 17 August 2012 16:34:40 Joe Hershberger wrote:
Designed to be able to access itb files on a filesystem or an mtd partition.
Supports print and list (like the fdt command) and also offset for finding the offset and size of a given property in an FDT file.
This is especially helpful when reading properties from an ITB file.
doesn't the ftdump utility from the dtc package cover your needs ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120817/d5ae8f7c/attachment.pgp>
PATCH 6/6 fdt: Add a Linux tool for reading values from FDT files
Hi Mike,
Quoted 10 lines · Mike Frysinger
Quoted 7 lines · On Friday 17 August 2012 16:34:40 Joe Hershberger wrote:
Designed to be able to access itb files on a filesystem or an mtd partition.
Supports print and list (like the fdt command) and also offset for finding the offset and size of a given property in an FDT file.
This is especially helpful when reading properties from an ITB file.
doesn't the ftdump utility from the dtc package cover your needs ?
No. The purpose is to use this utility e.g. in a Linux shell script to retrieve a property from the ITB. The two places I use it are to retrieve a version number from the ITB and to identify the offset and size of a data block (image) in the ITB.
PATCH 6/6 fdt: Add a Linux tool for reading values from FDT files
Quoted 12 lines · On Monday 20 August 2012 19:40:45 Joe Hershberger wrote:
Quoted 10 lines · Mike Frysinger
Quoted 7 lines · On Friday 17 August 2012 16:34:40 Joe Hershberger wrote:
Designed to be able to access itb files on a filesystem or an mtd partition.
Supports print and list (like the fdt command) and also offset for finding the offset and size of a given property in an FDT file.
This is especially helpful when reading properties from an ITB file.
doesn't the ftdump utility from the dtc package cover your needs ?
Quoted 8 lines
No. The purpose is to use this utility e.g. in a Linux shell script to retrieve a property from the ITB. The two places I use it are to retrieve a version number from the ITB and to identify the offset and size of a data block (image) in the ITB.
From what I can see the ftdump utility in the dtc component just dumps the ITB as a single blob with no options. I'm looking at the dtc 1.2.0 source.
... so wouldn't the logical thing be to extend ftdump to support your needs and send a patch to the DTC authors rather than to write an entire tool from scratch and commit it to a tree that is merely a user of device trees ? -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120820/012abd02/attachment.pgp>
PATCH 6/6 fdt: Add a Linux tool for reading values from FDT files
Hi Mike,
Quoted 18 lines · Mike Frysinger
Quoted 17 lines · On Monday 20 August 2012 19:40:45 Joe Hershberger wrote:
Quoted 10 lines · Mike Frysinger
Quoted 7 lines · On Friday 17 August 2012 16:34:40 Joe Hershberger wrote:
Designed to be able to access itb files on a filesystem or an mtd partition.
Supports print and list (like the fdt command) and also offset for finding the offset and size of a given property in an FDT file.
This is especially helpful when reading properties from an ITB file.
doesn't the ftdump utility from the dtc package cover your needs ?
No. The purpose is to use this utility e.g. in a Linux shell script to retrieve a property from the ITB. The two places I use it are to retrieve a version number from the ITB and to identify the offset and size of a data block (image) in the ITB.
Quoted 7 lines
Quoted 3 lines
From what I can see the ftdump utility in the dtc component just dumps the ITB as a single blob with no options. I'm looking at the dtc 1.2.0 source.
... so wouldn't the logical thing be to extend ftdump to support your needs and send a patch to the DTC authors rather than to write an entire tool from scratch and commit it to a tree that is merely a user of device trees ?
Yes it probably would have been, if I had noticed that the ftdump utility existed, then that is the approach I would have taken. I think it is of specific use to u-boot users, but if you think it's better to extend ftdump, I guess I could take that approach.
-Joe
PATCH 6/6 fdt: Add a Linux tool for reading values from FDT files
Quoted 28 lines · On Monday 20 August 2012 20:51:32 Joe Hershberger wrote:
Quoted 18 lines · Mike Frysinger
Quoted 17 lines · On Monday 20 August 2012 19:40:45 Joe Hershberger wrote:
Quoted 10 lines · Mike Frysinger
Quoted 7 lines · On Friday 17 August 2012 16:34:40 Joe Hershberger wrote:
Designed to be able to access itb files on a filesystem or an mtd partition.
Supports print and list (like the fdt command) and also offset for finding the offset and size of a given property in an FDT file.
This is especially helpful when reading properties from an ITB file.
doesn't the ftdump utility from the dtc package cover your needs ?
No. The purpose is to use this utility e.g. in a Linux shell script to retrieve a property from the ITB. The two places I use it are to retrieve a version number from the ITB and to identify the offset and size of a data block (image) in the ITB.
Quoted 8 lines
Quoted 3 lines
From what I can see the ftdump utility in the dtc component just dumps the ITB as a single blob with no options. I'm looking at the dtc 1.2.0 source.
... so wouldn't the logical thing be to extend ftdump to support your needs and send a patch to the DTC authors rather than to write an entire tool from scratch and commit it to a tree that is merely a user of device trees ?
Quoted 4 lines
Yes it probably would have been, if I had noticed that the ftdump utility existed, then that is the approach I would have taken. I think it is of specific use to u-boot users, but if you think it's better to extend ftdump, I guess I could take that approach.
i think it has a better chance of being maintained and other people using it if it were merged into the canonical DTC project. i can see a more swiss army type tool being useful to people rather than having to pipe it all through awk.
git: git://git.jdl.com/software/dtc.git
e-mail: devicetree-discuss at lists.ozlabs.org
they're friendly people :)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120820/e98301c9/attachment.pgp>
PATCH 6/6 fdt: Add a Linux tool for reading values from FDT files
Dear Mike Frysinger,
Quoted 40 lines · On Monday 20 August 2012 20:51:32 Joe Hershberger wrote:
Quoted 29 lines · Mike Frysinger
Quoted 19 lines · On Monday 20 August 2012 19:40:45 Joe Hershberger wrote:
Quoted 18 lines · Mike Frysinger
Quoted 11 lines · On Friday 17 August 2012 16:34:40 Joe Hershberger wrote:
Quoted 8 lines
Designed to be able to access itb files on a filesystem or an mtd partition.
Supports print and list (like the fdt command) and also offset for finding the offset and size of a given property in an FDT file.
This is especially helpful when reading properties from an ITB file.
doesn't the ftdump utility from the dtc package cover your needs ?
No. The purpose is to use this utility e.g. in a Linux shell script to retrieve a property from the ITB. The two places I use it are to retrieve a version number from the ITB and to identify the offset and size of a data block (image) in the ITB.
Quoted 8 lines
Quoted 3 lines
From what I can see the ftdump utility in the dtc component just dumps the ITB as a single blob with no options. I'm looking at the dtc 1.2.0 source.
... so wouldn't the logical thing be to extend ftdump to support your needs and send a patch to the DTC authors rather than to write an entire tool from scratch and commit it to a tree that is merely a user of device trees ?
Quoted 4 lines
Yes it probably would have been, if I had noticed that the ftdump utility existed, then that is the approach I would have taken. I think it is of specific use to u-boot users, but if you think it's better to extend ftdump, I guess I could take that approach.
i think it has a better chance of being maintained and other people using it if it were merged into the canonical DTC project. i can see a more swiss army type tool being useful to people rather than having to pipe it all through awk.
Quoted 4 lines
git:
git://git.jdl.com/software/dtc.git
e-mail: devicetree-discuss at lists.ozlabs.orgthey're friendly people :)
Mostly :-)
Best regards,
Marek Vasut
PATCH 1/6 fdt: Check error codes returned from fdtlib when loading ITB
In reply to Joe HershbergerHi Jerry,
Quoted 6 lines · Joe Hershberger
Before this patch, error codes returned from fdtlib were ignored and continued access would cause a crash. Now just check if the image is truncated and error if so.
Signed-off-by Joe Hershberger <[email protected]>---
What's the progress on this series? I know Mike didn't like the last patch (6 of 6), but the first 5 should be good to go. I'd like them to be in the 2012.10 release.
Are you able to apply them through your branch? Or maybe ack and go through Tom?
Thanks,
-Joe
PATCH 1/6 fdt: Check error codes returned from fdtlib when loading ITB
Hi Joe, Tom,
Quoted 10 lines · Joe Hershberger
Hi Jerry,
Quoted 6 lines · Joe Hershberger
Before this patch, error codes returned from fdtlib were ignored and continued access would cause a crash. Now just check if the image is truncated and error if so.
Signed-off-by Joe Hershberger <[email protected]>---
Quoted 6 lines
What's the progress on this series? I know Mike didn't like the last patch (6 of 6), but the first 5 should be good to go. I'd like them to be in the 2012.10 release.
Are you able to apply them through your branch? Or maybe ack and go through Tom?
The first 5 of the series look good to me. #1 and #5 touch image.c which is on the fringe of my FDT mandate.
Tom, do you want to pick the changes up? Unless you object, I'll apply them to the fdt subrepo and submit a pull request when the window opens.
Quoted 2 lines
Thanks,
-Joe
Thanks,
gvb
PATCH 1/6 fdt: Check error codes returned from fdtlib when loading ITB
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 20 lines · Jerry Van Baren
Hi Joe, Tom,
Quoted 8 lines · Joe Hershberger
Hi Jerry,
Quoted 4 lines · Joe Hershberger
Before this patch, error codes returned from fdtlib were ignored and continued access would cause a crash. Now just check if the image is truncated and error if so.
Quoted 8 lines
Quoted 1 line
Signed-off-by Joe Hershberger <[email protected]> ---What's the progress on this series? I know Mike didn't like the
last patch (6 of 6), but the first 5 should be good to go. I'd like them to be in the 2012.10 release.Are you able to apply them through your branch? Or maybe ack and go through Tom?
Quoted 6 lines
The first 5 of the series look good to me. #1 and #5 touch
image.cwhich is on the fringe of my FDT mandate.Tom, do you want to pick the changes up? Unless you object, I'll apply them to the fdt subrepo and submit a pull request when the window opens.
Sounds fine with me so long as you're happy with the changes.
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iQIcBAEBAgAGBQJQc2b2AAoJENk4IS6UOR1Wm+IP/0l7XzeJO2xCTzCcPmskV6v/ 513G5BV+6nIlCG0UBT489bc3Rg5HWzfR+iml/SaAxmsPnRChesWRF9PQybVHFXRV u+001a877BKfp7xqh+LApKWtjr6CqUzgCsHnpwsp66/GOTjbSkfaedJvv/SwZFGL yQBhSnJ5PntXJRfcIZGxwMdDobOZXyq3C7niLDAF6PecCL+TQNk2L/uhuhLWU7QB 28o0cDft1lX7yyy1unGN8xUel4wDh86d3GTkzJP+uQAk7CYNJr7FTSMo1CdGqmtQ Ubovt28fa2K0aLOQf0fTs8DSAc+3elzvsf3C5JrzZL2WYfgGC3yM53j5Ef4Te+aU +jnkehcThE6URbLVjEtC8de5QjeDSX2HTNpAk0+PICpLQ+DSoYdXuFyCtYxF/7i5 0MH7fuWFU3evHrm+i1/0prgK9Q0HcDCYR69G8kCobMbWjJuFaEnZ0h86YDR12X+b oUghtbYprqhsTitFtZ0N3Pfd3AsirBPTVd/SCCLz/wFcOhk4FP3YJ2sJCfK2KHDc pqPcR6YmOjSGfD7PhllYD7Vrq3WqwzXd9mPKbVPGGG6pWp+oA2xfTaZAWzFym754 4PBe3RlnUL9MFY7DhCqb+VHIvC21Goz+xWG9BNoq7IxMshAPH7GF0U4R7cZPlD2F FDM2wjhHxc0pvE9+JU30
=I+aj
-----END PGP SIGNATURE-----