===== I have moved on! =====

Please join me at Virtually Lost in the search to find Nirvana using virtualization technologies.

Monday, 1 January, 2007

Compiling XNU (OSX Kernel)

We are looking into getting OCF into the OSX kernel. That means we have to first be able to compile the XNU/Darwin kernel. I followed this howto.

Note a few points:


  • Make sure to install GCC 3.3 on a OSX machine.

  • Get the building utilities pre-built here.

  • Get the Xnu kernel tarball, either PPC or Intel.


So, all of this is rather straightforward, BUT I had install both GCC 4.0 and GCC3.3, and I think that XNU is allergic to GCC4.0

I ended up relinking all the /usr/bin/gcc, /usr/bin/c++, and such to their gcc 3.3 equivalent. Once done, the compile went rather well, until the very end and then ended up complaining about -lcc_kext not found. The trick is to modify makedefs/MakeInc.def and to change:

#
# Default runtime libraries to be linked with the kernel
#
export LD_KERNEL_LIBS = -lcc_kext

with

#
# Default runtime libraries to be linked with the kernel
#
export LD_KERNEL_LIBS = -L/usr/lib/gcc/darwin/3.3/ -lcc_kext


That's it.

Here are a few links that might interest you for understanding of building of the XNU kernel:
MacOSX Forge
OpenDarwin
O'Reilly
Building Intel xnu with darwinbuild

0 comments: