summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2013-12-05 14:53:37 -0700
committerStephen Warren <swarren@nvidia.com>2013-12-06 13:00:21 -0700
commitda1ad6414c6e1d5afc1e8fe052ab04578ef5f23d (patch)
tree7f007b1509dbdc0ca79ee6daea9d35f70057bf18
parentcce543ffb088c2017a39933735ee6f27419d371f (diff)
downloadtegra-uboot-flasher-scripts-da1ad6414c6e1d5afc1e8fe052ab04578ef5f23d.tar.gz
Allow overriding environment variables during flashing
The flashing process resets the U-Boot environment to the built-in default. Allow the user to specify some non-default values to be set before saving the environment. This can be useful e.g. to set up the default boot target: ./tegra-uboot-flasher flash --env boot_targets dhcp beaver Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Thierry Reding <treding@nvidia.com>
-rwxr-xr-xtegra-uboot-flasher7
1 files changed, 7 insertions, 0 deletions
diff --git a/tegra-uboot-flasher b/tegra-uboot-flasher
index 3f79c8c..b401fa2 100755
--- a/tegra-uboot-flasher
+++ b/tegra-uboot-flasher
@@ -194,6 +194,9 @@ def func_flash():
# Perhaps U-Boot should set $boardname based on the ID EEPROM; then we wouldn't need this
if config['dtbfn-extra'] != '':
bootcmd += 'setenv board ' + boardname + config['dtbfn-extra'] + ' ; '
+ if args.env:
+ for (var, value) in args.env:
+ bootcmd += 'setenv %s %s ; ' % (var, value)
bootcmd += 'saveenv ; '
# To update the bootloader, reset.
# If wanting to run installer, set installer_args.configname in environment, 'run bootcmd'
@@ -282,6 +285,10 @@ parser_flash.add_argument('--flash-image', type=str,
help='The flash image to write, instead of U-Boot itself')
parser_flash.add_argument('--gen-only', action='store_true',
help='Just create the work-dir; don\'t actually flash the image')
+parser_flash.add_argument('--env', type=str, nargs=2, action='append',
+ metavar=("VAR", "VALUE"),
+ help='Set a U-Boot environment variable after flashing. This option ' +
+ 'may be given multiple times')
parser_exec = subparsers.add_parser('exec',
help='Download and execute an unmodified bootloader binary, named ' +