diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2017-07-27 01:56:13 +0200 |
---|---|---|
committer | Yongbok Kim <yongbok.kim@imgtec.com> | 2017-07-28 13:32:32 +0100 |
commit | 3ee3122c0d2614297890ded2017655fc2a139af6 (patch) | |
tree | 95b1a1d320680952eed547fce98463543a2ac619 /hw/mips/mips_malta.c | |
parent | 871a0f7ad2b9560c5f7d640125c5be95ca23ca7f (diff) |
hw/mips: load_elf_strerror to report kernel loading failure
Emulated MIPS boards bail out with a simple "could not load kernel" when
a kernel could not be load, without specifying the underlying reason.
Fix that by calling load_elf_strerror.
At the same time use error_report to report the error instead of
fprintf.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Diffstat (limited to 'hw/mips/mips_malta.c')
-rw-r--r-- | hw/mips/mips_malta.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 3487d16f61..8ecd544baa 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -794,7 +794,7 @@ static void GCC_FMT_ATTR(3, 4) prom_set(uint32_t* prom_buf, int index, static int64_t load_kernel (void) { int64_t kernel_entry, kernel_high; - long initrd_size; + long kernel_size, initrd_size; ram_addr_t initrd_offset; int big_endian; uint32_t *prom_buf; @@ -808,11 +808,13 @@ static int64_t load_kernel (void) big_endian = 0; #endif - if (load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, NULL, - (uint64_t *)&kernel_entry, NULL, (uint64_t *)&kernel_high, - big_endian, EM_MIPS, 1, 0) < 0) { - fprintf(stderr, "qemu: could not load kernel '%s'\n", - loaderparams.kernel_filename); + kernel_size = load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, + NULL, (uint64_t *)&kernel_entry, NULL, + (uint64_t *)&kernel_high, big_endian, EM_MIPS, 1, 0); + if (kernel_size < 0) { + error_report("qemu: could not load kernel '%s': %s", + loaderparams.kernel_filename, + load_elf_strerror(kernel_size)); exit(1); } |