Running Debian Testing on a Powerbook 2400c

A Little Background

My original intention with this Powerbook 2400c was to run Mac OS X Jaguar on it. XPostFacto has recently fixed the issue of running Jaguar with 604/603 CPUs and there is a nice source of 96MB memory modules on eBay. If I could find a cheap G3 accelerator I would really have a nice setup. At this point, any of you who have tried such a thing are probably chuckling to yourselves. The genesis of my quest started with a 2400c off eBay (which I no doubt paid too much for) but it was in quite nice shape, 80 MB RAM, a battery that would hold a two hour charge, and came with floppy drive and cables. I had a 10 GB laptop drive lying around as well as a Linksys WPC11 802.11b wireless PCMCIA adapter and an old NE2000 compatible PCMCIA card. First off was to replace the stock 1.3 GB drive with my 10 GB drive. The 2400c is definitely a challenge to upgrade. Since this machine was to run OS X by way of XPostFacto, I thought the best way to partition my drive was 8 GB for OS X and 2 GB for MacOS 9.1. I really dislike MacOS prior to X. It seemed like an incredibly bad joke played upon the Apple faithful. Regardless, it was a requirement to get this thing going. Next on the agenda was to increase the memory to 112 MB through an eBay purchase. I quickly received my purchase in the mail and installed it (much easier than the hard disk thankfully). No dice. Memory test failure at boot. I reinstalled the original 64 MB with no problem. Back to the 96 MB module. No dice. Great, now I have to wait for a new module. When I sent the module back I was told that it worked fine. I had one of the few 2400cs that didn't work with the module (a total of two). My money was quickly and graciously refunded. Didn't help my quest much, though. About this time I discovered the true cost of the G3 upgrades. More than I was willing to pay (and more than I bought the 2400c for to begin with). Time to re-evaluate my plan.

I looked at what I had - a nice, small, laptop with 10 GB drive, good battery, nice screen (although a little tiny), and a moderate amount of memory at 80 MB. I already own a 12" Powerbook G4 and a G3 Lombard. The G4 is a dream with OS X, the G3 dual boots Linux and OS X for my in-the-field astronomy work with two batteries installed. Since I've already installed Debian on the G3, I knew it would run well with the limited resources of the 2400c. The G3 only had Debian stable installed which meant it had very old versions of the packages. Old but stable, hence its name. I usually run testing on my x86 machines as it fits the need of relative stability with more up-to-date packages. In fact, Debian testing is close to what other distros ship as commercial product.

Preparation

My plan of attack was to do a very basic install using the Debian PPC CD, then upgrade to testing over the network. Unfortunately, my wireless card isn't supported directly in the Linux kernel. It requires an additional source package to be compiled against the running kernel. If you don't yet have a wireless card yet, do yourself a favor and find one supported in the Linux kernel. The Orinoco cards appear to be safe bets. This is where my NE2000 compatible PCMCIA card came to the rescue. It is well supported and was quickly recognized when inserted.

Taking a step back here, I want to visit the disk partitioning scheme I employed. I left the basic 8 GB, 2 GB scheme I planned on for OS X. I still wanted to have the ability to run MacOS so I downgraded (upgraded?) my MacOS partition from 9.1 to 8.6 to spare myself the random crashes and lockups 9.x is infamous for. With the 2400c, you have to use BootX if you want to share the drive with Linux and MacOS. Something to do with the transition from Old World to New World firmware. If you don't feel the need to share, you can make your 2400c boot straight into Linux, skipping the MacOS->BootX step. BootX comes on the Debian CD. It is both an extension and a control panel app. While booting, you can select MacOS or Linux when the BootX extension is loaded (it is the first extension loaded). The caveat is that the kernel image has to reside on your MacOS partition. An interesting side-effect of my original partitioning was that there was 100 MB of free space left on my hard drive. I had used the Apple disk setup from 8.6 and thought I had used up the entire drive. Apparently not. So I employed this extra free space as my swap partition. In retrospect, I would probably have made this a little bigger. A good rule of thumb would be to have 256 MB of combined RAM+swap although I have yet to run out of resources.

The Installation

The Debian install process on PPC is just like every other Debian install. It is text based and verbose, but not particularly difficult. You boot the Debian PPC CD by plugging in a CD ROM into the SCSI port of the 2400c and holding down the C key while turning on the power. It seems you have to hold down the C key for quite some time. There are numerous places that help out with Debian installations. The idea is to install only the required minimum. Don't install any of the worksets as it will just take more time.
note: write down the partition entries when running fdisk!

Once the basic install is complete, you will reboot. You will reboot into MacOS if you are using my partitioning scheme. On the PPC CD, copy the BootX directory over to your MacOS partition. You will need to drop the extension into the System Folder and the BootX.App into the Control Panel Folder. Move the Linux Kernels folder to the System Folder. Restart. When MacOS starts to load the extensions, it will pop up the BootX dialog. You will need to set the kernel image to 2.4.18-powerpc and the root partition to what you created in fdisk. Click on Save Prefs and click on Linux. Your machine should boot into Linux multi-user for the first time.

For now, login in as root. The first file to edit is /etc/apt/sources.list. Edit it to match this:


deb http://http.us.debian.org/debian testing main contrib non-free
Next you want to make sure your /etc/pcmcia/config.opts looks like this:

#
# Local PCMCIA Configuration File
#
#----------------------------------------------------------------------

# System resources available for PCMCIA devices

include port 0x100-0x4ff, port 0x800-0x8ff, port 0xc00-0xcff
include memory 0x80000000-0x80ffffff

# High port numbers do not always work...
include port 0x1000-0x17ff

# Extra port range for IBM Token Ring
#include port 0xa00-0xaff

# Resources we should not use, even if they appear to be available

# First built-in serial port
#exclude irq 4
# Second built-in serial port
#exclude irq 3
# First built-in parallel port
#exclude irq 7

#----------------------------------------------------------------------

Now, depending on your kernel configuration, you may want to install some kernel modules at boot time. Run modconf and select from the kernel/drivers/macintosh modules all that look good. I installed all of them. Go to the kernel/drivers/pcmcia modules and deselect all the ones selected. Then select yenta_socket.

Next, check your networking options in the file /etc/network/interfaces. Mine looks like this:


# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
	wireless_mode managed

You may or may not need the wlan0 description. It doesn't hurt to leave it in. Type "/etc/init.d/pcmcia restart" to re-init the pcmcia subsystem. Plug your network adapter in and watch the messages to make sure it is identified correctly. If everything went OK, you should be able to type "ifconfig" and see your network connection up.

Upgrade to Testing

Using the power of the Debian APT package manager, type "apt-get dist-upgrade" and watch your machine upgrade itself. If you only installed the basic system, this shouldn't take all that long. Once completed, its time to install some packages. I prefer to use aptitude to manage my packages. It is the next-generation of dselect, the original Debian package manager interface. The first package to install is a newer kernel. I found the kernel from stable, 2.4.18, to have problems on my 2400c. As of this writing the current 2.4.x kernel image is 2.4.27. I am more familiar with this generation of kernel than the newer 2.6.x generation and haven't upgraded due to my wireless adapter. For the purpose of this exercise, I will continue with the 2.4.27 kernel. You will need the kernel-image-2.4.27-powerpc-pmac and the kernel-modules-2.4.27-powerpc packages. During the install process, APT will ask you whether to install a boot block using QUICK. Answer "n" to this. The most difficult aspect of upgrading the kernel is to get the kernel image over to your MacOS partition where BootX can load it. Linux has support for the HFS+ filesystem so you can type this to mount your MacOS partition:

mkdir /mnt/macos
mount /dev/hda8 /mnt/macos -t hfsplus
cp /boot/vmlinux-2.4.27-powerpc /mnt/macos/System\ Folder/Linux\ Kernels

note: the /dev/hda8 may be different for you. You did write down the partitions while installing, right?

restart the 2400c. When BootX comes up, don't forget to select the new kernel and Save Prefs!. Start Linux. Login as root again and type "uname -r" to ensure you are running the new kernel. Check for your network connection.

The Basic Packages

At the moment you have a very nice linux terminal. Not particularly useful, however. That is about to change with the ability to access thousands of available packages through Debian. Fire up our old friend aptitude and lets start selecting some important first packages. First, will be the xserver-xfree86 package. A shortcut to search for packages uses the "/" key. Press "/" and start typing the package name. aptitude will show matches real-time. Press "return" when the package you want is highlighted. Press "+" to select the package for installation. Here is a list of good packages to install:

gdm
gnome-desktop-environment
pbbuttonsd
gtkpbbuttons
powerprefs
wmaker
wterm
mozilla-firefox
mozilla-thunderbird

Any dependencies will automatically be added to your downloads. Go ahead and install the packages. This will take some time, as there is a lot to get.

Configuring The X Server

The 240cc has a Chips and Technologies VGA core found in many of the laptops and PCs of its era. As a result, X support is quite good. Only one tweak had to be made to fix a bug in the color expansion code. You can simply cut and paste this as your /etc/X11/XF86Config-4 file:


# XF86Config-4 (XFree86 X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the XF86Config-4 manual page.
# (Type "man XF86Config-4" at the shell prompt.)
#
# This file is automatically updated on xserver-xfree86 package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xfree86
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following commands as root:
#
#   cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom
#   md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum
#   dpkg-reconfigure xserver-xfree86

Section "Files"
	FontPath	"unix/:7100"			# local font server
	# if the local font server has problems, we can fall back on these
	FontPath	"/usr/lib/X11/fonts/misc"
	FontPath	"/usr/lib/X11/fonts/cyrillic"
	FontPath	"/usr/lib/X11/fonts/75dpi/:unscaled"
	FontPath	"/usr/lib/X11/fonts/100dpi/:unscaled"
	FontPath	"/usr/lib/X11/fonts/Type1"
	FontPath	"/usr/lib/X11/fonts/CID"
	FontPath	"/usr/lib/X11/fonts/Speedo"
	FontPath	"/usr/lib/X11/fonts/75dpi"
	FontPath	"/usr/lib/X11/fonts/100dpi"
EndSection

Section "Module"
	Load	"GLcore"
	Load	"bitmap"
	Load	"dbe"
	Load	"ddc"
	Load	"dri"
	Load	"extmod"
	Load	"freetype"
	Load	"glx"
	Load	"int10"
	Load	"record"
	Load	"speedo"
	Load	"type1"
	Load	"vbe"
EndSection

Section "InputDevice"
	Identifier	"Generic Keyboard"
	Driver		"keyboard"
	Option		"CoreKeyboard"
	Option		"XkbRules"	"xfree86"
	Option		"XkbModel"	"macintosh"
	Option		"XkbLayout"	"us"
EndSection

Section "InputDevice"
	Identifier	"Configured Mouse"
	Driver		"mouse"
	Option		"CorePointer"
	Option		"Device"		"/dev/input/mice"
	Option		"Protocol"		"ImPS/2"
	Option		"Emulate3Buttons"	"true"
	Option		"ZAxisMapping"		"4 5"
EndSection

Section "Device"
	Identifier	"Generic Video Card"
	Driver		"chips"
	Option		"UseFBDev"		"true"
	Option		"XaaNoCPUToScreenColorExpandFill"
EndSection

Section "Monitor"
	Identifier	"Generic Monitor"
	HorizSync	28-38
	VertRefresh	43-72
	Option		"DPMS"
EndSection

Section "Screen"
	Identifier	"Default Screen"
	Device		"Generic Video Card"
	Monitor		"Generic Monitor"
	DefaultDepth	16
	SubSection "Display"
		Depth		1
		Modes		"800x600"
	EndSubSection
	SubSection "Display"
		Depth		4
		Modes		"800x600"
	EndSubSection
	SubSection "Display"
		Depth		8
		Modes		"800x600"
	EndSubSection
	SubSection "Display"
		Depth		15
		Modes		"800x600"
	EndSubSection
	SubSection "Display"
		Depth		16
		Modes		"800x600"
	EndSubSection
	SubSection "Display"
		Depth		24
		Modes		"800x600"
	EndSubSection
EndSection

Section "ServerLayout"
	Identifier	"Default Layout"
	Screen		"Default Screen"
	InputDevice	"Generic Keyboard"
	InputDevice	"Configured Mouse"
EndSection

Section "DRI"
	Mode	0666
EndSection

X also relies heavily on two and three button mice. You have the option of emulating the second and third mouse button using any key on the keyboard. I chose the command and enter keys on either side of the spacebar as they aren't really useful for anything else and are nicely located near the trackpad. To get them working as mouse buttons, edit the file /etc/sysctl.conf to look like this:

#
# /etc/sysctl.conf - Configuration file for setting system variables
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
#net/ipv4/icmp_echo_ignore_broadcasts=1

# enable emulation for 2+3 mouse buttons
dev/mac_hid/mouse_button_emulation=1
dev/mac_hid/mouse_button2_keycode=0x7d
dev/mac_hid/mouse_button3_keycode=0x60

You can change the emulated keys to anything you want. Run "showkeys" to spit back the scancode for any key you press.

The X server has extensions that provide for very high quality font anti-aliasing. This is a crucial technology for the 2400c as it allows low resolution fonts to be rendered in a way as to remain very legible. This lets you see more information on the screen without having to guess what character the black blob on the screen represents. Currently, both the Gnome2 desktop and KDE support font anti-aliasing, as well as apps compiled against the GTK+ 2 libraries. This covers most common apps like FireFox and ThunderBird.

Power Management

Power management under Linux is what separates the 2400c as a really useful tool from a neat toy. The pbbuttonsd powerbook management daemon and its associated configuration application powerprefs set the 2400c apart as one of the best supported laptops under Linux. The only feature I have problems with is the screen brightness buttons. For some reason it trashes the color depth mode of the X server. It changes the brightness OK, but I have to switch to a virtual console and back (by way of ctrl-option-F1 and ctrl-option-F7) to reset the color depth. I also have to disable the idle screen dimming feature in powerprefs.

Final Configuration Thoughts

By default, your 2400c will start up the gdm graphical login. From here you can select your default desktop environment and configure gdm itself. If you followed my advice, then you installed the wmaker package which is the GNUstep WindowMaker window manager (which is a clone of OpenStep, the precursor to OS X). It has the benefit of being very lightweight and has a cool dock that allows applets to run inside. It also has a good keyboard shortcut editor that makes window navigation a breeze. I found the default Gnome desktop to be too slow and screen real-estate hungry. However, it is useful for configuring apps that use the Gnome and GTK+ libraries. I also configured gdm to use WindowMaker as my default environment and automatically log me in. Startup times are much faster than Gnome, but you'll rarely need to restart. If you have configured your 2400c correctly, it will stay up just like a newer Powerbook running Panther. Simply close its lid to put it to sleep, or just leave it alone until the idle timeout puts it to sleep.

Other Useful Packages

I also downloaded all the extras for WindowMaker all of which start with wm* to get some cool system monitors running in the dock. With such limited resources, its nice to be able to watch what is in use and make adjustments if needed. I use wterm instead of xterm because it is lighter weight and is in keeping with the GNUstep theme. A nice recent find is bluefish, a code editor targeted at HTML. It won't put BBEdit out of business, but it is the closest thing to a professional HTML editor I've found under Linux and it supports anti-aliased fonts.

What I Haven't Gotten to Work

Aside from the problem with the backlight control, the one thing that I really wanted to get working isn't. I'm talking about Mac On Linux. I tried all sorts of versions (including compiling my own) and get a zero page mapping failure when running "startmol --test." Anyone know why this is? I appear to be the only one with this problem. As much as I disklike MacOS, it would would like be running Classic under OS X. It could be useful every now and then.

Getting the WPC11 Working

I should note that there are many versions of the WPC11. I have the original using the Prism2 chipset. First, you need to download the source tar file: linux-wlan-ng-0.2.0.tar.gz. You then need to compile your kernel from source. There are Debian packages to make this easier, but you have to compile it - you don't have to install it. You then need to build the wlan-ng package, pointing it to the correct kernel source. You may also need the pcmcia-source package. I did run into a problem of mismatched compiler versions. I did have to install my compiled kernel because the Debian packaged compiler was a different version than mine and caused kernel faults when loading the wlan modules. After sorting everything out, I have to say it runs like a champ. Next is to do the CardBus modification and get USB working.