[darwinbuild-dev] Building AppleFan.kext

William Siegrist wsiegrist at apple.com
Mon Feb 16 08:07:09 PST 2009

On Feb 16, 2009, at 5:49 AM, Jonas Maebe wrote:

> On 15 Feb 2009, at 21:18, William Siegrist wrote:
>> On Feb 14, 2009, at 9:56 AM, Jonas Maebe wrote:
>>> On 13 Feb 2009, at 14:18, Jonas Maebe wrote:
>>>> Building with -nochroot however failed because it couldn't find  
>>>> "IOI2CDevice.h", which after some googling turned out to be part  
>>>> of the AppleHWSensor project.
>>> Building that one failed because it required a private header in  
>>> IOKit/pwr_mgt/. Googling about that turned uphttp://www.puredarwin.org/developers/darwinbuild/troubleshooting#TOC-system_cmds 
>>> , which suggests installing IOKitUser first.
>>> That one failed because it could not find iokitmig64.c. And  
>>> googling about this error suggested building xnu (http://darwinbuild.macosforge.org/trac/ticket/17 
>>> ).
>>> So that's what I'm doing now :)
>> The rest of this is pretty much expected.   However, if darwinbuild  
>> did not automatically try to load a pre-built root for  
>> AppleHWSensor when you tried to build AppleFan, then thats a bug  
>> and you should file a ticket for it.
> Ok, I'll do that.
> Now, I'm still not able to generate the iokitmig32.c and  
> iokitmig64.c because I have no idea about how to use mig  
> (darwinbuild does not seem to try to generate the C-files by  
> itself). There no man page for mig and I also cannot get mig to  
> print out any usage instructions or help screen.
> If I feed it the /Volumes/Builds/Build9G55/BuildRoot/private/var/tmp/ 
> xnu/xnu-1228.9.59.root/usr/include/device/device.defs file, it  
> generates the following files:
> iokitUser.c
> iokitServer.c
> iokit.h
> I have however no idea about with which parameters I should invoke  
> it to generate the correct iokitmig32.c and iokitmig64.c files. I  
> also don't know where I should put those C and header files (unpack  
> Sources/IOKitUser-388.50.tar.gz, add all generated files to the top  
> level, repack and overwrite the previous version in Sources?)

xnu comes with the 2 files (*.defs) you need in /usr/include/device.  
So make sure you load xnu and the files are there:

$ darwinbuild -load xnu
$ ls -1 BuildRoot/usr/include/device/

The source files get generated during the DeviceMIG target of  
IOKitUser.  If you are building with -nochroot, you need to copy  
the .defs files from BuildRoot to /usr/include/device/.


More information about the darwinbuild-dev mailing list