OpenBSD Journal

Developer Blog - gwk@: OpenBSD on old-world Macs, part 2

Contributed by ben on from the new-hardware-support.. squeee! dept.

In part 1 I mentioned some of the hurdles encountered during my porting efforts. Today, we’ll discuss how to install OpenBSD on Old World Mac’s.

What are old world macintosh computers ?

Old world macintosh computers are machines made by Apple with the PowerPC processor, PCI and using Open Firmware much like the new-world or currently supported macppc machines. Their numbering scheme typically consisted of 4 digits for example 9600 and were sold prior to the arrival of the Power Macintosh Blue and White G3 and the god awful iMac. These machines typically have a 603 or 604 PowerPC processor as to differentiate them from the 601 based machines which typically lacked PCI and open firmware. We might call these nubus based Power Macs. Even though it might be grand to claim that OpenBSD ran on everything apple made capable of running real UNIX, such an effort inspires even less interest than the old-world macs themselves (I am not even interested :).

Booting -current on an old world mac:

The following is provided only as a guide for the adventurous. I am hesitant to provide it as I would rather spend my time making things work better versus answering questions about how to perform an install. But by all means if you encounter some weirdness with the boot loader and kernel on a machine I haven’t been testing with (e.g. non tsunami) it would be nice to hear about it.

Setup:

So far for booting on an old-world mac I have been using serial, and net booting the machines. With some models you should be able to do an install with the frame buffer console, however if anything borks, getting a trace or interesting open firmware info will be time consuming.

Getting at Open Firmware:

I use Hayes macintosh compatible serial cable db25->db9 changer and a null modem cable connected to a PC. You can then use tip or cu to access the machine over the serial port, remember to use a speed of 38400 or your console will be garbled. To break into the machines Open Firmware use the cmd-opt-o-f snag keys on the machines keyboard during the startup chime, hopefully their are sane defaults for output-device and input-device, such as ttya, however I have seen some machines with idiotic things such as input-device as ttya and output-device as ttyb in that case you may need to boot Mac OS and use Disk Setup to change these (you can also change the machine to stop at open firmware or even try booting open firmware on the machines graphics port (caveat with the 9600 being that the frame buffer device in OpenBSD/macppc does no work with the IMS cards)

Once you have access to Open Firmware immediately make sure that auto-boot? is set to false it can be a real pain to break into OFW the first time so save yourself some pain!

0 > setenv auto-boot? false
0 > reset-all

(reset-all resets the machine saving your changes)

You also may have to make some machine specific changes which are documented on the NetBSD macppc support page.

For instance on my machines the only change required is to tweak real-base,

0 > setenv real-base F000000
0 > reset-all

If your successful in getting your machine to boot OpenBSD please carefully document the machine specific changes you needed to boot and send them my way, if old-world support progresses far proper installation documents must be written and I am not a fan of the above model support page, so better documentation of tested and confirmed machine specific requirements is needed.

Find the MAC address for the on-board ethernet:

0 > dev enet .properties 
name                    mace
device_type             network
AAPL,connector          ethernet
reg                     00011000  00001000 
                        00008200  00000100 
                        00008300  00000100 
AAPL,interrupts         0000000E 00000002 00000003 
local-mac-address       00A0406E 9688
address-bits            00000030 
max-frame-size          00000800

On your router setup a fixed address for this MAC address using DHCP.

Example from /etc/dhcpd.conf:

host powermac9600mp {
        hardware ethernet 00:A0:40:6e:96:88;
        fixed-address 172.16.0.18;
        option root-path "/NFS_exported_dir";
}

the root-path option is very important make sure it points to whatever directory your going to export over NFS below.

Now on your router setup tftpd and NFS.

For net booting open firmware uses TFTP to retrieve the bootloader so its necessary to uncomment the line

#tftp dgram udp wait root /usr/libexec/tftpd tftpd -s /tftpboot

in /etc/inetd.conf. Create the directory /tftpboot and copy the XCOFF bootloader (boot.mac) to that location.

The macppc boot loader uses NFS to retrieve the kernel image follow the excellent instructions in the FAQ to set up a simple NFS server and copy the ramdisk image bsd.rd to the root of the exported directory.

Actually booting,

0 > boot enet:,/boot.mac enet:,/bsd.rd

(One annoying quirk of old world macs is that if fetching the boot loader fails the first time using tftp, it will default to some pre-standardization bootp variant that does not work well and it will be necessary to reset the machine e.g. 0 > reset-all)

Perform an installation as you normally would on macppc, its important to note that I haven’t begun testing booting off the machines disks only net booting so far so one important step is to copy the kernel image bsd to the NFS exported directory. Use MBR disk partioning, OFW 1.0.5 doesn’t understand HFS but does do msdos filesystems.

Subsequent boots can be done as follows

0 > boot enet:,/boot.mac enet:,/bsd

One thing to note that is there is still work to be done the boot path format for older versions of Open Firmware is slightly different from new-world machines so every boot will halt at two prompts asking for the root device and swap device.

If all goes well your kernel will boot look similar to the following:

0 > boot enet:,/boot.mac enet:,/bsd 
file: 172.16.0.1,boot.mac-loading XCOFF
tsize=C6AC dsize=340 bsize=2A50 entry=E00000 
SECTIONS:
.text    00E00000 00E00000 0000C6AC 00000214
.data    00E0D000 00E0D000 00000340 0000C8C0
.bss     00E0D340 00E0D340 00002A50 00000000
.debug_a 00000000 00000000 000003A0 0000CC00
.debug_p 00000000 00000000 0000072B 0000CFA0
.debug_i 00000000 00000000 0002985B 0000D6CB
.debug_a 00000000 00000000 00003002 00036F26
.debug_l 00000000 00000000 000030C5 00039F28
.debug_f 00000000 00000000 00000D07 0003CFED
.debug_s 00000000 00000000 00003AFC 0003DCF4
.debug_r 00000000 00000000 000000D0 000417F0
loading .text, done..
loading .data, done..
clearing .bss, done..

OpenBSD/macppc Boot
file: 172.16.0.1,ofwboot.xcoffUsing IP address: 172.16.0.18
root addr=172.16.0.1 path=/export/client/root
4628432+313292+189152189152+170266170266=0x50e5d0
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2006 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 4.0-current (GENERIC) #182: Wed Dec  6 19:14:15 EST 2006
    gwk@gateway:/usr/src/sys/arch/macppc/compile/GENERIC
real mem = 318767104 (311296K)
avail mem = 281812992 (275208K)
using 1254 buffers containing 15937536 bytes (15564K) of memory
mainbus0 (root): model Power Macintosh
cpu0 at mainbus0: 604ev (Revision 0x202): 200 MHz
mpcpcibr0 at mainbus0 bandit: bandit, Revision 0xff
pci0 at mpcpcibr0 bus 0
pchb0 at pci0 dev 11 function 0 "Apple Bandit" rev 0x03
de0 at pci0 dev 15 function 0 "DEC 21140" rev 0x22, Asante 21140A pass 2.2: irq 25, address 00:00:94:a0:d3:99
macobio0 at pci0 dev 16 function 0 "Apple GC" rev 0x02
macintr0 at macobio0
"53c94" at macobio0 offset 0x10000 not configured
mc0 at macobio0 offset 0x11000: irq 14,2,3: address 00:a0:40:6e:96:88
zsc0 at macobio0 offset 0x13000: irq 15,16
zstty0 at zsc0 channel 0 (console i/o)
zstty1 at zsc0 channel 1
awacs0 at macobio0 offset 0x14000: irq 17,8,9 speaker
audio0 at awacs0
"swim3" at macobio0 offset 0x15000 not configured
adb0 at macobio0 offset 0x16000 irq 18: via-cuda, 1 target
akbd0 at adb0 addr 2: extended keyboard
wskbd0 at akbd0 mux 1
pi2c0 at adb0
iic0 at pi2c0
mesh0 at macobio0 offset 0x18000 irq 13: 50MHz, SCSI ID 7
scsibus0 at mesh0: 8 targets
sd0 at scsibus0 targ 0 lun 0:  SCSI2 0/direct fixed
sd0: 17366MB, 6962 cyl, 24 head, 212 sec, 512 bytes/sec, 35566480 sec total
"nvram" at macobio0 offset 0x1d000 not configured
mpcpcibr1 at mainbus0 bandit: bandit, Revision 0xff
pci1 at mpcpcibr1 bus 0
pchb1 at pci1 dev 11 function 0 "Apple Bandit" rev 0x03
"Integrated Micro Solutions Twin Turbo 3D" rev 0x01 at pci1 dev 15 function 0 not configured
bootpath: 'enet:,/bsd'
string [/bsd] not found
Warning: bootpath unrecognized: enet:,/bsd
boot device: lookup '' failed.
root device : sd0
swap device (default sd0b): 
root on sd0a
mesh0: timeout state 3
rootdev=0x200 rrootdev=0x800 rawdev=0x802
WARNING: / was not properly unmounted
WARNING: clock gained 10 days -- CHECK AND RESET THE DATE!
Automatic boot in progress: starting file system checks.
/dev/rsd0a: 1525 files, 15665 used, 500006 free (46 frags, 62495 blocks, 0.0% fragmentation)
/dev/rsd0a: MARKING FILE SYSTEM CLEAN
/dev/rsd0e: UNREF FILE  I=3  OWNER=root MODE=100600
/dev/rsd0e: SIZE=0 MTIME=Oct 26 07:30 2006  (CLEARED)
/dev/rsd0e: FREE BLK COUNT(S) WRONG IN SUPERBLK (SALVAGED)
/dev/rsd0e: SUMMARY INFORMATION BAD (SALVAGED)
/dev/rsd0e: BLK(S) MISSING IN BIT MAPS (SALVAGED)
/dev/rsd0e: 5 files, 3 used, 257828 free (20 frags, 32226 blocks, 0.0% fragmentation)
/dev/rsd0e: MARKING FILE SYSTEM CLEAN
/dev/rsd0h: 85085 files, 419085 used, 5076866 free (346 frags, 634565 blocks, 0.0% fragmentation)
/dev/rsd0h: MARKING FILE SYSTEM CLEAN
/dev/rsd0f: 1 files, 1 used, 515670 free (14 frags, 64457 blocks, 0.0% fragmentation)
/dev/rsd0f: MARKING FILE SYSTEM CLEAN
/dev/rsd0g: 77509 files, 317350 used, 198321 free (81 frags, 24780 blocks, 0.0% fragmentation)
/dev/rsd0g: MARKING FILE SYSTEM CLEAN
/dev/rsd0d: 679 files, 2895 used, 1028312 free (152 frags, 128520 blocks, 0.0% fragmentation)
/dev/rsd0d: MARKING FILE SYSTEM CLEAN
setting tty flags
starting network
DHCPDISCOVER on mc0 to 255.255.255.255 port 67 interval 2
DHCPOFFER from 172.16.0.1
DHCPREQUEST on mc0 to 255.255.255.255 port 67
DHCPACK from 172.16.0.1
bound to 172.16.0.18 -- renewal in 1800 seconds.
starting system logger
starting initial daemons: ntpd.
savecore: no core dump
checking quotas: done.
building ps databases: kvm dev.
clearing /tmp
starting pre-securelevel daemons:.
setting kernel security level: kern.securelevel: 0 -> 1
creating runtime link editor directory cache.
preserving editor files
starting network daemons: sendmail inetd sshd.
starting local daemons:.
standard daemons: cron.
Sun Nov  5 22:45:19 MST 2006

OpenBSD/macppc (9600MP.home) (console)

login:

(Comments are closed)


Comments
  1. By Jonathan Gray (62.178.75.222) jsg@ on

    swim3 appears to be the floppy controller for anyone looking for something to do after they get the external 53c94 scsi working :)

    Comments
    1. By Otto Moerbeek (87.210.142.234) otto@drijf.net on http://www.drijf.net

      > swim3 appears to be the floppy controller for anyone looking for something to do after they get the external 53c94 scsi working :)

      Yeah, that's a Super Wozniak Intergrated Machine. Nice to see that they still use a floppy controlle that has it's roots in the AppleIIc. If only for the name...

    2. Comments
      1. By Anonymous Coward (199.18.139.77) on

        > http://fxr.watson.org/fxr/source/drivers/block/swim3.c?v=linux-2.6.11.8
        > Yes I know, but it's all that we have at the moment:)...

        Yes, by all means. And then the IWM Integrated Woz Machine controller on the 68k's... Unfortunately Apple seems to have lost any docco they had for it.

  2. By Anonymous Coward (144.134.250.59) on

    PPC mac's are shiney! compared with my old mac.

  3. By scot bontrager (216.62.11.163) MyFirstName...LookUp@indievisible.org on

    I've got an old Performa 6116 up in the attic that i'm not going to bother bringing down anytime soon. I could never get NetBSD to load on it--nor could anyone else. The only thing I can think of that I wasted more time on was trying to get that damn SCSI in the MacII-FX working properly. I want that year of my life back.

    Comments
    1. By Anonymous Coward (199.18.139.77) on

      > I've got an old Performa 6116 up in the attic that i'm not going to bother bringing down anytime soon. I could never get NetBSD to load on it--nor could anyone else. The only thing I can think of that I wasted more time on was trying to get that damn SCSI in the MacII-FX working properly. I want that year of my life back.

      Hehe, yeah I had a 6100 at the office for a while. The only thing it would run was an MkLinux kernel with a Debian/PPC userland. I basically used it as a gateway to our SMB shares, I could scp stuff off the SMB mounts. One day I discovered that something heavy had hit it, it was done. I remember the disk i/o was really bad...

  4. By commonsense (commonsense) on

    Nice plan, porting to old world boxes. I've got some floating around here and i'll be happy todo some testing.

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]