Configuring the nvramrc Variable on a Sun SparcStation...

 

The boot PROM on virtually all Sun SparcStations and SparcServers uses a collection of variables and routines to modify the operation of the machine to the desired application.  While most of the variables are set to some default value, different operational characteristics can be achieved by changing the default values.  The classic example is changing the default boot device from the Sun default of disk net to disk1 (representing the disk at SCSI address 1).  From the OK prompt of the PROM, you would enter the very C Shell-like command:


                                 setenv boot-device disk1


To make more elaborate changes, such as configuring video adapters, device aliases, etc.  Sun has provided the nvramrc mechanism.  It operates as a string of PROM commands executed before the system boot process, so that device behaviors and environmental settings can be altered before the OS is loaded.  Note that you can also build a customized boot process within the nvramrc sequence and bypass things like PROM-level error trap processing.


The nvramrc mechanism is set up as two variables:


use-nvramrc? -- a boolean variable to toggle nvramrc use on and off,
                          and

nvramrc          -- a sequence of one or more PROM commands.


Once nvramrc is populated, you can selectively invoke it at boot time by setting the value of use-nvramrc? to true or false, through the PROM commands:


                                setenv use-nvramrc? true


                                                 or


                                setenv use-nvramrc? false


If you are only placing one command in the nvramrc variable, you can use the setenv PROM command to set or clear the value.  If you are entering more than one command into the nvramrc variable, it's better to use the nvedit routine in the PROM.


The nvedit routine is a built-in line-oriented text editor that lets you enter, modify and delete lines from the nvramrc sequence.  Once you've modified the contents of the nvramrc variable, you exit back to the PROM by typing a Control-C.  The contents of nvramrc must then be saved by executing the nvstore PROM command.  So a session building a simple nvramrc sequence would look like this:


            ok  nvedit                                 [invoke nvedit]

            0:  probe-all                             [first PROM command]

            1:  install-console                     [more PROM commands...]

            2:  banner           

            3:  boot              

            4:  ^C                                       [Control-C to stop input]

            ok  nvstore                               [ invoke nvstore to keep nvramrc]

            ok setenv use-nvramrc? true   [ use the nvramrc file we just built]

            use-nvramrc? =     true

            ok  reset                                   [ reboot using nvramrc]


While editing the nvramrc file with nvedit, you can navigate up and down in the command sequence using Control-P and Control-N respectively.  For other nvedit commands, consult with the Sun OpenBoot PROM documentation.