A portion of NVRAM, whose size depends on the particular SPARC system, is called NVRAMRC. It is reserved to store user-defined commands that are executed during start-up.
Typically, NVRAMRC would be used by a device driver to save start-up configuration parameters, to patch device driver code, or to define installation-specific device configuration and device aliases. It also could be used for bug patches or for user-installed extensions. Commands are stored in ASCII, just as the user would type them at the console.
There are two NVRAMRC-related configuration parameters:
nvramrc
use-nvramrc?
Commands in NVRAMRC are executed during system start-up if use-nvramrc? is set to true. Almost all Forth Monitor commands can be used here. The following are exceptions:
banner (use with caution)
boot
go
nvedit
password
reset
setenv security-mode
The NVRAMRC editor, nvedit, lets you create and modify the contents of NVRAMRC using the commands listed in Table 3-4.
Table 3-4 NVRAMRC Editor Commands
Command |
Description |
---|---|
nvalias alias device-path |
Store the command "devalias alias device-path" in NVRAMRC. The alias persists until the nvunalias or set-defaults commands are executed. |
nvedit |
Enter the NVRAMRC editor. If data remains in the temporary buffer from a previous nvedit session, resume editing those previous contents. If not, read the contents of NVRAMRC into the temporary buffer and begin editing them. |
nvquit |
Discard the contents of the temporary buffer, without writing it to NVRAMRC. Prompt for confirmation. |
nvrecover |
Recover the contents of NVRAMRC if they have been lost as a result of the execution of set-defaults; then enter the editor as with nvedit. nvrecover fails if nvedit is executed between the time that the NVRAMRC contents were lost and the time that nvrecover is executed. |
nvrun |
Execute the contents of the temporary buffer. |
nvstore |
Copy the contents of the temporary buffer to NVRAMRC; discard the contents of the temporary buffer. |
nvunalias alias |
Delete the corresponding alias from NVRAMRC. |
Not all OpenBoot 2.x systems include the nvalias and nvunalias commands.
The editing commands shown in Table 3-5 are used within the NVRAM
Table 3-5 nvedit Keystroke Commands
Keystroke |
Description |
---|---|
Control-B |
Move backward one character. |
Control-C |
Exit the editor and return to the OpenBoot command interpreter. The temporary buffer is preserved but is not written back to NVRAMRC. (Use nvstore afterwards to write back the temporary buffer.) |
Control-F |
Move forward one character. |
Control-K |
If at the end of a line, join the next line to the current line (that is, delete the new line). |
Control-L |
List all lines. |
Control-N |
Move to the next line of the NVRAMRC editing buffer. |
Control-O |
Insert a new line at the cursor position and stay on the current line. |
Control-P |
Move to the previous line of the NVRAMRC editing buffer. |
Delete |
Delete the previous character. |
Return |
Insert a new line at the cursor position and advance to the next line. |
Other standard line editor commands are described in Chapter 4, Using Forth Tools.
Use the following steps to activate an NVRAMRC command file:
At the ok prompt, type nvedit
Edit the contents of NVRAMRC using editor commands.
Type Control-C to get out of the editor and back to the ok prompt.
Type nvstore to save your changes.
Enable the interpretation of NVRAMRC by typing: setenv use-nvramrc? true
Type reset to reset the system and execute the NVRAM contents, or type nvramrc eval to execute the contents directly. If you have not yet typed nvstore to save your changes, type nvrun to execute the contents of the temporary edit buffer.
The following example shows you how to create a simple colon definition in NVRAMRC.
ok nvedit 0: : hello ( -- ) 1: ." Hello, world. " cr 2: ; 3: ^-C ok nvstore ok setenv use-nvramrc? true ok reset .... ok hello Hello, world. ok
Notice the nvedit line number prompts (0:, 1:, 2:, 3:) in the above example. These prompts may be different on some systems.