Building xnu requires Xcode and some additional open-source (but not pre-installed) dependencies. You can build xnu manually by doing:
- Install OS X Mountain Lion and Xcode 4.4
- Launch Xcode, go to Preferences... > Downloads and install the Command Line Tools
- Download the source for the dtrace and AvailabilityVersions projects, which are required dependencies, as well as xnu itself
$ curl -O http://opensource.apple.com/tarballs/dtrace/dtrace-96.tar.gz $ curl -O http://opensource.apple.com/tarballs/AvailabilityVersions/AvailabilityVersions-4.2.tar.gz $ curl -O http://opensource.apple.com/tarballs/xnu/xnu-2050.7.9.tar.gz
- Build and install CTF tools from dtrace
$ tar zxf dtrace-96.tar.gz $ cd dtrace-96 $ mkdir -p obj sym dst $ xcodebuild install -target ctfconvert -target ctfdump -target ctfmerge ARCHS="x86_64" SRCROOT=$PWD OBJROOT=$PWD/obj SYMROOT=$PWD/sym DSTROOT=$PWD/dst ... $ sudo ditto $PWD/dst/usr/local /usr/local Password: $ cd ..
- Install AvailabilityVersions
$ tar zxf AvailabilityVersions-4.2.tar.gz $ cd AvailabilityVersions-4.2 $ mkdir -p dst $ make install SRCROOT=$PWD DSTROOT=$PWD/dst $ sudo ditto $PWD/dst/usr/local /usr/local $ cd ..
- Build xnu
$ tar zxf xnu-2050.7.9.tar.gz $ cd xnu-2050.7.9 $ make ARCH_CONFIGS=X86_64 KERNEL_CONFIGS=RELEASE
Thank you for this!
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThanks for the write-up - you saved me time an effort, kudos for caring enough to write it up!
ReplyDeleteThanks for these great instructions. When tested with XCode 5 tools, building 10.8.4 generates a multitude of 'use of __private_extern__ on' errors. Any clue as to how to get rid of it, short of reinstalling XCode 4.6? Thanks, once again.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThanks you so much!
ReplyDeleteThis works on 10.9 as well.
ReplyDeleteJust the versions of the source is different and there are some newer tools available
I used those versions:
http://opensource.apple.com/tarballs/dtrace/dtrace-118.tar.gz
http://opensource.apple.com/tarballs/AvailabilityVersions/AvailabilityVersions-6.tar.gz
http://opensource.apple.com/tarballs/xnu/xnu-2422.1.72.tar.gz