]>
git.ipfire.org Git - people/ms/u-boot.git/blob - scripts/get_default_envs.sh
3 # Copyright (C) 2016, Lukasz Majewski <l.majewski@majess.pl>
5 # SPDX-License-Identifier: GPL-2.0+
8 # This file extracts default envs from built u-boot
9 # usage: get_default_envs.sh > u-boot-env-default.txt
12 ENV_OBJ_FILE
="env_common.o"
13 ENV_OBJ_FILE_COPY
="copy_${ENV_OBJ_FILE}"
15 echoerr
() { echo "$@" 1>&2; }
17 path
=$
(readlink
-f $0)
18 env_obj_file_path
=$
(find ${path%/scripts*} -not -path "*/spl/*" \
19 -name "${ENV_OBJ_FILE}")
20 [ -z "${env_obj_file_path}" ] && \
21 { echoerr
"File '${ENV_OBJ_FILE}' not found!"; exit 1; }
23 cp ${env_obj_file_path} ${ENV_OBJ_FILE_COPY}
25 # NOTE: objcopy saves its output to file passed in
26 # (copy_env_common.o in this case)
27 objcopy
-O binary
-j ".rodata.default_environment" ${ENV_OBJ_FILE_COPY}
29 # Replace default '\0' with '\n' and sort entries
30 tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} |
sort -u
32 rm ${ENV_OBJ_FILE_COPY}