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.