Introduction to Inside XNU.


Welcome to Inside XNU! A blog-series in which I hope analyse and discuss the boot process and functionality of the XNU Kernel. I have recently taken up OS development as a hobby and learning exercise with nullpixel. We have found that reading through the source code of other kernels - Linux, XNU, etc - is very valuable despite them being far more advanced than what we're aiming for.

I had also discovered a neat book by @0xAX called "Linux Insides" in which he details in-depth the Linux Kernel, it's boot sequence, different areas of the kernel such as IPC, Concepts, Interrupts, Memory management etc - essentially what I aim to do with this.

However, I found that there was nothing equivalent for the XNU Kernel, the kernel that as I'm sure most of you know is used by the Darwin Operating System (iOS, iPadOS, macOS, etc).

Format

How this will work is subject to change as I'm treating this post almost like a pilot episode of a new TV show. The feedback from this will determine whether I continue to write this with the intention of others reading it, or if I write it purely as my own notes. The format I had in mind is similar to the Linux Insides book. I will discuss different areas of the kernel in what I hope are weekly or at least monthly articles - but please don't hold me to this. In each post I may also discuss how I've implemented similar aspects into my own Kernel - LightOS.

There are two main reasons for me to choose this format, rather than writing an actual book. The first being that I can measure the popularity of something like this over time, and second being that if I cannot continue for whatever reason the content is still here for anyone who needs it, I wouldn't have wasted my time half-writing a book, and it's more easy for me to pick it up in the future.

Finally, I do not want to commit to a timeframe of how often these posts will be. I am starting my second year of University in the next few weeks so It's unclear how much time I can devote to this, but I certainly wont abandon it!

Requirements

There are a few basic requirements I suggest you meet before reading:

  • An understanding of C
  • Basic understanding of AArch64 architecture and ARM64 assembler
  • Purpose of a kernel

Some knowledge of how the XNU kernel is designed may be useful, but that's something I'll explain anyway. I'll be using the latest available XNU sources, which at the time of writing is XNU-6153.141.1.

Summary

Thank you for your interest in this project, and I hope you find it interesting and valuable. You can begin reading here, or click on the "Inside XNU" tab above. Any questions you have please either email me@h3adsh0tzz.com, or Tweet me @h3adsh0tzz.