[U-Boot] [PATCH 1/2 v4] env: only build env_embedded and envcrc when needed

Wolfgang Denk wd at denx.de
Tue Oct 27 00:24:58 CET 2009


Dear Mike Frysinger,

In message <200910182055.01744.vapier at gentoo.org> you wrote:
>
...
> From 1ffa4c71d249e877c8b4b84e412af7efc1e8f113 Mon Sep 17 00:00:00 2001
> From: Mike Frysinger <vapier at gentoo.org>
> Date: Sun, 18 Oct 2009 19:37:11 -0400
> Subject: [PATCH 2/2] env_embedded: remove unused code from linker scripts
>
> Punt references to common/env_embedded.o when the linker script does not
> utilize env_offset as this means the location of the environment is not
> kept in a fixed location -- it'll get appended wherever the previous
> .text objects happen to end.  This will fluctuate greatly by the compiler
> and related optimizations.
>
> For boards that do leverage env_offset behind a DEFINED() check, only try
> to include env_embedded.o when the object would actually be non-zero.
> i.e. when CONFIG_ENV_IS_EMBEDDED is defined

I give up. Applying this patch was a wrong thing to do. It _does_
break boards.

I wrote this before:

------- Forwarded Message

Date:    Mon, 19 Oct 2009 11:31:36 +0200
From:    Wolfgang Denk <wd at denx.de>
To:      Mike Frysinger <vapier at gentoo.org>
cc:      u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH 1/2 v4] env: only build env_embedded and envcrc wh
	  en needed

...
I would tend to apply your second patch - but looking at it I will
not do it, as it seems to break boards just harder, i. e. they may
build, but will fail to work.

For example:

...
> diff --git a/board/tqc/tqm8xx/u-boot.lds b/board/tqc/tqm8xx/u-boot.lds
> index 2df8d84..8207b2c 100644
> --- a/board/tqc/tqm8xx/u-boot.lds
> +++ b/board/tqc/tqm8xx/u-boot.lds
> @@ -21,6 +21,8 @@
>   * MA 02111-1307 USA
>   */
>  
> +#include <config.h>
> +
>  OUTPUT_ARCH(powerpc)
>  /* Do we need any of these for elf?
>     __DYNAMIC = 0;    */
> @@ -64,8 +66,10 @@ SECTIONS
>      lib_generic/zlib.o		(.text)
>      lib_ppc/cache.o		(.text)
>  
> +#ifdef CONFIG_ENV_IS_EMBEDDED
>      . = DEFINED(env_offset) ? env_offset : .;
>      common/env_embedded.o	(.ppcenv)
> +#endif

All TQM8xx boards use a hand-optimized linker script that places  the
envrionment  (both  the  primary  and  the redundant copies) into the
small boot sectors of the bottom boot block type NOR  flash  used  on
these  boards  (and the same is true for other boards as well; I know
this for sure at least for  IVM*,  km8xx,  purple,  spc1920,  stxxtc,
trab).

However, none of these #defines CONFIG_ENV_IS_EMBEDDED in their board
config files.
...

------- End of Forwarded Message


And this is what happens:

Before applying the patch:

 *fill*         0x40007a68      0x598 00
 common/env_embedded.o(.ppcenv)
 .ppcenv        0x40008000     0x8000 common/env_embedded.o
                0x40008000                environment
                0x4000c000                redundand_environment
 *(.text)

i. e. the environment sectors are neatly aligned at the bootom boot
sectors at offset 0x8000 and 0xC000

After applying the patch:

.ppcenv         0x40033278     0x8000
 .ppcenv        0x40033278     0x8000 common/libcommon.a(env_embedded.o)
                0x40033278                environment
                0x40037278                redundand_environment


i. e. the environment sectors are at random locations. U-Boot doesn't
even boot any more on two 8xx boards I tested.



Sorry, but I don't have time nor nerves any more at this point of the
release cycle to continue trying this patch or that, so I decided  to
revert commit 6dab6add ("env: only build env_embedded and envcrc when
needed").

Now all boards build fine again.

Please clean this up so it works on all boards, and resubmit for next
release. Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
It is dangerous to be sincere unless you are also stupid.
                                                - George Bernard Shaw


More information about the U-Boot mailing list