[U-Boot-Users] builtin OF tree dtb gone

Joakim Tjernlund joakim.tjernlund at transmode.se
Mon Dec 18 15:39:17 CET 2006


On Mon, 2006-12-18 at 00:56 +0100, Wolfgang Denk wrote:
> Dear Joakim,
> 
> in message <1166378632.30422.98.camel at gentoo-jocke.transmode.se> you wrote:
> >
> > how about this patch:
> 
> Sorry, but there are two things I don't like:
> 
> > Make it possible to use a OF tree embedded in u-boot.
> > Also make sure OF tree is below 8MB.
> > 
> > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
> > 
> > diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
> > index 7aae8a6..78f8d15 100644
> > --- a/common/cmd_bootm.c
> > +++ b/common/cmd_bootm.c
> > @@ -531,8 +531,12 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int fl
> >  	image_header_t *hdr = &header;
> >  #ifdef CONFIG_OF_FLAT_TREE
> >  	char	*of_flat_tree = NULL;
> > +#ifdef CFG_EMBEDDED_FLAT_TREE
> 
> I don't want to have another #ifdef here. It should be possible to do
> this (for example in the linker script) without this.

Can't figure out how some linker magic would solve this. Somehow
this function needs a handle to where a default tree is stored.
Moved around the code a bit, hope you like this better.

> 
> > -#ifndef CFG_NO_FLASH
> > -			if (addr2info((ulong)of_flat_tree) != NULL)
> > +		   if (of_flat_tree >= (char *) (8*1024*1024))
> 
> And  I  definitely  reject  such  hard-wired  and  uncommented  magic
> constants which are wrong on most of the systems.

Right, redid this part. If you don't like this either, we can skip
this part for now.

  Regards
          Jocke

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 7aae8a6..b3654ee 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -510,6 +510,23 @@ fixup_silent_linux ()
 #endif /* CONFIG_SILENT_CONSOLE */
 
 #ifdef CONFIG_PPC
+
+/* Define oftree_dtb to point to you own built in
+ * OF tree if you need one.
+ */
+#ifndef oftree_dtb
+ #define oftree_dtb 0
+#endif
+/* Early in the linux boot process most ppc systems
+ * can only access the first few MB of RAM. If the
+ * OF tree is located higher up in memory than
+ * LINUX_INITIAL_MEMORY, it will be copied to a
+ * lower address where the kernel can access it.
+ */
+#ifndef LINUX_INITIAL_MEMORY
+ #define LINUX_INITIAL_MEMORY (8*1024*1024) /* 8MB */
+#endif
+
 static void  __attribute__((noinline))
 do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 		int	argc, char *argv[],
@@ -531,7 +548,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int fl
 	image_header_t *hdr = &header;
 #ifdef CONFIG_OF_FLAT_TREE
 	char	*of_flat_tree = NULL;
-	ulong	of_data = 0;
+	ulong	of_data = (ulong)oftree_dtb;
 #endif
 
 	if ((s = getenv ("initrd_high")) != NULL) {
@@ -745,10 +762,8 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int fl
 		hdr = (image_header_t *)of_flat_tree;
 
 		if  (*(ulong *)of_flat_tree == OF_DT_HEADER) {
-#ifndef CFG_NO_FLASH
-			if (addr2info((ulong)of_flat_tree) != NULL)
+			if (of_flat_tree >= (char *) LINUX_INITIAL_MEMORY)
 				of_data = (ulong)of_flat_tree;
-#endif
 		} else if (ntohl(hdr->ih_magic) == IH_MAGIC) {
 			printf("## Flat Device Tree Image at %08lX\n", hdr);
 			print_image_hdr(hdr);
diff --git a/common/ft_build.c b/common/ft_build.c





More information about the U-Boot mailing list