I want to port the xnu kernel to the ARM architecture, with the ultimate goal of being able to run a full kernel inside Qemu. While I do realise that this is a very difficult task, I still want to have a go at it.
As far as I know, you're meant to write an entry point for the kernel (osfmk/arm/start.s) where you do general initialisation (MMU and PlatformExpert) after which the Kext/IOKit subsystems can be started and load CPU specific extensions (ie. traps, GPIO, clock) which are either prelinked into the binary or loaded by the bootloader (because the kernel can't interact with the filesystem due to the NAND extensions not being available yet).
While I do have a general idea on how ARM CPUs work, I don't even know where to get started with the xnu port, because I'm not entirely sure how to:
- Do low level debugging (since the kernel debugging facilities are unavailable early during startup).
- Integrate the ARM branch with the rest of the kernel source tree (ie. making sure the stuff in
osfmk/kernis working). - Create a sane environment for platform independent kernel to start (
machine_startup()); - Fix up some platform specific code inside the main kernel code (most of the platform code is limited to
osfmk/platform_namebut some of it has to be integrated intoosfmk/kernand others).
Are there any decent guides on porting the XNU (or at least Mach) kernel to different platforms, just like there are Linux guides?