Skip to contentSkip to conversation

image: check "bootm_low" and "bootm_size" if "initrd_high" is missing

PATCH New Masahiro Yamada 2 participants 5 messages Dec 17, 2015 – Jan 13, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 image: check "bootm_low" and "bootm_size" if "initrd_high" is missing

To boot Linux, we should prevent Initramdisk and FDT from going too high.

Currently, boot_relocate_fdt() checks "fdt_high" environment first, and then falls back to getenv_bootm_mapsize() + getenv_bootm_low() if "fdt_high" is missing.

On the other hand, boot_ramdisk_high() only checks "initrd_high" to get the address limit for the Initramdisk. We also want to let this case fall back to getenv_bootm_mapsize() + getenv_bootm_low().

---

 common/image.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
common/image.c +1 -2
index c36927f..d63d9e0 100644
@@ -1113,8 +1113,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
 		if (initrd_high == ~0)
 			initrd_copy_to_ram = 0;
 	} else {
-		/* not set, no restrictions to load high */
-		initrd_high = ~0;
+		initrd_high = getenv_bootm_mapsize() + getenv_bootm_low();
 	}
 
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 image: check "bootm_low" and "bootm_size" if "initrd_high" is missing

Quoted 2 lines · Masahiro Yamada

To boot Linux, we should prevent Initramdisk and FDT from going too high.

OK, why? I could be entirely wrong here but I had thought for some reason that if the ramdisk was in "highmem" the kernel would relocate contents (or if compressed, uncompress to a non-highmem location). The FDT must be in lowmem as that tells the kernel where memory even is. Is this not the case? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160104/ef991061/attachment.sig>
#2 lore raw

PATCH 1/1 image: check "bootm_low" and "bootm_size" if "initrd_high" is missing

Hi Tom,

2016-01-05 4:59 GMT+09:00 Tom Rini <[email protected]>:

Quoted 10 lines · Masahiro Yamada
Quoted 3 lines

To boot Linux, we should prevent Initramdisk and FDT from going too high.

OK, why? I could be entirely wrong here but I had thought for some reason that if the ramdisk was in "highmem" the kernel would relocate contents (or if compressed, uncompress to a non-highmem location). The FDT must be in lowmem as that tells the kernel where memory even is. Is this not the case? Thanks!

Just in case, I asked this in the kernel ML.

See this thread:
https://lkml.org/lkml/2016/1/8/169

Jon gave me the answer.

5. Load initramfs.
------------------

Existing boot loaders:          OPTIONAL
New boot loaders:               OPTIONAL

If an initramfs is in use then, as with the dtb, it must be placed in a region of memory where the kernel decompressor will not overwrite it while also with the region which will be covered by the kernel's low-memory mapping.

A safe location is just above the device tree blob which itself will be loaded just above the 128MiB boundary from the start of RAM as recommended above.

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw

PATCH 1/1 image: check "bootm_low" and "bootm_size" if "initrd_high" is missing

Quoted 33 lines · Masahiro Yamada

Hi Tom,

2016-01-05 4:59 GMT+09:00 Tom Rini <[email protected]>:

Quoted 10 lines · Masahiro Yamada
Quoted 3 lines

To boot Linux, we should prevent Initramdisk and FDT from going too high.

OK, why? I could be entirely wrong here but I had thought for some reason that if the ramdisk was in "highmem" the kernel would relocate contents (or if compressed, uncompress to a non-highmem location). The FDT must be in lowmem as that tells the kernel where memory even is. Is this not the case? Thanks!

Just in case, I asked this in the kernel ML.

See this thread:
https://lkml.org/lkml/2016/1/8/169

Jon gave me the answer.

5. Load initramfs.
------------------

Existing boot loaders:          OPTIONAL
New boot loaders:               OPTIONAL
Quoted 8 lines

If an initramfs is in use then, as with the dtb, it must be placed in a region of memory where the kernel decompressor will not overwrite it while also with the region which will be covered by the kernel's low-memory mapping.

A safe location is just above the device tree blob which itself will be loaded just above the 128MiB boundary from the start of RAM as recommended above.

Which explains why I picked the regions I picked for ti_armv7_common.h that I did. So, OK, thanks! I'll apply this patch shortly.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160113/71fa1483/attachment.sig>
#4 lore raw

PATCH 1/1 image: check "bootm_low" and "bootm_size" if "initrd_high" is missing

In reply to Masahiro Yamada
Quoted 7 lines · Masahiro Yamada

To boot Linux, we should prevent Initramdisk and FDT from going too high.

Currently, boot_relocate_fdt() checks "fdt_high" environment first, and then falls back to getenv_bootm_mapsize() + getenv_bootm_low() if "fdt_high" is missing.

Quoted 5 lines

On the other hand, boot_ramdisk_high() only checks "initrd_high" to get the address limit for the Initramdisk. We also want to let this case fall back to getenv_bootm_mapsize() + getenv_bootm_low().

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160113/26cff3a3/attachment.sig>