[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 3/5] hw/riscv: Extend the kernel loading support
From: |
Alistair Francis |
Subject: |
[Qemu-devel] [PATCH v1 3/5] hw/riscv: Extend the kernel loading support |
Date: |
Mon, 24 Jun 2019 15:11:54 -0700 |
Extend the RISC-V kernel loader to support Image and uImage files.
A Linux kernel can now be booted with:
qemu-system-riscv64 -machine virt -bios fw_jump.bin -kernel Image
Signed-off-by: Alistair Francis <address@hidden>
---
hw/riscv/boot.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index 883df49a0c..ff023f42d0 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -56,12 +56,22 @@ target_ulong riscv_load_kernel(const char *kernel_filename)
uint64_t kernel_entry, kernel_high;
if (load_elf(kernel_filename, NULL, NULL, NULL,
- &kernel_entry, NULL, &kernel_high, 0, EM_RISCV, 1, 0) < 0) {
- error_report("could not load kernel '%s'", kernel_filename);
- exit(1);
+ &kernel_entry, NULL, &kernel_high, 0, EM_RISCV, 1, 0) > 0) {
+ return kernel_entry;
}
- return kernel_entry;
+ if (load_uimage_as(kernel_filename, &kernel_entry, NULL, NULL,
+ NULL, NULL, NULL) > 0) {
+ return kernel_entry;
+ }
+
+ if (load_image_targphys_as(kernel_filename, KERNEL_BOOT_ADDRESS,
+ ram_size, NULL) > 0) {
+ return KERNEL_BOOT_ADDRESS;
+ }
+
+ error_report("could not load kernel '%s'", kernel_filename);
+ exit(1);
}
hwaddr riscv_load_initrd(const char *filename, uint64_t mem_size,
--
2.22.0
- [Qemu-devel] [PATCH v1 0/5] RISC-V: Add firmware loading support and default, Alistair Francis, 2019/06/24
- [Qemu-devel] [PATCH v1 2/5] hw/riscv: Add support for loading a firmware, Alistair Francis, 2019/06/24
- [Qemu-devel] [PATCH v1 3/5] hw/riscv: Extend the kernel loading support,
Alistair Francis <=
- [Qemu-devel] [PATCH v1 1/5] hw/riscv: Split out the boot functions, Alistair Francis, 2019/06/24
- [Qemu-devel] [PATCH v1 5/5] hw/riscv: Load OpenSBI as the default firmware, Alistair Francis, 2019/06/24
- [Qemu-devel] [PATCH v1 4/5] roms: Add OpenSBI version 0.3, Alistair Francis, 2019/06/24
- Re: [Qemu-devel] [PATCH v1 0/5] RISC-V: Add firmware loading support and default, Alistair Francis, 2019/06/25