Am Donnerstag, den 16.06.2011, 21:50 +0800 schrieb Hamo:
- When we create the rom file, we covert all address and size from
LSB to MSB using htonl, and when we use them in the rom, we covert them to LSB. Why we do this? Is it necessary or historical or something else? Since ARM don't have an instruction like BSWAP in X86 (or I don't know it), it is not easy to covert a register from LSB to MSB or vice versa.
We thought it's a good idea to mandate _some_ default, otherwise we'd risk having incompatible image formats created by the same tool.
Question is if we should define native endianess per platform and let cbfstool take care of things (instead of coreboot at runtime), adding a flag to the CBFS header (which would have to be properly specified so things are clear)
- What's the purpose of tryharder in src/arch/x86/lib/walkcbfs.S? In
my opinion, After we found a 'LARCHIVE', we can just compare the name with the target name. If they are the same, OK, we got it and we can jump to it, If not, we should jump to searchfile to find the next CBFS component.
It's probably somewhat misnamed: searchfile takes the alignment property of an image and searches the image for LARCHIVE headers in "align"-increments. tryharder skips a file (of a known size) so the cbfs walker doesn't have to search inside files (we know that new files won't start there).
Essentially the algorithm is like this: 1. determine ALIGN 2. set cursor to the beginning of the image 3. search for 'LARCHIVE' header in ALIGN-steps (address mod ALIGN == 0) (searchfile) 4. if a file is found, check filename 5. if filename matches, return success 7. otherwise skip file (tryharder) 8. if cursor left image area, return failure 9. go to 3.
where 3. expands to: 3a. look for 'LARCHIVE' 3b. if found, go to 4. 3c. otherwise do cursor += ALIGN; 3d. if cursor left image area, return failure 3e. go to 3a.
Regards, Patrick