fix initrd load failed
PATCH 1/1 fix initrd load failed
Here's a bug, some examples are as follows:
1.Assuming Guest's filesystem size 6M.
2.For vexpress_a15, the loader_start = 2048M.
If we set guest ram_size range from 2048M+128M to 2048M+128M+6M,
then the initrd load failed.
3.For mach-virt, the loader_start = 128M.
If we set guest ram_size range from 256M to 256M+6M, then it is failed too.
So,it is a bug for load initrd max mem calculation. It should be (ram_size + loader_start - initrd_start).
--- hw/arm/boot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/arm/boot.c +4 -2
@@ -415,12 +415,14 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)if (info->initrd_filename) { initrd_size =load_ramdisk (info->initrd_filename, info->initrd_start, - info->ram_size - + info->ram_size + + info->loader_start - info->initrd_start);if (initrd_size <0 ) { initrd_size =load_image_targphys (info->initrd_filename, info->initrd_start, - info->ram_size - + info->ram_size + + info->loader_start - info->initrd_start); }if (initrd_size <0 ) {
Signature · 1 line
1.7.9.5
Quoted 11 lines · ChenQun
Here's a bug, some examples are as follows:
1.Assuming Guest's filesystem size 6M.
2.Forvexpress_a15, theloader_start= 2048M.
If we set guestram_sizerange from 2048M+128M to 2048M+128M+6M,
then the initrd load failed.
3.For mach-virt, theloader_start= 128M.
If we set guestram_sizerange from 256M to 256M+6M, then it is failed too.So,it is a bug for load initrd max mem calculation. It should be (
ram_size+loader_start-initrd_start).
Yes, this is definitely a bug. The set of addresses/sizes we pass to the loader is a bit of a mess, though -- we kind of implicitly assume that "loader_start" means "bottom of RAM", and that all the ram is in one chunk. However for example realview-pbx-a9 sets loader_start to 0 when the size of that bit of RAM may be less than the total ram_size. The device tree editing code also assumes a single contiguous block of RAM...
thanks
-- PMM