From patchwork Sat Dec 4 04:28:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Sakoman X-Patchwork-Id: 74245 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id E17271007D1 for ; Sat, 4 Dec 2010 15:29:41 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C1C6A2817A; Sat, 4 Dec 2010 05:29:35 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aITDzBGQLXvZ; Sat, 4 Dec 2010 05:29:35 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0ED712817E; Sat, 4 Dec 2010 05:29:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3A2B62816B for ; Sat, 4 Dec 2010 05:29:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6WZwiPoVIVzw for ; Sat, 4 Dec 2010 05:29:22 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-gy0-f172.google.com (mail-gy0-f172.google.com [209.85.160.172]) by theia.denx.de (Postfix) with ESMTP id 0536928165 for ; Sat, 4 Dec 2010 05:29:20 +0100 (CET) Received: by gyb13 with SMTP id 13so5176439gyb.3 for ; Fri, 03 Dec 2010 20:29:19 -0800 (PST) Received: by 10.150.215.10 with SMTP id n10mr5066149ybg.124.1291436959613; Fri, 03 Dec 2010 20:29:19 -0800 (PST) Received: from localhost.localdomain (static-74-41-60-154.dsl1.pco.ca.frontiernet.net [74.41.60.154]) by mx.google.com with ESMTPS id p30sm1748541ybk.8.2010.12.03.20.29.17 (version=SSLv3 cipher=RC4-MD5); Fri, 03 Dec 2010 20:29:18 -0800 (PST) From: Steve Sakoman To: u-boot@lists.denx.de Date: Fri, 3 Dec 2010 20:28:51 -0800 Message-Id: <1291436933-26861-2-git-send-email-steve@sakoman.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1291436933-26861-1-git-send-email-steve@sakoman.com> References: <1291436933-26861-1-git-send-email-steve@sakoman.com> MIME-Version: 1.0 Cc: =?UTF-8?q?Lo=C3=AFc=20Minier?= Subject: [U-Boot] [RFC 1/3] tools/env: Default to the config specified in FW_CONFIG_FILE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Loïc Minier This patch allows one to override the default location of the config file by setting FW_CONFIG_FILE environment variable. Signed-off-by: Loïc Minier Tested-by: Steve Sakoman --- tools/env/fw_env.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 8ff7052..75f6a98 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1224,8 +1224,15 @@ static int parse_config () struct stat st; #if defined(CONFIG_FILE) + /* Default to the config file specified in FW_CONFIG_FILE */ + char *config_file = getenv("FW_CONFIG_FILE"); + if (!config_file || !strlen(config_file)) { + /* If unset or empty use the default config file */ + config_file = CONFIG_FILE; + } + /* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */ - if (get_config (CONFIG_FILE)) { + if (get_config (config_file)) { fprintf (stderr, "Cannot parse config file: %s\n", strerror (errno)); return -1;