All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Chargin <jimccrown@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] How can I save U-Boot env vars to HUSH shell vars.
Date: Wed, 09 Apr 2014 14:09:00 -0700	[thread overview]
Message-ID: <5345B6EC.6050109@gmail.com> (raw)

I'd like to store the values of environment variables in HUSH shell 
variables and then restore them later. My ultimate goal is to preserve a 
few environment variables through a "env default -f".

I'm working with U-Boot 2010.12. Changing to a newer version is not 
possible at this time.

I realize this is a very old U-Boot. I'm hoping that the relevant parts 
of U-Boot have not changed between that old version and versions you 
might provide help for.

I tried a few things and haven't found the right combination. I think 
the following commands demonstrate my problem.

Given the U-Boot commands

=> setenv e "e ethaddr ipaddr rootpath"
=>
=> printenv e ethaddr ipaddr rootpath
e=e ethaddr ipaddr rootpath
ethaddr=00:00:17:88:09:36
ipaddr=10.3.134.80
rootpath=/home/anyuser/a/device/tr/rootfs
=>
=> for i in $e; do v_$i=$i; done
=>

What I get:

=> showvar
HUSH_VERSION=0.01
v_e=e
v_ethaddr=ethaddr
v_ipaddr=ipaddr
v_rootpath=rootpath
=>

What I want:

=> showvar
HUSH_VERSION=0.01
v_e=e ethaddr ipaddr rootpath
v_ethaddr=00:00:17:88:09:36
v_ipaddr=10.3.134.80
v_rootpath=/home/anyuser/a/device/tr/rootfs
=>

So, how do I re-write the for loop to get the desired results

Thanks for any help,
Jim

-- 
Jim Chargin
AJA Video Systems                       jimc at aja.com
(530) 271-3334                          http://www.aja.com

             reply	other threads:[~2014-04-09 21:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-09 21:09 James Chargin [this message]
2014-04-09 21:50 ` [U-Boot] How can I save U-Boot env vars to HUSH shell vars Wolfgang Denk
2014-04-09 23:15   ` James Chargin
2014-04-10  6:52     ` Wolfgang Denk
2014-04-10 16:58       ` James Chargin
2014-04-10 18:46         ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5345B6EC.6050109@gmail.com \
    --to=jimccrown@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.