From patchwork Thu Dec 5 22:13:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 297426 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 805392C00A1 for ; Fri, 6 Dec 2013 09:13:10 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751912Ab3LEWNJ (ORCPT ); Thu, 5 Dec 2013 17:13:09 -0500 Received: from avon.wwwdotorg.org ([70.85.31.133]:33262 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751422Ab3LEWNJ (ORCPT ); Thu, 5 Dec 2013 17:13:09 -0500 Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id D3F896233; Thu, 5 Dec 2013 15:13:08 -0700 (MST) Received: from swarren-lx1.nvidia.com (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 8AAA7E47A9; Thu, 5 Dec 2013 15:12:55 -0700 (MST) From: Stephen Warren To: swarren@wwwdotorg.org Cc: linux-tegra@vger.kernel.org, Stephen Warren Subject: [flasher PATCH 3/4] Allow overriding environment variables during flashing Date: Thu, 5 Dec 2013 15:13:01 -0700 Message-Id: <1386281582-18561-3-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1386281582-18561-1-git-send-email-swarren@wwwdotorg.org> References: <1386281582-18561-1-git-send-email-swarren@wwwdotorg.org> X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.97.8 at avon.wwwdotorg.org X-Virus-Status: Clean Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org From: Stephen Warren 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 --- tegra-uboot-flasher | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tegra-uboot-flasher b/tegra-uboot-flasher index 06e297730112..bd8af7caa888 100755 --- a/tegra-uboot-flasher +++ b/tegra-uboot-flasher @@ -191,6 +191,8 @@ 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'] + ' ; ' + 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' @@ -279,6 +281,8 @@ 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', + help='Set a U-Boot environment variable after flashing') parser_exec = subparsers.add_parser('exec', help='Download and execute an unmodified bootloader binary, named ' +