Building Darwin

18 Apr 2003

Building your own kernel. Not something you should ever have to do yourself, but as a weirdo something I thought I’d do for fun. So today I built my first Darwin kernel. Building OS kernels is never straight forward the first time you do it, and this was no exception. These instructions are almost perfect, but if you’re going to try it yourself note two things:

  1. When building libkld.a it can’t find sys/unistd.h. The way I solved this was by hacking the makefile to add -I/usr/include as the last thing on the include search path.
  2. Once you’ve built and copied libkld.a into /usr/local/lib, you need to do “sudo ranlib /usr/local/lib/libkld.a” otherwise the kernel won’t link against it.

Now I just need to pluck up the courage to install it on a machine :)