
Dear Albert ARIBAUD,
In message 4CCFDE45.3060306@free.fr you wrote:
These is a valid point that the SPL isn't necessarily rebuilt and flashed every time u-boot itself is built and flashed, so whatever constant the SPL would carry would only be valid for the u-boot that was built alongside.
I have to admit that I was not aware that there are systems were SPL and U-Boot itself are not bundled into a single image, but handled separately. [I have to admit that I don;t like such a setup; it cries for incompatibilities and other trouble.]
Now a solution would be that the actual u-boot size be flashed along with it, for instance as a literal defined as '.word _end - _start' right after the vectors. The SPL could load a first NAND block, read the literal, round it to a multiple of NAND blocks by default, and then read this quantity.
That would remove the dependency at the cost of extra code in the SPL, though, and not all boards might be able to afford it.
Indeed. Maybe be can combine several approaches:
- In case SPL and U-Boot are combined into a single image anyway, we can use a compile-time compution of the needed length, without additional code in the SPL. - Where this is not prossible (i. e. SPL and U-Boot are separate), we can try and optionally provide the solution you suggest. - Where memory is toot ight to allow for that code, the old style of a static #define will be used as a fallback.
Best regards,
Wolfgang Denk