?

Log in

No account? Create an account
eyes black and white

Installing Linux on an old Powerbook 3400c

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 <<END
#! /bin/sh
sulogin tty12 &
END
	chmod a+x /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.

Comments

I don't remember if this works on Old Worlds - in fact I think it doesn't - but I had a lot more luck with yaboot than with BootX when I installed Debian on my clamshell iBook.

xf86conf

Hi, ive successfully installed debian woody and kubuntu 5.10 on a powerbook 3400c/240.

Had problems with the NIC under Kubuntu that im trying to sort out now, but anyway, heres a working xf86 config ;D

#start XF86Config-4.conf

Section "ServerLayout"
Identifier "Powerbook 3400c Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
FontPath "/usr/share/fonts/ttf"
FontPath "/usr/share/fonts/artwiz-fonts:unscaled"
FontPath "/usr/share/fonts/misc"
FontPath "/usr/lib/X11/fonts/100dpi/:unscaled"
# FontPath "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/misc:unscaled"
# FontPath "/usr/lib/X11/fonts/Type1"
# FontPath "/usr/lib/X11/fonts/Speedo"
# FontPath "/usr/lib/X11/fonts/75dpi"
# FontPath "/usr/lib/X11/fonts/100dpi"
EndSection

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

Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
Option "Protocol" "Standard"
Option "AutoRepeat" "250 30"
Option "LeftAlt" "Meta"
Option "RightAlt" "Meta"
Option "ScrollLock" "Compose"
Option "RightCtl" "Control"
Option "XkbLayout" "us"
EndSection

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
# Option "ZAxisMapping" "4 5"
Option "Protocol" "PS/2"
# Kernel 2.4 with devfs:
Option "Device" "/dev/input/mice"
# Kernel 2.2 :
# Option "Device" "/dev/mouse"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
# DisplaySize 256 184
HorizSync 119
VertRefresh 196
Option "DPMS"
Option "blank time""5"
Option "standby time""10"
Option "suspend time""30"
Option "off time""60"
EndSection

Section "Device"
Identifier "Card0"
Driver "fbdev"
# BusID "PCI:0:17:0"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultDepth 15
SubSection "Display"
Depth 1
EndSubSection
SubSection "Display"
Depth 4
EndSubSection
SubSection "Display"
Depth 8
Modes "800x600"
ViewPort 0 0
Virtual 800 600
EndSubSection
SubSection "Display"
Depth 15
fbbpp 16
Modes "800x600"
# ViewPort 0 0
# Virtual 800 600
EndSubSection
SubSection "Display"
Depth 16
fbbpp 16
Modes "800x600"
# ViewPort 0 0
# Virtual 800 600
EndSubSection
SubSection "Display"
Depth 24
Modes "800x600"
ViewPort 0 0
Virtual 800 600
EndSubSection
SubSection "Display"
Depth 32
Modes "800x600"
ViewPort 0 0
Virtual 800 600
EndSubSection
EndSection

#End Xf86Config.conf
hmmm
for some reason, my pb3400 freezes up after I click the BootX to load Linux!?
any pointers?

freeze

Did you configure bootX properly? What's the last message? Do you have enough RAM? Do you use the right kernel? The instructions painstakingly given worked for me.

Re: freeze

Well, first off the systm specs are: pb3400c, 144mb Ram, 2gb scsi hdd.

Partitioned the hdd with 200mb HFS extended - os9.1 installed and rest unallocated.
I've downloaded the latest vmlinux and initrd.gz from
http://ftp.us.debian.org/debian/dists/sarge/main/installer-powerpc/current/images/powerpc/netboot/
and configured BootX to use vmLinux kernel and initrd.gz as its ram disk with ~8K mem (default values)

System froze shortly after I click on the Linux on BootX, still whowing the boot os 9.1 logo!

Re: freeze

Did you install the BootX extension? Did you specify the right MacOS path to your kernel files (with correct case)? What happens if you try with a different kernel and/or initrd? It's 8192 KiB (8MiB), not 8 KiB. Did you get something wrong in the MacOS or Linux configuration for the video mode? I'm sorry, but debugging without seeing is impossible, so I can only give you very general advice: try to vary the parts until you identify the one that breaks. Ask for advice on a proper mailing list or IRC channel, whatever it is.

(Anonymous)

Re: freeze

Hi. Thanks for your work and documentation in getting linux running on powerbook 3400c's.

I have a 3400c with debian installed (and a pb wallstreet as well). For the 3400c, I've been struggling with updating my kernel. It works fine with 2.6.8. I'd like to get it running with 2.6.18 or newer. So far, no luck - with both BootX and quik, I can't get it up.

Do you know if there is an inherent limitation with the 3400c with regard to newer kernels, or should I keep plugging away at it with the hope that it'll work?

Thanks.

iamzaven _at_ yahoo _dot_ com
eyes black and white

April 2019

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930    

Tags

Powered by LiveJournal.com