Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

PowerPC74

macrumors member
Original poster
Dec 15, 2024
55
21
I'm having trouble finding step by step on how to build the xnu kernel for PPC on Tiger 10.4.11 PPC.

Can anyone point me to a dummies guide to building the mach_kernel?
 
There's this: https://developer.apple.com/library...Conceptual/KernelProgramming/build/build.html

but I haven't tried it. It might be missing some steps or it might not work with the latest 10.4 source or the latest 10.4 source might be missing something.
Turns out that AppleCore99PE.kext is the one that only kickstarts 4 CPUs on Tiger and 2 for Leopard/SL PPC.

So a recompile of the kernel is not necessary, sadly tho there is less documentation on how to build Core99PE than there is the kernel.

Tiger supports 256 CPUs in the PPC Kernel, no changes should be needed. Maybe one day we can get OS X PPC running on IBM Power and make use of a bunch of those cores! That would require a PE anyways, nd we just kickstart that CPUs from there.
 
So a recompile of the kernel is not necessary, sadly tho there is less documentation on how to build Core99PE than there is the kernel.
AppleCore99PE has an Xcode project file. You just open it and build. Unless you're saying that some source files are missing or have errors?

AppleCore99PE only has source code up to MacOS X 10.4.11.
Code:
grep "AppleCore99PE" $(find /Volumes/Work/Darwin/DarwinNew/opensource.apple.com -maxdepth 2 -type f -name 'tarballs.txt') | perl -pE 's|.*opensource.apple.com/(.*)/tarballs.*/(\w+\-.*).tar.gz|\1 \2|' | sort -V 10.0 AppleCore99PE-1.0d11 10.0.4 AppleCore99PE-1.0d11 10.1 AppleCore99PE-1_1d7 10.1.1 AppleCore99PE-1_1d7 10.1.2 AppleCore99PE-1_1d7 10.1.3 AppleCore99PE-1_1d7 10.1.4 AppleCore99PE-1_1d7 10.1.5 AppleCore99PE-1_1d7 10.2 AppleCore99PE-120.0.2 10.2.1 AppleCore99PE-120.0.2 10.2.2 AppleCore99PE-120.0.2 10.2.3 AppleCore99PE-120.0.2 10.2.4 AppleCore99PE-120.0.2 10.2.5 AppleCore99PE-120.0.2 10.2.6 AppleCore99PE-120.0.2 10.2.7 AppleCore99PE-120.0.2 10.2.8 AppleCore99PE-120.0.2 10.2.8.G5 AppleCore99PE-120.0.2 10.3 AppleCore99PE-121.0.2 10.3.1 AppleCore99PE-121.0.2 10.3.2 AppleCore99PE-121.0.2 10.3.3 AppleCore99PE-121.0.2 10.3.4 AppleCore99PE-121.0.2 10.3.5 AppleCore99PE-121.0.2 10.3.6 AppleCore99PE-121.0.2 10.3.7 AppleCore99PE-121.0.2 10.3.8 AppleCore99PE-121.0.2 10.3.9 AppleCore99PE-121.0.2 10.4 AppleCore99PE-122.0.1 10.4.1 AppleCore99PE-122.0.1 10.4.2 AppleCore99PE-122.0.1 10.4.3 AppleCore99PE-122.0.1 10.4.4.ppc AppleCore99PE-122.0.1 10.4.4.x86 AppleCore99PE-131.0.1 10.4.5.ppc AppleCore99PE-122.0.1 10.4.5.x86 AppleCore99PE-131.0.1 10.4.6.ppc AppleCore99PE-122.0.1 10.4.6.x86 AppleCore99PE-131.0.1 10.4.7.ppc AppleCore99PE-122.0.1 10.4.7.x86 AppleCore99PE-131.0.1 10.4.8.ppc AppleCore99PE-122.0.1 10.4.8.x86 AppleCore99PE-131.0.1 10.4.9.ppc AppleCore99PE-122.0.1 10.4.9.x86 AppleCore99PE-131.0.1 10.4.10.ppc AppleCore99PE-122.0.1 10.4.10.x86 AppleCore99PE-131.0.1 10.4.11.ppc AppleCore99PE-122.0.1 10.4.11.x86 AppleCore99PE-131.0.1 bbdiff /Volumes/Work/Darwin/DarwinNew/opensource.apple.com/tarballs/AppleCore99PE/AppleCore99PE-122.0.1 /Volumes/Work/Darwin/DarwinNew/opensource.apple.com/tarballs/AppleCore99PE/AppleCore99PE-131.0.1

Even though 131.0.1 is for Intel, it has updates compared to 122.0.1 (it removes references to IOPMPagingPlexus)
The version string in the plist for 131.0.1 is 1.2.3.

Core99 limits the number of CPUs to 1 if uniNVersion < kUniNVersion107.

The number of CPUs can be limited by the MPIC registers. See AppleMPIC.cpp where it sets numCPUs
 
@Larsvonhier
AppleCore99PE has an Xcode project file. You just open it and build. Unless you're saying that some source files are missing or have errors?

AppleCore99PE only has source code up to MacOS X 10.4.11.
Code:
grep "AppleCore99PE" $(find /Volumes/Work/Darwin/DarwinNew/opensource.apple.com -maxdepth 2 -type f -name 'tarballs.txt') | perl -pE 's|.*opensource.apple.com/(.*)/tarballs.*/(\w+\-.*).tar.gz|\1 \2|' | sort -V 10.0 AppleCore99PE-1.0d11 10.0.4 AppleCore99PE-1.0d11 10.1 AppleCore99PE-1_1d7 10.1.1 AppleCore99PE-1_1d7 10.1.2 AppleCore99PE-1_1d7 10.1.3 AppleCore99PE-1_1d7 10.1.4 AppleCore99PE-1_1d7 10.1.5 AppleCore99PE-1_1d7 10.2 AppleCore99PE-120.0.2 10.2.1 AppleCore99PE-120.0.2 10.2.2 AppleCore99PE-120.0.2 10.2.3 AppleCore99PE-120.0.2 10.2.4 AppleCore99PE-120.0.2 10.2.5 AppleCore99PE-120.0.2 10.2.6 AppleCore99PE-120.0.2 10.2.7 AppleCore99PE-120.0.2 10.2.8 AppleCore99PE-120.0.2 10.2.8.G5 AppleCore99PE-120.0.2 10.3 AppleCore99PE-121.0.2 10.3.1 AppleCore99PE-121.0.2 10.3.2 AppleCore99PE-121.0.2 10.3.3 AppleCore99PE-121.0.2 10.3.4 AppleCore99PE-121.0.2 10.3.5 AppleCore99PE-121.0.2 10.3.6 AppleCore99PE-121.0.2 10.3.7 AppleCore99PE-121.0.2 10.3.8 AppleCore99PE-121.0.2 10.3.9 AppleCore99PE-121.0.2 10.4 AppleCore99PE-122.0.1 10.4.1 AppleCore99PE-122.0.1 10.4.2 AppleCore99PE-122.0.1 10.4.3 AppleCore99PE-122.0.1 10.4.4.ppc AppleCore99PE-122.0.1 10.4.4.x86 AppleCore99PE-131.0.1 10.4.5.ppc AppleCore99PE-122.0.1 10.4.5.x86 AppleCore99PE-131.0.1 10.4.6.ppc AppleCore99PE-122.0.1 10.4.6.x86 AppleCore99PE-131.0.1 10.4.7.ppc AppleCore99PE-122.0.1 10.4.7.x86 AppleCore99PE-131.0.1 10.4.8.ppc AppleCore99PE-122.0.1 10.4.8.x86 AppleCore99PE-131.0.1 10.4.9.ppc AppleCore99PE-122.0.1 10.4.9.x86 AppleCore99PE-131.0.1 10.4.10.ppc AppleCore99PE-122.0.1 10.4.10.x86 AppleCore99PE-131.0.1 10.4.11.ppc AppleCore99PE-122.0.1 10.4.11.x86 AppleCore99PE-131.0.1 bbdiff /Volumes/Work/Darwin/DarwinNew/opensource.apple.com/tarballs/AppleCore99PE/AppleCore99PE-122.0.1 /Volumes/Work/Darwin/DarwinNew/opensource.apple.com/tarballs/AppleCore99PE/AppleCore99PE-131.0.1

Even though 131.0.1 is for Intel, it has updates compared to 122.0.1 (it removes references to IOPMPagingPlexus)
The version string in the plist for 131.0.1 is 1.2.3.

Core99 limits the number of CPUs to 1 if uniNVersion < kUniNVersion107.

The number of CPUs can be limited by the MPIC registers. See AppleMPIC.cpp where it sets numCPUs
Yes, Core99PE requires some external headers, mostly from xnu, but who knows what versions, because the ones from the corresponding xnu releases don't work.

If I ever figure it out I'll try and document what needs to be done, most IOKIT/IOCPU.h, but what versions?
 
  • Like
Reactions:Larsvonhier
Compare the versions to make sure the newer version is a superset of the older version? You may need to worry about fields being added or removed. For kexts, you may need to worry about virtual methods being removed or added to the virtual table.

I can extract virtual tables using Hopper.app disassembler and a script I made.

The KDKs (kernel debug kits) have symbols that describe structs, classes, and virtual tables of many kernel related source files which include some kexts that are built into the kernel. I have a script to extract that info.
https://gist.github.com/joevt/da0500cd574f00042f0db61f9af5512f
The same object appears multiple times in the output because multiple source files use the same object. For example, the IOCPU class is used by:
xnu-792.24.17/iokit/Kernel/IOPlatformExpert.cpp
xnu-792.24.17/iokit/Kernel/IOCPU.cpp
xnu-792.24.17/iokit/Drivers/platform/drvApplePlatformExpert/AppleCPU.cpp

Note: 10.4.11 uses stabs instead of dwarf. My script handles both.
 

Attachments

  • joedwarf for 10.4.11_8S165.zip
    12.1 MB · Views: 9
  • Like
Reactions:cellularmitosis
I'm having trouble finding step by step on how to build the xnu kernel for PPC on Tiger 10.4.11 PPC.

Can anyone point me to a dummies guide to building the mach_kernel?

Did you try darwinbuild? You may need to fix download links or fetch sources manually (since Apple moved them to GitHub), but other than that it is supposed to work, since it did before. I think PureDarwin folks even had bootable images based on open sourced part of Tiger.
 
Did you try darwinbuild? You may need to fix download links or fetch sources manually (since Apple moved them to GitHub), but other than that it is supposed to work, since it did before. I think PureDarwin folks even had bootable images based on open sourced part of Tiger.
I have darwinbuild installed, but as you say, it can't download anything, and I can't really find any current guides on how to sue it, or how to use it to build Core99PE or MacRISC2PE?
 
I have darwinbuild installed, but as you say, it can't download anything, and I can't really find any current guides on how to sue it, or how to use it to build Core99PE or MacRISC2PE?

Honestly I don’t think Darwinbuild is a convenient build system, and documentation is insufficient. However my use case was to force ppc builds of 10.6 components, which is not something that developers ever had in mind. So I assume that for 10.4 it should be easier.
If you plan to build a rather limited subset of components, it may be easier to provide sources manually rather than fix fetching. If you do the latter, make sure to fix extraction as well: Apple changed tarballs naming, so if it is not accounted for, nothing will build, since Makefiles won’t be found.
You can look at my partial fix in my fork. It covers most of cases, I think, but not all. (That is, extraction.)
At the same time it could be faster and more practical to reimplement needed builds in some alternative build system. (I’m only familiar with MacPorts; see libdispatch-legacy port as an example how such things can be done via MacPorts in a “clean” way without introducing any dependencies on MacPorts headers and libraries.)

Sorry, I’m not familiar with these specific components, so can’t say anything useful on that. Darwinbuild can show dependencies for any given component; what is not clear is the right sequence to build those, since there are many circular dependencies.
 
AppleCore99PE has an Xcode project file. You just open it and build. Unless you're saying that some source files are missing or have errors?
Basically these projects are useless unless you are just trying to figure out how the hardware works. They can not be built without Apple's internal frameworks and they did not release them that I am aware.

They can not be built.
 
They can not be built.
You may need to disassemble the kext to fill in the missing parts of the code.
The debugging symbols have info about structs, classes, virtual tables, variables, etc that exist in the kernel.
Platform Experts are not very large kexts.
 
  • Like
Reactions:ADunsmuir
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.
close