A newbie's encounter with LinuxPPC

By A.C. Jorgensen

Note: This document was written as a comment to fill out version 1.0 of Ingvar's howto. As the howto today is in version 1.1, many of the issues noted here is changed and/or repaired.

Introduction

It all started with a couple of unknown "boxes" made by IBM. They turned out to be RS/6000-43p, type 7248 with a 1 GB hard disk. Years ago, I knew IBM used some special setup disks to come to "bios" functions. They had AIX installed, but I didn't have the original OS - disks. So, I had a visit at IBM's web site to locate any information I could get. Then I learned that these did not have any Intel cpu, and I started to search for some support from Linux.

I don't know much about Linux, but I use RH5.2 on an Intel box, and had just installed KDE 1.1, and it didn't look bad. I found some sites with Linux-PPC, and started to download some code with a slow modem. Big mistake ! KDE was also a big mistake, as I used the file browser and it turned out that several files did not show up. It was a time of total confusion. I tried to put together a minimum system, that would just fire this box up and I could decide if this was any useable platform at all.

After all sorts of mistakes, I came across this Howto made by Ingvar Hagelund. I was still very confused and wrote to him. He was kind enough to help me with some CDs - as it turned out to be almost impossible to sort out what I needed. Actually I had been stupid enough to believe I could reuse some of my Intel platform programs, - so I am not proud to admit my mistake :)

But it all turned out to be a difficult task, and for some reason I wrote down what I did, and here is the story. I hope that someone could get a little help from this, - but it turns out that it raises more questions than answers.


Problems:

- It would not install from the CD station.
( I had already tried several attempts similar to what this howto explained, so this time I wanted to at least try to follow
what this says :)

- It was not possible to do a network installation for me

- I had no IDE drives
( this could be the most easy way to do it, but I don't have any manual on the machine, so I didn't want to mess with it )

- I had limited disk size


What I wanted:

Several disk partitions. If you have /home , /usr , /var, etc. as separate partitions, then you can mount these in and out. There
is less chance that you will not be able to boot up the root partitions, because a lot of files you may play around with, exists on
separate partitions. It can sometimes be difficult to decide what you would like to have, sizes, etc.

But I wanted a large root partition, and an even larger /usr partition.


Making diskettes:

- follow the howto that Ingvar has made.

But, I had several problems to fit the ram disks on two floppy diskettes, I ended up with much more. Ingvar said I had to pay
attention to my browser program, - it could pack out the compressed files. But when I got the CD, I still had problems. I think
this may be caused by the "dd" program if it somehow find some problems writing to the diskette. So, maybe just use blank
diskettes of high quality. In the end I got them as they should be, but even when I had 6 ram disk diskettes, it worked. It was just
a lot of work to feed diskettes.

- utility diskette:

I did this a bit different, because I had more than one box to set up, and got tired of fumbling with the keyboard.
Use a editor and make two files:

filename: do1

## do1 - just helps set the path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/floppy

filename: do2

## do2 - copy the CD to harddisk
/bin/mke2fs /dev/sda2
/bin/mkdir /mnt/install
/bin/mount -text2 /dev/sda2 /mnt/install
/bin/cp -R -v /mnt/cdrom/RedHat /mnt/install

Note : I decided to copy my CD files into /sda2 - the second partition. You may change this.

making the diskette:

mke2fs /dev/fd0
mount /dev/fd0 /mnt/floppy
cp fdisk cfdisk libslang.so.1.2.2 do1 do2 /mnt/floppy
ln -s /mnt/floppy/libslang.so.1.2.2 /mnt/floppy/libslang.so.1
chmod 777 fdisk cfdisk do1 do2
umount /mnt/floppy

Note: I have made it read/write and executable, even the fdisk and cfdisk. These need to be executable, so do the
two files I made, but fdisk and cfdisk should only be readable. I just skipped that detail.

What these other files will do, is explained a bit later.


Red Hat installation:

When you boot the computer, the Red Hat installation program will start.

When the RedHat install program comes up on your screen,
type cntrl-z and leave for a shell.

Now you will be located in the "home" directory for "root", but
it will not show this because root is not set up yet. Look at the
prompt - it will say "[root@(none) ~]". The prompt means:
- you are root at machine (none) and "~" means root's home.

After install has done it's job, the machine name may be replaced,
and the "~" will show "root". If you issue the command "pwd", then it
will display the directory /root.

Okay, system files is located at /bin and /sbin. Devices is named in
/dev and a usual mount place is on /mnt.
To move around, use cd. If you are unsure, use the "pwd" command to see
where you are.

Now you need to mount the floppy disk, but first we need to make a
place to mount it.

mkdir /tmp/floppy

- you just made a directory called floppy.

mount -text2 /dev/fd0 /mnt/floppy

- you have mounted the device fd0 (floppy) with an extended linux
file system, on /mnt/floppy.

- you may traverse into this and take a look.

cd /mnt/floppy
ls

- now the files on the floppy should get listed.

You have a disk partition program called pfdisk in the
/sbin directory, but it is not so nice to use. But on this
floppy you have two others.

For this installation, I wanted a small boot partition, and
a temporary partition to hold the CD files.

A disk partition program will show your disk with the physical
heads/sectors - cylinders and blocks. You have to know how
to calculate this in order to transform it into the usual bytes.
If you use fdisk and select a size of 10K, you will not get a
size of 10Kbytes, but 10K units. This may translate to 10Mbytes,
or something else, as it depends on heads/cylinders, etc.
Instead I used cfdisk that is on the floppy, but it will need
some functions in the "libslang" library.

Because the keyboard is not yet set up, it may be difficult to
find the right keys. So the less you have to type, the easier it
will be. The first file to run, is "do1".

It looked like this:

## do1 - just helps set the path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/floppy

You could type the "export.." line, but this file does it for you.
It is not a normal "shell" program, it doesn't start with
#!/bin/bash - it will not spawn another bash process, but use
the one you already use. This may preserve some memory usage.
The runable bits is set, with the chmod 777 instruction, but you
have to do a little trick to get it running. Type:

. do1

Notice the space before and after the single "dot", then the name.

Now start cfdisk:

/mnt/floppy/cfdisk

You just delete all partitions, that is what this installation does,
so begin from nothing and add "New" partition.
Set the size to just "1" - this should break down to 1Mb for sda1.
You should see sda1 as a primary linux 82 system. Select "Type" and
change it to "41", that is "PPC PReP Boot". You may also set the "Boot"
flag.

Use the up/down cursor and select "Free Space" and enter "New" partition,
and set the size to 650Mb. Goto "Type" and change it from 82, to 85, - that
is extended Linux.

On this disk, there should be about 382Mb left as free space. You are done,
select "Write" and answer the prompt with the full word "yes" then select
"Quit" and leave the program.

Okay, now you can run the second batch:

. do2

Again notice the spaces and the single "dot".

Now you may take a coffee break, because this file should make a file system on partition 2 and
copy all the files you need from the CD disk.

If everything did install as expected, you may move around and take a look,
else you have to try to fix it.

The last thing you do, is to issue the command

/bin/umount /mnt/install

- this will remove the hard disk you just have copied to. The install
program will find it, but if you don't "umount" it, it will complain that the device is busy.

Then leave this shell, type

exit

You should be back in the RedHat install program.


Continue Red Hat installation:

- set up the keyboard
- on what media that holds the installation packages, select hard disk
( it should find sda2 on it's own )
- select install and custom ( we just want a minimum system now )
- select Disk Druid to partition the drive

Partition the rest of the drive:

With DiskDruid, move the up/down keys until you highlight the bottom bar,
with free space. Then use the "tab" key to the "Add" or use "F1"

Select the mount point as "/" and 200Mb, and Linux Native.
( this should show up as sda5 - goto "free space again" )

Select the mount point as "/home" and 100Mb, Linux Native.
( goto "free space again" and note how much you have left )

Select "Add" again, but don't enter a mount point, and for size,
select 1Mb less than you had free. Then select it as "Linux swap".
( about 80 - something Mb )

Note on the partition setup:

You may setup different partitions and sizes. But the root "/" is the main
partition for linux. Installing all user files under /usr as another
partition, will make it possible to umount this one, and mount another disk
in it's place. There is also less chance that Linux will not boot because of
disk problem. If something goes wrong in /usr, it will still boot and you
may be able to fix it.

- now continue the installation
- don't select any packages
( you can do this later when the system is installed, but you may select a few small
packages, like an editor, etc. but keep it small )
- when it asks to write the bootloader, let it do so to /sda1


Rebooting and tidy up:

When the machine restarts, it will give you a prompt for a short time like this:

Linux/PPC load:

Now you have to enter :

Linux/PPC load: root=/dev/sda5

You should get your login prompt, enter it and you have a linux box running.

Bugs:

The first thing you may want to do is to remark out the following:

/etc/inittab:

Check the default runlevel setting. It's a line that looks like this:

id:3:initdefault:

If the number between the colons is 5, you should change it to 3, unless you
get a stable and goot X-server working, that you want to use as your
general login interface. If your X-server wont work properly, and
your default runlevel is 5, the system will try to start a window manager
every 5 minutes or so, and give error messages to your screen unless you
have X running. This can be quite annoying.

You can reboot, /sbin/shutdown -R now, for this to take effect.

For some reason, the Red Hat install program leave this line in inittab, even when you didn't
select any X11 programs. For every five minutes, it will try to run your preferred X-window manager,
and you don't have any. So it will clutter up your screen with error messages, every 5 minutes.


Your disk space:

Here is what I wanted, and the reason for the way I have done this:

- I selected /sda2 to hold my whole CD, it would be so much easier under installation,
but I wanted a separate /usr partition on at least 650Mb.

You can try to do this:

mount -text2 /dev/sda2 /usr

cd into it and have a look. It should now hold your RedHat installation files, but notice that you
have lost all "normal" files, editors, libraries and so forth, in your /usr directory.

Okay, do

umount /usr

and everything should be back to normal. But I want a separate /usr partition on 650Mb, so
do:

tar czvf /usr.tgz /usr

This will make a file - usr.tgz - and pack everything in your /usr directory. This is why you should
not install too much, else this file may be very large.

rm -Rf /usr/

You should have deleted everything in your /usr directory, but the /usr directory should still exist, if not
mkdir /usr, again. Note: before you do this, there might be something you would like to have at hand, like
your editor, etc, - so before you do it, - you may copy it to your /root directory.

Now you can mount the other partition again:

mount -text2 /dev/sda2 /usr

and do rm -Rf /usr/ again. Now you delete everything on this partition. Now it is time to restore the
usual files:

tar xzvf /usr.tgz /usr

This will write all your /usr/bin, /usr/lib, etc. back into this directory, and you can remove the tar file:

rm /usr.tgz

What you have just done, is to restore as much space as possible on you "/" - root partition. If you had not
deleted the and moved the /usr - files, you would not be able to use it, and it would still take up space.
If you reboot your computer now, you will not get your /usr directory and files, but need to mount it every time.


Final change:

Edit the file /etc/fstab like this:

fstab:

/dev/sda5 / ext2 defaults 1 1
/dev/sda2 /usr ext2 defaults 1 2
/dev/sda6 /home ext2 defaults 1 2

Copy the first line, insert it and make the change. Doing it this way, will make sure you have the
correct tabs and spaces in it. Save the file, and you can reboot. When it comes up again, you
should have :

/ - of 200Mb
/usr - of 650Mb
/home - of 100Mb


Make the rest:

Now you can mount the CD rom, and move to /RedHat/RPMS and do rpm -i <package> and install
it.

Here I looked at Ingvar's Howto, and Installed X. Then I used the "gnomerpm" installer to
select the packages I wanted. I must say, VGA is not the video driver you would want, and I
found several "bugs" or unstable parts. But at least I have the box running.


Final thoughts:

I really miss LILO, and I hate to have to enter " root=/dev/sda5 ". LILO has some added checks, and features.
I just hated this setup, so I tried to find out how to enter this string, or make a new kernel. While I looked at the boot up
if I didn't supply the string, - it would look after a "block major 3 " for the default root.

Well, as this HowTo say in "4.2 How to make the bootfloppies" - you use the kernel image:

zImage-2.2.10+IDE

Okay, a "block major 3" is a IDE hard disk, so this kernel is wrong for this machine. This is probably why it don't load
from the CD drive either. I am just a novice, so I have not found out how to correct this. On my next machine, I tried
a different kernel, but it would not work. But then I used disk druid in a different way, and I got the whole installation to
use the CD drive, and install everything - straight out of the box. ( Yes, I still used zImage-2.2.10+IDE ) I didn't leave
the intallations, and did anything of the stuff I have explained above.

I found bugs in pdisk, fdisk, cfdisk and disk druid, the Red Hat installer, the kernel image, and the VGA driver. Wow !

How I made it install straight out of the box ? I have to leave that for another time, because I just don't know where this
bug is, but it could be that something is left on the boot sectors on the machine. I just didn't find out. It may also have to do
with disk druid.

For any kernel hackers, make a new zImage for SCSI and leave out the IDE, or make it default to SCSI. And/Or ,
get LILO working. ( you will need it if you want to try running realtime kernels, and other modules )

A last note:

A great thanks to everyone that has worked on this ! :)