public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] fdt: add fdtcmd env var to allow post processing of device tree before boot
@ 2008-08-04 18:46 Kumar Gala
  2008-08-04 18:56 ` Wolfgang Denk
  0 siblings, 1 reply; 16+ messages in thread
From: Kumar Gala @ 2008-08-04 18:46 UTC (permalink / raw)
  To: u-boot

Added the 'fdtcmd' environment variable as a way to provide 'fdt' commands
that the user can supply to manipulate the device tree after ft_board_setup()
and before the tree is handled to the kernel.

The idea is that users may want to add or manipulate nodes w/changing the u-boot
binary.  The current point in the code we do this we have yet to determine the
final size and have yet to do the final fixup of the initrd information.

If its desirable for the 'fdtcmd' support to have the proper initrd information
a bit of code reorder will be in order.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 common/fdt_support.c  |   21 +++++++++++++++++++++
 include/fdt_support.h |    1 +
 lib_ppc/bootm.c       |    1 +
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 93b144e..b1aa7df 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -30,6 +30,10 @@
 #include <fdt_support.h>
 #include <exports.h>

+#ifdef CFG_HUSH_PARSER
+#include <hush.h>
+#endif
+
 /*
  * Global data (for the gd->bd)
  */
@@ -529,3 +533,20 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev)
 		       fdt_strerror(err));
 }
 #endif /* defined(CONFIG_MPC83XX) || defined(CONFIG_MPC85xx) */
+
+int ft_env_setup(void *blob, bd_t *bd)
+{
+	int rcode = 0;
+
+	working_fdt = blob;
+
+#ifndef CFG_HUSH_PARSER
+	if (run_command (getenv ("fdtcmd"), 0) < 0)
+		rcode = 1;
+#else
+	if (parse_string_outer (getenv ("fdtcmd"),
+			FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0)
+		rcode = 1;
+#endif
+	return rcode;
+}
diff --git a/include/fdt_support.h b/include/fdt_support.h
index a7c6326..a60b5f0 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -67,6 +67,7 @@ void ft_board_setup(void *blob, bd_t *bd);
 void ft_cpu_setup(void *blob, bd_t *bd);
 void ft_pci_setup(void *blob, bd_t *bd);
 #endif
+int ft_env_setup(void *blob, bd_t *bd);

 #endif /* ifdef CONFIG_OF_LIBFDT */
 #endif /* ifndef __FDT_SUPPORT_H */
diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index a872d31..d7a1236 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -194,6 +194,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 		/* Call the board-specific fixup routine */
 		ft_board_setup(of_flat_tree, gd->bd);
 #endif
+		ft_env_setup(of_flat_tree, gd->bd);
 	}

 	/* Fixup the fdt memreserve now that we know how big it is */
-- 
1.5.5.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-08-04 22:53 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-04 18:46 [U-Boot-Users] [PATCH] fdt: add fdtcmd env var to allow post processing of device tree before boot Kumar Gala
2008-08-04 18:56 ` Wolfgang Denk
2008-08-04 19:49   ` Kumar Gala
2008-08-04 20:19     ` Jerry Van Baren
2008-08-04 20:24       ` Kumar Gala
2008-08-04 20:44         ` Jerry Van Baren
2008-08-04 20:52           ` Kumar Gala
2008-08-04 21:04           ` Wolfgang Denk
2008-08-04 20:27     ` Wolfgang Denk
2008-08-04 20:50       ` Kumar Gala
2008-08-04 20:55         ` Scott Wood
2008-08-04 22:18           ` Kumar Gala
2008-08-04 22:21             ` Scott Wood
2008-08-04 22:53             ` Wolfgang Denk
2008-08-04 21:07         ` Wolfgang Denk
2008-08-04 22:23           ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox