
Note: I've added this command to ft_build.c instead of a seperate cmd_*.c because it is such a small amount of code.
Signed-off-by: Grant Likely grant.likely@secretlab.ca --- common/ft_build.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/common/ft_build.c b/common/ft_build.c index 980e40f..9a36187 100644 --- a/common/ft_build.c +++ b/common/ft_build.c @@ -20,6 +20,7 @@ */
#include <common.h> +#include <command.h> #include <malloc.h> #include <environment.h>
@@ -588,4 +589,26 @@ #ifdef DEBUG ft_dump_blob(blob); #endif } + +int do_ftinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + void* addr; + if (argc < 2) { + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; + } + + addr = (void*)simple_strtoul(argv[1], NULL, 16); + printf("Printing device tree at 0x%x\n", addr); + ft_dump_blob(addr); + return 0; +} + +/* -------------------------------------------------------------------- */ + +U_BOOT_CMD( + ftinfo, 2, 2, do_ftinfo, "ftinfo - print a flattened device tree\n", + "ftinfo addr\n" + " - print device tree at address 'addr'\n" +); #endif