[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 1/3] PPC PReP: Load ELF kernel
From: |
Fabien Chouteau |
Subject: |
[Qemu-ppc] [PATCH 1/3] PPC PReP: Load ELF kernel |
Date: |
Wed, 3 Apr 2013 18:40:11 +0200 |
It is useful to be able to boot non-binary (i.e. ELF) kernels directly,
as it is simpler to use and it makes symbols available in -d in_asm.
Also remove, unnecessary exit() after hw_error().
Signed-off-by: Fabien Chouteau <address@hidden>
---
hw/ppc/prep.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 2920911..a2730c8 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -41,6 +41,7 @@
#include "sysemu/blockdev.h"
#include "sysemu/arch_init.h"
#include "exec/address-spaces.h"
+#include "elf.h"
//#define HARD_DEBUG_PPC_IO
//#define DEBUG_PPC_IO
@@ -521,12 +522,17 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
if (linux_boot) {
kernel_base = KERNEL_LOAD_ADDR;
- /* now we can load the kernel */
- kernel_size = load_image_targphys(kernel_filename, kernel_base,
- ram_size - kernel_base);
+
+ /* Try to load the kernel as an ELF file */
+ kernel_size = load_elf(kernel_filename, NULL, NULL, NULL, NULL, NULL,
+ 1, ELF_MACHINE, 0);
+ if (kernel_size < 0) {
+ /* Try to load the kernel as an binary file */
+ kernel_size = load_image_targphys(kernel_filename, kernel_base,
+ ram_size - kernel_base);
+ }
if (kernel_size < 0) {
hw_error("qemu: could not load kernel '%s'\n", kernel_filename);
- exit(1);
}
/* load initrd */
if (initrd_filename) {
--
1.7.9.5
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 3/3] PPC PReP: can run without bios image, (continued)
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 3/3] PPC PReP: can run without bios image, Andreas Färber, 2013/04/04
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 3/3] PPC PReP: can run without bios image, Fabien Chouteau, 2013/04/05
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 3/3] PPC PReP: can run without bios image, Peter Maydell, 2013/04/05
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 3/3] PPC PReP: can run without bios image, Andreas Färber, 2013/04/04
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 3/3] PPC PReP: can run without bios image, Rob Landley, 2013/04/04
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 3/3] PPC PReP: can run without bios image, Andreas Färber, 2013/04/04
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 3/3] PPC PReP: can run without bios image, Fabien Chouteau, 2013/04/04
[Qemu-ppc] [PATCH 1/3] PPC PReP: Load ELF kernel,
Fabien Chouteau <=
Re: [Qemu-ppc] [PATCH 0/3] PPC PReP: Use ElF kernel on PReP, Alexander Graf, 2013/04/03