Issue
I am trying to make a baremetal arm os in qemu with baremetal bios as well as kernel.
When I try qemu-system-arm -machine virt -bios boot.bin -nographic
boot.bin gets mapped to 0x00 and when i try qemu-system-arm -machine virt -kernel kernel.bin
kernel.bin gets mapped to 0x40010000.
So when I do qemu-system-arm -machine virt -bios boot.bin -kernel kernel.bin
boot.bin gets mapped to 0x00 but i don't find kernel.bin. I tried to check at 0x40000000 but there also some garbage value is there(might not be garbage but it is not kernel.bin)
I don't find any documentation telling about this, also if I were to use -drive
option how can I go forward on this? like Do i need to write a driver for accessing the drive if yes where can I see documentation or something which can guide
Solution
If you pass a firmware image to the 'virt' board using -bios then QEMU will put the kernel image (and any initrd) in the 'fw-cfg' device. Guest code in the bios image can then access the fw-cfg device to tell it to DMA the kernel image to whatever address it likes. (This facility is provided primarily for the UEFI BIOS, though of course any guest code can use the fw-cfg device if it likes.)
The data at 0x40000000 is the device tree blob, which is what your bios image should be reading in order to find out where in the address map all the hardware devices are. (This part is documented, at the bottom of https://www.qemu.org/docs/master/system/arm/virt.html)
Note that '-kernel' means "I am a Linux kernel, load me in whatever seems the most appropriate way". If you didn't want that, and just wanted "load a binary image at the address I specify", have a look at the "generic loader" device instead.
Answered By - Peter Maydell
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.