From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerry Van Baren Date: Fri, 07 Dec 2007 08:14:37 -0500 Subject: [U-Boot-Users] Can U-boot Autodetect arch/ppcversusarch/powerpc from info in the uImage? In-Reply-To: <00aa01c83859$77863cb0$02ac10ac@Jocke> References: Your message of "Tue, 04 Dec 2007 00:33:15 +0100."<057d01c83604$e0bb9ce0$5267a8c0@Jocke><20071204002352.71F48242E9@gemini.denx.de> <057f01c83611$e37308d0$5267a8c0@Jocke> <00aa01c83859$77863cb0$02ac10ac@Jocke> Message-ID: <4759473D.7080008@ge.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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. > > [PATCH] Make it possible to use a builtin OF tree. > Signed-off-by: Joakim Tjernlund > --- > common/cmd_bootm.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c > index d816349..8405de7 100644 > --- a/common/cmd_bootm.c > +++ b/common/cmd_bootm.c > @@ -507,6 +507,9 @@ fixup_silent_linux () > #endif /* CONFIG_SILENT_CONSOLE */ > > #ifdef CONFIG_PPC > +#ifndef DEFAULT_OF_TREE > + #define DEFAULT_OF_TREE NULL > +#endif > static void __attribute__((noinline)) > do_bootm_linux (cmd_tbl_t *cmdtp, int flag, > int argc, char *argv[], > @@ -527,7 +530,7 @@ 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) > - char *of_flat_tree = NULL; > + char *of_flat_tree = DEFAULT_OF_TREE; > ulong of_data = 0; > #endif 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). Best regards, gvb