Sponsored Links

NetBSD on my Mac LC 475

21st Mar 2006, 17:29:41

By James Stocks

Why? Well, I tried Debian, but it was just too slow on the old Mac. The newest kernel I could get to run reliably was 2.2.25. 2.6 is available, but was too unstable for me to use. No disrespect intended to the guys who work on the 68k port, but there were too many niggly issues (hwclock!) and I just don't have vast tracts of time to devote to this. It's supposed to be fun!

NetBSD on the other hand is fast on this little Mac.

As far as installation is concerned, I pretty much just followed this Guide to installing NetBSD, but I wanted to have all my notes in one place, hence I wrote this.

Requirements:

Mac with a 68020+68851PMMU, 68030+68882FPU or a 68040*

8 MB RAM

A few 100 MB of hard disk to do anything useful

An ethernet card

*I replaced my LC's unsupported 68LC040 with a full '040

Installing

Firstly, you'll want to partition your hard disk if you've not done so already. I have a non-apple SCSI drive, so I used a patched version of HDSC Setup on a bootable system 7 floppy. It is worth noting that the NetBSD files themselves (temporarily) take up 50 MB on the Mac partition. I took 150 MB for the Mac Partition, 50 MB for NetBSD swap and the rest for NetBSD root&usr .

Boot from the boot floppy and start HD SC Setup

If you have multiple hard drives, click 'Drive' until you get the right SCSI ID for your drive

Click Partition

Delete the Macintosh partition (ERASES all your data!)

Create:

150 MB standard Macintosh partition

50 MB A/UX Swap

Whatever's left, use as a A/UX Root&usr partition

Click Done and Quit

I now had a blank hard disk, so I had to reinstall (as a minimum) 7.5.3, 7.5.5 updates, OpenTransport, Stuffit Expander and iCab. I used iCab to download the following:

Extract the Mac files but do not extract the BSD *.tgz files, this will happen automatically during the install.

Run the Mkfs program you extracted placed in the Mac folder and select the SCSI disk you partitioned.

Select the Root&usr partition and 'CHANGE' it to NetBSD Root & usr, then select the Swap partition and Change it to NetBSD Swap. Click each patition and 'FORMAT' them in turn - this takes a while. Click DONE to exit.

It's time to install, start the 'NetBSD/Mac68k Installer' program and choose your SCSI disk. Click File -> Install, then Add all of the .tgz files you placed in the BSD folder and then click 'done'.

Go to sleep, wash the cars, cook and eat Sunday lunch or whatever at this point, because this took hours on my LC. When the install Finally completes, choose File -> Build Devices and then quit the installer.

Click OK and choose Options -> Boot Now (cmd+b). If NetBSD boots, rejoice! If not, and you get an error regarding reading the filesystem here's that bad news: You need to start over from the Mkfs point and reinstall substituting kern-GENERIC.tgz for kern-GENERICSBC.tgz.
Otherwise, lets continue.

Choose sh for the shell when prompted. Type:

export TERM=vt100
tset vt100
clear
mount /dev/sd0a

Mounting might complain that the file system is dirty - don't worry, this gets taken care of. Now vi /etc/rc.conf and make these changes:

# Use program=YES to enable program, NO to disable it. program_flags are
# passed to the program on the command line.
#
sshd=yes
#JS: This enables you to log in through ssh

# Load the defaults in from /etc/defaults/rc.conf (if it's readable).
# These can be overridden below.
#
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
fi

# If this is not set to YES, the system will drop into single-user mode.
rc_configured=YES

# Add local overrides below
# JS: The host/domain name are for you to choose. The default route is your
# gateway or router.
hostname="lc475"
domainname="local"
defaultroute="172.16.0.1"

Save the file and that's it, reboot by typing, err... reboot

Your Mac boots the Mac OS again, so load the NetBSD booter once more. Boot as before, but this time don't set single user mode (just hit cmd+b to boot). The Mac will pause for a looong time while generating the SSH keys - this made me chuckle, since it takes the blink of an eye on a modern PowerPC or x86.

Log in as root. Right away, set a password for root by typing:

passwd

Now create a user for yourself (not stocksy!):

useradd -m stocksy
passwd stocksy

Add yourself to the wheel group by doing vi /etc/group. Add your name to the first line so it looks like:

wheel:*:0:root,stocksy

Type exit and log in as yourself. Now use type su to get root access again.

To set up networking, you need to know what type of card you have. Type dmesg | grep -i ethernet, it will return something like:

Note: there are loads of packages you can install in ftp://ftp.netbsd.org/pub/NetBSD/packages/1.6.2/m68k/All/ - take a look.

Use chsh to set your shell to /usr/pkg/bin/bash. Do not set root's shell to bash with chsh, instead add the line /usr/pkg/bin/bash to the end of /root/.cshrc. In truth, it won't matter for this setup, but it is bad practice to use a 'fancy' shell for BSD root accounts since /usr could be on a separate (umountable) partition so that you can't get a shell in single user mode. It's also really easy to fat finger it and leave yourself unable to log in as (or su to) root!

Do Stuff

I hate faffing about with the default ftp client, so the first thing I did was get curl from curl.haxx.se. You'll either need to find an ftp mirror for this or download and scp it to the Mac. This compiled and installed fine:

Initially, I tried to compile MySQL, but it wanted too many dependencies and I couldn't be bothered with it, so I thought this would be a good excuse to learn Postgres. PostgreSQL had just one dependency, gmake: