How to read newly added nvram variables once kernel is loaded ?

I need to add new variables to nvram in ‘Digi connect ME 9210’. I can add it but was unable to find a way to read it back once the kernel is loaded.

I believe that nvram utility is not built as part of the kernel. Also in general if we add new parameters to the nvram through the uboot bootloaded then is there any other way other than nvram utility as to how i can read them back once the kernel is loaded.

If nvram utility is the only way then where do I find the code for nvram utility. The current utility allows me to read only the predefined nvram variables so i will have to modify the nvram utility to read the new variables that i add?


use ubootenv command in linux kernel commandline for accessing nvram variables.

To read nvram from command line, check the examples in /etc/init.d/ /etc/init.d/ /etc/network/if-up.d/ifup

If you want to read the from C source code, the API is documented only in source code:
it uses

How to compile the source code on your own (for modifications):

  • copy the toolchain from DVD to your local host:

    cp -r DEL59-DVD/toolchain .

    cd toolchain

    export TOOLCHAIN_DIR=/usr/local/DigiEL-5.9/x-tools/arm-unknown-linux-gnueabi

    export POOLWWW=file://pwd/packages

    cd del_toolchain/packages

    cd libdigi; make

    cd …/nvram; cp SOMEFOLDER/nvram-Makefile Makefile; make

    cd …/ubootenv


    cp SOMEFOLDER/cgi_env.c src

    where SOMEFOLDER is where you extraced this application example source code


    copy target/ubootenv.cgi into your rootfs /usr/share/www/cgi-bin
    copy stylesheet.csss into your rootfs /usr/share/www
    Make NVRAM /dev/mdt1 read+writable for CGI script (see above)
    You might want to modify the source code src/cgi_env.c
    See src/.[ch] and …/nvram/src/.[ch] for example source code

here an example:

#include /* printf() getchar() EOS /
#include /
strncmp() */
#include // EXIT_FAILURE

#include /* uname(&struct utsname) */

#include “nvram.h” /* Nv* */

struct nv_critical *crit;
nv_param_ip_t *ip_params;
char ipaddr[IP_STRING_SIZE+1] = “”;
char serverip[IP_STRING_SIZE+1] = “”;

if (!NvInit(NVR_AUTO)) exit(-1);
if (!NvCriticalGet( &crit ) ) exit(-2);
ip_params = &crit->s.p.xIP;
strncpy(ipaddr, NvToStringIP(ip_params->axDevice[0].uiIP), sizeof(ipaddr));
strncpy(serverip, NvToStringIP(ip_params->uiIPServer), sizeof(serverip));