This work is based on the original work by Li Guang with extra features added by Peter C and myself.
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. This patch series makes the load_elf() function more generic by not requiring an architecture. It also adds new functions load_elf_as(), load_uimage_as and load_image_targphys_as which allows custom AddressSpaces when loading images. V9: - Logic and documentation corrections - Add address space loading support for uImages and targphys V8: - Allow custom AddressSpaces when loading images - Move ELF architecture handling code - Rebase - Corrections to loading code - Corrections to documentation V7: - Fix typo in comment - Rebase V6: - Add error checking V5: - Rebase V4: - Re-write documentation - Allow the loader to work with every architecture - Move the file to hw/core - Increase the maximum number of CPUs - Make the CPU operations conditional - Convert the cpu option to cpu-num - Require the user to specify endianess V2: - Add an entry to the maintainers file - Add some documentation - Perform bounds checking on the data_len - Register and unregister the reset in the realise/unrealise Changes since RFC: - Add support for BE Alistair Francis (8): loader: Allow ELF loader to auto-detect the ELF arch loader: Use the specified MemoryRegion loader: Allow a custom AddressSpace when loading ROMs loader: Add AddressSpace loading support to ELFs loader: Add AddressSpace loading support to uImages loader: Add AddressSpace loading support to targphys generic-loader: Add a generic loader docs: Add a generic loader explanation document MAINTAINERS | 6 ++ docs/generic-loader.txt | 63 +++++++++++++ hw/core/Makefile.objs | 2 + hw/core/generic-loader.c | 185 +++++++++++++++++++++++++++++++++++++++ hw/core/loader.c | 85 +++++++++++++----- include/hw/core/generic-loader.h | 45 ++++++++++ include/hw/elf_ops.h | 10 ++- include/hw/loader.h | 40 +++++++-- 8 files changed, 409 insertions(+), 27 deletions(-) create mode 100644 docs/generic-loader.txt create mode 100644 hw/core/generic-loader.c create mode 100644 include/hw/core/generic-loader.h -- 2.7.4