This guide is for developer that wants to compile something from Apple's Open source projects.
http://opensource.apple.com/SIC! There are new versions of the sources then shown here.
http://www.projectosx.com/forum/index.php?...ost&p=15540Prerequisites1. You should install XCode 3.2.5 that is free at
Apple's site but free registration needed.
Then follow next steps exactly:
2. Get
cxxfilt-9.tar.gz, unpack
CODE
cd cxxfilt-9
mkdir -p obj sym dst
make install RC_ARCHS="i386 x86_64" RC_CFLAGS="-arch i386 -arch x86_64 -pipe" RC_OS=macos RC_RELEASE=SnowLeopard SRCROOT=$PWD OBJROOT=$PWD/obj SYMROOT=$PWD/sym DSTROOT=$PWD/dst
sudo ditto $PWD/dst/usr/local /usr/local
3. Get
dtrace-78.tar.gz, unpack. (I also change some libraries inside to GNU version)
CODE
cd dtrace-78
mkdir -p obj sym dst
xcodebuild install -target ctfconvert -target ctfdump -target ctfmerge ARCHS="i386 x86_64" SRCROOT=$PWD OBJROOT=$PWD/obj SYMROOT=$PWD/sym DSTROOT=$PWD/dst
sudo ditto $PWD/dst/usr/local /usr/local
4. Get
kext_tools-180.2.tar.gz, unpack
CODE
cd kext_tools-180.2
mkdir -p obj sym dst
xcodebuild install -target kextsymboltool -target setsegname ARCHS="i386 x86_64" SRCROOT=$PWD OBJROOT=$PWD/obj SYMROOT=$PWD/sym DSTROOT=$PWD/dst
sudo ditto $PWD/dst/usr/local /usr/local
5. Get
bootstrap_cmds-72.tar.gz, unpuck
CODE
cd bootstrap_cmds-72
mkdir -p obj sym dst
make install RC_ARCHS="i386" RC_CFLAGS="-arch i386 -pipe" RC_OS=macos RC_RELEASE=SnowLeopard SRCROOT=$PWD OBJROOT=$PWD/obj SYMROOT=$PWD/sym DSTROOT=$PWD/dst
sudo ditto $PWD/dst/usr/local /usr/local
6. Get latest XNU. (now it is xnu-1504.9.26 (OSX 10.6.6), unpack.
CODE
cd xnu-1504.9.26
make install ARCH_CONFIGS="I386 X86_64" KERNEL_CONFIGS="RELEASE"
Thus you created mach_kernel that you need no. Why you did this step? Look into dst folder:
Screen_shot_2011_01_13_at_15.15.12.png ( 38.33K )
Number of downloads: 224You need no mach_kernel if you are not suppose to create patched one (for example for Restart/Sleep fix

) but you need new headers appears during this build.
CODE
cp -r BUILD/dst/System/Frameworks/* /System/Frameworks/
cp -r BUILD/dst/usr/* /usr
But I found it is not good path.
Instead of
/System/Library/Frameworks/Kernel.framework/Versions/A/PrivateHeadersmust be
/System/Library/Frameworks/Kernel.framework/PrivateHeaders (link is not help

)
The same for
System.frameworkJust copy by finder from default place to the place of link.
Compiling IOUSBFamily project.
Get latest source. Unpack. Try to compile. Without the prerequisites above you got thousands errors.
1. Copy headers
IOUSB*.h from project to
Kernel.framework/Headers/IOKit/usb/2. Build. You got 16 errors
- libutil.h not found in two places - comment out of the project
- SetPortPower is not declared.

Apple forget to describe it in the new project. Just copy from 315 sources
CODE
//================================================================================
================
// SetPortPower
//================================================================================
================
IOReturn
AppleUSBHub::SetPortPower(UInt16 port, UInt32 on)
{
IOReturn kr = kIOReturnUnsupported;
USBLog(5, "AppleUSBHub[%p](0x%lx)::SetPortPower to %s, for port %d", this, _locationID, on ? "ON" : "OFF", port);
if ( on == 1 )
return SetPortFeature(kUSBHubPortPowerFeature, port);
else
return ClearPortFeature(kUSBHubPortPowerFeature, port);
}
into AppleUSBHub.cpp and a header into .h
That's all. Zero errors and few warnings. Full project is compiled. The result
CustomUSBFamily.zip ( 1.62MB )
Number of downloads: 64Here I applied kErrataMCP79IgnoreDisconnect as requested by THeKiNG
RememberIf you see an error like symbol is not declared it means usually that Kernel.framework is not good. Read this post from initial.
Now AbsoluteTime is good so
CODE
#if ASNOW
clock_get_uptime(&now);
#else //old hack
clock_get_uptime((uint64_t*)&now);
#endif
For other project you may need some other private headers from other project. This is my small collection (some of the headers deprecated use with cautions)
IOKit_private.zip ( 165.39K )
Number of downloads: 64Continue
Thanks, for info and iousb, going to test it asap.
L.E. Tested, still same bugs with USB and sleep/wake, and errata is same as with original.
Maybe you missed something, and I don't think apple "forgot" to put SetPortPower but did it with intention, since is a problem on us...
After this step, what exactly should be done? I mean what are the right path to copy the frameworks?
CODE
6. Get latest XNU. (now it is xnu-1504.9.26 (OSX 10.6.6), unpack.
CODE
cd xnu-1504.9.26
make install ARCH_CONFIGS="I386 X86_64" KERNEL_CONFIGS="RELEASE"
I mean what are the right path to copy the frameworks?
CODE
You need no mach_kernel if you are not suppose to create patched one (for example for Restart/Sleep fix ) but you need new headers appears during this build.
CODE
cp -r BUILD/dst/System/Frameworks/* /System/Frameworks/
cp -r BUILD/dst/usr/* /usr
But I found it is not good path.
Instead of
/System/Library/Frameworks/Kernel.framework/Versions/A/PrivateHeaders
must be /System/Library/Frameworks/Kernel.framework/PrivateHeaders (link is not help )
The same for System.framework
Just copy by finder from default place to the place of link.
This part is not very clear to me

I'm trying to understand, thanks.
QUOTE (vincent99 @ Jan 14 2011, 03:16 PM)

I mean what are the right path to copy the frameworks?
CODE
cp -r BUILD/dst/System/Frameworks/* /System/Frameworks/
cp -r BUILD/dst/usr/* /usr
But I found it is not good path.
Instead of
/System/Library/Frameworks/Kernel.framework/Versions/A/PrivateHeaders
must be /System/Library/Frameworks/Kernel.framework/PrivateHeaders (link is not help )
The same for System.framework
CODE
cp -r BUILD/dst/System/Library/Frameworks/Kernel.framework/Versions/A/PrivateHeaders /System/Library/Frameworks/Kernel.framework/
QUOTE (THe KiNG @ Jan 14 2011, 08:55 PM)

@Slice how did u fixed that USB tracer crap?
QUOTE
- libutil.h not found in two places - comment out of the project
and one symbol not found (it must be in the lib). Just comment out, it is not logically needed.
And you can exclude USB tracer target from the project.
I see all others are compilable for you?
QUOTE (Slice @ Jan 14 2011, 07:01 PM)

and one symbol not found (it must be in the lib). Just comment out, it is not logically needed.
And you can exclude USB tracer target from the project.
I see all others are compilable for you?
Yeah, after 3h almost gave up lol...
I saw removing tracer left only 24 warnings.
ContinueNext step is headers for
IOKit framework.
7. Get
AppleRAID-4.0.6CODE
cp -v */AppleRAID-4.0.6/*.h /System/Library/Frameworks/IOKit.framework/Versions/A/Headers/storage/RAID
8. Get
IOKitUser-514.16.31. Unpack.
Open XCode project and try to build. Thousands errors. But you create Derived sources needed for IOKit
Here
/build/IOKitUser.build/Development/IOKit.build/DerivedSources/i386and here
/build/Development/Copy headers as you see the folder structure.
Or make as previous
CODE
mkdir -p obj sym dst
xcodebuild install -target IOKit ARCHS="i386 x86_64" SRCROOT=$PWD OBJROOT=$PWD/obj SYMROOT=$PWD/sym DSTROOT=$PWD/dst
9. Get
DiskArbitration-213.1, unpack and copy headers to DiskArbitration.framework.
After these manipulation I can compile
bless without warning and errors.
About compiled kernel. It works but after very long initial start (rebuild caches?).
CODE
sergey:~ slice$ uname -a
Darwin sergey 10.7.0 Darwin Kernel Version 10.7.0: четверг, 2 июня 2011 г. 12:05:05 (MSD); slice:xnu-1504.9.37/BUILD/obj//RELEASE_I386 i386
sergey:~ slice$
mDNSResponder and all around.
Download mDNSResponder-258.18.tar.gz. Newer version has a bug.
Unpack.
Download
configd-289.2. Unpack. Take from it dnsinfo.h and place into
mDNSResponder-258.18/mDNSMacOSX/Build
CODE
cd mDNSResponder-258.18
mkdir -p obj sym dst
make install RC_ARCHS="i386 x86_64" RC_CFLAGS="-arch i386 -arch x86_64 -pipe" RC_OS=macos RC_RELEASE=SnowLeopard SRCROOT=$PWD OBJROOT=$PWD/obj SYMROOT=$PWD/sym DSTROOT=$PWD/dst
Now created
CODE
dst:
AppleInternal:
Library:
PreferencePanes:
Bonjour.prefPane
Library:
Application Support:
Bonjour:
ddnswriteconfig
private:
etc:
dnsextd.conf
System:
Library:
CoreServices:
mDNSResponder.bundle
Java:
Extensions:
dns_sd.jar
LaunchDaemons:
com.apple.dnsextd.plist
com.apple.mDNSResponder.plist
com.apple.mDNSResponderHelper.plist
usr:
bin:
dns-sd
mDNS
lib:
java:
libjdns_sd.jnilib
sbin:
dnsextd
mDNSResponder
mDNSResponderHelper
share:
man:
man1:
dns-sd.1
mDNS.1
man8:
dnsextd.8
mDNSResponder.8
mDNSResponderHelper.8
sandbox:
mDNSResponder.sb
New guide for creating Efitools: namely
mtoc.
1. Download
cctools-800 from
http://opensource.apple.com/release/mac-os-x-107/. Unpack.
2. Download
llvm-2.9 from
http://llvm.org/releases/download.html3. Download
ld64-95 from
http://opensource.apple.com/release/mac-os-x-1068/Copy
prune_trie.h from
ld64-95.2.12/src/other to
/usr/include/mach-o/Copy folder
cctools-800/include/mach-o/ to
/usr/include/mach-o/Build target libprunetrie (RELEASE). Now build success.
Copy
ld64-95.2.12/build/Release/libprunetrie.a -> /usr/local/lib/libprunetrie.a4. Copy folder
llvm-2.9/include/llvm-c -> cctools-800/include/5.
CODE
cd cctools-800
make
Now you have full set of new tools including new mtoc
sudo cp mtoc.NEW /usr/local/bin/mtocThe result
mtoc.NEW.zip ( 52.9K )
Number of downloads: 846. To compile ld64 project you also need download dyld-132.13 from
http://opensource.apple.com/release/mac-os-x-1068sudo cp -r -v dyld-132.13/include/mach-o/* /usr/include/mach-o/and .hpp files from
http://www.opensource.apple.com/source/lib...bunwind-30/src/ (dunno how to get an archive)
Newer versions can be found here
http://opensource.apple.com/release/developer-tools-41/Now compilable
bootstrap_cmds-79.tar.gz
dtrace-90.tar.gz
cctools-806.tar.gzNew tools - new success. Now kernel 10.8.0 compiled without errors about IOMemoryDescriptor. Apple just forget to define
#define CPUFAMILY_INTEL_SANDYBRIDGE 0x462a4ffdThis is my number. As I know it should be random.
PS. Apple implemented this number 0x5490b78c
New sources.
ld64-127.2CODE
mkdir -p obj sym dst
xcodebuild install -target libprunetrie ARCHS="i386 x86_64" SRCROOT=$PWD OBJROOT=$PWD/obj SYMROOT=$PWD/sym DSTROOT=$PWD/dst
sudo cp -v /Developer/Projects/ld64-127.2/dst/usr/local/lib/libprunetrie.a /usr/local/lib/
cctools-809Copy
prune_trie.h from
ld64-127.2/src/other to
/usr/include/mach-o/Copy folder
cctools-809/include/mach-o/ to
/usr/include/mach-o/llvm-3.0Copy folder
llvm-3.0/include/llvm-c -> cctools-809/include/Do not replace Disassembler.h!
make
mtoc.NEW_Lion_XCode42.zip ( 52.92K )
Number of downloads: 39
QUOTE (cavendish @ Aug 15 2012, 10:14 PM)

anyone tried with latest code of ML?
Yes, success.
OpenSource 10.8
XCode 4.4.1
The mach_kernel was created.
Hi Slice.
I'm trying to compile IOCPIFamily 162,3 and I have this error:
CODE
duplicate symbol _out in:
/Users/matteo/Library/Developer/Xcode/DerivedData/IOPCIFamily-dqrvdyxmygiasrgpeshtdndwjavy/Build/Intermediates/IOPCIFamily.build/Development/IOPCIFamily.build/Objects-normal/x86_64/IOPCIDevice.o
/Users/matteo/Library/Developer/Xcode/DerivedData/IOPCIFamily-dqrvdyxmygiasrgpeshtdndwjavy/Build/Intermediates/IOPCIFamily.build/Development/IOPCIFamily.build/Objects-normal/x86_64/IOPCIBridge.o
duplicate symbol _out in:
/Users/matteo/Library/Developer/Xcode/DerivedData/IOPCIFamily-dqrvdyxmygiasrgpeshtdndwjavy/Build/Intermediates/IOPCIFamily.build/Development/IOPCIFamily.build/Objects-normal/x86_64/IOPCIDevice.o
/Users/matteo/Library/Developer/Xcode/DerivedData/IOPCIFamily-dqrvdyxmygiasrgpeshtdndwjavy/Build/Intermediates/IOPCIFamily.build/Development/IOPCIFamily.build/Objects-normal/x86_64/IOPCIDeviceI386.o
duplicate symbol _out in:
/Users/matteo/Library/Developer/Xcode/DerivedData/IOPCIFamily-dqrvdyxmygiasrgpeshtdndwjavy/Build/Intermediates/IOPCIFamily.build/Development/IOPCIFamily.build/Objects-normal/x86_64/IOPCIDevice.o
/Users/matteo/Library/Developer/Xcode/DerivedData/IOPCIFamily-dqrvdyxmygiasrgpeshtdndwjavy/Build/Intermediates/IOPCIFamily.build/Development/IOPCIFamily.build/Objects-normal/x86_64/IOPCIRange.o
duplicate symbol _out in:
/Users/matteo/Library/Developer/Xcode/DerivedData/IOPCIFamily-dqrvdyxmygiasrgpeshtdndwjavy/Build/Intermediates/IOPCIFamily.build/Development/IOPCIFamily.build/Objects-normal/x86_64/IOPCIDevice.o
/Users/matteo/Library/Developer/Xcode/DerivedData/IOPCIFamily-dqrvdyxmygiasrgpeshtdndwjavy/Build/Intermediates/IOPCIFamily.build/Development/IOPCIFamily.build/Objects-normal/x86_64/IOPCIConfigurator.o
duplicate symbol _out in:
/Users/matteo/Library/Developer/Xcode/DerivedData/IOPCIFamily-dqrvdyxmygiasrgpeshtdndwjavy/Build/Intermediates/IOPCIFamily.build/Development/IOPCIFamily.build/Objects-normal/x86_64/IOPCIDevice.o
/Users/matteo/Library/Developer/Xcode/DerivedData/IOPCIFamily-dqrvdyxmygiasrgpeshtdndwjavy/Build/Intermediates/IOPCIFamily.build/Development/IOPCIFamily.build/Objects-normal/x86_64/IOPCIFamily_info.o
ld: 5 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Have you any advice for me?