devos50 / qemu-ios

A QEMU emulator for legacy Apple devices
Other
951 stars 63 forks source link

Parse boot arguments to XNU kernel via QEMU #45

Open calmsacibis995 opened 1 year ago

calmsacibis995 commented 1 year ago

Is it possible to parse boot arguments to XNU via QEMU? If possible, what is the command? (I know that you can use the -serial mon:stdio option, but it would be cool to see the XNU kernel messages on boot on the emulated iPod's display)

devos50 commented 1 year ago

The boot args for the iPod Touch 1G are loaded from the NOR image, and are included in there. As I generate and build this NOR image separately, it's not possible just yet to pass them through a QEMU argument. But with a few modifications that should not be too difficult (for example, we could modify the NOR image when loading it in QEMU).

For the iPod Touch 2G, things are a bit different. It seems that Apple disabled the possibility of passing custom boot arguments when iBoot is built with a release tag. So to work around this, I write the boot args to the kernel memory (see https://github.com/devos50/qemu-ios/blob/ipod_touch_2g/hw/arm/ipod_touch_fmss.c#L30). It's trivial to adjust the code and pass these arguments with a QEMU flag. 👍