Skip to content

Instantly share code, notes, and snippets.

@peshi
Created January 26, 2014 02:29
Show Gist options
  • Save peshi/8627358 to your computer and use it in GitHub Desktop.
Save peshi/8627358 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Download and build OS X Mavericks XNU Source
if [ ! -d "dtrace-118" ]; then
curl -O http://opensource.apple.com/tarballs/dtrace/dtrace-118.tar.gz
tar zxf dtrace-118.tar.gz
rm dtrace-118.tar.gz
fi
if [ ! -d "AvailabilityVersions-6" ]; then
curl -O http://opensource.apple.com/tarballs/AvailabilityVersions/AvailabilityVersions-6.tar.gz
tar zxf AvailabilityVersions-6.tar.gz
rm AvailabilityVersions-6.tar.gz
fi
if [ ! -d "xnu-2422.1.72" ]; then
curl -O http://opensource.apple.com/tarballs/xnu/xnu-2422.1.72.tar.gz
tar zxf xnu-2422.1.72.tar.gz
rm xnu-2422.1.72.tar.gz
fi
cd dtrace-118
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
cd ..
cd AvailabilityVersions-6
mkdir -p dst
make install SRCROOT=$PWD DSTROOT=$PWD/dst
sudo ditto $PWD/dst/usr/local `xcrun -sdk / -show-sdk-path`/usr/local
cd ..
cd xnu-2422.1.72
make ARCH_CONFIGS=X86_64 KERNEL_CONFIGS=RELEASE
cd ..
echo The built kernel can be found at xnu-2422.1.72/BUILD/obj/RELEASE_X86_64/mach_kernel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment