LJ Archive

Linux on the PS/2

David Weis

Issue #37, May 1997

While running Linux on a PS/2 is not the usual choice, it is getting easier.

The PS/2 line historically has not been able to run Linux due to the Microchannel (MCA) Bus used in it. Technical specifications were difficult to get from IBM. There has been support available to run Linux on MCA machines since about 1994, but it was difficult to install and required much patching by the user. That situation has changed, and MCA machines are relatively easy to install. Make no mistake, though, if you plan to run Linux on your PS/2, you are still in for a challenge.

Supported hardware for MCA machines includes 3Com and SMC-WD Ethernet cards, IBM token ring cards, many SCSI cards and various other cards. Most lower-end PS/2s have ESDI drive controllers, which are not supported in the standard Linux kernel. Also, bus differences require the kernel to do other timing-related functions not necessary on either an ISA or a PCI bus.

This article gives fairly detailed instructions on installing Slackware on a PS/2 with an ESDI drive. It was tested on my 55SX with 4MB of RAM and a 60MB hard drive. The Slackware CD was NFS mounted from another machine through an SMC Ethernet card.

Note, this would probably not be a good first installation for anyone. It assumes familiarity with Slackware, and some steps normally performed by the the setup program must be done manually.

First, export the Slackware directories.

Before starting, as with any normal Slackware installation, you will need a boot disk, a root disk and one more disk with device files, a modified fdisk and a modified LILO. These files are available at ftp://glycerine.cetmm.uni.edu/pub/slackware/.

Begin by downloading ps2-boot.gz, color.gz and esdi_slack.tgz. ps2-boot and color must be decompressed; otherwise, you will probably get some errors on the boot. Next:

cat ps2-boot >/dev/fd0

Then, switch disks:

cat color>/dev/fd0
Then, switch disks:
cat esdi_slack.tgz >/dev/fd0
Be sure to label these disks.

Drive geometry detection does not always work, so you'll need to know your cylinders, heads and sectors. Below is a table for IBM drives.

size    command line
30 MB
60 MB   ed=58,64,32

Insert the Boot disk and turn on your machine. When you get to the LILO prompt enter ramdisk ed=58 (or 64 or 32—choose appropriate geometry). Watch the kernel messages go by to see if your hardware was properly detected. Your machine may seem to hang while resetting the ESDI drive, but it can take up to 15 seconds. Eventually, you will get a login prompt. Log in as root. Run fdisk /dev/eda (the first ESDI device). Delete all the partitions on the drive. Now you will need to make a root partition and a swap partition. For the 60MB drive, I recommend 50MB for the root and 8 for the swap partition. To set up the partitions, pick: new partition, primary partition, 1st primary partition, start at cylinder 1, end at cylinder 50. This is your root. Now pick: new again, primary partition, 2nd primary partition, start at cylinder 51, and end at cylinder 58. Also select “change the type of partition 2 to 82 (Linux Swap)”. Print the partition table to make sure there are no obvious problems. Check how many blocks are in the swap partition, because you will need that information later. With the numbers above it should be 8192. Go ahead and write it to disk.

If your machine is like mine, it doesn't have a lot of RAM installed. In order to run the setup program you will need to activate the swap partition. To do that, run mkswap /dev/eda2 (number of blocks). After some disk activity, run swapon /dev/eda2. Now your machine is ready for the setup program.

Run setup, the Slackware install program. Choose to add a swap partition. It will find the /dev/eda2 partition itself. Be sure to pick “no” when asked to run mkswap or swapon. Running these twice will cause problems. Now select the target device. Once /dev/eda1 is located, you will need to format this partition. Accept the defaults you are given. After a while, you will be asked about installation media. I have chosen NFS, because I am allergic to swapping floppies, but you can try it if you want.

In order to do an NFS installation, you will need an IP address for your machine and the machine with the Slackware disks on it. You will also need to know where the files are located on the mount. If you have mounted a CD containing Slackware on /cdrom with the disks in distributions/slackware, you would export the /cdrom/distributions/slackware directory. In the event you don't have a CD, look forward to downloading. I recommend installing the A and N series for now. It is unnecessary to install any kernels or source, since they won't run on this machine. Go take a break while the installation program is running—brag to your friends about what you are doing, have a pop, etc.

When that step is completed, you are asked to install LILO. Do not do this yet. Follow the normal steps until you are asked if you want to exit. Go ahead. The setup program does not correctly set up the /etc/fstab and /etc/lilo.conf files, so you need to do that yourself. Printed below are the proper commands to type at the shell prompt. Note the append line is the one you first typed with the boot disk.

cat <<EOF >/mnt/etc/lilo.conf
        append="ed=cyl,head,sec"
        boot=/dev/eda
        vga=normal
        ramdisk=0
        timeout=50
        prompt
        image=/vmlinuz
                root=/dev/eda1
                label=linux
                read-only
EOF

Mount the boot disk you used to start the machine. You can use the /cdrom mount point, like:

mount /dev/fd0 /cdrom
Copy the kernel from the floppy disk to the hard drive:
cp /cdrom/vmlinuz /mnt/vmlinuz
The LILO installed by setup does not recognize the major device number 36 that the ESDI drives use, so at this point, get out the disk with esdi_slack.tar.gz on it, put it in the floppy drive and type:
cd /mnt
tar zxvf /dev/fd0
You will get some error messages, but ignore them. To install LILO, type:
lilo -r /mnt -C /etc/lilo.conf
The arguments tell LILO the disk with the configuration is mounted at /mnt.

The file system table, /etc/fstab, is still not set up correctly, so you will also need to execute:

cat <<EOF >/mnt/etc/fstab
/dev/eda1       /       ext2    defaults 1 1
/dev/eda2       none    swap    swap    0 0
none            /proc   proc    defaults 0 0
EOF

At this point the system is ready to be rebooted. Be sure to unmount the floppy and press CTRL-ALT-DEL. If the machine does not reboot after about a minute, you will need to cycle the power yourself. Be patient with your system. The ESDI drive is pretty slow. The system should reboot into LILO and start up Linux.

This is still not an exact science. You may have troubles with the partitioning depending on how the drive was formatted before. I've found installing DOS on it will usually make the drive conform to the cylinders, heads and sectors you enter on the append line instead of the physical geometry.

References

David Weis (weisd3458@uni.edu) is a computer science student at the University of Northern Iowa. His favorite things to do include spending time with his girlfriend and solving problems using Linux.

LJ Archive