public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] data alignment problem with redundant env
@ 2011-03-31 15:30 Andre Schwarz
  2011-03-31 15:39 ` Wolfgang Denk
  0 siblings, 1 reply; 6+ messages in thread
From: Andre Schwarz @ 2011-03-31 15:30 UTC (permalink / raw)
  To: u-boot

Hi,

moving to latest U-Boot introduces some issues with the environment.

Setup:
- PowerPC based boards (52xx / 83xx)
- Environments are in flash with redundancy

Dumping flash the environments with dd and using hexdump shows :

          - crc32 - flags Data (first entry beginning with 'a').
0000000: b0ea 7858 0100  64...
0000010: ...

Regarding to include/environment.h data is "unsigned char" as well as 
data[].
To me it looks like 2-byte wide flags (or 16-bit alignment of data) is 
wrong.

Although env modification within u-boot only is safe it breakother
tools modifying the environment within e.g. Linux.


This happened somewhere between v2010.9 and current master.
Back then U-Boot env data started on byte 5.

Do we need an attribute(packed) on the env struct ?

Any help is welcome.


Regards,
Andr?

MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] data alignment problem with redundant env
  2011-03-31 15:30 [U-Boot] data alignment problem with redundant env Andre Schwarz
@ 2011-03-31 15:39 ` Wolfgang Denk
  2011-03-31 15:48   ` Andre Schwarz
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2011-03-31 15:39 UTC (permalink / raw)
  To: u-boot

Dear Andre Schwarz,

In message <4D949E22.5090000@matrix-vision.de> you wrote:
> 
> moving to latest U-Boot introduces some issues with the environment.

Which board would that be?  I don't see this on any board I tested.

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
The existence of god implies a violation of causality.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] data alignment problem with redundant env
  2011-03-31 15:39 ` Wolfgang Denk
@ 2011-03-31 15:48   ` Andre Schwarz
  2011-03-31 16:01     ` Wolfgang Denk
  0 siblings, 1 reply; 6+ messages in thread
From: Andre Schwarz @ 2011-03-31 15:48 UTC (permalink / raw)
  To: u-boot

Wolfgang,
> Dear Andre Schwarz,
>
> In message<4D949E22.5090000@matrix-vision.de>  you wrote:
>> moving to latest U-Boot introduces some issues with the environment.
> Which board would that be?  I don't see this on any board I tested.
it is mvblm7 (=MPC8343) and a new MPC8377 based one waiting for
the merge window to open.


I'm using a gcc-4.3.3 from OpenEmbedded/Angstrom ... if this matters at all.


Regards,
Andr?

MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] data alignment problem with redundant env
  2011-03-31 15:48   ` Andre Schwarz
@ 2011-03-31 16:01     ` Wolfgang Denk
  2011-03-31 16:41       ` Andre Schwarz
  2011-04-06  9:05       ` Andre Schwarz
  0 siblings, 2 replies; 6+ messages in thread
From: Wolfgang Denk @ 2011-03-31 16:01 UTC (permalink / raw)
  To: u-boot

Dear Andre Schwarz,

In message <4D94A250.907@matrix-vision.de> you wrote:
>
> > Which board would that be?  I don't see this on any board I tested.
> it is mvblm7 (=MPC8343) and a new MPC8377 based one waiting for
> the merge window to open.
> 
> 
> I'm using a gcc-4.3.3 from OpenEmbedded/Angstrom ... if this matters at all.

Can you please try and use anothe rtool chain, say good ole ELDK 4.2
for a test?

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
Behind every great man, there is a woman -- urging him on.
	-- Harry Mudd, "I, Mudd", stardate 4513.3

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] data alignment problem with redundant env
  2011-03-31 16:01     ` Wolfgang Denk
@ 2011-03-31 16:41       ` Andre Schwarz
  2011-04-06  9:05       ` Andre Schwarz
  1 sibling, 0 replies; 6+ messages in thread
From: Andre Schwarz @ 2011-03-31 16:41 UTC (permalink / raw)
  To: u-boot

Wolfgang,
>>> Which board would that be?  I don't see this on any board I tested.
>> it is mvblm7 (=MPC8343) and a new MPC8377 based one waiting for
>> the merge window to open.
>>
>>
>> I'm using a gcc-4.3.3 from OpenEmbedded/Angstrom ... if this matters at all.
> Can you please try and use anothe rtool chain, say good ole ELDK 4.2
> for a test?
yes, of course.
But I can make some tests on real hardware not before monday.

This is what I can say after compiling with both toolchains.

1. redundant env

CROSS_COMPILE=ppc_6xx- ARCH=powerpc sh MAKEALL mvblm7
    text       data        bss        dec        hex    filename
  233298      21940      66960     322198      4ea96    ./u-boot

CROSS_COMPILE=powerpc-angstrom-linux-  ARCH=powerpc sh MAKEALL mvblm7
    text       data        bss        dec        hex    filename
  233758      21948      66956     322662      4ec66    ./u-boot


2. without redundant env

swa at swa-m460:~/u-boot$ CROSS_COMPILE=ppc_6xx- ARCH=powerpc sh MAKEALL mvblm7
    text       data        bss        dec        hex    filename
  232494      21912      66960     321366      4e756    ./u-boot

swa at swa-m460:~/u-boot$ CROSS_COMPILE=powerpc-angstrom-linux-  
ARCH=powerpc sh MAKEALL mvblm7
    text       data        bss        dec        hex    filename
  232954      21920      66956     321830      4e926    ./u-boot


size of final u-boot binary differs by 8 bytes ... sounds promising ;-)

Will run both versions asap.


Regards,
Andr?

MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] data alignment problem with redundant env
  2011-03-31 16:01     ` Wolfgang Denk
  2011-03-31 16:41       ` Andre Schwarz
@ 2011-04-06  9:05       ` Andre Schwarz
  1 sibling, 0 replies; 6+ messages in thread
From: Andre Schwarz @ 2011-04-06  9:05 UTC (permalink / raw)
  To: u-boot

Wolfgang,

>>> Which board would that be?  I don't see this on any board I tested.
>> it is mvblm7 (=MPC8343) and a new MPC8377 based one waiting for
>> the merge window to open.
>>
>>
>> I'm using a gcc-4.3.3 from OpenEmbedded/Angstrom ... if this matters at all.
> Can you please try and use anothe rtool chain, say good ole ELDK 4.2
> for a test?
ok - that's it.

Compiling with ELDK 4.2 gives an environment as expected.

4 bytes crc32 + 1 byte redundancy flags + data :

mvBL-M7> md ff800000 10
ff800000: 56900c81 01626175 64726174 653d3131    V....baudrate=11
ff800010: 35323030 00626f6f 74617267 733d726f    5200.bootargs=ro

Using OpenEmbedded's (Angstrom) gcc 4.3.3 produces a corrupted
layout with data having a 16-Bit alignment leading to a 1 byte offset when
redundancy is used.


Will stick to ELDK 4.2 for U-Boot.

Problem solved, but I'm still irritated how easily things can be broken 
nowadays ...


Regards,
Andr?


MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-04-06  9:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-31 15:30 [U-Boot] data alignment problem with redundant env Andre Schwarz
2011-03-31 15:39 ` Wolfgang Denk
2011-03-31 15:48   ` Andre Schwarz
2011-03-31 16:01     ` Wolfgang Denk
2011-03-31 16:41       ` Andre Schwarz
2011-04-06  9:05       ` Andre Schwarz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox