Subject: Re: macfs & such
To: The Great Mr. Kurtz [David A. Gatwood] <davagatw@mars.utm.edu>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: port-mac68k
Date: 01/03/1997 18:48:52
> No chance the MkLinux in-kernel HFS support could be hacked for NetBSD, is
> there?  Not that hfsutils (or even the old hfs) doesn't do enough for most
> people, it'd just be kind of cool.

It would be MUCH better than "kind of", in my humble opinion. It would
make installing a LOT cleaner; just put the base12, etc12 files in
the booter's directory, and away you go.

To that end, Paul Goyette and I have been porting MacFS to NetBSD. This
is a package which will read MacOS partitions. It won't write them, so
don't try!

We've put version 0.1 up for public beta test. It's on puma in my
private directory, and I'll append the README.

Note: These changes require re-compiling MOST (if not ALL) of the
kernel! They touch malloc.h, a very popular file. :-)

The plan is to add a few more features to this version, and freeze it.
I've spoken with Paul Hargrove (the author of the Linux HFS support), and
he's open to porting it to NetBSD. I think Paul's going to work on it,
though I might not be able to help much (other projects, like my
PhD dissertation will be coming up soon!). The idea for the switch is
that the mklinux folks are going to use it, and it supports writing.

Unfortunately neither one of them will ever make it into the kernel.
Both of them have restrictions which dissagree with the NetBSD
idea of "open" software. hfs_fs (the Linux one) is GPL'd, and will
stay that way (mainly because of the evil empire in Seattle).

Please, if you're not comfortable hacking on the kernel, wait a
bit before testing out this lkm! We've tried it, and it seems fine,
but there might be bugs lying around somewhere.

Let me and Paul know how things look!

Take care,

Bill

README.0.1:

This is v.0.1 of the macfs-how-to. :-)

Here's an overview of what to do:

1) Get all 3 parts and a -current system. Note: we need the remalloc
routine which was added to -current after the freeze, otherwise, it's
stock 1.2.

The files are at ftp://ftp.macbsd.com/private/wrstuden/macfs and are
mount_macfs.tgz, macfs.0.1.tgz, and macfs.sys12.patches.tgz.

2) mount_macfs goes in /src/sbin. This archive includes binaries! So
there should be a mount_macfs in there. If not, make should make it,
then just make install. Note: to compile, you also need the sbin/mount
source for mount_macfs to compile, which is why I threw in the binaries.
Also, we'd need mount.h from step 3. No biggie if you're building current
every day, but not transparent for those of us who only partially follow
current. make install to install it!

3) cd /tmp and then tar xzf macfs.sys12.patches.tgz. 
cd /sys/sys.  patch < /tmp/*diff* .This will change malloc.h, mount.h,
and vnode.h. malloc.h needs to know about the memory bins we use,
mount.h needs to know about the mount arguements, and vnode.h needs to know
that macfs vnodes exist.

Two caveats: You might need to do the patches one at a time, not as
one huge patch job ( /tmp/*diff* might give an error, just do them one
at a time). Also, the malloc.h patch takes a 1.2 malloc.h (or -current
from just after the 1.2 release) to a -current one. As I don't have a
-current malloc.h, I can't easily generate the requisite diff. You'll
probably need to help this one by hand. I'd appreciate it if someone
(Paul G.?) would send diffs off of a recent -current.

4) cd /sys and tar xzf macfs.0.1.tgz to generate the macfs directory.
We put it here as we thought it could make into the kernel. Oh well.

5) cd macfs/lkm. make. You should then end up with macfs.o, the lkm
to be. Then go single-user, and make load in this directory. You
should now be able to mount macfs partitions.

6) mount -t macfs -o rdonly /dev/sd1f /mac
will mount the macfs partition living on /dev/sd1f onto /mac. :-)

Please try this!