From: Grant Likely Date: Sun, 29 Oct 2006 15:54:08 -0700 Subject: [U-Boot-Users] [PATCH] Add 'ftinfo' command for displaying a flattened device tree image In-Reply-To: <1162162451844-git-send-email-grant.likely@secretlab.ca> References: <11621624501057-git-send-email-grant.likely@secretlab.ca> <11621624503973-git-send-email-grant.likely@secretlab.ca> <1162162451844-git-send-email-grant.likely@secretlab.ca> Message-ID: <1162162451805-git-send-email-grant.likely@secretlab.ca> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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 +#include #include #include @@ -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 -- 1.4.3.rc2.g0503