Add a generic loader
cover Add a generic loader
This work is based on the original work by Li Guang with extra features added by Peter C.
The idea of this loader is to allow the user to load multiple images or values into QEMU at startup.
Memory values can be loaded like this: -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4
Images can be loaded like this: -device loader,file=./images/u-boot.elf,cpu=0
This can be useful and we use it a lot in Xilinx to load multiple images into a machine at creation (ATF, Kernel and DTB for example).
It can also be used to set registers.
At the moment only LE ARM is supported. I haven't tested BE support, so I'm not sure what state it is in. The limiation for arch is based off settting the ELF_ARCH macro.
The reset patch is required otherwise the reset will never be registered and the loader can't change the PC in the case of images.
I have tested this on ARM and it works. What do people think? Is it worth pursuing to try and get accepted?
Alistair Francis (2):
qdev-monitor.c: Register reset function if the device has one
generic-loader: Add a generic loader
default-configs/arm-softmmu.mak | 1 + hw/misc/Makefile.objs | 2 + hw/misc/generic-loader.c | 121 +++++++++++++++++++++++++++++++++++++++ include/hw/misc/generic-loader.h | 50 ++++++++++++++++ qdev-monitor.c | 2 + 5 files changed, 176 insertions(+) create mode 100644 hw/misc/generic-loader.c create mode 100644 include/hw/misc/generic-loader.h
Signature · 1 line
2.5.0
RFC 1/2 qdev-monitor.c: Register reset function if the device has one
If the device being added when running qdev_device_add() has a reset function, register it so that it can be called.
---
qdev-monitor.c | 2 ++ 1 file changed, 2 insertions(+)
qdev-monitor.c +2 -0
@@ -560,6 +560,8 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)if (bus) {qdev_set_parent_bus (dev, bus); + }else if (dc->reset) { +qemu_register_reset ((void (*)(void *))dc->reset, dev); } id =qemu_opts_id (opts);
Signature · 1 line
2.5.0
RFC 2/2 generic-loader: Add a generic loader
In reply to Alistair FrancisAdd a generic loader to QEMU which can be used to load images or set memory values.
---
default-configs/arm-softmmu.mak | 1 + hw/misc/Makefile.objs | 2 + hw/misc/generic-loader.c | 121 +++++++++++++++++++++++++++++++++++++++ include/hw/misc/generic-loader.h | 50 ++++++++++++++++ 4 files changed, 174 insertions(+) create mode 100644 hw/misc/generic-loader.c create mode 100644 include/hw/misc/generic-loader.h
default-configs/arm-softmmu.mak +1 -0
@@ -109,3 +109,4 @@ CONFIG_IOH3420=y CONFIG_I82801B11=y CONFIG_ACPI=y CONFIG_SMBIOS=y +CONFIG_LOADER=y
hw/misc/Makefile.objs +2 -0
@@ -44,3 +44,5 @@ obj-$(CONFIG_STM32F2XX_SYSCFG) += stm32f2xx_syscfg.o obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_EDU) += edu.o obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o + +obj-$(CONFIG_LOADER) += generic-loader.o
hw/misc/generic-loader.c new file +121 -0
121 lines not on this page · raw message
include/hw/misc/generic-loader.h new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
2.5.0
Hi Alistair,
Quoted 8 lines · Alistair Francis
This work is based on the original work by Li Guang with extra features added by Peter C.
The idea of this loader is to allow the user to load multiple images or values into QEMU at startup.
I have tested this on ARM and it works. What do people think? Is it worth pursuing to try and get accepted?
For what it's worth, I think this is worthwhile.
Cov
Signature · 3 lines
Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 6 lines · Christopher Covington
Hi Alistair,
Quoted 3 lines · Alistair Francis
This work is based on the original work by Li Guang with extra features added by Peter C.
Quoted 7 lines
Quoted 5 lines
The idea of this loader is to allow the user to load multiple images or values into QEMU at startup.
I have tested this on ARM and it works. What do people think? Is it worth pursuing to try and get accepted?
For what it's worth, I think this is worthwhile.
Hey Chris,
That is great! Any chance you would mind commenting on the code?
I'm assuming you are looking at ARM targets, which is all that is supported at the moment.
Thanks,
Alistair
Quoted 8 lines
Cov
--
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project