
Dear Igor Grinberg,
In message 5110BDB2.8040800@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