ARCLoad

From LinuxMIPS
Revision as of 13:10, 31 August 2007 by Jblache (Talk | contribs)

Jump to: navigation, search

General

ARCLoad was built to load any Linux kernel on any SGI/ARCS machine. Therefore, it currently supports:

Paths and filesystems

Filesystem support in ARCLoad is based on GNU GRUB filesystem code. The approach taken is somewhat more general than the common one (disk - filesystem - file), namely there is no difference between a partition and a file. This means that filesystems can be nested (e.g. loading kernels from ISO images). Kernels and configuration files are also loadable from the DVH (Disk Volume Header). ARCLoad can also load kernels from a TFTP server, so a network-based install is possible.

A file path is defined as:

<file path> := <arc path> | <file path> '[' <fs name> ']' <fs path>

where possible values for the filesystem name are: ext2, fat, iso9660, jfs, minix, ufs, xfs (not all have been tested, ext2 is the best bet). There is also an [*arcfs] pseudo-filesystem that maps directly onto the ARC firmware path space, and is automatically used when no filesystem name is supplied.

Therefore, an kernel on the root partition can be accessed by:

xio(0)pci(15)scsi(0)disk(1)rdisk(0)partition(0)[ext2]/boot/vmlinux

It is possible to load a kernel directly from the DVH:

xio(0)pci(15)scsi(0)disk(1)rdisk(0)partition(8)/vmlinux

A surprising, but very useful feature is netbooting via TFTP:

bootp():/vmlinux

ARCLoad is always built into a relocatable binary: ELF64 on 64-bit platforms, ECOFF on 32-bit platforms. ARCLoad has its own ELF32 to ECOFF converter in the source package.

Configuration file

The text configuration file is named 'arc.cf' and loaded from the place pointed to by the OSLoadPartition environment variable. ARCLoad reads the file and executes it in order. The configuration file is structured into options that can be nested. Comments begin with a '#' and are discarded (duh). Options are selected by the OSLoadFilename environment variable.

An option looks like this:

feature1 feature2 {
    # code for any of the features
}

The code inside the braces will be executed only if any of the features listed are found in the current feature set. Think of the option as an alternate syntax of a conditional statement. Therefore,

feature1 {
     feature2 {
         # code for both features
     }
}

realizes an AND Boolean operator.

There are several statements allowed both inside the options and outside them. All statements are terminated with a semicolon (';'). They will be executed in-order. The list of valid statements is given below:

detect;

Performs hardware autodetection. The current feature set will be replaced with the autodetected one. Detected features include: software architecture (ip22, ip27, ip28, ip30, ip32), SMP-ness (smp, up), console type (serial, video), video resolution for graphics console (video=AAAxBBB) and CPU (r4000, r4600, r4700, r5000, rm5200, rm7000, r10000, r12000).

comment "Something to be displayed...\r\n";

Comments are displayed when the list option is given. They allow writing self-documenting ARCLoad configuration files.

description "Option description";

Descriptions are displayed with the names of respective options when the list option is given.

image "filename";
image system "/filename";
image absolute "filename";

Sets the kernel image to be loaded. If "filename" is empty (""), the option is deemed to be unsupported. The system option directs ARCLoad to prepend the contents of OSLoadPartition to the filename, while the absolute option exists only for completeness as it is the same as default.

append "arg1" "arg2";

Appends arguments to the kernel command line.

options "arg1" "arg2";

Replaces the kernel command line with the given arguments.

If any kernel image is assigned during the configuration file parsing, ARCLoad will attempt to load the image. Otherwise, it will signal an error and return to the interactive PROM command line.

Downloading and building

ARCLoad can be found at Linux-MIPS. Building it requires only a single setting in the Makefile: the MODE. If it is set to M64, a 64-bit ARCLoad binary will be built (for ip27, ip28 and ip30). If it is set to M32, a 32-bit ARCLoad binary will be built (for ip22 and ip32). It is possible to place those binaries under the names of 'sash64' and 'sashARCS', respectively; in this case, it will be possible to use the Install New Software option in ARCS PROM to run the appropriate binary on any SGI machine.

There is a patch for gcc < 4.2 (see also GCC PR 25871), that causes ARCLoad to skip the warning message on startup on M64 machines. It is related to a particularly obscure bug in GCC that affected nested function calls by function variable on 64-bit MIPS systems which don't use compatibility segments. This bug has been fixed in gcc >= 4.2.

Usage

As mentioned above, kernels are loaded from the location specified by the OSLoadPartition environment variable (if image system is used), and options are selected using the OSLoadFilename environment variable. The loaders mentioned above ('sash64' or 'sashARCS') needs to also be set in the OSLoader environment variable, this should be default, however if it could have changed.

Suppose you have an arc.cf like the following:


 append  "root=/dev/sda3";
 append  "ro";
 append  "console=ttyS0,9600";
 
 ip28 {
   working {
     description  "Known Working Kernel";
     image system "/working";
   }
 
   new {
     description  "Freshly Built Kernel";
     image system "/new";
   }
 
   debug {
     description  "Debug Shell";
     append "init=/bin/bash";
   }
 }

To boot the "working" option, this would be done in the PROM like so:

 setenv OSLoadFilename ip28(working)
 boot

Or for the "new" option

 setenv OSLoadFilename ip28(new)

Multiple options may be selected... e.g.

 setenv OSLoadFilename ip28(new,debug)

See also

  • Load64 ARCLoad's now obsolete ancestor.