[darwinbuild] Selecting arch to build for
(Darwinports newbie, obviously) 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? I tried modifying the .build/8C46.plist file to add the following to the xnu definition: environment = { RC_ARCHS = "ppc"; }; But no dice. What am I missing? Alternatively, how can I turn the universal binary back into a bootable PPC binary? (possibly not a darwinbuild question)
On Aug 4, 2005, at 4:35 AM, Alastair Rankine 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?
I tried modifying the .build/8C46.plist file to add the following to the xnu definition:
environment = { RC_ARCHS = "ppc"; };
But no dice. What am I missing?
Which plist did you edit? (the on in $DARWIN_BUILDROOT/.build/ 8C46.plist, the one in your darwinbuild distribution, or one downloaded independently?) Did you do this before or after you did "darwinbuild -init 8C46.plist"? If you did it after, note that plists are only used as a transport mechanism to seed your local SQLite database. Once you've done either "darwinbuild -init" (or the corresponding set of "darwinxref loadIndex" commands), the plist is no longer consulted. 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.
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. Shantonu
Shantonu Sen wrote:
(Darwinports newbie, obviously)
I hope you mean darwinbuild ;-)
Oops!
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)
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?
Have you tried uname -a? It should tell you the kernel version you're using... _Mark
Mark Pauley wrote:
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?
Have you tried uname -a? It should tell you the kernel version you're using...
Thanks, but that wasn't what I was after. I want to know the filename of the kernel. On most darwin systems it is /mach_kernel. I want a way to determine whether I am booting off /mach_kernel or /mach_kernel.new or whatever
same way you set it: "nvram boot-file" As long as you don't change it, it will reflect the last value you set it to. Shantonu On Aug 5, 2005, at 7:55 PM, Alastair Rankine wrote:
Mark Pauley wrote:
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?
Have you tried uname -a? It should tell you the kernel version you're using...
Thanks, but that wasn't what I was after. I want to know the filename of the kernel. On most darwin systems it is /mach_kernel. I want a way to determine whether I am booting off /mach_kernel or / mach_kernel.new or whatever
_______________________________________________ darwinbuild mailing list darwinbuild@opendarwin.org http://www.opendarwin.org/mailman/listinfo/darwinbuild
By the way, the console message you're thinking of from Panther was totally fake, that's why it was removed: <http://darwinsource.opendarwin.org/10.3.9/network_cmds-176.4.1/ syslogd.tproj/syslogd.c> #ifdef __APPLE__ /* We lack getbootfile() 3187949 and 3187947 */ (void)strlcpy(bootfile, "/mach_kernel", sizeof("/mach_kernel")); #else (void)strlcpy(bootfile, getbootfile(), sizeof(bootfile)); #endif Shantonu On Aug 5, 2005, at 8:09 PM, Shantonu Sen wrote:
same way you set it: "nvram boot-file"
As long as you don't change it, it will reflect the last value you set it to.
Shantonu
On Aug 5, 2005, at 7:55 PM, Alastair Rankine wrote:
Mark Pauley wrote:
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?
Have you tried uname -a? It should tell you the kernel version you're using...
Thanks, but that wasn't what I was after. I want to know the filename of the kernel. On most darwin systems it is /mach_kernel. I want a way to determine whether I am booting off /mach_kernel or /mach_kernel.new or whatever
_______________________________________________ darwinbuild mailing list darwinbuild@opendarwin.org http://www.opendarwin.org/mailman/listinfo/darwinbuild
_______________________________________________ darwinbuild mailing list darwinbuild@opendarwin.org http://www.opendarwin.org/mailman/listinfo/darwinbuild
On Aug 4, 2005, at 6:35 AM, Alastair Rankine wrote:
(Darwinports newbie, obviously)
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?
Umm, I'm pretty sure your Powerbook G4 *is* ppc ;) It should boot fine assuming it was built properly.
I tried modifying the .build/8C46.plist file to add the following to the xnu definition:
environment = { RC_ARCHS = "ppc"; };
But no dice. What am I missing?
I'm not sure where but you'll need to remove "RC_i386=YES" and change RC_ARCHS to "RC_ARCHS=ppc" in the .plist . I would recommend letting it build fat, and thinning later as I've had much better luck building Darwin projects with a fat, errr, 'universal' toolchain.
Alternatively, how can I turn the universal binary back into a bootable PPC binary? (possibly not a darwinbuild question)
Why do you think universal binaries won't run on ppc? Generally a universal(fat) binary is built to run on ppc{64} AND x86. Anyway, see manpages for lipo(1) and ditto(1) if you really want to thin the unneeded archs from your binaries. --Kito
_______________________________________________ darwinbuild mailing list darwinbuild@opendarwin.org http://www.opendarwin.org/mailman/listinfo/darwinbuild
participants (4)
-
Alastair Rankine
-
Kito
-
Mark Pauley
-
Shantonu Sen