[ltp] Storing data in /dev/nvram

Onno Benschop linux-thinkpad@linux-thinkpad.org
Mon, 31 Jul 2006 22:14:34 +1000


Watching this list with protracted discussions about how batteries work=20
and how bits and pieces hang together at a low level, I thought I'd jump =

in with a low-level question of my own.

I have a need to store two bytes of data between reboots. The machine is =

built into a car and the hard-disk is read-only. I don't want to=20
particularly setup my machine to write to the hard-disk, and if I could=20
make that the head never writes, I would.

I hit on the idea of storing data in CMOS somewhere, don't really care=20
where, as long as I can store two bytes every five minutes or so, and=20
read them when the machine boots.

I investigated using libsmbios, even downloaded and compiled it, but=20
then found that it needs a later kernel, and all manner of other stuff=20
would need to happen - way too complicated.

I then thought of storing the two bytes in the RTC, but my chosen=20
location - epoch - only works on Alpha's, and I'm using an x86 board.

So, then someone suggested I investigate /dev/nvram.

I did.

I can read from it, store the data into a file, presumably modify the=20
read file, then write it back.

What I don't know is what else is stored there, which bytes I can play=20
with - I come from a 6502 world where you can PEEK and POKE, but that's=20
a story for a different email :-)

So, who can tell me what I can read to get some answers, or can I just=20
store what ever I want in those 114 bytes?

If it matters, the board is an Intel D810EMO.

If my suggestion for writing into /dev/nvram doesn't work, what about=20
modifying the boot logo?



Cheers in anticipation,

--=20
Onno Benschop

Connected via Optus B3 at S27=B052'34" - E151=B015'43" (Millmerran, QLD)
--
()/)/)()        ..ASCII for Onno..
|>>?            ..EBCDIC for Onno..
--- -. -. ---   ..Morse for Onno..

Proudly supported by Skipper Trucks, Highway1, Concept AV, Sony Central, =
Dalcon
ITmaze   -   ABN: 56 178 057 063   -  ph: 04 1219 8888   -   onno@itmaze.=
com.au