Installing Linux on an old Powerbook 3400c

Sep 21, 2005 06:29


My friend Mahesh had this PB3400c with 80MB of RAM and 2.5GB of harddisk, that he wanted to transform into a jukebox. A few weeks ago, he asked me to install Linux on it, to play music off the network, and so I did. I learnt much more than I ever wanted to know about Macs, in the process, yuck, but it's incredible how Linux can turn an old computer into something able to use the latest intercommunication standards to do useful things. Here are steps to follow if you too want to install Debian GNU/Linux on a similar computer.
GUIDE TO INSTALLING LINUX ON A PB3400c

The PB3400c is an "Old Word" powermac, with a PowerPC 603 processor and Open Firmware 2.0.1. This particular PowerBook had 80MB of RAM and 2.5GB of harddisk. This guide might or might not apply to other slightly different models.

(*) The first thing you need to learn is how to get the Open Firmware prompt. You can get it by pressing the Ctrl-Option-O-F key combination right after the initial boot tone (you may cause a reboot by pressing Ctrl-Command-Power, Power being the upper right button with a left-bound triangle on the PB3400). The Ctrl-Option-O-F combination doesn't work everytime, so try again. Note that it's Ctrl-Option, and not Ctrl-Command (as in the reboot combination) or Option-Command or anything.

(*) When you're at the prompt, you have an IEEE 1275 Open Firmware, including a standard FORTH interpreter. Useful commands include the following:
printenv will show the environment variables, and their current AND default value, should you want to reset them. You can change them with command setenv followed by name and value (without quotes or anything, just a space separator after setenv).
ls will show the device tree
devalias will show nicknames for some devices. THIS IS IMPORTANT INFORMATION THAT YOU'LL HAVE TO USE LATER WHEN SETTING UP YOUR BOOT-LOADER. So write it down. For instance, I learned that my mac's internal hard-disk had this lovely name: ata0/ata-disk@0. Obviously YMMV. Since you will want to have the OF prompt everytime you boot, and until you get it right, you may
setenv auto-boot? false Note that you can exit to MacOS with the command
bye

(*) Now, you'll have to boot on a working MacOS CD (the OF command is bye).

(*) When you're there, you should repartition the internal disk with Disk Setup. Make the first partition 256 MB to hold a full MacOS 9 installation plus BootX and stuff. Make it more if you want to install MacOS 9 applications (for use under e.g. MOL). Don't make it less unless you have time to spend trimming MacOS. The rest of the disk you can put in a large single partition (for a total of two partitions), or more partitions, at your leisure -- these partitions will have to be deleted and/or reconfigured when you install Linux, only the first one will remain.

(*) Install the latest MacOS you can. MacOS 8.5 was not good enough for me (no tools to access the internet), and the MacOS 9.0 CD refused to boot, so I first booted on the 8.5 CD and installed 8.5 on the extra partition, then booted on the harddisk and installed OS 9.0 to the 256MB partition. I had to select the 256MB partition as the startup disk using the control panel "Startup Disk".

(*) Now boot into MacOS 9. Using IE 4.5, download Debian's net-installer images (vmlinux and initrd.gz). and bootX (which itself requires Stuffit Expander 5 or later to be expanded).

(*) Configure BootX to boot into the debian installer: use vmlinux as your kernel, initrd.gz as your ramdisk, specify an (uncompressed) size of 8192 KiB for the ramdisk. A typical location to put those files on your harddisk is :System Folder:Linux Kernels:.

(*) When you've booted into the ramdisk, configure the network (it's easier if you have DHCP on your network), and let it download the rest of the debian installer.

(*) When in the debian installer, do manual partitioning of your disk. If there's no satisfying partitioner in the menu, open a shell on the available VT and use pdisk.

(*) You may switch VTs with key combos Option-F1 to Option-F12 -- The Option key on the Mac keyboard is mapped to the Meta prefix in Linux, just like the "Alt" key on a PC keyboard. One of the VTs is waiting to open a shell for you. Thank you, debian.

(*) When in the partitioning program, leave the 256 MB MacOS partition as a fall back plan to be able to boot your computer (and as a toy for use with MOL) -- and configure debian to mount it as HFS on /macos. The rest of the disk is for Linux so you may delete any partition created by MacOS after that first one (don't touch any of the small magic system partitions that precede, however, or you may not be able to boot into MacOS anymore the day you have an emergency). Create a small partition ext2 partition for the quik bootloader (I used 25 MB, and currently over 10MB of it is used, so I'd say you should reserve 16MB for it, more if you like to compile and test new kernels), and have it mounted as /quik/. Create a swap partition (I also used 256MB on my 2.5GB disk, but use more if your disk is bigger). For the rest of the disk, do as you like. For a simple setup, create a single reiserfs partition for all of the disk. You might try something more elaborate, but there is nothing mac-specific here.

(*) When you're done partitioning, let the debian installer install its base system on your target root partition, but DON'T REBOOT UNTIL YOU'VE CONFIGURED quik. Instead, go to a shell prompt and be sure to get your system bootable. If you rebooted, well, you're back using BootX and going all the way to getting a shell prompt, maybe having to mount your disks manually.

(*) Using the shell prompt of the debian installer, you can chroot /target and run commands on your target installation system.
chroot /target

(*) For extra safety, copy debian's /boot/vmlinux and /boot/initrd.img to the linux kernel directory of your MacOS partition, for use with BootX.
cp /boot/vmlinux /boot/initrd.img /macos/System\ Folder/Linux\ Kernels/

(*) To configure quik, move /boot to your ext2 partition, and create a etc/quik.conf in that partition, as follows, using vi.
mv /boot /quik/ ln -s /quik/boot /boot mkdir /quik/etc vi /quik/etc/quik.conf

(*) vi is a tool that you'll want to be able to survive with if you do system administration, even though like me you might prefer emacs for serious editing. To learn how to survive with vi, ask google about a "vi cheat sheet". Alternatively, you can edit a file with cat, echo, and > and >> redirection.

(*) Here's the edited contents of my /quik/etc/quik.conf
timeout = 20 # two second timeout at the quik prompt before booting. Change at your convenience. default = debian # This can be overriden by the boot-file OF environment variable. As in setenv boot-file linux device = ata0/ata-disk@0 # This is my harddisk, as found on the device tree with ls and its shortened alias found with devalias. YMMV. partition = 10 # This is the ext2 partition where quik is. /dev/hda10 under linux. YMMV. init-message = "\n\ninsert your funky greeting message here...\n\n" root = /dev/hda8 # This is my / reiserfs partition YMMV. # This is my own custom-compiled kernel, it doesn't need a ramdisk. YMMV. Obviously not available when you first install debian image = ata0/ata-disk@0:10/boot/vmlinux-2.6.13 label = linux # This allows you to load debian's kernel image = /boot/vmlinux # This assumes the device and partition configured above #ramdisk = /boot/initrd.img # This line was not needed initrd = /boot/initrd.img # This line is requierd. append = "ramdisk_size=2048" # This line is required. 2048 was enough for me. You should adjust to fit the size of the *uncompressed* ramdisk. label = debian

(*) You can now install quik as follows:
quik -r /quik -v

(*) Run sync to ensure everything is written to disk
sync

(*) Now, reboot properly, with Ctrl-Alt-Del, or with reboot or with telinit 6. If you do it from the command prompt, don't forget to exit your chroot and umount those partitions.

(*) You can now reboot into debian (hopefully). At the open boot prompt, you may find the following kind of commands useful, though YMMV:
\ This will tell it openfirmware to boot on the hard-disk \ instead of the Apple ROM: setenv boot-device ata0/ata-disk@0 \ Useful to override the quik default. \ You may also specify the full path to a kernel, \ followed by command line arguments, if only you don't need a initrd. \ This refers to a specification from your quik.conf or an actual \ kernel file (without initrd) as in ata0/ata-disk@0:10/boot/vmlinux-2.6.13 \ Be sure to boot debian the first time. setenv boot-file linux \ Useful if quik refuses to work because the disk is not ready setenv boot-command begin ['] boot catch 1000 ms cr again boot

(*) When you're into debian, do your usual base system configuration.

(*) When you're done with this minimal configuration, you may choose to use testing instead of stable. If so, change your /etc/apt/sources.list to use testing instead of stable, then run
apt-get update apt-get -fumy dist-upgrade or you may keep stable if you want. You may also add contrib and non-free packages.

(*) You may install the packages you like. Here follows a command that will install all those I needed. YMMV obviously.
apt-get -fumy install less screen zsh xemacs21 units w3m centericq ssh rsync lftp cvs subversion ntpdate mtr-tiny ntp-simple dict clisp xchat xmms ratpoison openmcl xserver-xfree86 mpg321 mol ssh quik apt-file lynx cvsutils stow xterm gpm mozilla gaim xfonts-base ratmenu unzip ca-certificates recode busybox w3m-img sox aumix sudo xfce4 xbase-clients curl qiv xpdf fbi imagemagick imlib-progs menu xmms-lirc lirc-x lirc wireless-tools bzip2 hostap-source xfonts-75dpi xfonts-100dpi xfonts-base xfonts-bitmap-mule xfonts-intl-asian xfonts-intl-chinese xfonts-intl-chinese-big xfonts-intl-european xfonts-intl-japanese xfonts-intl-japanese-big xfonts-intl-phonetic xfonts-jmk xfonts-konsole xfonts-terminus xfonts-terminus-dos xserver-common xfonts-scalable smbclient smbfs smbc qemu fbset esound esound-clients mikmod xcolors xcolorsel madman moc mp3blaster ncurses-dev

(*) Packages I considered to install but didn't include kde alsamixer alsaplayer. Others that weren't available include msttcorefonts xserver-xorg. One issue I had to deal with was that debian was missing a depencency from apt-file to curl.

(*) When you're satisfied, you can setenv auto-boot? true at the OF prompt and then boot.

(*) The debian kernel was a pain to configure to boot, due to its initrd, which requires extra bootloader configuration: this took me a lot of attempts to get right, since it's under documented. More importantly, the debian kernel's initrd occupies precious kernel memory at runtime: debian tries to free the initrd memory after it's booted, but fails, because some kernel [mediabay] daemon uses it as its current working directory. This is BAD.

(*) Hence, to avoid those hassles, I compiled my own kernel. It works fine to me. I have a .config for kernel 2.6.13 on a PB3400, available among the files I publish (see below). Obviously YMMV so use make menuconfig to tweak to your heart's delight. Be patient as compilation of a modern kernel takes hours on this old machine.
cd /usr/src lftp ftp://ftp.bz2.us.kernel.org/pub/linux/kernel/v2.6/linux-2.6.13.tar.bz2 tar jxf linux-2.6.13.tar.bz2 cd /usr/src/linux-2.6.13 # cp /root/config-2.6.13 .config make menuconfig make vmlinux modules modules_install cp vmlinux /quik/boot/vmlinux-2.6.13 cp System.map /quik/boot/System.map-2.6.13 cp .config /quik/boot/vmlinux-2.6.13

(*) Because the machine takes so long to boot up, I added a file 00localboot in /etc/init.d, linked from /etc/rcS.d/S03localboot, that allows me to login on tty12 before the boot is complete.
ln -s ../init.d/00localboot /etc/rcS.d/S03localboot cat > /etc/init.d/00localboot <

(*) I had a lot of trouble getting X to work on this computer. See below the FAILURES section. I also have a XF86Config-4 available.

All the files I used are available on my site as a .tar.bz2 archive.
FAILURES

(*) Originally lacking a bootable MacOS CD, I tried to install from floppies downloaded on the net, as listed by gamba. It never worked, and never could. I managed to boot 8.5DT from a rescue disk, then install it on the disk, where I could boot it for a while: it issued a warning saying it was meant to boot on floppy everytime before booting and you had to click through it. Later on, it would refuse to boot unless you held the shift key while booting to disable extensions, even though it wasn't using any extension. From that 8.5DT, I could install a (unbootable) 7.5 system on one partition, then update it with the PB3400 7.6.1 update floppies. But the resulting system would fail miserably at boot-time, claiming it ran out of memory -- even though 80 MB is much more than required under 7.6.1. I never managed to configure it properly. Note that the Linux HFS Utilities (debian package hfsutils) were instrumental in managing to create floppies with stuff on it without a working MacOS computer.

Question: is it possible to copy system 8.5 from the floppy, then to install an upgrade? You might want to try if you don't otherwise have access to a bootable Mac CD.

(*) I tried to install YDL 4, booting with BootX. The graphical installer was very slow, and ultimately failed: 80MB was not enough RAM to run it to completion, even of a minimal install. The installer hanged after I was done painfully configuring it, with no visible indicator of progress or failure. Switching to the console, you could see the anaconda installer, written in python, dumped a backtrace: forking the mkswap process was unsuccessful because of lack of memory. Using mkswap on the command line worked fine, but was useless, because they forgot to compile swapon into busybox, so you can't add the memory to your starved system before it's too late and the installer is crashed. (And considering how the system is misdesigned, it could still have failed because it wouldn't expect the swap partition already having been configured and used).

(*) I wasted a lot of time trying to configure quik with an initrd before I got it right. The bootloader is under-documented. Understanding that OF's boot-file was overriding the quik default, that initrd= was needed but not ramdisk=, that append="ramdisk_size=8192" was needed, etc., took me a lot of attempts to figure out.
REMAINING ISSUES:

(*) The smbfs layer issues errors after some process uses it for a while (maybe due to byteorder discrepancy?). When it happens, mp3blaster must be killed and restarted. mocp (from the moc package) works great despite this problem.

(*) the xfree86 chips driver has lots of byteorder issues, I couldn't use it successfully.

(*) the xfree86 fbdev driver also has byteorder and palette issues, but is workable in 8bpp mode if you don't VT switch out of it and back (which breaks the palette).

(*) mocp, mp3blaster and other tools can't set sound via normal mixer, but aumix works fine. The main volume is the second line, though, named "Spkr". (Maybe the first line is for the external headset plug?)

(*) debian mistake: apt-file depends on curl, but the package doesn't say.

pb3400c, retrocomputing, code, linux, en

Previous post Next post
Up