HOWTO - Nubus Power Macintoshes as LTSP Clients

Skip Gaede

   sgaede@attbi.com
 

Revision History
Revision 0.1 27 Mar 2002
First draft for review.

Table of Contents
1. Why?
2. How Does it Work?
3. Setting Up the Server
3.1. Software Components Needed
3.2. Install the Software
3.3. Fix the mappings for Backspace and Delete
3.4. Edit the lts.conf file
4. Setting up the Client
4.1. Partition the Disk
4.2. Install the MacOS
4.3. Install the MkLinux Boot Loader
4.4. Install Stuffit Expander on the Client
4.5. Install the Linux kernel on the client
5. Next Steps
6. Extending this to other Macs
A. Software Development for the PowerMac Client
A.1. Notes for Installation of YDL 1.2 Champion Server
A.2. Cross-Compiling the Linux kernel
A.3. Building the Ramdisk
References

1. Why?

This project started as a request from Rob Belleville, the MIS guru for the Millbury, MA school system. He had 20-30 Power Macintoshes sitting in storage, and because the storage space was needed for other uses, the Macs were destined for the dumpster. He was familiar with the LTSP software, and thought maybe he could coax a few more years of service out of the Macs as thin clients in the library.

For those not familiar with Macintosh computers, they come in many sizes and configurations. The ones I was asked to deal with were the Power Macintosh 6100/66 variety. These, along with the 7100s, 8100s and the Performa series, have something called a Nubus, which is serves the same function as the PCI bus in the Intel architecture. Through the efforts of Takashi Oe, a Linux kernel has been ported to this architecture. Other Macintoshes may be usable as thin clients, provided a Linux kernel exists. I am indebted to Michael Roeder for his writeup on how to install Linux on a Power Macintosh 6100.

The Power Mac 6100/66s used in this project date back to about 1995. They are, computationally, on a par with a i486/66 PC. At the time they were retired, they were running MacOS 7.5.3. The web browser was Netscape 4.0. Because that version did not support Java, surfing the web was a real painful experience. These Macs have 40MB of memory, and running the web browser natively is sluggish, at best. In stark contrast to that, running as a thin client is a dream. The pages load almost instantaneously, and you think you are using a much faster machine. Furthermore, we are able to run Netscape 6.2, and to take advantage of all the latest software. The only weakness of the Macs is their display adapter, which is limited to a maximum resolution of 832x624 and 256 colors.


2. How Does it Work?

Very nicely, thank you. The process differs from the Intel process in four respects:

  1. The Macintosh has a builtin NIC, but no boot ROM, so it cannot perform a network boot.

  2. The Macintosh needs to boot the MacOS initially.

  3. The Macintosh has a local hard drive that can be used for swapping.

  4. The Macintosh needs to run different software than the PC. A major difference is that the byte order is big endian on the Macintosh, and little endian on the PC. This means that different fonts and a separate font server are needed.

As the Macintosh starts its boot process, it starts loading extensions to the operating system. One of these is the MkLinux boot loader, which looks at two ASCII text files, and determines that Linux should be loaded. The kernel, with an attached RAM drive is loaded from Macintosh partition on the local hard drive, and the process then follows the steps outlined by Jim McQuillan [jam2002.03.02]. (Because the Macs have a local hard disk, a portion of the disk was allocated for swapping. I haven't tried using the NFS swapping technique. If it works well, then repartitioning the disk and reinstalling the MacOS could be eliminated. (I do know that I can boot the client with no swap file enabled, and I have approximately 10 MB of free memory after starting the browser. I welcome feedback on this.)


3. Setting Up the Server

This project was developed with the LTSP 3.0.0 software modules.


3.1. Software Components Needed

  • ltsp_core_<version>

  • ltsp_server_0.1.ppc.tar.gz


3.2. Install the Software

After unpacking the ltsp core package, there are two scripts to run. The first one, install.sh, creates a templates directory with a number of template files. Please go through each if these files, and make whatever changes are appropriate. In particular, replace all occurences of "i386" with "ppc". Then run the template installation script.

Install the power pc tarball as follows:

tar -xzf ltsp_server_0.1.tar.gz -C /opt/ltsp

This will unpack the archive into the directory tree /opt/ltsp/ppc.


3.3. Fix the mappings for Backspace and Delete

I do not have a comprehensive solution for this yet. The problem is that the Delete key on the Extended keyboard erases characters to the left, while the Backspace key deletes characters to the right. This is not intuitive, On Linux Mandrake systems, there is a script, /etc/X11/xinit/fixkeyboard that assigns the "customary" actions to the two keys. Unfortunately, the fix is specific for the keyboard selected when the OS was installed. And not only does it not solve the problem on the Mac, it makes it worse, by clobbering the meaning of two additional keys. A fixed copy of fixkeyboard is in the ppc_scripts_eg folder. The script is setup to apply the correct key fixup to a list of machines based on their names. Edit the selection criteria to fit your needs and replace the file in the xinit directory. Instructions for other Linux distros will be added if feedback is sent to the author.


3.4. Edit the lts.conf file

The /opt/ltsp/ppc/etc/lts.conf must be customized for your site. The following parameters are used:

Table 1. Lts.conf Variables

Name Semantics Value Notes
SERVER IP address of server doing the computing 192.168.0.254  
XSERVER Video Driver Xpmac.rev10 Does not use the XF86config file!
RAMDISK_SIZE Amount of memory to be allocated for temporary storage 1024 Specified in Kbytes
LOCAL_SWAP Boolean Y If N is specified, no swap file will be setup
LOCAL_SWAP_PART Partition on local hard drive to be used for swapping /dev/sda4 Determined by how the drives are partitioned
SWAPFILE_SIZE Size of the SWAP partition 100000 Size is in Kbytes
USE_XFS Boolean, use X Font Server Y Almost mandatory with Xpmac, since it ignores the XF86Config file.
USE_LOCAL_XFS Boolean, Should the font server run on the client? Y This needs to be set to Y
LOCAL_APPS Should the Local Apps feature be used N Only useful for clients with lots of memory
RUNLEVEL Where to stop in the boot process 3 or 5 3 is console terminal, 5 is X Window
VIDEO_MODE Resolution for X Display 12 or 13 12 is 800x600, 13 is 832x624

4. Setting up the Client

Setting up the client involves several steps, and having a Macintosh on the network with the MacOS available for network installation is very handy. If a CD with the MacOS 7.5.3 or better is available it can be used instead. For this project, the MacOS 7.5.3 was chosen. This version can be downloaded from the Apple web site and unpacked to create a virtual volume, which can then be used for network installation.


4.1. Partition the Disk

This step may become unnecessary, pending further investigation. However, I currently recommend setting aside a 100 MB Swap partition. Use the Apple HD SC Setup tool to allocate between 50000 (Kbytes) and (Size of disk - 100000) (Kbytes) for the Macintosh partition, and 100000 (Kbytes) for the Unix Swap partition.


4.2. Install the MacOS

If you are using the MacOS 7.5.3, install the OS using Easy Install. If you are a minimalist, you need to include the following items:

  • The minimum kernel

  • Appleshare

  • Open Transport

  • CD Support

  • Chooser

  • Startup Disk

  • Memory applet in Control Panel

  • Date/Time applet

Reboot the client and turn off memory management using the Memory applet in the Control panel.


4.3. Install the MkLinux Boot Loader

At this point, it helps to have a Macintosh with a web browser and access to the Internet. Obtain Stuffit Expander, version 5.5 or better, from Aladdin, and the MkLinux Boot Code from the Nubus-Pmac web site. The package consists of three pieces,

  • A piece that goes in the Control Panel

  • A piece that goes in the Extensions Folder

  • A piece that goes in the Preferences Folder.

Open the Preferences Folder and double click on MkLinux.prefs. Edit the file so it looks like this:

bootos=MkLinux   # Boot to either "MacOS" or "MkLinux"
bootdelay=0      # Seconds to pause at boot dialog


Open lilo.conf and check that it looks like this:

# 'rootdev' defines the location of the root device
#

# After install use these with YDL 1.2
#rootdev=/dev/sdb5
#mach_options= video=ariel2fb

# Use these for initial YDL 1.2 install
rootdev=/dev/ram
mach_options= ramdisk=8192


With the boot delay set to zero, you will need to disable extensions (by holding down the shift key) in order to boot into the MacOS.


4.4. Install Stuffit Expander on the Client

Stuffit Expander is used to decompress the Linux kernel (which has a ".gz" extension. If you use a Macintosh as file server, you may expand the kernel image before distributing it to the clients. A second alternative is to put the kernel on an Intel server running Linux and the AppleTalk protocol, and use Apple File Exchange to download the image. In this scenario, the image must be expanded on the client to avoid corruption.


4.5. Install the Linux kernel on the client

Conceptually, this is involves placing a copy of the Linux kernel plus ramdisk (initrd) in the Extensions folder on the client, and changing its name to "Mach Kernel". This involves either downloading the file to a Macintosh acting as a file server, or downloading from the LTSP server and expanding the file on the client.


5. Next Steps

Once the clients have been setup, accounts for each machine must be setup on the server. You can easily achieve this by logging onto the server for each account and customizing the desktop for each client. If you use KDE for your client desktop, I recommend using autologon to steer each machine to its own user account. There are some files in the /opt/ltsp/ppc_scripts_eg directory giving some hints.


6. Extending this to other Macs

Life is not perfect. Neither is this implementation. As it stands today, it is heavily biased towards the Nubus PMacs. If you are fortunate enough to have PCI based clients, or PMacs with an addin video card, you will need to enhance the current package. The author does not have the necessary hardware to develop and test the changes necessary to support other Macs. I think it would be straight forward to add support for X 4.x. As mentioned earlier, the issue of whether local swapping is needed, also needs further investigation.


A. Software Development for the PowerMac Client

If you need to make changes to the software, you're in for an exciting ride. Having Linux boot off the Mac allows you to make changes and to test them locally. After you are satisfied, you can upload them to the server vis NFS, and reboot the system as a thin client and test the changes.


A.1. Notes for Installation of YDL 1.2 Champion Server

Michael Roeder's article [Roeder2001] provides an excellent place to start. The first hurdle, however, is to obtain a copy of the YDL distribution. There are a couple of choices:



I recommend burning a CDROM if you can locate the ISO image.

The only gotcha I encountered during the installation was that after completing it per the instructions, the system was unbootable. Eventually the cause was found: there was no /etc/fstab! Fortunately, the fix for this is simple. While the installation is copying the selected files to the Hard Drive, switch to the second terminal window and create the file manually:

cat >/mnt/etc/fstab <<EOF
/dev/sda5  /          ext2     defaults     1 1
proc       /proc      proc     defaults     0 0
/dev/scd0  /mnt/cdrom iso9660  ro,noauto    0 0
EOF

A.2. Cross-Compiling the Linux kernel

Paulo Tribolet Abreu [Abreu2001] has written a great article on this. There are a couple of things you need to know related to compiling the kernel for the Nubus Power Macintosh MkLinux Boot Loader.

  • I recommend using the latest sources available from the Nubus-Pmac web site. I used the 2.4.5 kernel, the 2.4.6-pre3 patch, both from the Linux kernel web site, Etushi Kato's patch (ftp://ppc.linux.or.jp/pub/users/ekato/nubus-pmac/) and Takashi Oe's (miBoot patch. Etushi has just released a 2.4.13-pre3 kernel patch, but I have not tested it.

  • To build the kernel, the command is make zImage. To build one with an initrd, use the command make zImage.initrd. (The RAMDISK image, ramdisk.image.gz needs to be copied to the linux/arch/ppc/appleboot directory prior to issuing the make command.) The output of both commands is a file named Mach Kernel, located in the appleboot directory.


A.3. Building the Ramdisk

  • ltsp_utilities source code. NOTE: getltscfg.c needs to be patched as the variable 'c' in main needs to be defined as a long at line 399, and then cast as type char in line 421. Jim is rewriting the utility, so perhaps this will be fixed by the time you try this.

  • ltsp_initrd_ppc_v0.1 kit

The techniques for actually building a RAMDISK image are discussed elsewhere. Refer to the i386 initrd kit for more details.


References

jam2002.03.02 McQuillan, James. "LTSP - Linux Terminal Server Project - v3.0" http://www.ltsp.org/documentation/ltsp-3.0.0/ltsp-3.0.html

toe.2001 Oe, Takashi. "Welcome to the World of Linux 2.4!" http://nubus-pmac.sourceforge,net

Roeder2001 Roeder,Michael. "How to Install Linux PPC on Power Macintosh 6100" http://www.sonic.net/~mroeder/beowoof/installingLinux.html

Abreu2001 Abreu, Paulo. "Step-by-step Cross-compiling the Kernel" http://lists.linuxppc.org/linuxppc-nubus/200103/msg00035.html

Gooch2002 Gooch, Richard. "Linux Devfs (Device File system) FAQ". http://www.atnf.csiro.au/~rgooch/linux/docs/devfs.html

deGoede1999 de Goede, Hans. "Root over NFS clients & Server HOWTO" http:/www.linuxdoc.org/HOWTO/Diskless-root-NFS-HOWTO.html