NetBSD-MacPPC Install

This guide details a NetBSD MacPPC version 2 install onto a 400 MHz iMac.

I wrote this in the hopes that mac users –many of which are disappointed in OS X, Apple’s business policies (such as the closing off of Darwin, and the withholding of Airport Extreme driver and associated spec information) and who are perhaps seeking something other than Gnu-Linux-PPC– would follow me into the world of BSD. (I have no axe to grind with Gnu/Linux, or the GPL).

Prologue-This article’s Other Motivating Factors

I was attracted to BSD because of a higher quality output. For instance, buggy software is not tolerated. For instance, (at the time of writing this article) Firewire still hasn’t been incorporated into the BSDs, presumably because it’s buggy.

Gnu-Linux on the other hand, has had Firewire support for years and as of late (and in my experience) is stable (on distros such as Debian Sarge and Ubuntu Warty onwards). Also to BSD’s (dis)credit, I have never had to fiddle around with X’s config file on Gnu-Linux-PPC as I’ve had to on BSDs. In my experience, Gnu-Linux has always returned me to a fully working console –if X were to fail– while NetBSD MacPPC and FreeBSD PC haven’t.

Not to discredit BSD further, but there’s sometimes a contradiction between what’s reported to work in official documentation and what really works. An example is my 400 MHz iMac DV. It’s officially reported to boot from the OpenBSD-PPC install CD. It never has, while with any Gnu-Linux PPC install or live CD, it boots like a charm.

Given BSD shortcomings (in the plural sense of term BSD), compiling my own packages (better associated with NetBSD), having a platform with which security is a higher priority (more OpenBSD), and having an OS that is optimized is attractive (in the end BSDs tend to influence each other). Note: NetBSD can install onto ultra-ancient hardware. As an example of these efficiency, NetBSD will install onto 486s and and only recently lost support for 386s. Also, my old p1 233 MHz running OBSD runs Xpdf much faster than a minimal-server style Ubuntu-PPC install on a 400MHz iMac. By many accounts (including my own), BSDs have a better user feel in that they seem more responsive than Gnu-Linuxes. Interestingly, this *BSD feel doesn’t carry over to OS X, despite that you sometimes don’t have acceleration enabled when running a true *BSD –this, purely from my experience.

Alsem’s on-line “HOWTO install NetBSD onto an iBook” also motivated this article. It was useful as a reference, but I found Alsem’s write-up inaccessible for most Apple users –despite NetBSD documentation, including for myself who had been using Gnu-Linux-PPC for a few years. Alsem and I have different target groups. His is the BSD crowd wanting to try PPC hardware, while mine is the Mac crowd with little terminal experience. Thus this write up, perhaps a parallel and initially supplementary to Alsem’s documentation, although no reading of the said documentation is necessary.

Another motivation for my write-up is that the NetBSD MacPPC documentation is confusing on account that the install procedure differs from one Apple model to another. I also found the few MacPPC NetBSD HOWTOs I could find lacking clarity because they assumed too much of the reader. (This might change slowly with the start-up of a NetBSD wiki that has occurred recently.)

Use this at your own discretion. I take no responsibility for any negative results resulting from using this guide.

Without further rambling.

Partitioning with OS 9’s Drive Setup
1) Boot onto the OS 9 install CD.

2a) Start ‘Drive Set-up’ (version 1.8.1 or later) and fashion a HFS+ partition and A/UX partitions such as (for a 60 gigabyte hard drive);

one HFS+ partition at 20 000 MB
A/UX Root 1000 MB root a
A/UX swap 2500 MB swap b
A/UX Free1 1000 MB /tmp e
A/UX Free2 1000 MB /var f
A/UX user 10 000 MB /usr g
A/UX Free3 /home h

(The letters on the right hand side are designations I assigned on paper as reference; NetBSD seems to associate them with these letters.)

2b) Reboot and hold left mouse button to eject the Apple OS install CD.

Boot from NetBSD MacPPC CD
3) Boot to CD from OF with:

boot cd:,\ofwboot.xcf Netbsd.macppc

Formatting and Initializing NetBSD Partitions
4) Select “I) install” >> Utility Menu >> Run sh

5) In the forthcoming shell with ‘#’ prompt run:

disklabel /dev/wd0

or just pass

disklabel wd0

6) Check to see that a, b, e, f, g, h are BSD FSes.

7) Notice that swap does NOT get formatted/initialized!

# newfs /dev/wd0a
# newfs /dev/wd0e
# newfs /dev/wd0f
# newfs /dev/wd0g
# newfs /dev/wd0h

8) Next:

# mount /dev/wd0a /mnt
# cd /mnt

9) Reasoning that I needed to make the following for every partition I previously made, I did:

# mkdir etc
# mkdir tmp
# mkdir var
# mkdir usr
# mkdir home

Instead of my instructions 8 and 9 you’ll find a set of instructions (Anselm’s) on the net suggesting the following but I really don’t know what he’s attempting without stipulating a “/home” and with “/mnt2”.

# mount /dev/wd0a /mnt2
# mount /mnt2/etc/
# mount /mnt/tmp
# mount /mnt/var
# mount /mnt/usr

10)

cd etc

11) Next make a fstab matching all your partitions, my way, (again I don’t like how Alsem’s instructions suggest making the fstab as it is easy to make an error). You can cntrl+ u to erase a line:

# cat > fstab
/dev/wd0a / ffs rw 1 1
/dev/wd0b none swap sw 0 0
/dev/wd0e /tmp ffs rw 1 2
/dev/wd0g /var ffs rw 1 2
/dev/wd0f /usr ffs rw 1 2
/dev/wd0h /home ffs rw 1 2 [press enter]
[hit cntrl-c]

12a) To check fstab:

# more fstab

12b) Unmount /mnt and exit console.

# cd /
# umount /mnt
# exit

13) Exit the “Utility Menu” in sysint and select “Reinstall set or install additional sets”.

14) According to Alsem’s HOWTO documentation, configure “Time Zone” and “Set password” next, which are both supposed options in “Utilities Menu”. I did not have a “set root password” option. You might be able to set the root password by going back into shell but I don’t think this worked for me (you can do it later after the first reboot), ie:

# password

15) Back out till the “Exit Install System”,

# reboot

and hold down the left mouse button to eject the NetBSD install CD.

Installing Apple’s OS X
16) Throw in the Apple install DVD (or CD) and install OS X (or classic) onto the HFS+ partition previously made with OS 9’s ‘Drive Set-up’ (version 1.8.1 or later).

17) Once the Apple OS is installed (and while still logged in to Apple’s OS), drag ‘ofwboot.xcf’ from the NetBSD install CD/DVD to OS X’s root level (beside the ‘Applications’ folder).

You’ll need the following information to boot into single user mode under Netbsd.
Anselm is vague here.

18) In OS X’s xterm pass:

diskutil list

to see the first (top) Apple_UNIX_SVR2. Verify size of partition.

Booting into Single-user Mode

The rest of this HowTo deals with Netbsd, not any of Apple’s OSes.

My result from the above “diskutil list” inquery was ‘9’, so my command to boot off of the hd is:

boot hd:,ofwboot.xcf hd:9,/Netbsd

19) Press “enter” for /bin/sh and pass the following:

# mount -o rw /dev/wd0 /

20)

# cd /etc

Next you need to edit rc.conf to enable multi-user mode. You can’t use vi (or is it vim?) unless you mount the partition where it resides, which failed miserably for me (see Anselm’s guide). I suggest doing some reading on basic use of ed. It is terse and probably one of the hardest tasks of this install process, honestly.

21)

# ed rc.conf

First use the print line function to display lines. ie., ’18’ displays:

rc_configured=NO
Then change ‘rc_configured=NO’ to ”rc_configured=YES with:

s/rc_configured=No/rc_configured=YES

Lastly, pass ’19’ which prints a blank line upon which I wrote ‘wscons=YES’. To save I did something like

. <enter>

22)

# reboot

First Multi-user Boot
23) After the computer has booted up, log in as root with no password and then to type in your root password:

# password


Finishing Up

24) Enable Softupdates (BSD’s response to journalling)

# vi /etc/fstab

and add ‘,softdep’ to every FS (except swap) after ‘rw’. ie.,
‘/dev/wd0a / ffs rw 1 1’ changes to ‘/dev/wd0a / ffs rw,softdep 1 1’.

25) Add Users

# useradd -m -G wheel USERNAME

26) Add Password to newly Added User

# password USERNAME

Set Up X Windows
27) To configure X to work you go through a similar process as manually configuring X on Debian. It’s a series of questions asking info about your hardware. You should have printed out info from OS X’s Apple Profiler and generally be informed about your hardware before attempting this.

# cd USERNAME
# xf86config

For my particular model of iMac, an iMac DV 400MHz with an evil m$ two button digital mouse with a scroll wheel/button (totalling three buttons), I eventually selected the input to reflect:

Keyboard?
protocol: wskbd
derive; /dev/wskbd

Mouse
no emulation for three buttons
/dev/wsmouse
mouse protocol: wsmous

105-key keyboard (which I latter changed to ‘macintosh’ in /etc/X11/XF86config with vi.)
no us varient
no additional XKB

Monitor Settings
horizontal resolution: 60-60
vertical resolution: 74-117
labelled monitor: iMac Monitor

Video Card
select Rage video card as: 128
ram input: 8834
modes: OK
select 16 bit colour depth

Write X config to /etc/X11/XF86config [if you ran this as a regular user and you attempt to save it to root you’ll have to redo this whole process. If you like, you can save your X settings to “home” as a regular user and then copy them from /home/XF86Config to /etc/X11/XF86config as root with something like:

# cp /home/XF86Config /etc/X11/XF86config

Write to current directory. You’ll have to pass xf86config while at home. Otherwise go root and pass xf86config from /etc/X11/ and save to your current directory.

There is no backspace to go back and correct mistakes in xf86config! So get it right or you’ll have to perform it over until you do.

Then exit root and login as username. Pass:

startx

If X works, you’ve accomplished the hardest task I encountered.

If X doesn’t work, cntrl-opt-+ should cycle you through video resolutions. Cntrl-opt-backspace, or delete on a mac, should kill X. All I got was a black screen my first few tries when starting X. I’m told that the X config failed and exited X but did not reinitialize my video card to display on-screen console data. My solution was to blindly ‘su’ and cast ‘reboot’.

A few recommendations:
Don’t try to enable video acceleration as it is not supported on MacPPC (I’m told from the MacPPC mailing list [I’ve received contradictory info on this since]). It also seems to have frozen my computer necessitating a hard reboot (hmm I thought BSD was above these things). I must admit I did not ssh in, but then again I did not have it networked.

28) Internet Connection
You might have noticed that there is no internet connection yet. Ergo, you can’t

ping google.com

and get feedback.

Temporary Connection:
(While on the subject of internet connection and alternatively, Alsem encourages the downloading of pdisk during the install rather than the use of Apple’s OS 9’s ‘Drive Setup’ [see above]. This necessitates creating an internet connection. It’s no longer necessary because the appropriate pdisk is now included in NetBSD MacPPC, at least from 2.0.2 onwards. [Don’t worry about this as we are using my method.])

Searching around Openbsd’s? documentation I found that you could put up a temporary internet connection with:

$ dhclient tlp0

This works post-install, not during the install. Obviously, you have to figure out your Ethernet card name. Do a

dmesg | grep Ethernet

I got “tlp0” as output, you may get something else.

Permanent Internet Connection
Searching NetBSD’s DHCP documentation I found:
First off, create the /etc/dhclient.conf file:

mkdir /etc/dhclient.conf

“Configure DHCP (top)
The DHCP client can be configured in the file etcdhclient.conf. If the file is not present, DHCP will still work fine. See dhclient.conf(5) and dhcp-options(5) for more detailed information. A typical etcdhclient.conf is shown below.

Send host-name “myname.my.domain”; <=== Put your hostname here.
send dhcp-client-identifier “myident”; <=== Put your host identifier here.
(this is often times the same as myname).
request subnet-mask, broadcast-address, routers,
domain-name-servers;
timeout 30;
retry 60;
select-timeout 5;
script “/sbin/dhclient-script”;
lease {
interface “sn0”; <=== put your interface device here.
option host-name “myname.my.domain”; <=== put your hostname here
option subnet-mask 255.255.255.0;
option domain-name “my.domain”; <=== put your domain name here
option domain-name-servers 127.0.0.1;
renew 2 2000/1/12 00:00:01;
rebind 2 2000/1/12 00:00:01;
expire 2 2000/1/12 00:00:01;
}”

Fill out hostname and other names as you like then add ‘dhclient=YES’ to bottom.

To start internet connection without rebooting I passed:

sh /etc/rc.d/dhclient start

It worked but then I started to get a continual error, “fw0: can’t handle af0”. I found some FreeBSD error explanation on-line that suggests this is because (Net)BSD is attempting to pass internet packets through every interface including my modem. The solution was to stipulate the Ethernet interface:

Add the following to /etc/rc.conf

dhclient_flags=”tlp0″

Replace “tlp0” with the output of

dmesg | grep Ethernet

if you’re not using the same model of iMac I used (and using ethernet).

29) Firewall
Coming soon, hopefully, a NetBSD HowTo on firewalling. As I write this, NetBSD uses IPFilter, although PF can be installed as a package add-on, as with any software that doesn’t come installed as default. I presently can handle OpenBSD’s PF. NetBSD 3 onwards will have PF installed in the base install (as will FreeBSD 6 onwards too). For the time being, try to learn to work with IPF. Get a sample IPF ruleset with,

man ipf

30) Booting
For now you can boot into NetBSD with the following commands.

boot hd:,ofwboot.xcf hd:9,/Netbsd

Contrary to what you may have read, I do recall circumventing the necessity of having the bootloader (ofwboot.xcf) in a HFS+ partition and used the bootloader on the NetBSD MacPPC CD to boot (using the following command).

boot cd:,ofwboot.xcf hd:9,/Netbsd

In any case I’ve left OS X on my iMac for use as a backup for my iBook. I may put Gnu-Linux-PPC on that OS X partition if I can continue to boot from the CD. (I don’t like OS X, if you haven’t noticed.)

Written by Maurice Cepeda
a.k.a. Chascon

Sources (in No Particular Order)

Anselm R. Garbe’s On-line Documentation (Among Others):
http://mail-index.netbsd.org/port-macppc/2004/01/19/0000.html
http://wiki.bsdforen.de/index.php/NetBSD_-_iBook_installieren (dead link)

Most illuminating was the Google cache of http://freebsdforums.zahui.net/html/30/5363.htm

NetBSD’s DHCP Documentation:

http://www.netbsd.org/Documentation/network/dhcp.html

Confusing Documentation:

Especially confusing is how to partition, and how and where to exactly come back in from the recommended partitioning docs (earlier doc) to the later doc.
http://www.netbsd.org/Ports/macppc/partitioning.html” suggests getting pdisk via internet connection when it is on NetBSD 2.0.2 install CDs onwards.
ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-2.0.2/macppc/INSTALL.html (No such file or directory now?)


Helpful Resources:
Fall-back Guide:
http://www.netbsd.org/guide/en/

PF:
http://home.nuug.no/~peter/pf/
http://www.nwo.net/ipf/ipf-howto.html#TOC_1
http://www.phildev.net/ipf/
http://www.tcbug.org/ipf.html (dead link)

X on NetBSD:

http://www.netbsd.org/Documentation/x/

Installing Packages:
http://www.netbsd.org/Documentation/software/packages.html

Shells:
http://www.netbsd.org/Documentation/misc/

Should you find yourself needing to use pdisk and not liking NetBSD’s documentation look at:
http://www.mklinux.org/getting_started/preparations/pdisk.html (dead link)

NetBSD can install onto Apple’s UFS. You might try this. I wasn’t successful. See: http://mail-index.netbsd.org/port-macppc/2005/04/27/0002.html.

This is licensed under the Attribution-NonCommercial-ShareAlike 3.0 Unported Creative Commons License. All brands mentioned are properties of their respective owners. By reading this article, the reader forgoes any accountability of the writer. The reading of this article implies acceptance of the above stipulations. The author requires attribution –by full name and URL– and notification of republications.

This article may be outdated and of historical value.

Advertisements

One thought on “NetBSD-MacPPC Install

  1. Pingback: Linux Loses Con Kolivas « Le Blog de Maurice

Comments are closed.