Tuesday, April 04, 2006

Ubuntu on a PowerBook 3400c

I'd just like to report that I've been casually (meaning: it has been distracting me for over 24 hours) trying to install Ubuntu Linux on a Macintosh PowerBook 3400c. I'm not a Mac user, so I've been learning a lot of new things. This Mac was recently given to me, and was lacking a System CD (that would be the Operating System, or Mac OS). It falls in the family of "Old World" macs, running a PPC (PowerPC) processor but not so old as to use the antiquated 68k processor. It isn't new enough to run OS X.

I have had numerous challenges in this process. First of all, I had no way to boot off of a CD, since I was lacking any bootable Mac CD. So I boldly decided to force edit the partition table to create enough free space for my Linux install. I had made the wild guess that since I was using a forceful hackerish type of program to do it "hot" (while the partition was mounted), that it would not actually erase the data on the drive, and I might still have a bootable System, since I theorized that the System was the first thing installed and would therefore be earlier on the disk.

Boy, was I wrong. It looked fine at first, but upon a reboot I got a blinking question mark on a disk.

After numerous hours of attempting all sorts of things, I managed to find a Macintosh "Disk Tools" for Mac OS 8.5 bootable floppy image. I used a raw image writer to write it to a floppy. I probably had to decode it from hqx or macbinary first, but I forget (I've had to do this so many times to so many files, that it is all a jumble in my head).

As a side note, I should mention that Macintosh files use two forks, a "data" fork and a "resource" fork. MacBinary is a way to stream these two forks together into a single file with a wrapper to tell it what is what. BinHex (hqx) is the same thing, but seems to create a file suitable for emailing (low ASCII only). The end result: You must turn a file into a MacBinary .bin file or an .hqx before it can be stored on a PC or Linux partition, or else you lose an entire fork of the file and end up with nothing useful, and you must undo this whenever you've put a file back onto the Mac in order to reconstitute it to a usable format. This of course does not apply to common interchange formats like .jpg, .zip, or .txt where all the content resides in only one fork anyway.

So I booted my PowerBook 3400c from the Disk Tools. I was able to use Disk First Aid to do ... something. Then I used Disk Setup to Initialize the hard drive, which finally took on the partitioned size I had selected before. So my partitioning job was actually fine, I probably should have just done it after I booted off the Disk Tools disk, instead of before. :-)

I dragged the System Folder and Friends (the entire Disk Tools, actually) onto the hard disk, and now I had a bootable system using System 8.5DT (DT = Disk Tools), which is sort of a hackerish solution because every time I boot it tells me that the version of System I'm running was intended for boot from a floppy and I have to click OK. I can work around this later, I believe. If you own a PowerBook with the proper System installer, using that should alleviate this problem.

At any rate, we've partitioned the drive, and installed Mac OS onto a small partition, I used 250MB because I wasn't sure how much I was going to need to do on the Mac side. Don't touch the other 7 or 8 partitions, they are important Mac things that I have no clue about, you are only interested in lowering the size of the Apple HFS volume. So, I had 1.7G remaining for my Linux, and I left it unpartitioned for the moment.

Next, I found that I could not access any CD-ROM discs. Bother. So, I had people help me, and found out that I needed to install the Apple CD/DVD driver extension. At the time of this writing, it was living at this location, as an .img.bin file. I used hfvexplorer131 from my PC to create a Mac floppy containing it. This automatically translated it from MacBinary for me, so I'm left with just an .img file. Next, I discovered that I needed Apple's Disk Copy program in ordere to read an .img file. Disk Copy lives here, and has the advantage of being a self mounting image after you translate it from MacBinary.

So I click on the .smi file, open that up and install Disk Copy. Then I unmount the image, by dragging it to the Trash, because it won't actually finish the whole install while an image is mounted (since it is the thing that mounts images, circular logic!) After this, I was able to mount the .img file, and retrieve the small Apple CD/DVD extension which I then dropped onto my System Folder who magically migrated it into the Extensions folder.

I rebooted, and inserted a Macintosh CD. It mounted.

Next, I needed to install BootX, a bootstrap loader that would allow Linux to boot on an Old World mac. BootX lives here, and suffered from the problem that it was too new of a .sit file for the only version of StuffIt I could find for a Mac that old to work with. So I installed Aladdin StuffIt Expander for Windows, and unpacked it "with options" telling it on the Cross-Platform page to use MacBinary for all of the files. I ended up with a BootX 1.2.2 folder, which I then burnt onto a CD to load into the PowerBook.

No luck. Apparently, Mac can't read Joliet CD's, and I'm not sure what they do read natively, so I found an extension that lets Mac read Joliet CD's. It was located here, and I ran into the same problem with too new of a .sit file, so I did the same deal, but it fit onto a floppy with hfvexplorer so I didn't have to burn another CD.

I installed the extension, rebooted, and voila! My BootX CD was now available. I grabbed the BootX folder and copied it to the hard disk, and used StuffIt Expander for the Mac to reconstitute the forked files. Unfortunately, StuffIt was very difficult for me to find, and I didn't retain the link. Maybe someone reading this can comment on where to get the old version of it if they know. I had to reconstitute the BootX files one at a time to get the ones I needed. I was mostly interested in the BootX App and the BootX Extension. I dropped the App into System Control Panels (although I'm not sure I needed to), and the Extension in the Extensions folder. Also, move the Linux Kernels folder into your System Folder, you'll need it later.

Next, I put the Ubuntu Linux Mac disc into my CD-ROM drive, and went into the Install folder. I found a powerpc folder with the vmlinux and initrd.gz files in it.

I copied the vmlinux into the Linux Kernels folder on my hard disk, as well as the initrd, and then I ran the BootX App. Select the ram disk (initrd) in the options screen and check the box to use the ram disk, pick the kernel from the drop down, leave options blank and click Linux.

A window frame should shrink, the screen should go black, and after a while, text should appear scrolling on the screen and the Ubuntu installer will open to a blue screen with a language selection.

Unfortunately, I had BootX fail to go to the black screen a couple times. I was persistent, and it has worked ever since then. I'm not sure what it was.

The Ubuntu install went pretty well. When it got to the partitioning screen, I selected Manual Partitioning and made a swap disk of 150MB from the unpartitioned space (usage: swap), and also made an ext3 Linux partition with the remainder of the space (mount point "/").

I continued with the install. It detected my network and Internet connection, and everything installed smooth. When you get to the screen that talks about a bootloader, you'll need to manually intervene with Option+2 and press Enter, then do the following to copy the new kernel over to your Mac partition. Replace hda9 with wherever your Mac HFS partition is. You'll know you got it right when the mount command doesn't complain, and you can see your Mac files by doing ls /m :-)

mkdir /m
mount -t hfs /dev/hda9
ls /m
mkdir /m/boot
cp /boot/* /m/boot
umount /m

This should get everything we will need for later booting over to the Mac side.
Option+1 flips back over to the installer interface, where we will continue by pressing enter. Eventually you are asked to remove your install media from the CD Drive. Do so, and reboot.

I was a little sketchy about whether the BootX extension was actually working at Boot time, so I clicked MacOS manually and ran the BootX App after start-up to boot into the system again. But FIRST:

Copy the Kernel from your boot folder (the file starting with vmlinux- and having -powerpc in the name) into the "System Folder:Linux Kernels" folder.

Now, I don't remember exactly what I did next, but it involved picking one of the two initrd's combined with one of the two kernel's (vmlinux), and either setting or not setting the extra paramater as "root=/dev/hda10" (without the quotes, replacing hda10 with the Linux partition you used). This gives you only eight possible options to try, so figure out which one works to get you into the next step -- where you get back to the Ubuntu blue installer screen and install the packages that have been copied.

My intuition tells me I did the new kernel (with the number and powerpc) and the OLD initrd with the root option set. It didn't seem right to use the old initrd, but it seems like that was ultimately what was required. Any other combination gave me an ALERT! error and dropped me to a BusyBox shell.

After I got this going, I ran into a snag. Out of hard disk space. Ubuntu requires 1.8, and my Macintosh only had 1.7 left after my Mac partition of 250MB and my swap partition of 150MB.

I suck. I think I could trim down my Mac partition to 75MB and my swap to 50MB, but this would only be 1875 MB. Rumor has it, Ubuntu takes more than 1.8G during the install because it has to unpack some files while it is installing packages.

Also, the Ubuntu Mac disc did not give me a prompt to choose custom or server install as opposed to desktop, the way the PC version does. Otherwise, I'd be able to trim it down to ~400 MB hard drive requirement (and no graphical interface) easily. It says on the disc sleeve that that is an option, but I see no where to select it from.

I'll report back soon on progress.

0 Comments:

Post a Comment

<< Home