public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] Fix initrd/dtb interaction
@ 2007-08-13 23:01 Andy Fleming
  2007-08-14  0:19 ` Wolfgang Denk
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Fleming @ 2007-08-13 23:01 UTC (permalink / raw)
  To: u-boot

The original code would wrongly relocate the blob to be right before
the initrd if it existed.  The blob *must* be within CFG_BOOTMAPSZ,
if it is defined.  So we make two changes:

1) flag the blob for relocation whenever its address is above BOOTMAPSZ

2) If the blob is being relocated, relocate it before kbd, not initrd

Signed-off-by: Andy Fleming <afleming@freescale.com>
---
 common/cmd_bootm.c |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 2436581..580a9f0 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -21,6 +21,7 @@
  * MA 02111-1307 USA
  */
 
+#define DEBUG
 /*
  * Boot support
  */
@@ -925,6 +926,15 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 	unlock_ram_in_cache();
 #endif
 
+#ifdef CFG_BOOTMAPSZ
+	/*
+	 * The blob must be within CFG_BOOTMAPSZ,
+	 * so we flag it to be copied if it is
+	 */
+	if (of_flat_tree >= (char *)CFG_BOOTMAPSZ)
+		of_data = of_flat_tree;
+#endif
+
 #if defined(CONFIG_OF_LIBFDT)
 	/* move of_flat_tree if needed */
 	if (of_data) {
@@ -932,11 +942,9 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 		ulong of_start, of_len;
 
 		of_len = be32_to_cpu(fdt_totalsize(of_data));
-		/* position on a 4K boundary before the initrd/kbd */
-		if (initrd_start)
-			of_start = initrd_start - of_len;
-		else
-			of_start  = (ulong)kbd - of_len;
+
+		/* position on a 4K boundary before the kbd */
+		of_start  = (ulong)kbd - of_len;
 		of_start &= ~(4096 - 1);	/* align on page */
 		debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
 			of_data, of_data + of_len - 1, of_len, of_len);
@@ -975,11 +983,9 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 	if (of_data) {
 		ulong of_start, of_len;
 		of_len = ((struct boot_param_header *)of_data)->totalsize;
+
 		/* provide extra 8k pad */
-		if (initrd_start)
-			of_start = initrd_start - of_len - 8192;
-		else
-			of_start  = (ulong)kbd - of_len - 8192;
+		of_start  = (ulong)kbd - of_len - 8192;
 		of_start &= ~(4096 - 1);	/* align on page */
 		debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
 			of_data, of_data + of_len - 1, of_len, of_len);
-- 
1.5.0.2.230.gfbe3d-dirty

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

end of thread, other threads:[~2007-08-14  7:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-13 23:01 [U-Boot-Users] [PATCH] Fix initrd/dtb interaction Andy Fleming
2007-08-14  0:19 ` Wolfgang Denk
2007-08-14  3:05   ` Jerry Van Baren
2007-08-14  7:06     ` Wolfgang Denk
2007-08-14  7:00   ` Andy Fleming
2007-08-14  7:50     ` Wolfgang Denk

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