parameterised the initrd load address for arm boot process. Machine models can populate the initrd field with a non-zero address to specifiy that the default value of 0x00d00000 should be overridden.
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwa...@petalogix.com> --- hw/arm-misc.h | 2 ++ hw/arm_boot.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/arm-misc.h b/hw/arm-misc.h index 6e8ae6b..89e90c9 100644 --- a/hw/arm-misc.h +++ b/hw/arm-misc.h @@ -29,6 +29,8 @@ struct arm_boot_info { const char *kernel_filename; const char *kernel_cmdline; const char *initrd_filename; + /* FIXME: support initrd load address = 0 somehow */ + target_phys_addr_t initrd_load_addr; target_phys_addr_t loader_start; target_phys_addr_t smp_loader_start; target_phys_addr_t smp_bootreg_addr; diff --git a/hw/arm_boot.c b/hw/arm_boot.c index bf509a8..d63ed3f 100644 --- a/hw/arm_boot.c +++ b/hw/arm_boot.c @@ -71,7 +71,8 @@ static void set_kernel_args(const struct arm_boot_info *info, /* ATAG_INITRD2 */ WRITE_WORD(p, 4); WRITE_WORD(p, 0x54420005); - WRITE_WORD(p, info->loader_start + INITRD_LOAD_ADDR); + WRITE_WORD(p, info->loader_start + info->initrd_load_addr ? + info->initrd_load_addr : INITRD_LOAD_ADDR); WRITE_WORD(p, initrd_size); } if (info->kernel_cmdline && *info->kernel_cmdline) { @@ -148,7 +149,8 @@ static void set_kernel_args_old(const struct arm_boot_info *info, WRITE_WORD(p, 0); /* initrd_start */ if (initrd_size) - WRITE_WORD(p, info->loader_start + INITRD_LOAD_ADDR); + WRITE_WORD(p, info->loader_start + info->initrd_load_addr ? + info->initrd_load_addr : INITRD_LOAD_ADDR); else WRITE_WORD(p, 0); /* initrd_size */ @@ -250,11 +252,13 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info) } info->entry = entry; if (is_linux) { + target_phys_addr_t initrd_load_addr = info->initrd_load_addr ? + info->initrd_load_addr : INITRD_LOAD_ADDR; if (info->initrd_filename) { initrd_size = load_image_targphys(info->initrd_filename, info->loader_start - + INITRD_LOAD_ADDR, - ram_size - INITRD_LOAD_ADDR); + + initrd_load_addr, + ram_size - initrd_load_addr); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initrd '%s'\n", info->initrd_filename); -- 1.7.3.2