Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emulating a NAND based storage device in Qemu?

I want to test out a first stage bootloader I wrote in order to bootload an unfinished kernel, so I can debug it and see if it works or not. Is it possible to make Qemu emulate a NAND storage device, from which it would copy the bootloader and execute it? And if so, how would I go about doing it?

So basically, Qemu would need to initialize the virtual CPU and the virtual NAND, load a chunk of it into the RAM, and then make the CPU jump to it. After the loader is in memory, it will then be able to load the filesystem, find the kernel, decompress, decrypt, decode, relocate and execute it.

like image 885
Kristina Brooks Avatar asked Nov 13 '22 12:11

Kristina Brooks


1 Answers

Qemu provides MTD devices. Some board configurations that qemu emulates have them. The host provides an image file (like from disks) and the guest sees a flash device. I don't know more, but studying qemu source and configs for various boards and asking on qemu's mailing list should help.

like image 50
Z.T. Avatar answered Dec 18 '22 16:12

Z.T.