[U-Boot-Users] Can U-boot Autodetect arch/ppcversusarch/powerpc from info in the uImage?

Joakim Tjernlund joakim.tjernlund at transmode.se
Sun Dec 9 14:12:07 CET 2007


On Fri, 2007-12-07 at 08:14 -0500, Jerry Van Baren wrote:
> Joakim Tjernlund wrote:
> 
> [snip]
> 
> >>  Jocke
> >>> As far as I understand your request, this offers all the 
> >> same options
> >>> you can get with a compiled in device tree blob, but with  
> >> the  added
> >>> benefit of allowing many more things at the same time, too.
> >>>
> >>> Maybe I'm missing something?
> > 
> > Yes, here are some things to consider.
> > 
> > The extension I made can just as easily be a function that returns a dev. tree.
> > 
> > - One can have a dev. tree update procedure similar to
> >   rendundant env. The funktion then selects which dev. tree is valid and passes
> >   that back.
> > 
> > - The function can construct a dev. tree from builtin rules/code.
> > 
> > - One can even make it tftp a tree at boot and pass that back. Great
> >   in a development env. especially if you are debugging the dev. tree.
> > 
> > and the kicker is that you can still override this tree at runtime by passing
> > a dev. tree argument to bootm.
> > 
> > All this will be possible by the simple patch I posted earlier, included
> > below.
[SNIP]
> 
> FWIIW, while I appreciate and agree with Wolfgang's points, I don't see 
> why we cannot add Joakim's configuration tweak.  It is a pretty minor 
> issue and, if he finds it useful, perhaps it would be useful to others.
> 
> Having said that, the patch could be made better by IMHO using the 
> #ifdef logic embedded rather than defining DEFAULT_OF_TREE to NULL if it 
> isn't already defined:
> 
> #if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
> #ifdef DEFAULT_OF_TREE
> 	char	*of_flat_tree = DEFAULT_OF_TREE;
> #else
> 	char	*of_flat_tree = NULL;
> #endif
> 	ulong	of_data = 0;
> #endif
> 
> Also, we should have an update to the README to explain that 
> DEFAULT_OF_TREE can be defined in the board-specific config file to be 
> the address of a FDT embedded in u-boot or a function that 
> builds/modifies a FDT and returns the address.
> 
> This should probably go somewhere in the section on LIBFDT line 332 ff. 
> (I would put it at line 342, your line numbers may vary).
> <http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot/u-boot-fdt.git;a=blob;f=README;h=09eb76fe4528dfedca027b119ac760fce2570e35;hb=HEAD#l341>
> 
> Best regards,
> gvb

Made a new patch with Jerrys comments addressed. Also renamed
DEFAULT_OF_TREE to CFG_OF_TREE. OK?

>From 2f20cc2bb5eddd1ef06671ebf2080aadd8694e58 Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
Date: Sun, 9 Dec 2007 14:06:32 +0100
Subject: [PATCH] Add CFG_OF_TREE knob.

Make it possible to construct a OF tree from board code.
See README for details.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
---
 README             |    8 ++++++++
 common/cmd_bootm.c |    4 ++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/README b/README
index 3dad5fc..8bd70bf 100644
--- a/README
+++ b/README
@@ -340,6 +340,14 @@ The following options need to be configured:
 		 * Adds the "fdt" command
 		 * The bootm command automatically updates the fdt
 
+		CFG_OF_TREE
+		 * Define this to a function in board code to construct
+		   your own OF tree. The function should return a char *
+		   pointing to your OF tree.
+		   Useful if you have multiple OF trees or want to build your
+		   tree dynamically. You can still overide this tree by
+		   passing a OF tree to bootm.
+
 		CONFIG_OF_FLAT_TREE
 		 * Deprecated, see CONFIG_OF_LIBFDT
 		 * Original ft_build.c-based support
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index d816349..68dfb59 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -527,7 +527,11 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 	void	(*kernel)(bd_t *, ulong, ulong, ulong, ulong);
 	image_header_t *hdr = &header;
 #if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
+#ifdef CFG_OF_TREE
+	char	*of_flat_tree = CFG_OF_TREE;
+#else
 	char	*of_flat_tree = NULL;
+#endif
 	ulong	of_data = 0;
 #endif
 
-- 
1.5.3.6






More information about the U-Boot mailing list