OpenBoot 3.x Command Reference Manual

Using nvramrc

The nvramrc configuration variable whose contents are called the script, can be used to store user-defined commands executed during start-up.

Typically, nvramrc is used by a device driver to save start-up configuration variables, to patch device driver code, or to define installation-specific device configuration and device aliases. It can also 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.

If the use-nvramrc? configuration variable is true, the script is evaluated during the OpenBoot start-up sequence as shown:

It is sometimes desirable to modify the sequence probe-all install-console banner. For example, commands that modify the characteristics of plug-in display devices may need to be executed after the plug-in devices have been probed, but before the console device has been selected. Such commands would need to be executed between probe-all and install-console. Commands that display output on the console would need to be placed after install-console or banner.

This is accomplished by creating a custom script which contains either banner or suppress-banner since the sequence probe-all install-console banner is not executed if either banner or suppress-banner is executed from the script. This allows the use of probe-all, install-console and banner inside the script, possibly interspersed with other commands, without having those commands re-executed after the script finishes.

Most User Interface commands can be used in the script. The following cannot:

Editing the Contents of the Script

The script editor, nvedit, lets you create and modify the script using the commands listed in Table 3-5.

Table 3-5 Commands Affecting NVRAMAC



nvalias alias device-path

Stores the command "devalias alias device-path" in the script. The alias persists until either nvunalias or set-defaults is executed.


Performs the same function as nvalias except that it takes its arguments, name-string and device-string, from the stack.


Enters the script editor. If data remains in the temporary buffer from a previous nvedit session, resumes editing those previous contents. If not, reads the contents of nvramrc into the temporary buffer and begins editing it.


Discards the contents of the temporary buffer, without writing it to nvramrc. Prompts for confirmation.


Recovers the contents of nvramrc if they have been lost as a result of the execution of set-defaults; then enters 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.


Executes the contents of the temporary buffer. 


Copies the contents of the temporary buffer to nvramrc; discards the contents of the temporary buffer.

nvunalias alias

Deletes the specified alias from nvramrc.


Performs the same function as nvunalias except that it takes its argument, name-string, from the stack.

The editing commands shown in Table 3-6 are used in the script editor.

Table 3-6 Script Editor Keystroke Commands




Moves backward one character. 

Escape B 

Moves backward one word. 


Moves forward one character. 

Escape F 

Moves forward one word. 


Moves backward to beginning of the line. 


Moves forward to end of the line. 


Moves to the next line of the script editing buffer. 


Moves to the previous line of the script editing buffer. 

Return (Enter) 

Inserts a new line at the cursor position and advances to the next line. 


Inserts a newline at the cursor position and stays on the current line. 


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, joins the next line to the current line (i.e. deletes the newline). 


Erases the previous character. 


Erases the previous character. 


Erases the previous character. 

Escape H 

Erases from beginning of word to just before the cursor, storing erased characters in a save buffer. 


Erases from beginning of word to just before the cursor, storing erased characters in a save buffer. 


Erases the next character. 

Escape D 

Erases from the cursor to the end of the word, storing the erased characters in a save buffer. 


Erases the entire line, storing the erased characters in a save buffer. 


Inserts the contents of the save buffer before the cursor. 


Quotes the next character (i.e. allows you to insert control characters). 


Retypes the line. 


Displays the entire contents of the editing buffer. 


Exits the script editor, returning to the OpenBoot command interpreter. The temporary buffer is preserved, but is not written back to the script. (Use nvstore afterwards to write it back.)

Activating the Script

Use the following steps to create and activate the script:

  1. At the ok prompt, type nvedit.

Edit the script using editor commands.

  1. Type Control-C to get out of the editor and back to the ok prompt.

If you have not yet typed nvstore to save your changes, you may type nvrun to execute the contents of the temporary edit buffer.

  1. Type nvstore to save your changes.

  2. Enable the interpretation of the script by typing:

    setenv use-nvramrc? true

  3. Type reset-all to reset the system and execute the script, or type:

    nvramrc evaluate

to execute the contents directly.

The following example shows you how to create a simple colon definition in the script.

ok nvedit 
0: : hello ( -- ) 
1: ." Hello, world. " cr 
2: ; 
3: ^C 
ok nvstore 
ok setenv use-nvramrc? true 
ok reset-all 
ok hello 
Hello, world.

Notice the nvedit line number prompts (0:, 1:, 2:, 3:) in the above example. These prompts are system-dependent.