diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2020-01-06 12:01:17 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-05-06 15:12:48 -0400 |
commit | 15c160301cf4761d45e09808f9d818525425901b (patch) | |
tree | f91facfbe36692bde43c12fad1867849ca60d600 | |
parent | 1259567ae3cd4c84acb9db6ab1fadcdcd26968a9 (diff) | |
download | u-boot-15c160301cf4761d45e09808f9d818525425901b.tar.gz u-boot-15c160301cf4761d45e09808f9d818525425901b.tar.bz2 u-boot-15c160301cf4761d45e09808f9d818525425901b.zip |
scripts/get_default_envs.sh: preserve order of multiple entries for same variable
It's possible that the default_environment[] array contains multiple
entries for the same variable, e.g. a setting from env_default.h based
on some CONFIG_* variable, and another from
CONFIG_EXTRA_ENV_SETTINGS. In such a case, the last setting takes
effect.
Hence, in order to be able to use the output from this script as an
CONFIG_DEFAULT_ENV_FILE and get the same default environment as one
currently has, we need to preserve the order. So only sort by the
variable name, and disable the last-resort comparison.
We could pipe the result through uniq to remove duplicate lines, but I
think there's some value in seeing that certain variables are defined
multiple times.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rwxr-xr-x | scripts/get_default_envs.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/get_default_envs.sh b/scripts/get_default_envs.sh index da86a9d69c..d1f2ce4d5c 100755 --- a/scripts/get_default_envs.sh +++ b/scripts/get_default_envs.sh @@ -35,7 +35,7 @@ cp ${env_obj_file_path} ${ENV_OBJ_FILE_COPY} ${OBJCOPY} -O binary -j ".rodata.default_environment" ${ENV_OBJ_FILE_COPY} # Replace default '\0' with '\n' and sort entries -tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} | sort -u +tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} | sort --field-separator== -k1,1 --stable rm ${ENV_OBJ_FILE_COPY} |