[U-Boot] [PATCH 1/5] Add bmp_layout module for accessing BMP header data

Wolfgang Denk wd at denx.de
Tue Feb 5 10:57:03 CET 2013


Dear Igor Grinberg,

In message <5110BDB2.8040800 at compulab.co.il> you wrote:
>
> > Yes, struct bmp_header is a packed array with non-natural order of
> > entries; see also section "Bitmap file header" at [1]; we may consider
> > this a really stupid thing to do, but we have to live with this fact.
> 
> It was not that stupid in times of DOS and Win 3.1
> when int was 16 bits long (and DRAM was 64K or even less)...

It was as stupid then, too.  At that time, a large number of systems
with similar alignment requirements existed, and experience with these
existed, too.

Do you remember the "The Ten Commandments for C Programmers"?  If not,
look them up and check how old these are.  Note especially the ``All
the world's a VAX'' part - this is exactly what we see here in
operation.

The design of the BMP header is just BRAINDEAD.

> > Indeed, this should be documented.  And eventually the bmp command
> > should print a warning message if it sees other alignment.
> 
> Agreed on this also, but again what about the board brick case?

There is a ton of ways to brick a board.  Why should we add protection
for one special case while we agree to leave the 50 other ways
onfixed?

> Should we add the check for alignment and if it does not properly aligned
> deny further bmp header processing along with printing a warning?

Why should we?  Who tells that this is not perfectly legal on the
running system?


Let me repeat it: U-Boot is a boot loader.  It is not intended for
meddling by avarage Johnny Loser, but for system programmers who know
what they are doing. And anyone doing such things is well adviced to
_test_ his settings on the command line before storing these for
automatic use.  As I mentioned before, omitting such tests is a sin
that carries with it its own punishment.


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
Pig: An animal (Porcus omnivorous) closely allied to the  human  race
by  the splendor and vivacity of its appetite, which, however, is in-
ferior in scope, for it balks at pig.                - Ambrose Bierce


More information about the U-Boot mailing list