NetBSD/macppc nvedit HOW-TO

Introduction

This page gives a quick introduction to the commands needed to edit the contents of the Open Firmware NVRAMRC. The NVRAMRC is a permanently stored file that may be run at each reboot of your system. Usually, it holds a set of FORTH commands which modify the behavior of your system during boot. For more information on creating the contents of an NVRAMRC, the Apple Network Server 500,700: Open Firmware Read Me Technote is a good place to start.

There is a set of commands within Open Firmware that deal with this NVRAMRC. These commands are entered from the Open Firmware prompt (i.e. the 0 > prompt). As with all Open Firmware settings, it is best if you reset your machine after changing any settings using the reset-all command.

Modifying the NVRAMRC is pretty annoying, because the FORTH syntax is very picky (particularly about white space presence or absence) and the editor is very primitive. You might want to temporarily change to using a serial console so you can just paste in whatever patches you want.

Commands

nvedit start the editor with the current nvramrc contents. If there is still a file in the temporary buffer, it resumes editing that file. Otherwise, it copies the NVRAMRC contents into the temporary buffer and starts editing it.
nvstore stores the temporary nvram buffer into NVRAMRC and discards the contents of the temporary buffer
nvquit discards the contents of the temporary nvramrc buffer without writing to NVRAMRC
nvrun executes the contents of the temporary nvram buffer
nvalias <alias> <device-path-name> defines an alias to the specified device (you must use the full path, not other devaliases), for example:
nvalias bsd-cd /bandit/gc/mesh/sd@3:0,\OFWBOOT.XCF
will let you type `boot bsd-cd' and it will load ofwboot.xcf from the CD-ROM drive in a PowerMacintosh 7300
nvunalias <alias> removes the device alias from the NVRAMRC
setenv use-nvramrc? <value> where <value> is either true or false. This environment variable determines whether or not the contents of the NVRAM are executed each time the machine is reset or rebooted

Note: some Open Firmware 1.0.5 systems do not have enough NVRAM storage for the System Disk patches in addition to a nvalias setting. You should probably keep the System Disk patches instead of the nvalias.

nvedit Editor

As specified in the Open Firmware spec, there is an editor built into all Open Firmware implementations. These are the commands to use the editor. You may notice that some of the commands are very similar to emacs. We use C-x to represent holding down the control key and the x key.

C-l refreshes the display
C-k deletes from the cursor to the end of that line of text
C-n moves to the next line of text
C-p moves to the previous line of text
C-f moves forward one character
C-b moves back one character
C-c exit the editor and store edited contents into a temporary buffer
note: this does not save the changes to the NVRAMRC, you still need to run nvstore

Example

Here is an example of an Open Firmware session entering a NVRAMRC patch (to allow use of the Performa 5500 on-board video). <CR> is the "return" or "enter" key and <C-c> is control-c.
0 > nvedit
cpoke 0a7 0f3000032
cpoke 093 0f3000033
cpoke 03e 0f300003a
<C-c>
0 > nvstore
0 > setenv use-nvramrc? true
0 > reset-all

Up to NetBSD/macppc Port Page
NetBSD Home Page
NetBSD Supported Architectures

www@NetBSD.org
$NetBSD: nvedit.html,v 1.14 2004/10/30 22:33:48 jschauma Exp $
Copyright © 1998-2003 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.