Wednesday, January 20, 2010

Failed attempt to load gentoo linux on O2 work station

Installing Linux on SGI
Silicon Graphics International (SGI) launched their O2 workstations in 1996 as a successor to the Indy workstations.More technical details of the workstation can be found at http://www.nekochan.net/wiki/index.php/SGI_O2The O2 on which Linux was installed had 256 MB SDRAM and used the R5000 Processor clocked at 300 Mhz. The HDD capacity was 4 GB.
First Attempt: Gentoo on O2 SGI
Gentoo is a Linux Distribution which is considered to be very customisable with its powerful porteage and emerge features.
First, I created a live CD for SGI O2 architecture. The CD image can be found at the Oregon State UNiversity Mirror http://gentoo.osuosl.org/experimental/mips/livecd/x-rc6/Also, On my hard disk at C:\OLD PROJECTS\Linux on SGI O2\livecdwhich is also backed up using my CD catalog software.
CREATING THE LIVE CD
The O2 PROM (something similar to BIOS in ordinary workstation) tries to look for a 'boot sector' on the Boot CD. Therefore, the CD should have a partition which stores the bootable info. Such CD's can't be created in windows based burning software which burns in ISO 9660 format. Therefore, it requries a Linux PC using the command line cdrecord given from terminal. I used RedHat 4 to burn this image on the CD.
RUNNING THE LIVE CD
After inserting the CD, reboot the machine.When the 'Stop for maintenance'button comes on screen, click that and enter into the PROM GUI. Click on boot from CD ROM and complete the remaining steps by clicking 'Next'. If the CD is burned properly, you should see the Tux logo with SGI logo superimposed on it.The CD uses the XFCE desktop and is fully functional. If you connect an ethernet cable (before booting),and if you have a DHCP server on your network,the machine should be able to get an IP address from the DHCP server and if you set the proxy, browse internet as well. Live Cd installs on the RAM called ramdisk.This live CD is pretty much for demo purposes only.
INSTALLING SYSTEM FROM LIVE CD-FAILURE
There is a detailed user manual for installing Gentoo on MIPS which can be foud at http://www.gentoo.org/doc/en/handbook/handbook-mips.xml.The approach recomended is to netboot the system using TFTP/DHCP server. Somehow, for starters, this method was found to be complicated (though, it really isn't) and instead I thought, we can skip some steps of netbooting, as we already have the system booted up and running.Therefore, I skipped the earlier chapters and bagan with chapter 4, "Partitioning of Disks". The explanation given to partition the disk and to create a filesystem, was bit too complicated in the the above documentation, primarily, because, the documentation is intended for many SGI machines, like O2, cobalt and Indy. Iam summarising the major steps:-
1. Create an SGI disk labelThe disk label exists in the 9th Partition of the Hard Disk.It stores information about the disk partitions.First, start an fdisk session.Since SCSI drive is present, the device name would be sda. For IDE devices, it is generally hda.
fdisk /dev/sdaCommand (m for help): xx gets you to the expert mode in fdisk.
Expert command (m for help): mCommand action b move beginning of data in a partition c change number of cylinders d print the raw data in the partition table e list extended partitions f fix partition order g create an IRIX (SGI) partition table h change number of heads m print this menu p print the partition table q quit without saving changes r return to main menu s change number of sectors/track v verify the partition table w write table to disk and exit
Expert command (m for help): g
Now, Note that If a disk already has SGI disk label, it will not create another disk label. In this case, you have to exit the fdisk and fill the entire disk with zero and start over again. dd if=/dev/zero of=/dev/sda bs=512 count=1. This will completely fill the disk with zero. try giving g at expert mode and SGI disk label should be created for you.
Building a new SGI disklabel. Changes will remain in memory only,until you decide to write them. After that, of course, the previouscontent will be irrecoverably lost.
Expert command (m for help): r
Command (m for help): p
Disk /dev/scsi/host0/bus0/target1/lun0/disc (SGI disk label): 141 heads, 62 sectors, 1016 cylindersUnits = cylinders of 8742 * 512 bytes
----- partitions -----Pt# Device Info Start End Sectors Id System 9: /dev/sda1 0 4 10240 0 SGI volhdr11: /dev/sda2 0 1015 35803136 6 SGI volume----- Bootinfo -----Bootfile: /unix----- Directory Entries -----
Notice that Partition 9 starts from Cylinder 0 and Ends at Cylinder 4 and is known as SGI volume header. Another Partition, #11, spans the entire disk and is called SGI volume.
Step#2: Modify the size of Partition #9 (SGI Volhdr)This step tries to modify the partition #9 to make it right size for the gentoo boot loader and multiple kernel images to fit in.Due to some odd fdisk behaviour, it is not possible to adjust the size of partition # 9 directly. Therefore, first we create Partition #1.
Command (m for help): nPartition number (1-16): 1First cylinder (5-1015, default 5): 51 Last cylinder (51-1015, default 8682): 985
(Notice how fdisk only allows Partition #1 to be re-created starting at a )(minimum of cylinder 5? Had you attempted to delete & re-create the SGI )(Volume Header this way, this is the same issue you would have encountered. )(In our example, we want / to be 3.89 GB, so we start it at cylinder 51 (the )(Volume Header needs to start at cylinder 0, remember?), and set its ending )(cylinder to 985 Now, we delete partition # 9. and recreate it. Notice that on re-creating #9, the cylinders now are in range 0-50.
Command (m for help): dPartition number (1-16): 9
(Delete Partition #9 (SGI Volume Header))
Command (m for help): nPartition number (1-16): 9First cylinder (0-50, default 0): 0 Last cylinder (0-50, default 50): 50
(Re-Create Partition #9, ending just before Partition #1)
Step #3: Create swap partition and change its type to 'Linux Swap'
Command (m for help): nPartition number (1-16): 2First cylinder (986-1015, default 986): Last Cylinder (986-1015, default 1015):
This creates the swap partition of about 123.78 MB. Now, to change its type Command (m for help): tPartition number (1-16): 2Hex code (type L to list codes): 82Changed system type of partition 2 to 82 (Linux swap)Command (m for help): p
Disk /dev/scsi/host0/bus0/target1/lun0/disc (SGI disk label): 141 heads, 62 sectors, 1016 cylindersUnits = cylinders of 8742 * 512 bytes
----- partitions -----Pt# Device Info Start End Sectors Id System 1: /dev/scsi/host0/bus0/target1/lun0/part1 boot 51 985 8602128 83 Linux native 2: /dev/scsi/host0/bus0/target1/lun0/part2 swap 986 1015 262260 82 Linux swap 9: /dev/scsi/host0/bus0/target1/lun0/part3 0 50 17484 0 SGI volhdr11: /dev/scsi/host0/bus0/target1/lun0/part4 0 1015 8881872 6 SGI volume----- Bootinfo -----Bootfile: /unix----- Directory Entries -----
Command (m for help): w
w command writes out the created partitions to the disk.
The partition table has been altered!
Calling ioctl() to re-read partition table.Syncing disks.
#Step # 3: Formatting the Partitions and mounting
The root partition is partitioned as ext3 and the swap partition as made as swap.
# mke2fs -j /dev/sda1# mkswap /dev/sda2# swapon /dev/sda2mount /dev/sda1 /mnt/gentoo
We will also have to mount the proc filesystem (a virtual interface with the kernel) on /proc. But first we will need to place our files on the partitions.
Step # 4: Installing the base system
(a) Set the date date MMDDhhmmYYYY syntax # date 032916212005
(b) Copying the Stage3 and Portage filesA stage3 tarball is available in the /stages folder of live cd that is built with gcc-4.1.1 and targetted for the MIPS-III ISA. A Portage snapshot dated October 2nd, 2006 is also available in the /snapshots folder of live cd. These two files were copied to the hard disk and untarred. Later on, there was a step in chapter 7 to install the sources. On giving the command:# emerge mips-sources "The error message returned was !!! ARCH is not set--. Are you missing the /etc/make.profile Symlink? Is the Symlink correct? Is your Portage tree complete?"
The next line in just after this command notes that for O2, a 64 bit kernel is required therefore, you should emerge kgcc64 to create cross-compiler for building 64-bit kernels.The following settings were used in make.conf
ARCH="mips" PROFILE_ARCH="mips64" CHOST="mips64-unknown-linux-gnu" CFLAGS="-O2 -Pipe -march=mips3 -mabi=n32"
# emerge kgcc64

ALERT! : This might have been the problem..wrong tarball for the ISA level. SGI O2 uses Nevada R 5000 CPU which is 'Big Endian' and whoose ISA level is 4 (mips4), whereas I have used the tarball present in live cd which is targetted at mips3 architecture. Therefore, the correct tarball needs to be downloaded from the gentoo mirrors (see chapter 5). Also, the same settings need to be reflected in make.conf. This might be the reason for installation to fail.

No comments: