Files: www.freebsd.org/~grehan/ppc-root-latest.tbz2
kernel
loader
1. Make sure there's a spare partition on the hard drive large enough to
hold FreeBSD. The partition type doesn't matter, although it's a good
idea not to select HFS.
2. The initial install will have to be done with a network boot, or from a
CD
a) Network boot
Set up a DHCP/TFTP/NFS server, with boot/loader in the directory that
will be served by TFTP. Untar the distribution in a directory that
can be accessed with NFS, and put the tbz2 file in the root dir. The
entry that I am using for dhcpd.conf is
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
host emacfreebsd {
hardware ethernet 00:03:93:A4:36:FE;
fixed-address 192.168.0.12;
option host-name "emacfbsd";
server-identifier 192.168.0.1;
always-reply-rfc1048 on;
option root-path "192.168.0.1:/export/client/macfbsd/root";
option routers 192.168.0.1;
filename "loader";
next-server 192.168.0.1;
}
At the OpenFirmware prompt on the Mac (get to this with
cmd-option-o-f at boot time):
0 > boot enet:,loader
Hit the space bar when the loader is pausing to get to the loader
prompt, and then boot single-user
0K boot -s
At the mountroot> prompt, enter 'nfs' to get to the single-user prompt.
b) CDROM boot
Create a directory tree with the bare minimum of files, extracted from
the tarball, and the tarball itself, in the root directory. Here's
what I used as a minimal tree:
/ppc-root-latest.tbz2
/bin/ls
sh
/boot/loader
/boot/kernel/kernel
/dev
/etc/ttys
/mnt
/sbin/init
mount
newfs
shutdown
sysctl
umount
/usr/bin/bzip2
tar
Build an ISO with the following options, required for OFW to read
the CD:
mkisofs -o -hfs -part -l -J -r -L
With the CD in the mac drive (this can be done at the OpenFirmware
prompt on tray loaders with '0 > eject cd'), and at the Ofw prompt,
first verify that the CD can be read correctly
0 > dir cd:,\
CDROM
1/ 1/ 4 0: 0: 0 bin
1/ 1/ 4 0: 0: 0 boot
8192 10/24/ 3 11:24:35 Desktop%20DB
0 10/24/ 3 11:24:35 Desktop%20DF
1/ 1/ 4 0: 0: 0 dev
1/ 1/ 4 0: 0: 0 etc
1/ 1/ 4 0: 0: 0 mnt
50878857 10/23/ 3 17:48:55 ppc-root-102303.tbz2
1/ 1/ 4 0: 0: 0 sbin
1/ 1/ 4 0: 0: 0 usr ok
Now boot the loader, and break before it boots the kernel
0 > boot cd:,\boot\loader
( hit space bar )
0 > boot -s
I've found that on the G4 eMac, the loader gets a boot device that
it doesn't understand, and spits out a whole lot of 'method
not found; ihandle=0 phandle=0'. Don't be too worried about this,
and at the loader prompt, enter:
OK set currdev=cd:,
OK boot -s
At the mountroot> prompt, enter 'cd9660:acd0' to get to the
single-user prompt.
3. At the shell in single-user mode:
Have a look at the partitions just to make sure you will be using
the correct one. Here's the layout on my eMac:
# /sbin/sysctl -b kern.geom.conftxt
0 DISK ad0 40971571200 512 hd 16 sc 63
1 APPLE ad0s14 5362777088 512 i 13 o 35608794112 n Home file system ty Apple_UNIX_SVR2
1 APPLE ad0s13 8194153472 512 i 12 o 27414640640 n Eschatology 1 ty Apple_UNIX_SVR2
1 APPLE ad0s12 8194153472 512 i 11 o 19220487168 n Swap ty Apple_UNIX_SVR2
1 APPLE ad0s11 5414712320 512 i 10 o 13805774848 n A/UX Root ty Apple_UNIX_SVR2
1 APPLE ad0s10 33554432 512 i 9 o 13772220416 n untitled 2 ty Apple_HFS
1 APPLE ad0s9 13771429888 512 i 8 o 790528 n untitled ty Apple_HFS
1 APPLE ad0s8 262144 512 i 7 o 528384 n Patch Partition ty Apple_Patches
1 APPLE ad0s7 262144 512 i 6 o 266240 n Macintosh ty Apple_Driver_IOKit
1 APPLE ad0s6 102400 512 i 5 o 163840 n Macintosh ty Apple_FWDriver
1 APPLE ad0s5 37888 512 i 4 o 125952 n Macintosh ty Apple_Driver_ATA
1 APPLE ad0s4 27648 512 i 3 o 98304 n Macintosh ty Apple_Driver_ATA
1 APPLE ad0s3 37888 512 i 2 o 60416 n Macintosh ty Apple_Driver43
1 APPLE ad0s2 27648 512 i 1 o 32768 n Macintosh ty Apple_Driver43
1 APPLE ad0s1 32256 512 i 0 o 512 n Apple ty Apple_partition_map
In this case, I'm going to dump the filesystem on to ad0s13. First,
newfs and mount the partition
# /sbin/newfs /dev/ad0s13
# /sbin/mount /dev/ad0s13 /mnt
And now untar the distro
# cd /mnt
# /usr/bin/tar xjvf /ppc-root-102303.tbz2 .
(this will take quite a while. I have found that the dreaded
'ad0: device write underrun' has sometimes during this step - it
pretty much means having to reboot and do the newfs/untar again :-(
USB keyboard users can ctl-alt-del (aka ctl-option-del) to reboot
at this point. Otherwise, shutdown -h now.
Another known bug: the system rarely shuts down cleanly. After
'uptime' has been displayed, it's time for a power cycle or
programmer's switch halt :-(
4. It's time to boot the new system. However, here's the catch: OpenFirmware
doesn't understand UFS, so the loader has to live somewhere that OFW can
access it. This can be over the network as in step 2 a), or it can live
in a HFS+ partition that has MacOS/OSX installed. Here's how to boot when
loader is copied into the hard drive folder on both OS9 and OSX. Note
that loader can't understand HFS+, so it can't read the partition it was
booted from and fails (but that's OK).
0 > boot hd:,\loader
....
can't load 'kernel'
0 > set currdev=hd:13 (or whatever partition was used)
0 > boot -s
...
At the mountroot> prompt, enter 'ufs:ad0s13'.
5. It's now time to edit some of the system files so that multi-user can be
reached.
a) Mount the root filesystem read-write so that vi can use tmp files
# /sbin/mount -u -rw /dev/ad0s13 /
b) Now set the terminal type to be something screen oriented, unlike the
primitive type for /dev/console.
# export TERM=cons25 (for those lucky enough to have syscons)
or
# export TERM=ansi (for OpenFirmware cons users. vt100 seems to work OK
as well, but expect to be redrawing a lot in vi).
c) Create an fstab
/dev/ad0s13 / ufs rw 0 0
d) Create /etc/rc.conf. Here's what I've been using. Enabling sendmail was
causing a kernel hang at one stage.
defaultrouter="192.168.0.1"
hostname="emacfbsd.ptree32.com.au"
ifconfig_gem0="inet 192.168.0.12 netmask 255.255.255.0"
kern_securelevel_enable="NO"
nfs_client_enable="YES"
# Not really necessary, but handy
inetd_enable="YES"
# seems to hang the system at boot otherwise :-(
sendmail_submit_enable="NO"
# shut up debug
sendmail_msp_queue_enable="NO"
e) I usually enable telnet/ftp in inetd.conf, and enable secure access
to pty's
f) Create the initial password databases. Since I cross-built on x86, the
build process creates little-endian db files, so they have to be
re-created with native byte-order (at least that's what I think is
wrong).
# /usr/sbin/pwd_mkdb /etc/master.passwd
g) It's ready to go multi with a ctl-D !