We now have a working bootloader(arcboot) for Indys and I2s, so the information in this document is partially obsolete. Arcboot can be found at:
http://ftp.debian.org:/debian/pool/main/a/arcboot/
updates and additional information are available at:
http://honk.physik.uni-konstanz.de/linux-mips/arcboot/
Arcboot is easy to set up and gets rid of many limitations the method described below has like:
If you don't want to (or can't) use a bootloader to boot your machine from harddisk you can instead copy one or more Linux kernels into the volume header of the disk. You can then boot one of these kernels and pass kernel args by adjusting some settings in the PROM.
You can either build all the needed tools from source or download precompiled versions:
Dvhtool is the tool responsible for writing the kernel(s) into the volume header. You can get it's source code from linux-mips.org's cvs repository:
cvs -d:pserver:cvs@ftp.linux-mips.org:/home/cvs login cvs -d:pserver:cvs@ftp.linux-mips.org:/home/cvs co dvthool
cvs
. Note that in
order to build dvhtool you need at least glibc2.2.
If you don't want to compile yourself you can get a debian package from:
ftp://ftp.debian.org/debian/pool/main/d/dvhtool/
A rpm for Redhat 7.0 can be found at(thanks to Karel van Houten):
ftp://oss.sgi.com/pub/linux/mips/redhat/test-7.0/contrib/
Since about 2.4.3 you no longer need any additional kernel patches. Simply get your mips kernel from ftp.linux-mips.com cvs:
cvs -d:pserver:cvs@ftp.linux-mips.org:/home/cvs co linux
ftp://ftp.debian.org/debian/pool/main/k/kernel-patch-2.4.X-mips
directory. X is the minor part of the kernels version number.
If you don't have already partitioned your disk from within Irix(TM) you'll need fdisk to create a sgi partition layout conaining a volume header. Fdisk is part of the util-linux package:
ftp://ftp.kernel.org/pub/linux/utils/util-linux/
It's no longer necessary to patch fdisk since it comes with sgi support compiled in now.
Again if you don't want to compile yourself you can get a debian package from:
ftp://ftp.debian.org/debian/pool/main/u/util-linux/
To make this all work you need a disk with an Irix partition table. If you partitioned your disk form within Irix everything should be okay anyways (NOTE: this might not be true, several people reported that the volume header created by Irix is too small to actually hold the kernel). If you partition from within Linux make sure you choose an Irix (SGI) partition table (press 'x' then 'g') in fdisk. If the expert menu is not available, you'll have to wipe the existing partitioning information (which is stored in the first sector of your hard disk) first -- this will destroy all the data on your disk. To wipe this sector use dd. For example if you intend to create the new volume header on /dev/sda:
dd if=/dev/zero of=/dev/sda count=1 bs=512
Now you can resize the volume header by deleting partition number 9 in fdisk
and readding it, starting at cylinder 0 and ending at the desired cylinder. I
recommend a volumeheader of about 10-15MB which should be enough to hold at
least three to four kernels. The size of one cylinder is printed out by fdisk
(see Units = cylinders of X * Y bytes
below in the fdisk output
below).
Since some older PROMs can't boot ELF kernels we use kernels in ecoff binary
format on the Indy and I2. The simplest way for this is to build a new
kernel with make boot
instead of make vmlinux
. The new kernel
will be named vmlinux.ecoff and can be found in the arch/mips/boot
directory of your kernel source tree. We now copy the kernel into the volume
header of the first scsi disk:
dvhtool -d /dev/sda --unix-to-vh vmlinux.ecoff linux
dvhtool -d /dev/sda --unix-to-vh vmlinux.ecoff foolinux
dvhtool -d /dev/sda --print-all
Root partition: 0 Swap partition: 1 Bootfile: "/unix" Entry #0, name "linux", start 4, size 1717200 Part# 0, start 20770, size 3721984, type Unknown Partition Type Part# 1, start 3742754, size 481864, type Unknown Partition Type Part# 8, start 0, size 20770, type Volume Header Part# 10, start 0, size 4224618, type VolumeAlternatively 'fdisk -l' should show:
Disk /dev/sda (SGI disk label): 67 heads, 62 sectors, 1017 cylinders Units = cylinders of 4154 * 512 bytes ----- partitions ----- Device Info Start End Sectors Id System /dev/sda1 boot 5 900 3721984 83 Linux native /dev/sda2 swap 901 1016 481864 83 Linux native /dev/sda9 0 4 20770 0 SGI volhdr /dev/sda11 0 1016 4224618 6 SGI volume ----- bootinfo ----- Bootfile: /unix ----- directory entries ----- 0: linux sector 4 size 1717200
O.k. we're almost there. The last thing to do is to tell the PROM which file to boot on power up:
So reboot your machine and enter the PROM-monitor. We have to change the
settings of three variables there. OSLoader
specifies which entry in
the volume header the PROM tries to boot, SystemPartition
tells the
PROM on which disk it can find that volume header and finally
OSLoadPartition
is parsed by the kernel to determine the location of
the root-filesystem.
setenv OSLoader linux setenv SystemPartition scsi(0)disk(1)rdisk(0)partition(8) setenv OSLoadPartition /dev/sda1 setenv OSLoadOptions "single ip=off"
boot
in the PROM or by just rebooting your machine. Note
that we also set OSLoadOptions in the above example. This can be used to pass
boot options to the kernel. In this case we use it to boot into single user
mode and to turn of kernel-level configuration of network interfaces. It depends on your
PROM version how long the argument list after OSLoadOptions can be. E.g. my
I2 can only store eight bytes in it, while my Indy can happily store the above
example.
Besides the prom variables mentioned above there are other useful ones:
console={g,d1,d2}
- primary console to use: d1 and d2 are the two
serial lines, g is the graphics (keyboard & screen) console.AutoLoad=yes
- boot straight into the OS or enter PROM when unset.DEBUG=1
- prom debugging output
Thanks go to Dave Gilbert for pointing out the problems with the volume header created by Irix, how to fix this and various other suggestions.