From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Sakoman Date: Fri, 3 Dec 2010 20:28:51 -0800 Subject: [U-Boot] [RFC 1/3] tools/env: Default to the config specified in FW_CONFIG_FILE In-Reply-To: <1291436933-26861-1-git-send-email-steve@sakoman.com> References: <1291436933-26861-1-git-send-email-steve@sakoman.com> Message-ID: <1291436933-26861-2-git-send-email-steve@sakoman.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@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; -- 1.7.0.4