how to persistently save config values
Giorgio Dal Molin
giorgio.nicole at arcor.de
Fri Sep 29 05:31:40 PDT 2017
Hi Sascha,
thank you for the answer.
I just experimented a bit with the environment and the nv vars
and I think I'll go this way.
I was a bit surprised by the saveenv command though: my understanding
of the (default) environment was that it was a read only blob
hardcoded in the barebox image; I thought if I want some new/dynamic
env content to be saved for the next reboot I have to explicitly provide
a storage disk/cf/mtd partition to the saveenv and then to the loadenv.
Instead, just saying 'saveenv' saves the contents of '/env' 'somewhere'
from where it can be restored on next reboot (very good!).
Together with the nv vars and the 'nv.dev.' prefix this just does the
trick for me.
Thank you.
giorgio
> On September 29, 2017 at 1:35 PM Sascha Hauer wrote:
>
> On Fri, Sep 29, 2017 at 10:25:03AM +0200, Giorgio Dal Molin wrote:
> > Hi,
> >
> > I'm working on a new project with an embedded system based on
> > a standard intel PC.
> >
> > I already have a barebox.efi running on the system; my problem is now
> > how to permanently save some variables so that, on restart, they can be
> > automatically restored by my '/env/bin/init' script.
> > The variables I mean are for example 'eth0.ipaddr' or 'eth0.serveraddr'.
> > A solution I used in the past was a custom 'env_dump' command that generated
> > a config text file like:
> >
> > eth0.ipaddr=10.0.0.15
> > eth0.serveraddr=10.0.0.1
>
> (should be eth0.serverip)
> > ...
> >
> > Then I saved the file with 'saveenv' and restored it back with 'loadenv'.
>
> Normally you should edit /env/network/eth0 to change the network config.
>
> Also there is the possibility to create a nv variable that automatically
> mirrors to the device variable. In this case it would be
> nv.dev.eth0.ipaddr and nv.dev.eth0.serverip. This doesn't work with dhcp
> though.
>
> Sascha
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
More information about the barebox
mailing list