Installing the new kernel

Best is to leave the original kernel untouched, thus copy the new kernel to / and append some string to it like, .test.

% sudo cp ~/src/xnu/BUILD/obj/RELEASE_$ARCH/mach_kernel /mach_kernel.test

Make sure, that the new kernel has the proper permissions set:

-rw-r--r--   1 root    wheel    3733508 Jan 29 18:51 mach_kernel.test

The mach.sym file will automatically be generated during system startup.

OpenFirmware (on PPC-architecture) needs to be made aware of the new kernel, you can do this with nvram:

% sudo nvram boot-file="hd:9,\mach_kernel.test"

The path to the root device can be looked up with:

% sudo nvram boot-device

On the I386-architecture the kernel to boot, is looked up in the file /Library/Preferences/SystemConfiguration/com.apple.Boot.plist. Change the corresponding value for the "Kernel" key to reference the new kernel:

<string>mach_kernel.test<string>

Alternatively the kernel name can be provided on the command line of the I386 bootloader.