[coreboot] Questions about CBFS

Georgi, Patrick Patrick.Georgi at secunet.com
Fri Jun 17 08:29:04 CEST 2011


Am Donnerstag, den 16.06.2011, 21:50 +0800 schrieb Hamo:
> 1. 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)

> 2. 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
-- 
Patrick Georgi
Fachbereich SINA-Entwicklung
Geschäftsbereich Hochsicherheit
secunet Security Networks AG
Mergenthalerallee 77
65760 Eschborn, Germany
Telefon +49 201 54 54-3610
Telefax +49 201 54 54-1325
Patrick.Georgi at secunet.com 
www.secunet.com 

Sitz: Kronprinzenstraße 30, 45128 Essen
Amtsgericht Essen HRB 13615
Vorstand: Dr. Rainer Baumgart (Vors.), Thomas Koelzer, Thomas Pleines
Aufsichtsratsvorsitzender: Dr. Karsten Ottenberg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20110617/b157c72d/attachment.sig>


More information about the coreboot mailing list