* [U-Boot] [PATCH] script: Make the get_default_envs.sh script working with newest u-boot
@ 2018-02-13 22:01 Lukasz Majewski
2018-02-13 22:54 ` Alex Kiernan
2018-02-14 1:25 ` Tuomas Tynkkynen
0 siblings, 2 replies; 6+ messages in thread
From: Lukasz Majewski @ 2018-02-13 22:01 UTC (permalink / raw)
To: u-boot
This commit fixes several issues:
- After moving env related code to ./env directory the env_common.o file
is no longer present in the system (has been replaced with built-in.o).
- Use ${OBJCOPY} if available, fallback to system default's objcopy if not
present.
- Extend the script to accept different build directory than current one.
It is extremely handy with OE usage, where source code is separated from
build.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
scripts/get_default_envs.sh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/scripts/get_default_envs.sh b/scripts/get_default_envs.sh
index 7955db60e5..bbb6d0a6ef 100755
--- a/scripts/get_default_envs.sh
+++ b/scripts/get_default_envs.sh
@@ -6,16 +6,24 @@
#
# This file extracts default envs from built u-boot
-# usage: get_default_envs.sh > u-boot-env-default.txt
+# usage: get_default_envs.sh [build dir] > u-boot-env-default.txt
set -ue
-ENV_OBJ_FILE="env_common.o"
+: "${OBJCOPY:=objcopy}"
+
+ENV_OBJ_FILE="built-in.o"
ENV_OBJ_FILE_COPY="copy_${ENV_OBJ_FILE}"
echoerr() { echo "$@" 1>&2; }
-path=$(readlink -f $0)
-env_obj_file_path=$(find ${path%/scripts*} -not -path "*/spl/*" \
+if [ "$#" -eq 1 ]; then
+ path=${1}
+else
+ path=$(readlink -f $0)
+ path=${path%/scripts*}
+fi
+
+env_obj_file_path=$(find ${path} -path "*/env/*" -not -path "*/spl/*" \
-name "${ENV_OBJ_FILE}")
[ -z "${env_obj_file_path}" ] && \
{ echoerr "File '${ENV_OBJ_FILE}' not found!"; exit 1; }
@@ -24,7 +32,8 @@ 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
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [U-Boot] [PATCH] script: Make the get_default_envs.sh script working with newest u-boot 2018-02-13 22:01 [U-Boot] [PATCH] script: Make the get_default_envs.sh script working with newest u-boot Lukasz Majewski @ 2018-02-13 22:54 ` Alex Kiernan 2018-02-14 1:25 ` Tuomas Tynkkynen 1 sibling, 0 replies; 6+ messages in thread From: Alex Kiernan @ 2018-02-13 22:54 UTC (permalink / raw) To: u-boot On Tue, Feb 13, 2018 at 10:01 PM, Lukasz Majewski <lukma@denx.de> wrote: > This commit fixes several issues: > > - After moving env related code to ./env directory the env_common.o file > is no longer present in the system (has been replaced with built-in.o). > > - Use ${OBJCOPY} if available, fallback to system default's objcopy if not > present. > > - Extend the script to accept different build directory than current one. > It is extremely handy with OE usage, where source code is separated from > build. > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > --- > > scripts/get_default_envs.sh | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/scripts/get_default_envs.sh b/scripts/get_default_envs.sh > index 7955db60e5..bbb6d0a6ef 100755 > --- a/scripts/get_default_envs.sh > +++ b/scripts/get_default_envs.sh > @@ -6,16 +6,24 @@ > # > > # This file extracts default envs from built u-boot > -# usage: get_default_envs.sh > u-boot-env-default.txt > +# usage: get_default_envs.sh [build dir] > u-boot-env-default.txt > set -ue > > -ENV_OBJ_FILE="env_common.o" > +: "${OBJCOPY:=objcopy}" > + > +ENV_OBJ_FILE="built-in.o" > ENV_OBJ_FILE_COPY="copy_${ENV_OBJ_FILE}" > > echoerr() { echo "$@" 1>&2; } > > -path=$(readlink -f $0) > -env_obj_file_path=$(find ${path%/scripts*} -not -path "*/spl/*" \ > +if [ "$#" -eq 1 ]; then > + path=${1} > +else > + path=$(readlink -f $0) > + path=${path%/scripts*} > +fi > + > +env_obj_file_path=$(find ${path} -path "*/env/*" -not -path "*/spl/*" \ > -name "${ENV_OBJ_FILE}") > [ -z "${env_obj_file_path}" ] && \ > { echoerr "File '${ENV_OBJ_FILE}' not found!"; exit 1; } > @@ -24,7 +32,8 @@ 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 Tested-by: Alex Kiernan <alex.kiernan@gmail.com> -- Alex Kiernan ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] script: Make the get_default_envs.sh script working with newest u-boot 2018-02-13 22:01 [U-Boot] [PATCH] script: Make the get_default_envs.sh script working with newest u-boot Lukasz Majewski 2018-02-13 22:54 ` Alex Kiernan @ 2018-02-14 1:25 ` Tuomas Tynkkynen 2018-02-14 8:50 ` Lukasz Majewski 1 sibling, 1 reply; 6+ messages in thread From: Tuomas Tynkkynen @ 2018-02-14 1:25 UTC (permalink / raw) To: u-boot Hi, On Tue, 13 Feb 2018 23:01:13 +0100 Lukasz Majewski <lukma@denx.de> wrote: > This commit fixes several issues: > > - After moving env related code to ./env directory the env_common.o file > is no longer present in the system (has been replaced with built-in.o). > > - Use ${OBJCOPY} if available, fallback to system default's objcopy if not > present. > > - Extend the script to accept different build directory than current one. > It is extremely handy with OE usage, where source code is separated from > build. > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > --- > > scripts/get_default_envs.sh | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/scripts/get_default_envs.sh b/scripts/get_default_envs.sh > index 7955db60e5..bbb6d0a6ef 100755 > --- a/scripts/get_default_envs.sh > +++ b/scripts/get_default_envs.sh > @@ -6,16 +6,24 @@ > # > > # This file extracts default envs from built u-boot > -# usage: get_default_envs.sh > u-boot-env-default.txt > +# usage: get_default_envs.sh [build dir] > u-boot-env-default.txt > set -ue > > -ENV_OBJ_FILE="env_common.o" > +: "${OBJCOPY:=objcopy}" Maybe "${CROSS_COMPILE}objcopy" would be a better default as that's what the build system uses. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] script: Make the get_default_envs.sh script working with newest u-boot 2018-02-14 1:25 ` Tuomas Tynkkynen @ 2018-02-14 8:50 ` Lukasz Majewski 2018-02-14 10:01 ` Tuomas Tynkkynen 0 siblings, 1 reply; 6+ messages in thread From: Lukasz Majewski @ 2018-02-14 8:50 UTC (permalink / raw) To: u-boot On Wed, 14 Feb 2018 03:25:58 +0200 Tuomas Tynkkynen <tuomas@tuxera.com> wrote: > Hi, > > On Tue, 13 Feb 2018 23:01:13 +0100 > Lukasz Majewski <lukma@denx.de> wrote: > > > This commit fixes several issues: > > > > - After moving env related code to ./env directory the env_common.o > > file is no longer present in the system (has been replaced with > > built-in.o). > > > > - Use ${OBJCOPY} if available, fallback to system default's objcopy > > if not present. > > > > - Extend the script to accept different build directory than > > current one. It is extremely handy with OE usage, where source code > > is separated from build. > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > --- > > > > scripts/get_default_envs.sh | 19 ++++++++++++++----- > > 1 file changed, 14 insertions(+), 5 deletions(-) > > > > diff --git a/scripts/get_default_envs.sh > > b/scripts/get_default_envs.sh index 7955db60e5..bbb6d0a6ef 100755 > > --- a/scripts/get_default_envs.sh > > +++ b/scripts/get_default_envs.sh > > @@ -6,16 +6,24 @@ > > # > > > > # This file extracts default envs from built u-boot > > -# usage: get_default_envs.sh > u-boot-env-default.txt > > +# usage: get_default_envs.sh [build dir] > u-boot-env-default.txt > > set -ue > > > > -ENV_OBJ_FILE="env_common.o" > > +: "${OBJCOPY:=objcopy}" > > Maybe "${CROSS_COMPILE}objcopy" would be a better default as that's > what the build system uses. Unfortunately not with OE builds. In OE, the OBJCOPY is set to arm specific objcopy. With fallback (objcopy) from your local machine - it depends if it supports multi arch or not. A side note: I do use this script with /tools/mkenvimage to generate default main and redundant envs. Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180214/c7b14c63/attachment.sig> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] script: Make the get_default_envs.sh script working with newest u-boot 2018-02-14 8:50 ` Lukasz Majewski @ 2018-02-14 10:01 ` Tuomas Tynkkynen 2018-02-14 10:35 ` Lukasz Majewski 0 siblings, 1 reply; 6+ messages in thread From: Tuomas Tynkkynen @ 2018-02-14 10:01 UTC (permalink / raw) To: u-boot On Wed, 14 Feb 2018 09:50:17 +0100 Lukasz Majewski <lukma@denx.de> wrote: > On Wed, 14 Feb 2018 03:25:58 +0200 > Tuomas Tynkkynen <tuomas@tuxera.com> wrote: > > > Hi, > > > > On Tue, 13 Feb 2018 23:01:13 +0100 > > Lukasz Majewski <lukma@denx.de> wrote: > > > > > This commit fixes several issues: > > > > > > - After moving env related code to ./env directory the env_common.o > > > file is no longer present in the system (has been replaced with > > > built-in.o). > > > > > > - Use ${OBJCOPY} if available, fallback to system default's objcopy > > > if not present. > > > > > > - Extend the script to accept different build directory than > > > current one. It is extremely handy with OE usage, where source code > > > is separated from build. > > > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > > --- > > > > > > scripts/get_default_envs.sh | 19 ++++++++++++++----- > > > 1 file changed, 14 insertions(+), 5 deletions(-) > > > > > > diff --git a/scripts/get_default_envs.sh > > > b/scripts/get_default_envs.sh index 7955db60e5..bbb6d0a6ef 100755 > > > --- a/scripts/get_default_envs.sh > > > +++ b/scripts/get_default_envs.sh > > > @@ -6,16 +6,24 @@ > > > # > > > > > > # This file extracts default envs from built u-boot > > > -# usage: get_default_envs.sh > u-boot-env-default.txt > > > +# usage: get_default_envs.sh [build dir] > u-boot-env-default.txt > > > set -ue > > > > > > -ENV_OBJ_FILE="env_common.o" > > > +: "${OBJCOPY:=objcopy}" > > > > Maybe "${CROSS_COMPILE}objcopy" would be a better default as that's > > what the build system uses. > > Unfortunately not with OE builds. In OE, the OBJCOPY is set to arm > specific objcopy. > > With fallback (objcopy) from your local machine - it depends if it > supports multi arch or not. No, I meant that instead of having a fallback of "objcopy", have a fallback of "${CROSS_COMPILE}objcopy". I.e. squashing this change: diff --git a/scripts/get_default_envs.sh b/scripts/get_default_envs.sh index 3e532d12c4..184cc19ab7 100755 --- a/scripts/get_default_envs.sh +++ b/scripts/get_default_envs.sh @@ -9,7 +9,7 @@ # usage: get_default_envs.sh [build dir] > u-boot-env-default.txt set -ue -: "${OBJCOPY:=objcopy}" +: "${OBJCOPY:=${CROSS_COMPILE:-}objcopy}" ENV_OBJ_FILE="built-in.o" ENV_OBJ_FILE_COPY="copy_${ENV_OBJ_FILE}" That way the script works out-of-the-box for people who do the usual export CROSS_COMPILE=aarch64-linux-gnu- (or whatever) when building U-Boot. ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] script: Make the get_default_envs.sh script working with newest u-boot 2018-02-14 10:01 ` Tuomas Tynkkynen @ 2018-02-14 10:35 ` Lukasz Majewski 0 siblings, 0 replies; 6+ messages in thread From: Lukasz Majewski @ 2018-02-14 10:35 UTC (permalink / raw) To: u-boot Hi Tuomas, > On Wed, 14 Feb 2018 09:50:17 +0100 > Lukasz Majewski <lukma@denx.de> wrote: > > > On Wed, 14 Feb 2018 03:25:58 +0200 > > Tuomas Tynkkynen <tuomas@tuxera.com> wrote: > > > > > Hi, > > > > > > On Tue, 13 Feb 2018 23:01:13 +0100 > > > Lukasz Majewski <lukma@denx.de> wrote: > > > > > > > This commit fixes several issues: > > > > > > > > - After moving env related code to ./env directory the > > > > env_common.o file is no longer present in the system (has been > > > > replaced with built-in.o). > > > > > > > > - Use ${OBJCOPY} if available, fallback to system default's > > > > objcopy if not present. > > > > > > > > - Extend the script to accept different build directory than > > > > current one. It is extremely handy with OE usage, where source > > > > code is separated from build. > > > > > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > > > --- > > > > > > > > scripts/get_default_envs.sh | 19 ++++++++++++++----- > > > > 1 file changed, 14 insertions(+), 5 deletions(-) > > > > > > > > diff --git a/scripts/get_default_envs.sh > > > > b/scripts/get_default_envs.sh index 7955db60e5..bbb6d0a6ef > > > > 100755 --- a/scripts/get_default_envs.sh > > > > +++ b/scripts/get_default_envs.sh > > > > @@ -6,16 +6,24 @@ > > > > # > > > > > > > > # This file extracts default envs from built u-boot > > > > -# usage: get_default_envs.sh > u-boot-env-default.txt > > > > +# usage: get_default_envs.sh [build dir] > > > > > u-boot-env-default.txt set -ue > > > > > > > > -ENV_OBJ_FILE="env_common.o" > > > > +: "${OBJCOPY:=objcopy}" > > > > > > Maybe "${CROSS_COMPILE}objcopy" would be a better default as > > > that's what the build system uses. > > > > Unfortunately not with OE builds. In OE, the OBJCOPY is set to arm > > specific objcopy. > > > > With fallback (objcopy) from your local machine - it depends if it > > supports multi arch or not. > > No, I meant that instead of having a fallback of "objcopy", have a > fallback of "${CROSS_COMPILE}objcopy". I.e. squashing this change: > > diff --git a/scripts/get_default_envs.sh b/scripts/get_default_envs.sh > index 3e532d12c4..184cc19ab7 100755 > --- a/scripts/get_default_envs.sh > +++ b/scripts/get_default_envs.sh > @@ -9,7 +9,7 @@ > # usage: get_default_envs.sh [build dir] > u-boot-env-default.txt > set -ue > > -: "${OBJCOPY:=objcopy}" > +: "${OBJCOPY:=${CROSS_COMPILE:-}objcopy}" Yes, you are obviously right. I've misunderstood you, sorry. I will prepare v3 immediately. Thanks. > > ENV_OBJ_FILE="built-in.o" > ENV_OBJ_FILE_COPY="copy_${ENV_OBJ_FILE}" > > That way the script works out-of-the-box for people who do the usual > > export CROSS_COMPILE=aarch64-linux-gnu- (or whatever) > > when building U-Boot. Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180214/ea06e6a7/attachment.sig> ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-02-14 10:35 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-02-13 22:01 [U-Boot] [PATCH] script: Make the get_default_envs.sh script working with newest u-boot Lukasz Majewski 2018-02-13 22:54 ` Alex Kiernan 2018-02-14 1:25 ` Tuomas Tynkkynen 2018-02-14 8:50 ` Lukasz Majewski 2018-02-14 10:01 ` Tuomas Tynkkynen 2018-02-14 10:35 ` Lukasz Majewski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox