From: Loïc Minier <loic.min...@linaro.org>

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 <loic.min...@linaro.org>
Tested-by: Steve Sakoman <st...@sakoman.com>
---
 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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to