- Introduction
- Booting a System
- The OpenBoot Environment
- The OpenBoot Architecture
- The OpenBoot Interface
- Getting Help in OpenBoot
- PROM Device Tree (Full Device Pathnames)
- OpenBoot NVRAM
- OpenBoot Security
- OpenBoot Diagnostics
- OpenBoot PROM Versions
- Booting a System
- The Kernel
- The init Phase
- System Shutdown
- Summary
- Suggested Readings and Resources
OpenBoot NVRAM
Objective: List, change, and restore default NVRAM parameters.
- View and change NVRAM parameters from the shell.
System configuration variables are stored in system NVRAM. These OpenBoot variables determine the startup machine configuration and related communication characteristics. If you modify the values of the configuration variables, any changes you make remain in effect even after a power cycle. Configuration variables should be adjusted cautiously, however, because incorrect settings can prevent a system from booting.
Table 3.7 describes OpenBoot’s NVRAM configuration variables, their default values, and their functions.
Table 3.7 NVRAM Variables
Variable |
Default |
Description |
auto-boot? |
true |
The system starts up automatically after power-on or reset if auto-boot? is true. If it is set to false, the system stops at the OpenBoot prompt (ok) after power-on or reset. |
boot-command |
boot |
The command that is executed if auto-boot? is true. |
boot-device |
disk or net |
The device from which to start up. |
boot-file |
Empty string |
Arguments passed to the started program. |
diag-device |
net |
The diagnostic startup source device. |
diag-file |
Empty string |
Arguments passed to the startup program in diagnostic mode. |
diag-switch? |
false |
Whether to run in diagnostic mode. |
fcode-debug? |
false |
Whether name fields are included for plug-in device FCodes. |
input-device |
keyboard |
A console input device (usually keyboard, ttya, or ttyb). |
nvramrc |
Empty |
The contents of NVRAMRC. |
oem-banner |
Empty string |
A custom original equipment manufacturer (OEM) banner (enabled with oem-banner? true). |
oem-banner? |
false |
If true, use custom OEM banner. |
oem-logo |
No default |
A byte array custom OEM logo (enabled with oem-logo? true). Displayed in hexadecimal. |
oem-logo? |
false |
If true, use custom OEM logo; otherwise, use the Sun logo. |
output-device |
screen |
A console output device (usually screen, ttya, or ttyb). |
sbus-probe-list |
0123 |
Which SBus slots to probe and in what order. |
screen-#columns |
80 |
The number of onscreen columns (characters/line). |
screen-#rows |
34 |
The number of onscreen rows (lines). |
security-#badlogins |
No default |
The number of incorrect security password attempts. |
security-mode |
none |
The firmware security level (options: none, command, or full). |
security-password |
No default |
The firmware security password (which is never displayed). |
use-nvramrc? |
false |
If true, execute commands in NVRAMRC during system startup. |
You can view and change the NVRAM configuration variables by using the commands listed in Table 3.8.
Table 3.8 Commands for Viewing and Modifying Configuration Variables
Command |
Description |
password |
Sets the security password. |
printenv |
Displays the current value and the default value for each variable. To show the current value of a named variable, you type the following: |
|
printenv <parameter-name> |
setenv <variable> <value> |
Sets <variable> to the given decimal or text <value>. Changes are permanent, but they often take effect only after a reset. |
set-default <variable> |
Resets the value of a specified <variable> to the factory default. |
set-defaults |
Resets ALL OpenBoot variable values to the factory defaults. |
The following examples illustrate the use of the commands described in Table 3.8. All commands are entered at the ok OpenBoot prompt.
You use the printenv command, with no argument, to display the current value and the default value for each variable:
ok printenv
The system responds with this:
Variable Name Value Default Value tpe-link-test? true true scsi-initiator-id 7 7 keyboard-click? false false keymap ttyb-rts-dtr-off false false ttyb-ignore-cd true true ttya-rts-dtr-off false false ttya-ignore-cd true true ttyb-mode 9600,8,n,1,- 9600,8,n,1,- ttya-mode 9600,8,n,1,- 9600,8,n,1,- pcia-probe-list 1,2,3,4 1,2,3,4 pcib-probe-list 1,2,3 1,2,3 mfg-mode off off diag-level max max #power-cycles 89 system-board-serial# system-board-date fcode-debug? false false output-device screen screen input-device keyboard keyboard load-base 16384 16384 boot-command boot boot auto-boot? false true watchdog-reboot? false false diag-file diag-device net net boot-file boot-device disk:a disk net disk net local-mac-address? false false ansi-terminal? true true screen-#columns 80 80 screen-#rows 34 34 silent-mode? false false use-nvramrc? false false nvramrc security-mode none security-password security-#badlogins 0 oem-logo oem-logo? false false oem-banner oem-banner? false false hardware-revision last-hardware-update diag-switch? false false
To set the auto-boot? variable to false, you type the following:
ok setenv auto-boot? false
The system responds with this:
auto-boot? = false
You can verify the setting by typing the following:
ok printenv auto-boot?
The system responds with this:
auto-boot? = false
To reset the variable to its default setting, you type the following:
ok set-default auto-boot?
The system does not respond with a message—only another OpenBoot prompt. You can verify the setting by typing the following:
ok printenv auto-boot?
The system responds with this:
auto-boot? = true
To reset all variables to their default settings, you type the following:
ok set-defaults
The system responds with this:
Setting NVRAM parameters to default values.
It’s possible to set variables from the Unix command line by issuing the eeprom command. You must be logged in as root to issue this command, and although anyone can view a parameter, only root can change the value of a parameter. For example, to set the auto-boot? variable to true, you type the following at the Unix prompt (note the use of quotes to escape the ? from expansion by the shell):
eeprom ‘auto-boot?=true’
Any non-root user can view the OpenBoot configuration variables from a Unix prompt by typing the following:
/usr/sbin/eeprom
For example, to change the OpenBoot parameter security-password from the command line, you must be logged in as root and issue the following command:
example# eeprom security-password= Changing PROM password: New password: Retype new password:
The security mode password you assign must be between zero and eight characters. Any characters after the eighth are ignored. You do not have to reset the system after you set a password; the security feature takes effect as soon as you type the command.
With no parameters, the eeprom command displays all the OpenBoot configuration settings, similar to the OpenBoot printenv command.
Use the prtconf command with the -vp options to view OpenBoot parameters from the shell prompt as follows:
prtconf -vp
The system responds with a great deal of output, but you'll see the following OpenBoot information embedded in the output:
. . . . <output truncated> ansi-terminal?: 'true' screen-#columns: '80' screen-#rows: '34' silent-mode?: 'false' use-nvramrc?: 'false' nvramrc: security-mode: 'none' security-password: security-#badlogins: '0' oem-logo: oem-logo?: 'false' oem-banner: oem-banner?: 'false' hardware-revision: last-hardware-update: diag-switch?: 'false' name: 'options' Node 0xf002ce38 screen: '/pci@1f,0/pci@1,1/SUNW,m64B@2' net: '/pci@1f,0/pci@1,1/network@1,1' cdrom: '/pci@1f,0/pci@1,1/ide@3/cdrom@2,0:f' disk: '/pci@1f,0/pci@1,1/ide@3/disk@0,0' disk3: '/pci@1f,0/pci@1,1/ide@3/disk@3,0' disk2: '/pci@1f,0/pci@1,1/ide@3/disk@2,0' disk1: '/pci@1f,0/pci@1,1/ide@3/disk@1,0' disk0: '/pci@1f,0/pci@1,1/ide@3/disk@0,0' ide: '/pci@1f,0/pci@1,1/ide@3' . . . <output truncated>
You can use the NVRAM commands listed in Table 3.9 to modify device aliases so that they remain permanent, even after a restart.
Table 3.9 NVRAM Commands
Command |
Description |
nvalias <alias> <device-path> |
Stores the command devalias <alias> <device-path> in NVRAMRC. (The alias persists until the nvunalias or set-defaults command is executed.) This command turns on use-nvramrc?. |
nvunalias <alias> |
Deletes the corresponding alias from NVRAMRC. |
For example, to permanently create a device alias named bootdisk that represents a SCSI disk with a target ID of 3 on an Ultra 5 system, you type the following:
nvalias bootdisk /pci@1f,0/pci@1,1/ide@3/disk@3,0
Because disk device pathnames can be long and complex, the show-disks command is provided to assist you in creating device aliases. Type the show-disks command and a list of disk devices is shown as follows:
ok show-disks a) /pci@1f,0/pci@1,1/ide@3/cdrom b) /pci@1f,0/pci@1,1/ide@3/disk c) /pci@1f,0/pci@1,1/ebus@1/fdthree@14,3023f0 q) NO SELECTION Enter Selection, q to quit:
Type b to select an IDE disk and the system responds with the following message:
/pci@1f,0/pci@1,1/ide@3/disk has been selected. Type ^Y ( Control-Y ) to insert it in the command line. e.g. ok nvalias mydev ^Y for creating devalias mydev for /pci@1f,0/pci@1,1/ide@3/disk
Now create a device alias named mydisk followed by ctrl+y as follows:
nvalias mydisk ^Y
The system pastes the selected device path as follows:
ok nvalias mydisk /pci@1f,0/pci@1,1/ide@3/disk
Now all you need to do is add the target number and logical unit number (for example, sd@0,0 or disk@0,0) to the end of the device name as follows:
ok nvalias mydisk /pci@1f,0/pci@1,1/ide@3/disk@0,0
To remove an alias, type nvunalias <aliasname>. For example, to remove the devalias named mydisk, type
ok nvunalias mydisk
The alias named mydisk will no longer be listed after the next OpenBoot reset.
The nvedit Line Editor
Optionally, you can use nvedit to create your device aliases. On systems with a PROM version of 1.x or 2.x, the nvalias command might not be available and you must use nvedit to create custom device aliases. nvedit is an OpenBoot line editor that edits the NVRAMRC directly, has a set of editing commands, and operates in a temporary buffer. The following is a sample nvedit session:
ok setenv use-nvramrc? true
The system responds with the following:
use-nvramrc? = true ok nvedit 0: devalias bootdisk /pci@1f,0/pci@1,1/ide@3/disk@0,0 1: <Control-C> ok nvstore ok reset-all Resetting ...... ok boot bootdisk
The preceding example uses nvedit to create a permanent device alias named bootdisk. The example uses Ctrl+C to exit the editor. It also uses the nvstore command to make the change permanent in the NVRAMRC. Then, it issues the reset-all command to reset the system and then boots the system from bootdisk by using the boot bootdisk command.
Table 3.10 lists some of the basic commands you can use while in the nvedit line editor.
Table 3.10 nvedit Commands
Command |
Meaning |
Ctrl+A |
Moves backward to beginning of the line. |
Ctrl+B |
Moves backward one character. |
Esc+B |
Moves backward one word. |
Ctrl+C |
Exits the script editor, returning to the OpenBoot command interpreter. The temporary buffer is preserved but is not written back to the script. You use nvstore afterward to write it back. |
Ctrl+D |
Erases the next character. |
Esc+D |
Erases from the cursor to the end of the word, storing the erased characters in a save buffer. |
Ctrl+E |
Moves forward to the end of the line. |
Ctrl+F |
Moves forward one character. |
Esc+F |
Moves forward one word. |
Ctrl+H |
Erases the previous character. |
Esc+H |
Erases from the beginning of the word to just before the cursor, storing erased characters in a save buffer. |
Ctrl+K |
Erases from the cursor position to the end of the line, storing the erased characters in a save buffer. If at the end of a line, it joins the next line to the current line (that is, deletes the new line). |
Ctrl+L |
Displays the entire contents of the editing buffer. |
Ctrl+N |
Moves to the next line of the script-editing buffer. |
Ctrl+O |
Inserts a new line at the cursor position and stays on the current line. |
Ctrl+P |
Moves to the previous line of the script-editing buffer. |
Ctrl+Q |
Quotes the next character (that is, allows you to insert control characters). |
Ctrl+R |
Retypes the line. |
Ctrl+U |
Erases the entire line, storing the erased characters in a save buffer. |
Ctrl+W |
Erases from the beginning of the word to just before the cursor, storing erased characters in a save buffer. |
Ctrl+Y |
Inserts the contents of the save buffer before the cursor. |
Return (Enter) |
Inserts a new line at the cursor position and advances to the next line. |
Delete |
Erases the previous character. |
Backspace |
Erases the previous character. |