[U-Boot-Users] [PATCH] Add 'ftinfo' command for displaying a flattened device tree image

Grant Likely grant.likely at secretlab.ca
Sun Oct 29 23:54:08 CET 2006


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 at 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
-- 
1.4.3.rc2.g0503





More information about the U-Boot mailing list