How to add new QEMU machine types without modifying the mainline source code?

5.2k views Asked by At

Can a new machine type be added for qemu-system-arm -M <MachineType> without having to recompile qemu or write code? Are there docs to do this? I would like to be able to emulate raspberry pi and pandaboard using qemu.

I know that meego's fork of qemu supports pandaboard, but I am trying to stick with the main stream qemu that I can manage from the apt-get package manager. the main stream qemu now supports beagleboard rev C and beagleboard xm that were previously supported only in the meego fork.

2

There are 2 answers

4
datenwolf On BEST ANSWER

without having to recompile qemu or write code?

No. There must be some code doing the device specific emulation, like for example the way the Raspberry Pi or the Pandaboard implement video output. This is not a matter of just a few config files.

0
Ciro Santilli OurBigBook.com On

I've been able to emulate the Pi with -M versatilepb: https://raspberrypi.stackexchange.com/questions/165/emulation-on-a-linux-pc/53991#53991 and -M raspi2 has was later added in QEMU 2.6.

Maybe this feature is feasible to implement, see my experience with adding a new platform device: How to add a new device in QEMU source code?

There, I only needed to add a single line to attach a new device to versatilepb:

sysbus_create_simple("lkmc_platform_device", 0x101e9000, pic[18]);

so maybe we could have a config file containing lines of type:

type    name                  regid        irq
sysbus  lkmc_platform_device  0x101e9000   18

Related: out-of-tree devices: How to create out-of-tree QEMU devices?