xnu //darwin
the OsX kernel (see Kernel Notes for glinux)
building
ref docs
short notes based on above docs…
get the src
get the src and necessary tools (bootstrap_cmds, Libstreams, and cctools) from http://www.opensource.apple.com
(or cvs)
cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od login cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od co src/Libstreams cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od co src/bootstrap_cmds cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od co src/cctools cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od co src/xnu
Note, that the above steps check out the most current version of the source. If you want to have exactly the same code base, as in the tarballs from Apple, you need to specify the OD_APPLE_10_2_6 tag.
cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od co -r OD_APPLE_10_2_6 src/Libstreams
setup the environment, and build tools
export PATH=/usr/local/bin:$PATH
if its not in .bashprofile
cd ~/src/Libstreams make install DSTROOT=/tmp/Libstreams.dst (cd /tmp/Libstreams.dst; pax -rw . /) cd ~/src/bootstrap_cmds make install DSTROOT=/tmp/bootstrap_cmds.dst (cd /tmp/bootstrap_cmds.dst; pax -rw . /) cd ~/src/xnu make installhdrs DSTROOT=/tmp/xnu_hdrs.dst (cd /tmp/xnu_hdrs.dst; pax -rw . /) cd ~/src/cctools make install_tools DSTROOT=/tmp/cctools.dst SUBDIRS="libstuff libmacho misc" RC_OS=macos (cd /tmp/cctools.dst ; pax -rw . /) make lib_ofiles_install DSTROOT=/tmp/cctools.dst SUBDIRS="ld" RC_OS=macos (cd /tmp/cctools.dst ; pax -rw . /)
build the kernel
Finally, issue the following commands:
cd ~/src/xnu make
The resulting kernel can be found in the BUILD/obj/RELEASE_$ARCH/ directory and is called mach_kernel. $ARCH can be either PPC or I386.
By changing the KERNEL_CONFIGS environment variable you can specify which kernel configuration you want to build. For example, to build a debug version of the kernel, do this:
make KERNEL_CONFIGS=DEBUG all