Skip to contentSkip to conversation

Fix initrd/dtb interaction

PATCH Superseded Andy Fleming 2 participants 2 messages Aug 14, 2007

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Fix initrd/dtb interaction

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

---

Fixes the lingering DEBUG. Sending this just in case further modification can be postponed until the next window.

 common/cmd_bootm.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
common/cmd_bootm.c +14 -9
index 2436581..7d36786 100644
@@ -925,6 +925,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 +941,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 +982,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);
Signature · 1 line
1.5.0.2.230.gfbe3d-dirty
#1 lore raw

PATCH v2 1/1 Fix initrd/dtb interaction

Quoted 9 lines · In message <[email protected]> you wrote:

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

Sorry:

error: patch failed: common/cmd_bootm.c:925
error: common/cmd_bootm.c: patch does not apply Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merged common/cmd_bootm.c
CONFLICT (content): Merge conflict in common/cmd_bootm.c Failed to merge in the changes.
Patch failed at 0001.

Can you please redo the patch against current code?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Let's say the docs present a simplified view of reality...    :-)
                      - Larry Wall in  <[email protected]>