Subject: COMPAT_DARWIN status report
To: None <netbsd-users@netbsd.org, port-macppc@netbsd.org>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: netbsd-users
Date: 08/14/2004 23:36:19
Hello everybody

I have not been giving news for COMPAT_DARWIN developpement for a while.
Here is the latest status report.

Most of you know it, but I'll introduce it for thoses that don't:
COMPAT_DARWIN is a binary compatibility option in the NetBSD kernel that
enable MacOS X binaries to run on NetBSD/powerpc.

So far, command line programs work. X11 programs should work, wthough
nothing has been tested (anyone wants to test matlab?). Quartz (MacOS
X's native display system) programs don't work.

In fact Quartz programs may work, the problem is to display them: the X
server displays X, not Quartz. We need a Quartz display server. For now
I just try to run MacOS X's native display server on NetBSD. This
program was known as WindowServer on MacOS X.2, and it's called
QuartzDisplay on X.3.

WindowServer was able to display a mouse pointer and a blue background
screen when ran on NetBSD. I never completed the support for
WindowServer because I halted COMPAT_DARWIN to write a book on BSD
(http://www.eyrolles.com/Informatique/Livre/9782212114638/livre-bsd.php)
. When I came back to COMPAT_DARWIN, MacOS X.3 was out for a while, I
decided to move forward and work on MacOS X.3 support.

COMPAT_DARWIN has been updated to deal with MacOS X.3 specificities. The
current effort is now to run QuartzDisplay.

Problem: QuartzDisplay is not a stand-alone program. It should be loaded
by SystemStarter, when requested though the ConsoleMessage command.

SystemStarter needs coreservicesd to start-up.

coreservicesd needs SecurityServer to start-up.

SecurityServer needs mach_init to start-up. That's okay because
mach_init runs on NetBSD. But SecurityServer gets a SIGSEGV on launch. 

I have been tracking down this problem using gdb, which is not easy
since our gdb does not read symbols from Mach-O binaries (MacOS X uses
an executable format known as Mach-O. We use ELF). Facing an impossible
debugging work, I see three ways of working around the problem

1) Find a way of launching QuartzDisplay without the need of all these
extra services such as SecurityServer

2) Build a gdb that understands the Mach-O format, and hope it will make
the work in SecurityServer easier. I tried a lot in that direction, but
so far I failed. It seems Mach-O support in gdb is quite bound to MacOS
X runtime.

3) Build SecurityServer from Darwin sources (it's an opensource part),
and cripple it with printf until I understand what gets wrong. I have
not been able to rebuild SecurityServer on MacOS X.

Here is where the project is stalled. Feel free to contact me if you
have ideas that could help.

-- 
Emmanuel Dreyfus
Il y a 10 sortes de personnes dans le monde: ceux qui comprennent 
le binaire et ceux qui ne le comprennent pas.
manu@netbsd.org