1

Put succinctly I need a base for my system, since it was built on macOS Darwin seems like the logical choice as it will require the least porting effort. I know you can download up to Darwin 8.0.1 from Apple, and the full source tree is available for up to 10.0, however v8 is too old and lacks many standard modern features (i.e. a password system that doesn't restrict the root user to 10 characters, or support for the case-sensitive version of HFS+). I've tried building Darwin 9/10/11/12 from source using darwinbuild, but it always fails for various server-side reasons.

There has to be some way to create the equivalent of a vanilla Darwin 16 image. Perhaps taking an existing copy of macOS and stripping away all the closed-source stuff? Building the source that Apple provides at Apple Open Source Repository and substituting the rest of the packages required for the OS to function with source from another BSD distro? Taking an existing copy of FreeBSD and substituting the kernel with XNU? There has to be some way. Any ideas or thoughts on the ideas I suggested are welcome. Thanks.

pmdj
  • 22,018
  • 3
  • 52
  • 103
Alison E.E.
  • 196
  • 7

1 Answers1

1

The last xnu build instructions are for El Capitan (Darwin 15) but you might be able to follow them for Sierra (Darwin 16). The latest source available at time of writing is for 10.12.4, which isn't overly out of date.

This gets you most of the kernel of shipping macOS. It doesn't get you the driver stack - especially the SATA/AHCI stack is not open source, which could be a problem. (One of these days I'll get around to publishing our full virtio driver stack including virtio-blk and virtio-scsi drivers, with which you should be able to run without SATA in Qemu/KVM at least.)

I have no idea about getting a useful userland going - macOS/OSX uses launchd as its "init" process, and the last published source code for that is some years old. I don't know if it will need some tweaking to get it working on newer kernels.

pmdj
  • 22,018
  • 3
  • 52
  • 103
  • I think this should work. I'll probably have to tweak `launchd` quite a bit, as that likely can't be substituted. As far as SATA drivers go to my knowledge XNU borrows heavily from the BSD kernel in terms of handling drivers modules, so I might simply be able to substitute that with a generic BSD SATA driver (with some minor tweaking). Finally, I'll settle for 10.12.4 in a heartbeat, a few months old is far preferable to the 2005 release I had been trying to work with until this point. Thanks! – Alison E.E. Jul 09 '17 at 21:23
  • BSD's and xnu's driver stacks are entirely different. Apple created the IOKit from scratch as far as I'm aware. (they even replaced the NeXTStep driver stack) Storage drivers are built on top of the IOStorageFamily, for which source is available. – pmdj Jul 09 '17 at 21:26