OpenWrt Forum Archive

Topic: file instead of nvram

The content of this topic has been archived on 16 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Is there a way to make the nvram command access a file instead of actual nvram? That could be useful if a USB drive is used as root and multiple profiles could be selected by manually swapping drives.

Clever idea! Would make beta testing differing "builds" of firmware very easy to do.

C.

Hi both,

I suggest you check out how buildroot-ng handles this stuff. nbd put in a lot of work on new scripts to do exactly that. As nvram isn't cross platform and isn't a very descriptive configruation mechanism a different format was required.

Mike

ps. I doubt the USB bit works today or whether it will ever, but you could take it on as a project and submit any changes back to the project.

I'll see if I could make a replacement nvram program that accesses a file. Unfortunately, I have very limited experience with C++ (I'm a Java programmer), but I'll see what I can do.

you will not be able to completely use the nvram in that way, as the boot loader uses nvram before the OS starts.  You will need to find some sort of transition between the two that will not completely trash everything.

I have an Awk program which I could release that mimics nvram on wgt634 using /etc/config/network, but it'd be better if you just used buildroot-ng.

Mike

malbon wrote:

I have an Awk program which I could release that mimics nvram on wgt634 using /etc/config/network, but it'd be better if you just used buildroot-ng.

Mike

Can you please release the source under GPL? I'd like a starting point.

I think the general concensus is... use buildroot-ng.

Hi all and star882!

GREAT IDEA!!!

I would love to be able to use fail-safe mode, but i can not because the reset button of my and all Asus 500g Premium does not work with OpenWRT till now! But this idea opens a second fail-safe mode alternative. Maybe you can't substitue nvram by a file directly, but:

I think it must be easy  to let a special program in the firmware overwrite nvram with values of a file at some time after boot-loader or any stuff like that!

The file could be named OverwriteOpenWRTNVRAM or something like that, has to be in the root of any mounted device at USB. nvram will only be overwritten with the file, if the file is there and you can provide the file via usb.

This way you can always play around with vlans and that stuff and need not to worry about serious errors!?

It has only one disadvantage: you still have to reboot after overwriting nvram, to let new settings take effect (like it's usual for windows), but that is still better than having a non working unit or reflashing the firmware.

O.k. this sketched solution only works with USB, but let your phantasy play, what about optionally add some additional OpenWRT „fail-safe“ packages with other special programs that try to download such a file from your pc via network from a predefined IP or something like that. Perhaps they have to save current nvram settings, install secure default nvram settings, try to download the file from a fixed place and restore original nvram settings and ... need to reboot several times, hmm, ... but perhaps somebody has a better idea :-)

Best regards

Thorsten

The discussion might have continued from here.