Linux DevCenter    
 Published on Linux DevCenter (http://www.linuxdevcenter.com/)
 See this if you're having trouble printing code examples


LinuxPPC 2000 on a Dual Boot G4

by Michael J. Norton
10/27/2000

Related Articles:

Interview: LinuxPPC's Jeff Carr - Who Runs Linux on the Mac?

LinuxPPC News (via Meerkat)


Previous Features

More from the Linux DevCenter

About 5 years ago, I started playing around with a little operating system called Linux. I was working in an IS department supporting HPUX minicomputers. One of the administrators there got me hooked. Over these past couple of years, I have seen Linux evolve from a practical little OS into what is now a true phenomenon.

What was once a Unix-geeks operating system is now drawing attention from people in all corners of computing: from those developing massively parallel computing architectures at universities to senior citizens at home wanting to get a handle on this Internet revolution. Among this diversity I've noticed that a noteworthy segment of users are attempting to install LinuxPPC 2000 on their PowerPC G4s. Because I happen to share the opinion that the G4 hardware is very appealing, I'm going to describe in laymen's terms how to perform a LinuxPPC installation on a Macintosh PowerPC G4.

Sure, documentation currently exists for this type of installation, with one caveat: You must wipe your curent hard drive. This wasn't too appealing to me since I need my Mac OS to play Quake Arena and Unreal. I preferred a more stable approach, and that was to set up LinuxPPC on a secondary ATA drive. This would leave my primary drive free, and I could still use Mac OS 9 to get out on the Internet and retrieve information as I ran into installation problems.

The approach of this article is that you can sit down and perform the entire install on one Saturday afternoon, or you can break up the install into incremental steps. I recommend taking incremental steps if you have never set up a LinuxPPC workstation before. This article breaks up the installation of a second ATA hard drive, partitioning the drive, and then installing the LinuxPPC 2000 software. Breaking the tasks up into these three steps helps relieve any frustrations you may encounter along the way. Take one evening to install a second ATA drive and get your system to boot properly. The next evening, partition and format the drive. And finally, install the LinuxPPC 2000 software. I gathered as much information as possible to minimize the onset of any unnecessary grief.

What you'll need for a G4 installation

Many popular flavors of LinuxPPC exist on media and on the Internet. My example will walk you through the installation of LinuxPPC 2000, available from linuxppc.com. A full install version is available for download from the LinuxPPC.org (not to be confused with linuxppc.com; both urls exist) ftp server. I strongly encourage you to purchase the LinuxPPC 2000 CD set for a mere $20 from the linuxppc.com secure site. An OS install CD is great to have in the event of installation problems or hardware failure. What could possibly go wrong?

A detailed How-To article on LinuxPPC installation for G4s is available on the LinuxPPC.com site. This is a fairly exhaustive explanation of installing LinuxPPC on the hard drive that came with your computer. This installation requires that you re-partition your hard drive and re-format. In a nutshell, this is a clean installation on your hard drive. All data and files will be wiped out and re-installed. Like most users, I wasn't that excited about wiping out my hard drive. A more subtle approach is to add a secondary drive to your G4 for LinuxPPC installation. I will walk you through the setup and configuration of LinuxPPC on a secondary ATA drive.

Adding a second ATA drive

Hard drives under 20G storage capacity are relatively cheap. I picked up a Quantum Fireball Plus LM Ultra-ATA 10G drive from outpost.com for $99.95. A 10G drive would provide the flexibility I needed to add two operating systems, Virtual PC Windows 2000 and LinuxPPC 2000, to my Macintosh G4 system. The additional drive also provided the means for installing and experimenting with other operating systems while not having to worry about my Mac OS 9 20G boot hard drive and the files I have on it. If any installation problems should occur, at least my system would still boot under its native OS. This is the bottom line reasoning for going with a second drive. A strong word of caution: I highly recommend that you back up all of your important files before you proceed with this endeavor. Your Zip drive and the stuffit utility should be sufficient for this task.

Popping open the G4 case

Apple should be complemented on the layout of the G4 case. I actually waited an entire week after receiving my hard drive before I installed it. Based on previous experience with other hardware upgrades, I determined that the wisest thing to do was to set aside one evening during the week to attack the problem of the new hard drive installation. I anticipated an evening of cursing and fighting my way through tangles of cables to install the new hardware. This was not the case. On the right hand side of the G4 case is a button. You press the button, and the whole right side of the case folds down and opens out. Every component in the G4 is easily accessible. I strongly advise you to open the manual, "Setting Up Your Power Mac," that was included with your G4. There is a section in there that clearly outlines how to disable the power to the G4 before attempting to open the case. The article titled "About Internal Storage Options" describes which bay the second ATA drive should be installed in. What isn't covered is how to configure the master-slave mode jumpers on your new ATA drive. You must configure your new ATA secondary drive as a slave drive. Hard drives typically ship in master configuration as default. Two master hard drives in your system will cause conflict, and your Macintosh will not be able to boot.

Configuring the ATA drive slave jumpers

Reference guides for your new hard drive are available online from the manufacturer. For my Quantum Fireball Plus LM 10G drive, I used the jumper settings at Quantum's website. Again, this is the jumper setting for a Quantum Fireball Plus LM drive. If you decide to use a Seagate or IBM drive, consult the manufacturer's site for the exact make and model. For the Quantum Fireball Plus LM installation, the document instructs you to remove all jumpers to place the drive in slave mode. Once you have set the jumpers accordingly, install the drive as instructed in the "Setting Up Your Power Mac" guide from Apple.

Partitioning considerations

You now have your second hard drive installed and your system boots normally. We need to go in and format the new drive for installation of LinuxPPC. My intentions for installing a secondary drive, as I stated, are for using operating systems other than Mac OS. This may be your first Linux installation or it may be your hundredth. If this is your first time for installing Linux, let's take a look at what needs to be done to your new hard drive.

The first thing we need to do is format your new hard drive. Before you can proceed, you must consider how you want to partition your new hard drive. My new ATA drive has a capacity of 10G. I wish to install two operating systems on this drive, LinuxPPC and Connectix Virtual PC Windows 2000. Having two operating systems means that my hard drive requires at least two different file systems. I must partition my hard drive to handle these two distinct file systems. Fortunately, for the sake of this example, Connectix Virtual PC Windows 2000 resides on the Mac OS file system. This means I can partition one big contiguous chunk of the hard drive to a capacity of 7G (an arbitrary value I choose for holding AutoCAD and Visio files) under the Mac OS HFS (hierarchy file system).

Linux requires a different file system and we must make some considerations in advance for these partitions. If you are just experimenting with a LinuxPPC installation, you will need to create a LinuxPPC boot partition, a "/" (root) partition, and a "/swap" (swap) partition. Lastly, you will need to allocate at least a 150M free-space partition. To sum up, you will need a bare minimum of four partitions for a LinuxPPC installation.

LinuxPPC boot -- Mac OS partition

Now let's take a look at partition size considerations for a LinuxPPC install. I mentioned you would need four partitions, bare minimum. These are the LinuxPPC boot, root, swap, and free space. The LinuxPPC boot partition is required for booting your Macintosh. Please take note that this is a standard Mac OS partition. The size of this partition, which we will use later in the install process as a special Mac OS system folder partition, is 50M .

Root and swap - A/UX partitions

Our next two partitions are "/" (root) and "/swap". These partitions require the A/UX (Apple Unix) file system partitioning schemes. Your "/" partition should be no greater than 2G. Although it can be larger, a good rule of thumb is to keep partition sizes for Linux no greater than 2G each. I allocated 2G to my "/" partition and I still have plenty of room to spare on my LinuxPPC file system for playing around with software downloads. This partition is of type A/UX root. More on this when we partition our hard drive with the drive setup utility.

We now need to partition a "/swap" (swap space) partition on our drive. This partition will be used by the LinuxPPC 2000 operating system. It is needed when you run memory intensive applications, such as X-Windows and GNOME. The operating system uses this partition to swap items between RAM and disk for optimizing memory utilization. A rule of thumb is to allocate a swap space of two times your system's total memory. My G4 was shipped to my doorstep with a memory capacity of 128M. I therefore allocated a swap space partition of 256M. This partition scheme is of type A/UX swap.

Apple free space

The Macintosh operating system, like the LinuxPPC operating system, requires that you leave a partition of free space on your hard drive. This space will be used by the operating system as it accesses files in the file system. For my 10G drive, I reserved less than 150M for free space.

In a nutshell, we will require at least four partitions for our LinuxPPC installation. Again, these are the Linux boot partition (50M Mac OS), Linux Root partition (~2G A/UX root), a swap partition (256M A/UX swap), and the free space partition (~150M Apple Extra Space). If you are going to experiment with this partition scheme on your system, you could set up three partitions using Apple's drive setup. The last partition, Apple Extra Space, isn't actually a partition we'll be setting up. I just want you be aware that at least 150M of free space needs to exist if you choose to carve up a lot of partitions on your new hard drive.

Formatting the hard drive

Partitioning and formatting your new hard drive for LinuxPPC is fairly simple. The LinuxPPC 2000 CD comes with a drive formatting utility called pdisk. I recommend using the Mac OS 9 drive setup utility. Since we are partitioning and formatting a secondary drive on our Macintosh G4, we can go ahead and use the drive setup utility found on your Mac OS boot drive under the Macintosh HD:Utilities:Drive Setup folder. Figure 1 shows the Drive Setup utility icon and its folder in the utilities folder location.

Drive Setup Utility icon.

Figure 1. Drive Setup utility icon.

Double-click the Drive Setup utility icon and launch the application. I have included a screen-capture of my Drive Setup utility in Figure 2. The information displayed in the initial window is a list of drives the utility discovered on my system. My Mac OS native hard drive, volume name, TheMatrix, is listed as type ATA, its bus ID is 2, and the ID of the device in the bus is 0. This shows the volumes on my 20G hard drive as it comes factory equipped in my G4. The second listing shows multiple volume names, untitled, LinuxPPC Boot, and so forth. The bus ID is still 2 and this device ID for bus 2 is 1. This is my second drive, which I installed and already partitioned for LinuxPPC. You'll notice that both hard drives share the same bus, since they are sharing the same drive cable. The first device on the cable is ID 0 and the second device, which is the new drive, is ID 1.

FigDrive Setup volume names and bus IDs.

Figure 2. Drive Setup volume names and bus IDs.

Your drive will probably show up with a volume name of untitled. If you installed the drive on the same drive cable as the first factory-shipped drive, your drive may also be set to bus 2 and ID 1 for this particular drive. Select this drive and then press the Initialize button as shown in Figure 2. You will see Drive Setup layer a new window over the previous Drive Setup window, titled Initialize, as seen in Figure 3.

Initialize the Drive Alert window.

Figure 3. Initialize the Drive Alert window.

From this alert window, select the Custom Setup button. We need to divvy up the drive into its new partitions. My second drive has more partitions on it than is necessary for a basic LinuxPPC installation. I do have a 50M Mac OS LinuxPPC boot partition, a 2G A/UX root partition, a 256M A/UX swap partition, and a 150M Apple Extra space partition, as well as a spare 50M Mac OS partition and a 7G Mac OS partition for Connectix Virtual PC Windows 2000. The accounting on my system works out to 5 partitions. Recall that the Apple Free Space isn't necessarily counted as a partition. I just mention this to keep you aware of its requirement to exist on your drive.

Once you have selected the Custom Setup button, as shown in Figure 3, a new window, titled Custom Setup, will appear. See Figure 4. This is the Mac OS 9 graphical interface for partitioning your hard drive. The interface is pretty flexible, and you can play around with setting up partitions. The Partitioning Scheme list box allows you to select the number of partitions you want for your new hard drive. If you don't know how many partitions you want, you can also experiment by typing in new partitions in the Volume Info field of the Custom Setup window. You can also start inserting partitions by selecting Mac OS Standard from the partition Type list box. You will not be able to insert the Name of the partition until after the drive is formatted. Enter a partition size of 50M in the partition Size field and create your LinuxPPC Boot volume as depicted in Figure 4. You can then select another contiguous chunk of your drive from the Volumes graphical partition display in the Custom Setup window and set up a new partition, such as your Linux root (partition type A/UX Root in the partition Type list box).

Custom Setup Window to create a LinuxPPC Boot Mac OS partition.

Figure 4. Custom Setup window to create a LinuxPPC Boot Mac OS partition.

Once you're satisfied with the partitioning scheme you have laid out, go ahead and format your new ATA drive. As a word of caution, make sure you aren't partitioning your Mac OS boot partition ATA 2 0. In theory, there should be a fail safe that the OS won't let you format the boot hard drive. But one can never be too careful. The drive you want to partition and format is ATA 2 1.

You can name your Mac OS volumes after the partition formatting is completed. Once the LinuxPPC Boot volume mounts, most likely it will be labeled Untitled, go ahead and rename the volume. Your A/UX partitions will not mount at this time, so don't get flustered if you don't see these volumes appear on your desktop. Please remember that A/UX and Linux are different file systems, and Mac OS doesn't understand these natively. When we install the LinuxPPC, we will format the "/" and "/swap" partitions as well as name them.

At this point in the venture, let's check our volumes and make sure all is well with our system. The Mac OS volumes you created should appear on the desktop. Try a warm restart on your system and make sure the system reboots properly. We want to make sure the Mac OS portion of our G4 is stable and operating properly.

Installing LinuxPPC 2000

A Mac OS LinuxPPC installer is provided on the CD and appears on the Mac OS desktop when you insert the LinuxPPC 2000 CD into your DVD. Do not install LinuxPPC 2000 using this installer. Finally, we are at the moment of truth. Insert your LinuxPPC 2000 Install CD into your DVD drive and once again restart your system. As the system shuts down and comes back up under a warm restart, hold down the 'c' key to boot your G4 off the DVD drive. The system will boot using the LinuxPPC installer. Please take note that for a G4, we are booting off the CD for installation.

As your system reboots, your machine will come up with a black background screen with green letters. This is okay. We are not booting Mac OS and you will not see the familiar boot screen. In green text you should see the system prompt, boot:, and a stroke of the TAB key will generate a list of appropriate responses to this request. What you want to type in at this prompt is the command install. The LinuxPPC graphical interface, X Linux Installer, will then execute.

X Linux Installer
Once the X Linux Installer window is visible on your screen, you may proceed with finishing the partitioning of your Linux volumes. You will see a window titled X Linux Installer. This window has the following options (buttons) available:

The choices highlighted above in bold text are the options that are currently available to you. Always select the Instructions if you are unsure of anything. Now is a good time to thumb through the instructions and get an idea of what lies ahead in the install process. Once you have thumbed through that, go ahead and select the button labeled Partition Drives. This action will launch a window titled "PerlDisk - V1.5". This is the graphical window you will use to partition the Linux root and Linux swap components of the LinuxPPC file system.

Partitioning with the Linux PerlDisk utility

Be careful what you select from this window. You can wipe out your 20G or 40G Mac OS boot hard drive from this window with the stroke of a button click. Direct your attention to the window labeled Drive Info. The first drive that is highlighted in this window is your Mac OS boot drive. It is labeled in the window using Linux device naming schemes. Note the drive is not listed as ATA 2 0, for your Mac OS boot drive, as it was labeled in the Mac OS Drive Setup utility. It is now labeled /dev/hda. As I warned, do not touch this drive! Select the drive /dev/hdb from the Drive Info list. This is the second drive, or drive ATA 2 1 we partitioned earlier using the Mac OS Drive Setup utility. Select drive /dev/hdb and the partition information we display in the view labeled "Partitions:" of the PerlDisk utility window.

Find the partition of Type Apple_UNIX_SVR2 and Size 2.0G; this is the "/" partition we created in the Mac OS Drive Setup utility. Recall we couldn't name partitions in the Mac OS Drive Setup utility, so go ahead and name the partition now using the Change Name list box. Select the "/" root name option for this partition. You have now named the partition "/" partition.

We need to do the same for our /swap partition. Select the partition of Type Apple_UNIX_SVR2 and Size 256.0M from the Partitions display. Now select the name "swap" from the Change Name list box.

You have now successfully named your LinuxPPC partitions. Select the Quit button from the menu to exit. You will be returned to the X Linux Installer window. This concludes our drive partitioning.

Formatting and mounting LinuxPPC partitions

The partitioning of the "/" and "/swap" partitions is now completed. The next objective we need to complete is formatting and mounting the partitions. From the X Linux Installer window, double-click the "Select Partitions" button so you can begin formatting your partitions for the Linux file system. A new window, titled "Mount Partitions and Set Swap," will appear. Once again, this utiltiy is also capable of wiping out your Mac OS boot disk. Do not select to format anything with the partition label of /dev/hda. This is your Mac OS boot drive. I repeat, do not format anything on this device!

Select the partition in field Partition of ID /dev/hdb(some number) with the partition Name "/". This is the Linux root partition. It is a good idea to write these device numbers down somewhere. You will need to know this device ID when you configure the yaboot.conf file for your LinuxPPC Boot Mac OS volume. Select the check box to the right of this window to format the partition. If you fail to select the check box, the Linux installer will attempt to install software on the unformatted drive. If you see a lot of installation errors on your software install, it may be because you forgot to check this simple, harmless-looking little square button labeled "Format." You will need to select the radio button labeled "mkswap" for your swap partition as well. Do not select any other format button. This utility will wipe out your drives if you don't pay attention to what format buttons you are selecting. Only format your Linux partitions, leave the free space and Mac OS partitions alone!

Once you're confident of your formatting scheme, select the button labeled "Format and Mount." You are now on your way to installing your LinuxPPC 2000 software.

LinuxPPC 2000 software installation

Once your Linux partitions have been formatted and mounted, you are now ready to install the LinuxPPC software. Select the button labeled "Choose Packages" from the X Linux Installer window. If you want, you may select to install all the packages. The only exceptions may be the language packages such as Chinese or Japanese, depending on your individual needs.

You're now on your way! The Linux package installer will copy the files onto your system. Once you set your system password, you will be prompted to reboot. Your G4 will not reboot into the LinuxPPC 2000 operating system. There are still a few things we must do under Mac OS before this can occur.

Setting up the G4 for LinuxPPC Boot

When you are prompted to reboot your system go ahead and do so. Do not hold down the 'c' key this time. Let the G4 reboot into its native Mac OS. There are some things we must do to allow the G4 to boot with LinuxPPC. We are going to set up the G4 for dual boot, a nice little thing to have when you don't exactly want to completely abandon your Mac OS operating system, as would be the case if you formatted your factory-shipped drive for LinuxPPC.

LinuxPPC_Boot folder.

Figure 5. LinuxPPC_Boot folder.

Once the system boots up in Mac OS 9, launch your native web browser. There is a file we need to retrieve off the Internet. The files we require are the LinuxPPC boot software for the G4. In LinuxPPC-nese, the G4 and newer iMacs are referred to as New World ROM machines. You will need to download the file LinuxPPC_Boot.sit from the linuxppc.org ftp server. This is a stuffit file; it will download and unstuff to your desktop as a folder titled LinuxPPC_Boot, the contents of folder as shown in Figure 5.

Setting up the LinuxPPC boot volume

This folder contains a special System folder. Your original factory-shipped 20G hard drive will retain its original System folder. The System folder found in the LinuxPPC_Boot folder needs to be copied over to the 50M LinuxPPC Boot Mac OS volume you created earlier. Essentially, just perform a Select All operation on the contents of the LinuxPPC_Boot folder and drag them over to the LinuxPPC Boot volume. Your LinuxPPC Boot volume should resemble the contents in Figure 6.

LinuxPPC Boot volume.

Figure 6. LinuxPPC Boot volume.

From this figure you can see my empty LinuxPPC_Boot folder from which I dragged all the contents onto the root level of the LinuxPPC Boot volume. The two important items are the secondary System folder and the kernel "vmlinux.2.2.15pre3," which is required for New World ROM machines.

Blessing the new Finder

Once you have installed the new System folder on the LinuxPPC Boot volume, we will need to bless the Finder. Open the new System folder (the contents of this folder are shown in Figure 7), and examine the system files.

LinuxPPC Boot System Folder.

Figure 7. LinuxPPC Boot System Folder.

Four important files reside in the LinuxPPC Boot volume System folder. The first file is the new Finder, which is required for booting a G4 under Linux. The second file is the MacOS ROM folder for New World machines, the third file is the special System file, and the fourth file is the yaboot.conf configuration file.

There is a process called blessing the Finder found in the LinuxPPC Boot System folder. This involves dragging the Finder out onto your desktop and then back into the LinuxPPC Boot volume System folder. Once this is done, the new Finder is considered blessed.

Configuring the startup disk in the control panel

To boot LinuxPPC from the second ATA drive, you must configure this as the boot device. This operation can be accomplished using the Startup Disk control panel. My factory-shipped ATA drive, volume name TheMatrix, is my standard Mac OS boot device. However, for booting into LinuxPPC, I must select the LinuxPPC Boot volume as my startup device, as shown in Figure 8.

Configuring the LinuxPPC Boot volume as Startup Disk.

Figure 8. Configuring the LinuxPPC Boot volume as Startup Disk.

Do you Yaboot?

You will need to configure the yaboot.conf file in your LinuxPPC Boot folder. This file contains the set of instructions the boot process and kernel required to boot your G4 using LinuxPPC 2000. For booting a G4, here is the configuration file for yaboot.conf:

init-message = "\nWelcome to LinuxPPC!\nHit <TAB> for boot options.\n\n"
timeout = 50
default = linuxppc
image = vmlinux.2.2.15pre3
label = linuxppc
root=/dev/hdbnn <put your "/" partition device id here>
novideo
image = vmlinux_ibook
label = ibook
novideo

Remember the device name I told you to write down back when you were partitioning the root partition in the X Linux Installer? That device ID needs to be inserted into the yaboot.conf configuration file for the root= descriptor. It would look like /dev/hdb9 or /dev/hdb10, as examples.

Dual booting

Now you're probably wondering, how do you get back into Mac OS if you want to? When your system boots, hold down the "option" key. The screen will display your normal volume with a Mac OS boot volume on it, in my case, the volume TheMatrix. I can select to boot my G4 using this partition. In this manner, I can start up my G4 in Mac OS if I want to. The G4 under this configuration will always boot into LinuxPPC 2000 unless I intervene with the "option" key at time of startup. This gives the system a little flexibility in choosing which operating system you want to use. I usually leave my LinuxPPC workstation up for days on end, and I only reboot into Mac OS when I need to use Microsoft Office or make a new network drawing using Visio on Virtual PC Windows 2000.

Give it the boot!

By now you have worked hard setting up your LinuxPPC 2000 and you're probably anxious to boot your system. Check your yaboot.conf file once more for any obvious errors and double-check your Startup Disk control panel. If all looks well, give the system a warm restart. After rebooting, you should see the LinuxPPC 2000 logo screen with a login dialog box for user root. Go ahead and log in, you deserve it.

What could possibly go wrong?

A saying I frequently use at work that is synonymous to Murphy's Law is, "What could possibly go wrong?" I set up this guide so you could set up your LinuxPPC 2000 workstation in one afternoon or in incremental steps over a few evenings after work. If this is your first Linux installation, I recommend the incremental approach. Take it slow. The whole install may go very smoothly, or some problems may surface. Not to worry, there is an excellent e-mail support alias, linuxppc-user@lists.linuxppc.org. I found this list instrumental in gathering the details I have presented here.

If this is your first install, just be patient and take it slow. Follow the steps provided here incrementally. Using Linux is a lot like building an old hot rod: The project is never really ever finished. There is always so much you want to do to enhance your workstation. The first step is to install your operating system and to acknowledge the wealth of information that is available online using the LinuxPPC mailing list. Just tell the list you're new to LinuxPPC or this is your first install on a G4. The people on this list are all very helpful.

Michael J. Norton is a software engineer at Cisco Systems.


Discuss this article in the O'Reilly Network Linux Forum.

Return to the Linux DevCenter.

 

Copyright © 2009 O'Reilly Media, Inc.