[U-Boot] [PATCH v2 01/22] mkimage: Add OMAP boot image support

Wolfgang Denk wd at denx.de
Tue May 17 14:32:04 CEST 2011


Dear Aneesh V,

In message <4DD2657F.3020708 at ti.com> you wrote:
> 
> >>>> +struct ch_toc {
> >>>> +	uint32_t section_offset;
> >>>> +	uint32_t section_size;
> >>>> +	uint8_t unused[12];
> >>>> +	uint8_t section_name[12];
> >>>> +} __attribute__ ((__packed__));
> >>>> +
> >>>> +struct ch_settings {
> >>>> +	uint32_t section_key;
> >>>> +	uint8_t valid;
> >>>> +	uint8_t version;
> >>>> +	uint16_t reserved;
> >>>> +	uint32_t flags;
> >>>> +} __attribute__ ((__packed__));
> >>>> +
> >>>> +struct gp_header {
> >>>> +	uint32_t size;
> >>>> +	uint32_t load_addr;
> >>>> +} __attribute__ ((__packed__));
...
> > No. Not in the structs listed above.
> 
> Why do you think it will not create any problems. For instance, what if
> the field "uint8_t version" in "struct ch_settings" is aligned to a 32
> bit boundary by the compiler for faster access? That is not the
> intended layout.

If the compiler did such a thing, this would indeed be bad.  But I
have never seen a compiler doing this, nor is there a reason to do so.
The naturla alignment requirement for a uint8_t is a byte; ther eis no
need to align it on 4 byte boundary.

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
Man is the best computer we can put aboard a spacecraft ...  and  the
only one that can be mass produced with unskilled labor.
                                                  - Wernher von Braun


More information about the U-Boot mailing list