To support cross compile, partilly pick from mainline commit.
Base commit:
0778e7c50ba1 ("script: Make the get_default_envs.sh script working with newest u-boot")
Change-Id: I35d89cd30eafe83de648aec48e2698396bfaf3dc
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
# usage: get_default_envs.sh > u-boot-env-default.txt
set -ue
+: "${OBJCOPY:=${CROSS_COMPILE:-}objcopy}"
+
ENV_OBJ_FILE="env_common.o"
ENV_OBJ_FILE_COPY="copy_${ENV_OBJ_FILE}"
# NOTE: objcopy saves its output to file passed in
# (copy_env_common.o in this case)
-objcopy -O binary -j ".rodata.default_environment" ${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