[darwinbuild] Building xnu

Alastair Rankine arsptr at optusnet.com.au
Fri Aug 5 16:23:39 PDT 2005

Shantonu Sen wrote:

>> (Darwinports newbie, obviously)
> I hope you mean darwinbuild ;-)    


>> So it seems that when you build xnu, it builds a ppc/i386 universal 
>> binary. What is the darwinbuild magic to disable this and allow me to 
>> build a kernel that will run on my Powerbook G4?
> The universal binary will work fine on your PowerBook. Did you try it?

Yes, and I assumed that the reason it didn't work was because it was a 
universal binary. The problem turned out to be an incorrect partition 
number in the boot-file variable (ie "hd:3" instead of "hd:9"). Took a 
while (and a drafted but not sent email for help!) to track that one down.

I have (probably) booted successfully using my darwinbuilt kernel and 
all is well so far.

I say probably because there doesn't seem to be any way to determine 
which kernel I'm booting from. The older (7.x) xnu kernels reported the 
kernel file path in their dmesg output - the 8.x series don't seem to. 
Not in the sysctl MIB either. Is there any way to retrieve this 
information do you know?

> If you edited the plist after configuring your environment, you want 
> to reload the index for that build with:
> /usr/local/bin/darwinxref loadIndex /path/to/plist/8C46.plist
> This worked for me. Your RC_ARCHS change is the right one. The only 
> thing this will save you is time, at the expense of falling outside 
> the norm of the standard Darwin build configuration. Some projects 
> don't built at all unless they are built for all supported 
> architectures, but "xnu" should build fine for ppc only if you really 
> want this.

Understood, thanks. IMO this isn't explained very clearly in the doco; 
I'm happy to contribute some updates. LMK.

>> Alternatively, how can I turn the universal binary back into a 
>> bootable PPC binary? (possibly not a darwinbuild question)
> You can use lipo(1). See the man page for more information. But this 
> shouldn't be necessary to get a working kernel.

Thanks again, this works nicely. (cute name too)

More information about the darwinbuild-dev mailing list