Re: Build 10.4/10.5 kext on 10.10
Re: Build 10.4/10.5 kext on 10.10
- Subject: Re: Build 10.4/10.5 kext on 10.10
- From: Regis Duchesne <email@hidden>
- Date: Mon, 05 Jan 2015 17:04:24 +0000
- Thread-topic: Build 10.4/10.5 kext on 10.10
Christopher,
> For those of you who are still trying to support older OS X releases, you might like to know that I’ve investigated this further. The good news is that Xcode 6 still works with the older plugin formats, build tool configuration files etc. so follow the same approach with Xcode 6 as I indicated with Xcode 5 previously http://lists.apple.com/archives/darwin-kernel/2014/May/msg00017.html My environment now incudes Xcode 6.1.1 on top of 5.0.3, 4.6.2, and 3.2.6, and I can build on all SDKs and platforms from OS X 10.4
Since Apple does not ship earlier SDKs with later Xcode versions, I'm afraid this technique may not work in the long run: newer compilers may require you to edit older SDKs in order to compile.
Instead I simply install multiple versions of Xcode on the same box. But that only works well because I don't use Xcode projects, I use the compilers/linkers directly within make files (SCons files actually).
> There is one major new gotcha. It seems that Apple has removed the deprecated map_fd() system call from OS X 10.10.1 (and probably 10.10.0 but I have not tested it) and so /Xcode-3_2_6/usr/bin/ld_classic, the 32 bit old linker, crashes when you attempt to use it to link a 10.4/10.5 compatible kernel extension. I managed to work around this by downloading the Xcode 3.1.4 cc-tools source from http://www.opensource.apple.com/release/developer-tools-314/ and hacking the environment and makefiles enough to be able to build ld.NEW under OS X 10.6.8, 32 bit mode and Xcode 3.2.6.
I have been thinking about doing this a different way: create a new map_fd.dylib that only provides the map_fd() symbol, implemented in terms of a mmap() call. Then invoke the Apple binary by setting DYLD_LIBRARY_PATH and/or DYLD_INSERT_LIBRARIES to make use of that new map_fd.dylib.
The advantage is that there is nothing to recompile from open source: you keep using the official Apple ld_classic binary. And you can use the same map_fd.dylib for other programs that need the map_fd symbol.
> (Virtual machines are a wonderful thing!)
Yes, and it is precisely to keep virtual machines (really VMware Tools) running that I need to be able to build 32-bit kexts on a 10.10 host!
> Once I was able to build the ld_build target in cctools-698.1/ld/Makefile, I modified ld.c and pass1.c replacing the map_fd() calls with mmap (…PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE..,). This successfully links a 10.4 compatible kernel extension under OS X 10.10 using Xcode 6/5/4/3 together.
To implement my own map_fd() function, I would be interested in the exact modification you did (that will save me a bit of time). I.e. what was the exact map_fd() call code you replaced, and with what exact mmap() call did you replace it.
Thanks,
--
Regis "HPReg" Duchesne
Technical Lead for Fusion & Mac OS Guest
VMware, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden