Merge lp:~jcrigby/linaro-image-tools/mx51-initrd_addr-fix into lp:linaro-image-tools/11.11

Proposed by John Rigby
Status: Merged
Merged at revision: 306
Proposed branch: lp:~jcrigby/linaro-image-tools/mx51-initrd_addr-fix
Merge into: lp:linaro-image-tools/11.11
Diff against target: 12 lines (+1/-1)
1 file modified
linaro_media_create/boards.py (+1/-1)
To merge this branch: bzr merge lp:~jcrigby/linaro-image-tools/mx51-initrd_addr-fix
Reviewer Review Type Date Requested Status
Loïc Minier (community) Approve
Review via email: mp+53940@code.launchpad.net

Description of the change

This fixes bug #737321.

To post a comment you must log in.
Revision history for this message
Guilherme Salgado (salgado) wrote :

Do we really need 128M or would 22M (like the omaps) be enough?

Revision history for this message
Loïc Minier (lool) wrote :

There's a trivial conflict with lp:~lool/linaro-image-tools/efikasb-support which I just landed, but this change looks simple enough.

John, I'd like to add some tests to ensure we reserve enough memory between kernel and initrd, but I wonder:
* can we expect the initrd address to always be higher than the kernel address?
* how many MiBs should we make sure are reserved?
* we currently run "mkimage -a load_addr -e load_addr" to generate uImage and we generate a boot.scr which has "fatload mmc kernel_addr uImage", and we run "mkimage -a 0 -e 0" to generate uInitrd and use "fatload mmc initrd_addr uInitrd"; could you advise on whether we should test kernel_addr + some M < initrd_addr, or load_addr + some M < initrd_addr or both?

In general, if you could advise on what tests would be sensible, that would be welcome; but we can merge this test right now obviously.

review: Approve
Revision history for this message
Loïc Minier (lool) wrote :

On Fri, Mar 18, 2011, Guilherme Salgado wrote:
> Do we really need 128M or would 22M (like the omaps) be enough?

 Some smaller offset would be enough, but I am not sure it matters, I
 think the same amount of memory is available in both cases, but I'm not
 sure whether the kernel and initrd relocate themselves, so maybe there
 is less contiguous memory if we take a larger offset -- not sure

--
Loïc Minier

Revision history for this message
John Rigby (jcrigby) wrote :

No we don't need 128M. The arm kernel actually reserves the initrd location early in the boot process but apparently not early enough. The scenario that failed for me had the initrd loaded above the kernel including all the bss so at first I thought the larger kernel was not the problem. I then realized that early in the boot process the kernel does allocate some boot memory. Those early allocations before the initrd memory is reserved are apparently the problem.

I believe the test should be for both kernel_addr + some M and load_addr + some M. Also if there is ever a platform that loads the initrd before the kernel and the initrd image was too large it could corrupt the kernel. Not sure if that future proofing is worth it.

For modern u-boot's (not the LT ones that are not 2010.12 or later) u-boot relocates itself to the top of ram - size calculated at runtime. For that case the best place to put the initrd is top of ram - max size of u-boot runtime - max size of initrd.

This is all really a bug in arm u-boot. PPC u-boot does this relocation for you. In fact I enabled this for ARM when adding DT support but it is only turned on with DT.

Revision history for this message
John Rigby (jcrigby) wrote :

One more thing. Certain platforms (not sure if any of our currently supported ones) init a framebuffer in u-boot and put a splash screen there. They then pass address of framebuffer to the kernel. So obviously this address range is another one that needs to be avoided.

Revision history for this message
Loïc Minier (lool) wrote :

Since I didn't want to leave this mp open for too long when there's an useful fix, I've merged your commit but changed the initrd address to 0x92000000 to be 32 MiB away of the kernel.

I checked other boards and they used these offsets before the change:
Beagle, Overo: 22MiB
Panda: 20 MiB
Ux500: 127 MiB
Mx51: 8 MiB
Mx53: 16 MiB
Vexpress: ~528 MiB
SMDKV310: ~16 MiB

I filed LP #744539 to remember to implement the checks.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'linaro_media_create/boards.py'
2--- linaro_media_create/boards.py 2011-03-10 23:28:21 +0000
3+++ linaro_media_create/boards.py 2011-03-18 04:07:07 +0000
4@@ -418,7 +418,7 @@
5 extra_serial_opts = 'console=tty0 console=%s,115200n8' % serial_tty
6 live_serial_opts = 'serialtty=%s' % serial_tty
7 kernel_addr = '0x90000000'
8- initrd_addr = '0x90800000'
9+ initrd_addr = '0x98000000'
10 load_addr = '0x90008000'
11 kernel_suffix = 'linaro-mx51'
12 boot_script = 'boot.scr'

Subscribers

People subscribed via source and target branches