script: Make the get_default_envs.sh script working with cross compile 41/176741/1
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 23 Apr 2018 05:09:02 +0000 (14:09 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 23 Apr 2018 06:18:12 +0000 (15:18 +0900)
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>
scripts/get_default_envs.sh

index 7955db6..22848de 100755 (executable)
@@ -9,6 +9,8 @@
 # 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}"
 
@@ -24,7 +26,7 @@ cp ${env_obj_file_path} ${ENV_OBJ_FILE_COPY}
 
 # 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