boot

The primary function of the OpenBoot firmware is to start up the system. Starting up is the process of loading and executing a standalone program. An example of a standalone program is the operating system or the diagnostic monitor. In this discussion, the standalone program is the operating system kernel. After the kernel is loaded, it starts the UNIX system, mounts the necessary file systems, and runs /sbin/init to bring the system to the “initdefault” state specified in /etc/inittab. This process was discussed in Chapter 9.

Starting up can be initiated either automatically or by typing a command at the user interface. It is commonly referred to as the bootstrap procedure. On most SPARC-based systems, the bootstrap procedure consists of the following basic phases:

1.
The system hardware is powered on.

2.
The system firmware (the PROM) executes a POST. (The form and scope of these tests depends on the version of the firmware in your system.)

3.
After the tests have been completed successfully, the firmware attempts to autoboot if the appropriate OpenBoot configuration variable (auto-boot?) has been set.

The OpenBoot startup process is shown here:

Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 270MHz), No Keyboard 
OpenBoot 3.15, 128 MB memory installed, Serial #10642306. 
Ethernet address 8:0:20:a2:63:82, Host ID: 80a26382. 
Rebooting with command: boot 
Boot device: disk:a  File and args: 
SunOS Release 5.9 Version Beta_Refresh 64-bit 
Copyright 1983-2000 Sun Microsystems, Inc.  All rights reserved. 
configuring IPv4 interfaces: hme0. 
configuring IPv6 interfaces: hme0. 
Hostname: ultra5 
The system is coming up.  Please wait. 
checking ufs filesystems 
/dev/rdsk/c0t0d0s5: is clean. 
/dev/rdsk/c0t0d0s7: is clean. 
/dev/rdsk/c0t0d0s6: is clean. 
Starting IPv6 neighbor discovery.Setting default IPv6 interface for 
 multicast: add net ff00::/8: gateway fe80::a0 0:20ff:fea2:6382 
starting rpc services: rpcbind done. 
Setting default IPv4 interface for multicast: add net 224.0/4: gateway Ultra5 
syslog service starting. 
Print services started. 
volume management starting. 
Mar 23 13:19:33 unknown snmpdx: 
The system is ready. 
Ultra5 console login: 

The startup process is controlled by a number of configuration variables. The ones that affect the startup process are described in Table 10.18.

Table 10.18. Boot Configuration Variables
Variable Description
auto-boot? Controls whether the system automatically starts up after a system reset or when the power is turned on. The default for this variable is true. When the system is powered on, the system automatically starts up to the default run level.
boot-command Specifies the command to be executed when auto-boot? is true. The default value of boot-command is boot with no command-line arguments.
diag-switch? If the value is true, run in the diagnostic mode. This variable is false by default.
boot-device Contains the name of the default startup device used when OpenBoot is not in diagnostic mode.
boot-file Contains the default startup arguments used when OpenBoot is not in diagnostic mode. The default is no arguments. (See Table 10.19 for details of when this variable is used.)
diag-device Contains the name of the default diagnostic mode startup device. The default is net. (See Table 10.19 for details of when this variable is used.)
diag-file Contains the default diagnostic mode startup arguments. The default is no arguments. (See Table 10.19 for details of when this variable is used.)

Typically, auto-boot? is set to true, boot-command is set to boot, and OpenBoot will not be in diagnostic mode. Consequently, the system will automatically load and execute the program and arguments described by boot-file from the device described by boot-device when the system is first turned on or following a system reset. The boot command and its options are described in Table 10.19.

boot has the following syntax:

boot [OBP name] [filename] [options] [flags]
					

[OBP name] , [filename] , [options] , and [flags] are optional.

Table 10.19. boot Command
Option Description
OBP name Specifies the OpenBoot PROM designations. For example, on desktop SPARC-based systems, the designation /sbus/esp@0,800000/ sd@3,0:a indicates a SCSI disk (sd) at target 3, lun0 on the SCSI bus, with the esp host adapter plugged into slot 0. This OBP name can be a device alias such as disk0 (floppy 3 1/2-inch diskette drive), net (ethernet), or tape (SCSI tape). If the OBP name is not |specified and diagnostic-mode? returns true, boot uses the device specified by the diag-device configuration variable.
filename The name of the standalone program to be started up (for example, kernel/unix). The default is to start up /platform/ platform-name/ kernel/unix from the root partition. If specified, filename is relative to the root of the selected device and partition. If not, the boot program uses the value of the boot-file or diag-file based on the diag-switch? parameter.
options -a

The startup program interprets this flag to mean “Ask me,” so it prompts for the name of the standalone program to load.

-f

When starting an Autoclient system, this option forces the boot program to bypass the client’s local cache and read all files over the network from the client’s file server. This option is ignored for all non-Autoclient systems. The -f option is then passed to the standalone program.

-r

Triggers device reconfiguration during startup. (This option is covered in Chapter 11, “Device Administration and Disk Management.”)
flags The boot program passes all startup flags to filename. They are not interpreted by boot. (See the next section for information on the options available with the default standalone program, kernel/ unix.)

If you want to start up the default program when auto-boot? is false,a few options are available for starting up the system from the ok prompt. When you type the following:

boot 

The machine will start up from the default startup device using no startup arguments. This is set in the boot-device variable. Type the following:

boot [OBP name] 

When you specify an explicit OBP name, such as disk3, the machine will start up from the specified startup device using no startup arguments. Here’s an example:

boot disk3 

The system will boot from the disk drive defined by the device alias named disk3. It will then load kernel/unix as the default standalone startup program. Type the following:

boot [options] 

When you specify explicit options with the boot command, the machine will use the specified arguments to start up from the default startup device. Here’s an example:

boot –a 

The system will then ask for the name of the standalone program to load. If you specify kernel/unix, which is the default, you will be prompted to enter the directory that contains the kernel modules. (See the next section for details on kernel modules.)

Type the following:

boot [OBP name] [options] 

When you specify the boot command with an explicit startup device and explicit arguments, the machine will start up from the specified device with the specified arguments. Here’s an example:

boot disk3 –a 

This example will give the same prompts as the previous example, except you are now specifying a different startup device. The system will start up the bootblock from the disk drive defined by the devalias named disk3.

During the startup process, OpenBoot performs the following tasks:

1.
The firmware can reset the machine if a client program has been executed since the last reset. The client program is normally an operating system or an operating system’s loader program, but boot can also be used to load and execute other kinds of programs such as diagnostics. For example, if you have just issued the test net command, when you next type boot, the system will reset before starting up.

2.
The boot program is loaded into memory using a protocol that depends on the type of the selected device. You can start up from disk, tape, floppy, or the network. A disk startup might read a fixed number of blocks from the beginning of the disk, whereas a tape startup might read a particular tape file.

3.
The loaded boot program is executed. The behavior of the boot program can be further controlled by the argument string, if one was passed to the boot command on the command line.

The program loaded and executed by the startup process is a secondary boot program, the purpose of which is to load the standalone program. The second-level program is either ufsboot, when starting up from a disk, or inetboot, when starting up across the network.

If starting up from disk, the bootstrap process consists of two conceptually distinct phases: primary startup and secondary startup. The PROM assumes that the program for the primary startup (bootblk) is in the primary bootblock, which resides in sectors 1 through 15 of the startup device. The bootblock is created using the installboot command. The software installation process typically installs the bootblock for you, so you won’t need to issue this command unless you’re recovering a corrupted bootblock.

To install a bootblock on disk c0t3d0s0, type the following:

installboot /usr/platform/'uname -i'/lib/fs/ufs/bootblk/dev/rdsk/c0t3d0s0 

You cannot see the bootblock. It resides in a protected area of the disk that cannot be viewed. The program in the bootblock area will load the secondary startup program, named ufsboot.

When executing the boot command, if a filename was specified, this filename is the name of the standalone startup program to be loaded. If the pathname is relative (does not begin with a slash), ufsboot will look for the program in a platform-dependent search path. In other words, the relative path to the standalone program will be prefixed with /platform/ <platform-name> . <platform-name> will be specific to your hardware.

Note

Use the uname -i command to determine your system’s platform name. For example, on a Sun Ultra5, the path will be /platform/SUNW,Ultra-5_10. Use the command uname -m to find the hardware class name of a system; for an Ultra5, the hardware class name will be sun4u.


On the other hand, if the path to filename is absolute, boot will use the specified path. The startup program then loads the standalone program and transfers control to it.

The following example shows how to specify the standalone startup program from the OpenBoot ok prompt:

ok boot disk5 kernel/unix –s 

In the example, the PROM will look for the primary boot program (bootblk) on disk5 (/pci@1f,0/pci@1,1/ide@3/disk@5,0). The primary startup program will then load ufsboot. This will load the standalone startup program named /platform/SUNW,Ultra-5_10/kernel/unix using the -s flag. Typical secondary startup programs, such as kernel/unix, accept arguments of the form filename -flags, in which filename is the path to the standalone program and -flags is a list of options to be passed to the standalone program. The example will start up the operating system kernel, which is described in the next section. The -s flag will instruct the kernel to start up in single-user mode.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset