Reputation: 1354
QEMU allows to boot a VM with u-boot passed to -kernel option. But it requires additional file (u-boot itself) to be available on host system. My goal is to load u-boot which is stored inside of QEMU disk image. So I am expecting to do something like this:
qemu-system-arm -kernelblocks 1:128 -device sdhci-pci -drive format=raw,file=./build/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device sd-card,drive=disk
where -kernelblocks is an imaginary option telling QEMU to load u-boot from specific blocks of the QEMU disk image instead of file on the host system.
So the question is: how I can get QEMU to load u-boot from QEMU disk image? As alternative I may accept answer showing how to load a file from a file system on the QEMU disk image.
For my task I am at liberty to pass any options to QEMU but cannot have any files on the host system except just QEMU disk image.
Upvotes: 0
Views: 3306
Reputation: 11513
Your command line doesn't specify a particular machine model, which isn't valid for qemu-system-arm. The below rules of thumb may or may not apply for a particular QEMU machine model.
For running QEMU guest code you can generally either:
The first is a convenient shortcut; the second is like how the hardware actually boots. (qemu-system-x86_64 works like the -bios option approach; you just don't notice because the -bios option is enabled by default and loads the bios image from a system library directory.) Some board models don't support -bios.
QEMU doesn't have any way of saying "load the guest image from this block of the disk". That would be getting too much into the details of hand-emulating a guest BIOS, and we'd prefer to provide that functionality by just running an actual guest BIOS blob.
Upvotes: 1