Makefile: fix u-boot-initial-env target if lto is enabled
PATCH 1/1 Makefile: fix u-boot-initial-env target if lto is enabled
From: Max Krummenacher <[email protected]>
With LTO enabled the U-Boot initial environment is no longer stored in an easy accessible section in env/common.o. I.e. the section name changes from build to build, its content maybe compressed and it is annotated with additional data.
For GCC adding the option '-ffat-lto-objects' when compiling common.o adds additionally the traditional sections in the object file and 'make u-boot-initial-env' would work also for the LTO enabled case. However clang doesn't have that option.
Fix this by recompiling common.o into a object file only used for the creation of u-boot-initial-env if LTO is enabled.
See also:
https://lore.kernel.org/all/[email protected]/
---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)
Makefile +8 -0
@@ -2451,9 +2451,17 @@ endif $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost quiet_cmd_genenv = GENENV $@ +ifeq ($(LTO_ENABLE),y) +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o env/initial_env.o env/common.c; \ + $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/initial_env.o; \ + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ + sort --field-separator== -k1,1 --stable $@ -o $@; \ + rm -f env/initial_env.o env/initial_env.su +else cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \ sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ sort --field-separator== -k1,1 --stable $@ -o $@ +endif u-boot-initial-env: u-boot.bin $(call if_changed,genenv)
Signature · 1 line
2.35.3
Quoted 37 lines · Max Krummenacher
From: Max Krummenacher <[email protected]>
With LTO enabled the U-Boot initial environment is no longer stored in an easy accessible section in
env/common.o. I.e. the section name changes from build to build, its content maybe compressed and it is annotated with additional data.For GCC adding the option '-ffat-lto-objects' when compiling common.o adds additionally the traditional sections in the object file and 'make u-boot-initial-env' would work also for the LTO enabled case. However clang doesn't have that option.
Fix this by recompiling common.o into a object file only used for the creation of u-boot-initial-env if LTO is enabled.
See also:
https://lore.kernel.org/all/[email protected]/Signed-off-by Max Krummenacher <[email protected]>---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)Makefile +4
-0@@ -2451,9 +2451,17 @@ endif $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost quiet_cmd_genenv = GENENV $@ +ifeq ($(LTO_ENABLE),y) +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o env/initial_env.o env/common.c; \ + $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/initial_env.o; \ + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \
Makefile endif · line 2467
Quoted 10 lines
Makefile +4
-0+ sort --field-separator== -k1,1 --stable $@ -o $@; \ + rm -f env/initial_env.o env/initial_env.su +else cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \ sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ sort --field-separator== -k1,1 --stable $@ -o $@ +endif u-boot-initial-env: u-boot.bin $(call if_changed,genenv)
Can we pipe the output instead of making a new object file? Maybe not, in a portable way it seems. But, I'm not sure the above respects using O= as well so that does need to be checked and fixed if so.
Signature · 1 line
Tom
Hi Tom
Quoted 47 lines · Tom Rini
Quoted 45 lines · Max Krummenacher
From: Max Krummenacher <[email protected]>
With LTO enabled the U-Boot initial environment is no longer stored in an easy accessible section in
env/common.o. I.e. the section name changes from build to build, its content maybe compressed and it is annotated with additional data.For GCC adding the option '-ffat-lto-objects' when compiling common.o adds additionally the traditional sections in the object file and 'make u-boot-initial-env' would work also for the LTO enabled case. However clang doesn't have that option.
Fix this by recompiling common.o into a object file only used for the creation of u-boot-initial-env if LTO is enabled.
See also:
https://lore.kernel.org/all/[email protected]/Signed-off-by Max Krummenacher <[email protected]>---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)Makefile +8
-0@@ -2451,9 +2451,17 @@ endif $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost quiet_cmd_genenv = GENENV $@ +ifeq ($(LTO_ENABLE),y) +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o env/initial_env.o env/common.c; \ + $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/initial_env.o; \ + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ + sort --field-separator== -k1,1 --stable $@ -o $@; \ + rm -f env/initial_env.o env/initial_env.su +else cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \ sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ sort --field-separator== -k1,1 --stable $@ -o $@ +endif
Quoted 6 lines
Makefile endif · line 2467
Quoted 2 lines
Makefile +0
-0u-boot-initial-env: u-boot.bin $(call if_changed,genenv)Can we pipe the output instead of making a new object file? Maybe not, in a portable way it seems. But, I'm not sure the above respects using O= as well so that does need to be checked and fixed if so.
While I didn't test it seems that objcopy doesn't allow to pipe data in and out of it.
Max
Quoted 3 lines
--
Tom
Quoted 57 lines · On Wednesday 19 October 2022 14:59:49 Max Krummenacher wrote:
Hi Tom
Quoted 47 lines · Tom Rini
Quoted 45 lines · Max Krummenacher
From: Max Krummenacher <[email protected]>
With LTO enabled the U-Boot initial environment is no longer stored in an easy accessible section in
env/common.o. I.e. the section name changes from build to build, its content maybe compressed and it is annotated with additional data.For GCC adding the option '-ffat-lto-objects' when compiling common.o adds additionally the traditional sections in the object file and 'make u-boot-initial-env' would work also for the LTO enabled case. However clang doesn't have that option.
Fix this by recompiling common.o into a object file only used for the creation of u-boot-initial-env if LTO is enabled.
See also:
https://lore.kernel.org/all/[email protected]/Signed-off-by Max Krummenacher <[email protected]>---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)Makefile +8
-0@@ -2451,9 +2451,17 @@ endif $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost quiet_cmd_genenv = GENENV $@ +ifeq ($(LTO_ENABLE),y) +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o env/initial_env.o env/common.c; \ + $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/initial_env.o; \ + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ + sort --field-separator== -k1,1 --stable $@ -o $@; \ + rm -f env/initial_env.o env/initial_env.su +else cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \ sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ sort --field-separator== -k1,1 --stable $@ -o $@ +endifQuoted 6 lines
Makefile endif · line 2467
Quoted 2 lines
Makefile +0
-0u-boot-initial-env: u-boot.bin $(call if_changed,genenv)Can we pipe the output instead of making a new object file? Maybe not, in a portable way it seems. But, I'm not sure the above respects using O= as well so that does need to be checked and fixed if so.
Quoted 2 lines
While I didn't test it seems that objcopy doesn't allow to pipe data in and out of it.
I think it should be easier to compile a new application which includes header file with env data and prints it to stdout. There are already host tools like mkimage which are run during u-boot build process, so adding a new simple host tool should not be a problem -- instead of trying to hack objcopy, or try to find a way how to play with its input/output redirection and symbol names to achieve same thing.
Quoted 4 lines
Max
Quoted 3 lines
--
Tom
Quoted 31 lines · On Tuesday 18 October 2022 19:48:27 Max Krummenacher wrote:
From: Max Krummenacher <[email protected]>
With LTO enabled the U-Boot initial environment is no longer stored in an easy accessible section in
env/common.o. I.e. the section name changes from build to build, its content maybe compressed and it is annotated with additional data.For GCC adding the option '-ffat-lto-objects' when compiling common.o adds additionally the traditional sections in the object file and 'make u-boot-initial-env' would work also for the LTO enabled case. However clang doesn't have that option.
Fix this by recompiling common.o into a object file only used for the creation of u-boot-initial-env if LTO is enabled.
See also:
https://lore.kernel.org/all/[email protected]/Signed-off-by Max Krummenacher <[email protected]>---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)Makefile +0
-0@@ -2451,9 +2451,17 @@ endif $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
Makefile endif · line 2461
Quoted 10 lines
Makefile +7
-0quiet_cmd_genenv = GENENV $@ +ifeq ($(LTO_ENABLE),y) +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o env/initial_env.o env/common.c; \ + $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/initial_env.o; \ + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ + sort --field-separator== -k1,1 --stable $@ -o $@; \ + rm -f env/initial_env.o env/initial_env.su +else cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \
This code is still broken because in some cases section name is not RO.
So instead of using section name, I would rather suggest to compile simple host application which prints it.
Quoted 9 lines
Makefile +1
-0sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ sort --field-separator== -k1,1 --stable $@ -o $@ +endif u-boot-initial-env: u-boot.bin $(call if_changed,genenv)Signature · 1 line
2.35.3
Quoted 33 lines · Pali Rohár
Quoted 32 lines · On Tuesday 18 October 2022 19:48:27 Max Krummenacher wrote:
From: Max Krummenacher <[email protected]>
With LTO enabled the U-Boot initial environment is no longer stored in an easy accessible section in
env/common.o. I.e. the section name changes from build to build, its content maybe compressed and it is annotated with additional data.For GCC adding the option '-ffat-lto-objects' when compiling common.o adds additionally the traditional sections in the object file and 'make u-boot-initial-env' would work also for the LTO enabled case. However clang doesn't have that option.
Fix this by recompiling common.o into a object file only used for the creation of u-boot-initial-env if LTO is enabled.
See also:
https://lore.kernel.org/all/[email protected]/Signed-off-by Max Krummenacher <[email protected]>---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)Makefile +0
-0@@ -2451,9 +2451,17 @@ endif $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
Quoted 11 lines
Makefile endif · line 2461
Quoted 9 lines
Makefile +7
-0quiet_cmd_genenv = GENENV $@ +ifeq ($(LTO_ENABLE),y) +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o env/initial_env.o env/common.c; \ + $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/initial_env.o; \ + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ + sort --field-separator== -k1,1 --stable $@ -o $@; \ + rm -f env/initial_env.o env/initial_env.su +else cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \This code is still broken because in some cases section name is not RO.
Wait, when does that happen?
Signature · 1 line
Tom
Quoted 46 lines · On Tuesday 18 October 2022 14:04:46 Tom Rini wrote:
Quoted 33 lines · Pali Rohár
Quoted 32 lines · On Tuesday 18 October 2022 19:48:27 Max Krummenacher wrote:
From: Max Krummenacher <[email protected]>
With LTO enabled the U-Boot initial environment is no longer stored in an easy accessible section in
env/common.o. I.e. the section name changes from build to build, its content maybe compressed and it is annotated with additional data.For GCC adding the option '-ffat-lto-objects' when compiling common.o adds additionally the traditional sections in the object file and 'make u-boot-initial-env' would work also for the LTO enabled case. However clang doesn't have that option.
Fix this by recompiling common.o into a object file only used for the creation of u-boot-initial-env if LTO is enabled.
See also:
https://lore.kernel.org/all/[email protected]/Signed-off-by Max Krummenacher <[email protected]>---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)Makefile +0
-0@@ -2451,9 +2451,17 @@ endif $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpostQuoted 11 lines
Makefile endif · line 2461
Quoted 9 lines
Makefile +7
-0quiet_cmd_genenv = GENENV $@ +ifeq ($(LTO_ENABLE),y) +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o env/initial_env.o env/common.c; \ + $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/initial_env.o; \ + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ + sort --field-separator== -k1,1 --stable $@ -o $@; \ + rm -f env/initial_env.o env/initial_env.su +else cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \This code is still broken because in some cases section name is not RO.
Quoted 4 lines
Wait, when does that happen?
Signature · 1 line
Tom
E.g. for mvebu_espressobin-88f3720_defconfig
Quoted 47 lines · Pali Rohár
Quoted 46 lines · On Tuesday 18 October 2022 14:04:46 Tom Rini wrote:
Quoted 44 lines · Pali Rohár
Quoted 31 lines · On Tuesday 18 October 2022 19:48:27 Max Krummenacher wrote:
From: Max Krummenacher <[email protected]>
With LTO enabled the U-Boot initial environment is no longer stored in an easy accessible section in
env/common.o. I.e. the section name changes from build to build, its content maybe compressed and it is annotated with additional data.For GCC adding the option '-ffat-lto-objects' when compiling common.o adds additionally the traditional sections in the object file and 'make u-boot-initial-env' would work also for the LTO enabled case. However clang doesn't have that option.
Fix this by recompiling common.o into a object file only used for the creation of u-boot-initial-env if LTO is enabled.
See also:
https://lore.kernel.org/all/[email protected]/Signed-off-by Max Krummenacher <[email protected]>---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)Makefile +0
-0@@ -2451,9 +2451,17 @@ endif $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpostMakefile endif · line 2461
Quoted 10 lines
Makefile +7
-0quiet_cmd_genenv = GENENV $@ +ifeq ($(LTO_ENABLE),y) +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o env/initial_env.o env/common.c; \ + $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/initial_env.o; \ + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ + sort --field-separator== -k1,1 --stable $@ -o $@; \ + rm -f env/initial_env.o env/initial_env.su +else cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \This code is still broken because in some cases section name is not RO.
Quoted 3 lines
Quoted 1 line
Wait, when does that happen?
E.g. for mvebu_espressobin-88f3720_defconfig
Erm, ugh. I see 44be835d25ba ("arm: mvebu: Espressobin: Set default value for $ethNaddr env variable") and c4df0f6f315c ("arm: mvebu:
Espressobin: Set default value for $fdtfile env variable") I guess we couldn't solve this any other way? The platforms aren't unique in needing / wanting to set MAC or fdtfile variables.
Signature · 1 line
Tom
Quoted 50 lines · On Tuesday 18 October 2022 14:17:23 Tom Rini wrote:
Quoted 49 lines · Pali Rohár
Quoted 47 lines · On Tuesday 18 October 2022 14:04:46 Tom Rini wrote:
Quoted 33 lines · Pali Rohár
Quoted 32 lines · On Tuesday 18 October 2022 19:48:27 Max Krummenacher wrote:
From: Max Krummenacher <[email protected]>
With LTO enabled the U-Boot initial environment is no longer stored in an easy accessible section in
env/common.o. I.e. the section name changes from build to build, its content maybe compressed and it is annotated with additional data.For GCC adding the option '-ffat-lto-objects' when compiling common.o adds additionally the traditional sections in the object file and 'make u-boot-initial-env' would work also for the LTO enabled case. However clang doesn't have that option.
Fix this by recompiling common.o into a object file only used for the creation of u-boot-initial-env if LTO is enabled.
See also:
https://lore.kernel.org/all/[email protected]/Signed-off-by Max Krummenacher <[email protected]>---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)Makefile +0
-0@@ -2451,9 +2451,17 @@ endif $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpostQuoted 11 lines
Makefile endif · line 2461
Quoted 9 lines
Makefile +7
-0quiet_cmd_genenv = GENENV $@ +ifeq ($(LTO_ENABLE),y) +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o env/initial_env.o env/common.c; \ + $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/initial_env.o; \ + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ + sort --field-separator== -k1,1 --stable $@ -o $@; \ + rm -f env/initial_env.o env/initial_env.su +else cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \This code is still broken because in some cases section name is not RO.
Wait, when does that happen?
Quoted 10 lines
Quoted 1 line
E.g. for mvebu_espressobin-88f3720_defconfig
Erm, ugh. I see
44be835d25ba("arm: mvebu: Espressobin: Set default value for $ethNaddr env variable") andc4df0f6f315c("arm: mvebu:
Espressobin: Set default value for $fdtfile env variable") I guess we couldn't solve this any other way? The platforms aren't unique in needing / wanting to set MAC or fdtfile variables.Signature · 1 line
Tom
Yes, we can solve it. Marek was working on solution for setting default variables at runtime but seems it is not finished yet.
Quoted 53 lines · Pali Rohár
Quoted 52 lines · On Tuesday 18 October 2022 14:17:23 Tom Rini wrote:
Quoted 50 lines · Pali Rohár
Quoted 46 lines · On Tuesday 18 October 2022 14:04:46 Tom Rini wrote:
Quoted 33 lines · Pali Rohár
Quoted 32 lines · On Tuesday 18 October 2022 19:48:27 Max Krummenacher wrote:
From: Max Krummenacher <[email protected]>
With LTO enabled the U-Boot initial environment is no longer stored in an easy accessible section in
env/common.o. I.e. the section name changes from build to build, its content maybe compressed and it is annotated with additional data.For GCC adding the option '-ffat-lto-objects' when compiling common.o adds additionally the traditional sections in the object file and 'make u-boot-initial-env' would work also for the LTO enabled case. However clang doesn't have that option.
Fix this by recompiling common.o into a object file only used for the creation of u-boot-initial-env if LTO is enabled.
See also:
https://lore.kernel.org/all/[email protected]/Signed-off-by Max Krummenacher <[email protected]>---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)Makefile +0
-0@@ -2451,9 +2451,17 @@ endif $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpostQuoted 11 lines
Makefile endif · line 2461
Quoted 9 lines
Makefile +7
-0quiet_cmd_genenv = GENENV $@ +ifeq ($(LTO_ENABLE),y) +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o env/initial_env.o env/common.c; \ + $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/initial_env.o; \ + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ + sort --field-separator== -k1,1 --stable $@ -o $@; \ + rm -f env/initial_env.o env/initial_env.su +else cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \This code is still broken because in some cases section name is not RO.
Quoted 1 line
Wait, when does that happen?
E.g. for mvebu_espressobin-88f3720_defconfig
Quoted 8 lines
Quoted 5 lines
Erm, ugh. I see
44be835d25ba("arm: mvebu: Espressobin: Set default value for $ethNaddr env variable") andc4df0f6f315c("arm: mvebu:
Espressobin: Set default value for $fdtfile env variable") I guess we couldn't solve this any other way? The platforms aren't unique in needing / wanting to set MAC or fdtfile variables.Yes, we can solve it. Marek was working on solution for setting default variables at runtime but seems it is not finished yet.
OK, then lets not assume DEFAULT_ENV_IS_RW is something we need to worry about long term.
Signature · 1 line
Tom
Hi all
Thanks for the feedback
Quoted 61 lines · Tom Rini
Quoted 59 lines · Pali Rohár
Quoted 57 lines · On Tuesday 18 October 2022 14:17:23 Tom Rini wrote:
Quoted 47 lines · Pali Rohár
Quoted 46 lines · On Tuesday 18 October 2022 14:04:46 Tom Rini wrote:
Quoted 44 lines · Pali Rohár
Quoted 31 lines · On Tuesday 18 October 2022 19:48:27 Max Krummenacher wrote:
From: Max Krummenacher <[email protected]>
With LTO enabled the U-Boot initial environment is no longer stored in an easy accessible section in
env/common.o. I.e. the section name changes from build to build, its content maybe compressed and it is annotated with additional data.For GCC adding the option '-ffat-lto-objects' when compiling common.o adds additionally the traditional sections in the object file and 'make u-boot-initial-env' would work also for the LTO enabled case. However clang doesn't have that option.
Fix this by recompiling common.o into a object file only used for the creation of u-boot-initial-env if LTO is enabled.
See also:
https://lore.kernel.org/all/[email protected]/Signed-off-by Max Krummenacher <[email protected]>---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)Makefile +0
-0@@ -2451,9 +2451,17 @@ endif $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpostMakefile endif · line 2461
Quoted 10 lines
Makefile +7
-0quiet_cmd_genenv = GENENV $@ +ifeq ($(LTO_ENABLE),y) +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o env/initial_env.o env/common.c; \ + $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/initial_env.o; \ + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \ + sort --field-separator== -k1,1 --stable $@ -o $@; \ + rm -f env/initial_env.o env/initial_env.su +else cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \This code is still broken because in some cases section name is not RO.
Quoted 3 lines
Quoted 1 line
Wait, when does that happen?
E.g. for mvebu_espressobin-88f3720_defconfig
Erm, ugh. I see
44be835d25ba("arm: mvebu: Espressobin: Set default value for $ethNaddr env variable") andc4df0f6f315c("arm: mvebu:
Espressobin: Set default value for $fdtfile env variable") I guess we couldn't solve this any other way? The platforms aren't unique in needing / wanting to set MAC or fdtfile variables.
Quoted 5 lines
Quoted 2 lines
Yes, we can solve it. Marek was working on solution for setting default variables at runtime but seems it is not finished yet.
OK, then lets not assume
DEFAULT_ENV_IS_RWis something we need to worry about long term.
The patch was intended to fix u-boot-initial-env make target for cases where it worked
without 'CONFIG_LTO' to also work if that config gets enabled.
Any use case where it already fails without 'CONFIG_LTO' set will not benefit.
I agree that a variant of tools/env/fw_printenv compiled for the build host may solve additional issues present. However I will not be able to work on such a solution in the near future.
Max
Quoted 3 lines
--
Tom