Advertisement.

EnchantedLearning.com is a user-supported site.
As a bonus, site members have access to a banner-ad-free version of the site, with print-friendly pages.
Click here to learn more.

ad
(Already a member? Click here.)

How to Run NetBSD on an iMac

Mitchell Spector, spector@EnchantedLearning.com
Copyright ©1999 EnchantedLearning.com ------ How to cite a web page
URL: http://www.EnchantedLearning.com/tech/netbsd_imac.shtml

NetBSD-1.4 supports the iMac, but it must be booted off a network. This page shows you how to set this up. It uses the method outlined in the Diskless NetBSD HOW-TO; the information is modified to work with the iMac.

This documentation assumes that you have another machine already running NetBSD that you can use as a server to boot your iMac. If you plan to use a machine running Linux or some other Unix-like operating system as a server, the set-up will be similar, but the details on the server end will be different. The Diskless NetBSD HOW-TO may be useful in uncovering the differences.

I have successfully netbooted a 233-MHz iMac and a 266-MHz iMac using this procedure. If anyone tries it on a 333-MHz machine, please let me know if it works.

NetBSD is a freely available open-source Unix-like operating system which supports a wide variety of hardware platforms. See http://www.netbsd.org for more information.

If you find any errors, or if you have any suggestion or comments, please e-mail them to Mitchell Spector at spector@EnchantedLearning.com. Thanks!

And thanks to Matthew Vaughn <mwvaugh@uiuc.edu> for helpful comments, suggestions, and corrections on an earlier draft of this document.


Set-up instructions

Step 1. Set up the server and the iMac on an Ethernet. These two machines must be on the same network, with no router between them. Be sure that the server knows the domain name and corresponding IP number of the iMac. (If you don't have a full nameserver running, you probably will want to set up the files /etc/resolv.conf and /etc/hosts on the server.) You can test this by booting MacOS on the iMac. Try pinging the iMac from the server. Also telnet to the server from the iMac; the command

w

should show you as logged in from whatever hostname you've picked for the iMac.

For the rest of this document, we'll assume that the server's domain name is yourserver.yourdomain.com and the iMac's domain name is imac.yourdomain.com. Substitute your actual domain names wherever these occur.

Step 2. Download the files from the NetBSD-1.4 macppc distribution. Use anonymous ftp to ftp.netbsd.org or your nearest mirror. Look in the directory /pub/NetBSD/NetBSD-1.4/macppc. Read INSTALL.txt or INSTALL.html to decide which sets you want to install. At a bare minimum, you'll need to download binary/sets/kern.tgz, binary/sets/base.tgz, and binary/sets/etc.tgz. You'll probably need some of the other sets if you want to do anything useful, but you can always install them later when you know what you want. You can put these files in any convenient directory on your server.

Step 3. Become the superuser. Type the command

su -

to become the superuser and to change to the standard superuser environment. (Type the root password when prompted.) You must be root to carry out the following procedure. Be careful! The information contained in this document is not guaranteed. You assume all risk, including the risk of loss of data files and programs. Back up everything before proceeding.

Step 4. Create directories for the client's eventual use. Type

mkdir -p /export/imac/root/dev
mkdir -p /export/imac/usr
mkdir -p /export/imac/home
touch /export/imac/swap
mkdir /export/imac/root/swap
dd if=/dev/zero of=/export/imac/swap bs=4k count=8k


to create file systems for use by the iMac client. (This sets up a 32-megabyte swap file. Change the count in the dd command to use a swap file of a different size.)

Step 5. Uncompress the installation files. First cd to the directory where you saved the compressed tar files from the binary/sets part of the distribution. Then enter the command

cat kern.tgz | gunzip | (cd /export/imac/root; tar xpf - )

and repeat, substituting base.tgz, etc.tgz, and any other sets you want to install in place of kern.tgz in the command.

Warning: If you're not running NetBSD on your server, be sure that you have GNU tar version 1.12 or higher. There's some information on how to check for this at the filesystem set-up page in the Diskless NetBSD HOW-TO.

If you just install some of the sets now, intending to install others later, you can't just go back to Step 5 later on to install the additional sets. You'll need to complete the entire iMac NetBSD installation with whatever sets you've just selected. Eventually, after you netboot your iMac, you can install any additional sets while logged into the iMac. Don't try to install additional sets from the server later on, since the directory structure on the server won't match the directory structure on the iMac.

Step 6. Create the console device. Type the command

mknod /export/imac/root/dev/console c 0 0

Step 7. Configure the bootp server. Add an entry like the following to the file /etc/bootptab (if the file doesn't exist, create it):

# /etc/bootptab: database for bootp server (/etc/bootpd)
# You'll need to change most of these entries, as described below.
imac.yourdomain.com:\
:ht=ether:\
:ha=000502E60F2C:\
:sm=255.255.255.240:\
:lg=200.153.102.174:\
:ip=200.153.102.163:\
:bf=netbsd:\
:bs=auto:\
:rp=/export/imac/root/:\
:vm=auto:

Substitute your iMac's domain name for imac.yourdomain.com.

The hexadecimal number after ha= is the Ethernet hardware address of your iMac. To find this, open the TCP/IP Control Panel on your iMac (under MacOS). Look for the "Info" button in the lower-left corner of the control panel's window. (If you don't see this button, then go to the Edit menu, select "User Mode...", choose "Advanced", then click "OK"; the "Info" button should appear.) Click on the "Info" button. The hardware address listed there is the number you want (leave out the spaces when you copy it into the file /etc/bootptab). Click OK, and close the control panel's window.

The number after sm= is your subnet mask. (Both your iMac and your server must be on the same network, so both of these machines use the same subnet mask.)

The number after lg= is the dotted-decimal IP address of your server.

The number after ip= is the dotted-decimal IP address of your iMac.

Step 8. Set up the tftp server. Execute the commands

mkdir -p /tftpboot
cp /export/imac/root/netbsd /tftpboot

Note: The NetBSD MacPPC documentation indicates that you can speed up the netbooting process by gzipping the file netbsd and storing netbsd.gz instead of netbsd in the /tftpboot directory. To make this work, you'll need to set up bootp (Step 7) so that it loads the file ofwboot.elf rather than netbsd. The Open Firmware Boot program ofwboot.elf will take care of loading and gunzipping netbsd.gz, once it realizes that the file netbsd is not present. But there's a catch: the file ofwboot.elf is missing from the NetBSD MacPPC binary distribution; the ofwboot file that is there isn't in ELF format, so it can't be used. I'm told that if you download the source code for this program, you can compile it into an ELF PowerPC executable and it will work; I haven't tried this myself. (It would probably be easiest to get NetBSD installed on your iMac first, so that you can compile ofwboot there.) I find that it only takes perhaps 10 seconds to download netbsd from the server to the iMac over a 10-Mbps Ethernet, and it only happens when you boot, so I'm not sure whether it's really worth bothering with ofwboot.

Step 9. Configure inetd to listen for bootp and tftp requests. In the file /etc/inetd.conf, uncomment the lines

bootps dgram udp wait root /usr/sbin/bootpd bootpd

and

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

(remove the # at the beginning of the lines, or enter the lines entirely if they're missing).

Step 10. Tell inetd to reread /etc/inetd.conf. Type the command

ps -aux | grep inetd

to determine the process id of inetd; then type kill -HUP followed by that process id.

Step 11. Configure NFS.

Add the following lines to /etc/exports, or create the file if it doesn't exist:

# /etc/exports
/export/imac/root -maproot=root imac.yourdomain.com
/export/imac/swap -maproot=root imac.yourdomain.com
/export/imac/usr -maproot=root imac.yourdomain.com
/export/imac/home -maproot=root imac.yourdomain.com

Note: This configuration presumes that you can trust all users of your iMac (whether running NetBSD or MacOS or something else).

If /export/imac/usr and /export/imac/home aren't on the same disk partition as /export/imac/root or /export/imac/swap, you may be able to leave out the -maproot=root options for usr and home.

Step 12. Set up mountd.Type the command

ps -aux | grep mountd

to see if mountd is running and, if so, what its process ID is.

If mountd is already running, tell it to reread /etc/exports by typing kill -HUP followed by the process ID of the running mountd.

If mountd is not running, start it by typing the command

/sbin/mountd

Step 13. Start the NFS daemons.Type the command

ps -aux | grep nfsd

to see if the NFS daemons are running. If they're not currently running, then type

/sbin/nfsd -tun 4

to start them.

Step 14. Set up the iMac's filesystem table.Create a file called /export/imac/root/etc/fstab, containing the following:

yourserver:/export/imac/swap none swap sw,nfsmntpt=/swap
yourserver:/export/imac/root / nfs rw 0 0
yourserver:/export/imac/usr /usr nfs rw 0 0
yourserver:/export/imac/home /home nfs rw 0 0

Step 15. Set up rc.conf for the iMac. Edit the file /export/imac/root/etc/rc.conf, modifying three of the lines so they read:

hostname="imac.yourdomain.com" # The domain name of your iMac
defaultroute="200.153.102.161" # Use the IP address of your router or gateway machine
nfs_client=YES

Step 16. Set up the iMac's hosts file. Add lines like the following to the file /export/imac/root/etc/hosts:

200.153.102.174 yourserver
200.153.102.163 imac

Use your actual IP numbers and host names, of course.

You may also want to set up /export/imac/root/etc/resolv.conf so that you can make use of domain name service on the iMac. If you're getting DNS from your ISP, you can probably just type

cp /etc/resolv.conf /export/imac/root/etc/resolv.conf

to copy the configuration from your server to the iMac. If you're running named on your server, you'll need to set up the file /export/imac/root/etc/resolv.conf to contain at least the line

nameserver 200.153.102.174

(where you use the actual IP number of your server, of course). If you want to run a nameserver on your iMac, use one of these methods first, then set up the nameserver after you get NetBSD booted on the iMac.

Step 17. Configure network interface parameters for the iMac. Create a file called /export/imac/root/etc/ifconfig.bm0 containing the line:

inet imac netmask 255.255.255.240 broadcast 200.153.102.175

Replace imac with your iMac's host name, replace 255.255.255.240 with your subnet mask, and replace 200.153.102.175 with your broadcast IP address (generally the last address in your subnet).

Step 18. Move the installed usr directory to the proper location. Enter the command

mv /export/imac/root/usr/* /export/imac/usr/

Step 19. Make sure that NFS restarts every time you boot the server. Edit the file /etc/rc.conf, changing one line so that it reads:

nfs_server=YES


Installation is done!

Go ahead and boot your iMac, according to the following instructions.


Boot instructions

Start your iMac (shut it down first if it's already on); hold down the four keys Cloverleaf-Option-O-F (that's the letter O, not the digit 0) during start-up to get your Mac's Open Firmware prompt.

Type

dev enet
boot enet:0


to start booting.

During the boot process, you may see a warning that a USB controller could not be found. I haven't traced down what's causing this, but it doesn't seem to matter. (Both the keyboard and the mouse are being found -- the X Window system works.)

The first time you boot, the iMac will start in single-user mode. Enter vt220 instead of the default vt100. Set up rc.conf as usual, following the normal NetBSD installation instructions (make the devices, test the swap, and set rc_configured=YES in the iMac's /etc/rc.conf or the server's /export/imac/root/etc/rc.conf. Type exit (or reboot the iMac into NetBSD) and you should come up in normal multi-user mode.

After booting, but before using the console, press the shift key. This works around a bug in the kernel, which may otherwise cause typed characters to be repeated forever. I've found this to be necessary on a 233-MHz iMac, but not on a newer 266-MHz machine, but it's possible that something else accounts for the difference since I've only tried it on these two machines.

If you still have problems using the iMac keyboard, you can always telnet to your iMac from another machine.

Note: Documentation indicates that if you just hold down the N key while the iMac is starting, then OpenFirmware should automatically netboot the iMac, avoiding the need to enter any OpenFirmware commands manually. Unfortunately, this doesn't seem to work. Perhaps OpenFirmware can be configured in some way to make this happen, but it doesn't work out of the box.

Copyright ©1999 EnchantedLearning.com ------ How to cite a web page
URL: /tech/netbsd_imac.shtml



Web Sites from EnchantedLearning.com

Zoom Dinosaurs Zoom Sharks Zoom Whales Zoom Butterfly Zoom Birds Zoom Rainforest Zoom Astronomy
Zoom Store
Incredible educational toys!
Zoom School Little Explorers
A picture dictionary
KinderCrafts Rebus Rhymes Busy Little Brains
CD-ROM
Enchanted Learning Software

Also see SPARC at Enchanted Learning for an introduction to assembly language programming for the SPARC architecture.

E-mail


Enchanted Learning Search

Search the Enchanted Learning website for:



Advertisement.



Advertisement.



Advertisement.





Copyright ©1999 EnchantedLearning.com ------ How to cite a web page
URL: /tech/netbsd_imac.shtml