If a -bios option is specified on the command line, load the image into the internal ROM memory region, which contains the first instructions run by the CPU after reset.
A minimal Apache-2.0-licensed boot ROM can be found at https://github.com/google/vbootrom It is by no means feature complete, but it is enough to launch the Nuvoton bootblock[1] from offset 0 in the flash, which in turn will launch u-boot and finally the Linux kernel. [1] https://github.com/Nuvoton-Israel/bootblock Change-Id: I41eae4fc7786d33f532c14087e930bf1b5012562 Reviewed-by: Tyrone Ting <kft...@nuvoton.com> Signed-off-by: Havard Skinnemoen <hskinnem...@google.com> --- hw/arm/npcm7xx.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c index a5dbf08c00..417bc16b5c 100644 --- a/hw/arm/npcm7xx.c +++ b/hw/arm/npcm7xx.c @@ -22,6 +22,7 @@ #include "hw/misc/unimp.h" #include "hw/qdev-properties.h" #include "qapi/error.h" +#include "qemu-common.h" #include "qemu/units.h" #include "sysemu/sysemu.h" @@ -270,6 +271,22 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp) } memory_region_add_subregion(get_system_memory(), NPCM7XX_ROM_BA, &s->irom); + if (bios_name) { + g_autofree char *filename = NULL; + int ret; + + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + if (!filename) { + error_setg(errp, "Could not find ROM image '%s'", bios_name); + return; + } + ret = load_image_mr(filename, &s->irom); + if (ret < 0) { + error_setg(errp, "Failed to load ROM image '%s'", filename); + return; + } + } + /* External DDR4 SDRAM */ memory_region_add_subregion(get_system_memory(), NPCM7XX_DRAM_BA, s->dram); } -- 2.27.0.290.gba653c62da-goog