Subject: g4 powerbook success... almost...
To: None <port-macppc@netbsd.org>
From: None <ww@irl.styx.org>
List: port-macppc
Date: 04/22/2003 20:58:49
I have finally managed to get NetBSD running on one of the shiny
new apple powerbooks without using any non-free software.

The first problem was how to get the boot blocks onto the HFS boot
partition. It turns out that the Linux bootloader, yaboot, can be
coaxed into dropping a file called ofwboot into the boot partition.
Basically the procedure is:

        - boot from a gentoo cd
	- use linux's mac-fdisk to partition the disk
        - make an appropriate yaboot.conf -- if it contains a
          line that looks like bsd=/dev/hdaX, it will look
          for a file called ofwboot in /usr/local/lib/yaboot
          to install into the HFS partition
        - copy ofwboot.xcf to /usr/local/lib/yaboot
        - run "ybin -v" to actually install the boot stuff

The next step is to get NetBSD onto the hard drive. The 1.6 install
CD does not boot -- the kernel dies with memory access errros while
the spinning thing is going. Booting over the network does work, alhough
NetBSD's ofwboot.xcf doesn't grab the kernel over NFS for some reason. The 
OpenBSD bootloader does, however, so the system can be booted with
a command like

	boot enet:,ofwboot netbsd

after setting up the TFTP/NFS and DHCP server in the usual way. I
used the 1.6K snapshot.

Unfortunately all of the kernels on ftp.netbsd.org and releng.netbsd.org
as well as one that I built from yesterday's -current will not
boot with the same symptoms as the 1.6 install kernel.

Tsubai Masanari made a kernel that does work and it is available in

ftp://nandra.iri.co.jp/pub/NetBSD/macppc/snap-030329

Once the system was up after booting off of the network, I made a 
disklabel from the numbers that I had noted down from the previous
session with mac-fdisk, made the filesystems and unpacked the
distribution, etc.

Booting from the disk is tricky -- mac-fdisk from Linux seems to
tag the partitions as being Linux native partitions, even if they
are formatted as FFS. My first try failed -- the bootloader found
the kernel, booted it, and when the kernel tried to mount the
root partition, it assumed that it was of type ext2 and promptly
panicked. Not a big problem, all that was required was to boot the
kernel with -a and tell it that wd0a was indeed FFS, and all was
well. After a bit of basic configuration, the system boots 
multiuser. The boot command is "boot hd:,\ofwboot -a" and then
at the prompt from ofwboot, "netbsd -a"

Trying to build a kernel with the type of the root filesystem 
nailed to FFS fails because, of course, the kernel won't boot!
I wonder what Tsubai-san has in his private source tree...

The final problem is to get X windows working. At the moment,
with the XF86Config from ftp://ftp.netbsd.org/pub/NetBSD/misc/soren
slightly modified to use wskbd0 and wsmouse0, the X server dies 
complaining that it cannot open /dev/pci0. I am not sure at the 
moment how to fix this (securelevel related maybe...) and would
welcome any suggestions...

-w