Subject: Re: storing nvaliases in NVRAM ('NVRAMRC not valid')
To: Michael <macallan18@earthlink.net>
From: Dan LaBell <dan4l-nospam@verizon.net>
List: port-macppc
Date: 04/17/2005 17:13:29
On Apr 16, 2005, at 11:03 AM, Michael wrote:

> Hello,
>
>> So is there anything I can do to get past the 'not valid' message?
> I didn't follow the discussion ( just saw Jeff's post ) - I guess you 
> already tried the usual suspects, like boot with Cmd-Option-P-R - 
> should reset both PRAM and OF settings, if you're using an old world 
> mac boot any kind of MacOS - should wipe the NVRAM too, use the 
> reset-nvram or init-nvram command from OF ( some OF wants the former, 
> others the latter ). If nothing helps there's always the brutish and 
> violent method - turn the machine off, remove the battery, let it sit 
> there for a couple of hours, put it back in and the NVRAM should be 
> clean.
>
> have fun
> Michael

Ok, I setup a nvalias and confirmed my understanding of it ( see my 
prev reply this thread)
nvalias fd blahblahblah
goes straight into nvramrc, no need to nvstore.  ( I also tried a real 
address to
a usb device but I'm too lazy to retype that here )
  nvramrc type prints it out
To see a hex dump: nvramrc dump
This is simpler and probably better than what I tried before ( ascii # 
emit ... etc), if you're looking for junk characters etc.
printenv, doesn't actually print it, but prints something to the effect 
that its set
and to use nvedit.  Which one can do, but nvedit is kind of crude, 
basically it uses
the the readline() like console line edit function, and one only sees 1 
line of the buffer at a time, I guess if 1 is making a lot of typos 
entering a long colon definition
it might help ( a little )... I think I'd prefer ed though.
To  clear my nvramrc, I did
nvedit   ( then ctrl-c to quit )
optionally look at the tempbuf via: nv-bfr nv-bfr-len dump
then: 0 to nvr-bfr-len nvstore
This just clears nvramrc, leaving the rest of alone.
nvedit and ^c is just to setup the temp buffer, and set the nv-bfr 
values, doesn't seem
to be any checksum or anything like that, I found the subroutine that 
printed error message, it just checks that nv-bfr is not 0 or prints -- 
really the names and error messages aren't that descriptive nv-bfr is 
really more like nvedit-bfr, as its the temp buffer nvedit, etc 
allocates and uses.  The temp buffer may be in nvram as well though,
the addresses seemed close, I need to check that, if so it might 
explain what nvrecover
does... My inspection of nvstore (via see), is that nvramrc is just a 
special case
of a setenv type variable, except that it can span multiple lines, so 
needs
a different mechanism to edit, so one can probably clear nvramrc much 
simpler
via: setenv nvramrc
In fact, I just confirmed this...

To summarize:
nvalias  adds "devalias ... ..." to  the env variable nvramrc, that is 
stored in nvram .
nvstore isn't needed as it's part of nvedit/nvrun/nvquit/nvstore

Can see contents of variable nvramrc
via: nvramrc type
or hex dump via : nvramrc dump
Theres nvunalias <alias> to remove aliases.
Or you can blank it out, as if it's never been touched via:setenv 
nvramrc