[coreboot] Questions about CBFS

Thomas Jourdan tjourdan at neuf.fr
Fri Aug 21 21:31:14 CEST 2009

Le vendredi 21 août 2009 à 10:56 -0700, ron minnich a écrit :
> On Fri, Aug 21, 2009 at 10:42 AM, Thomas Jourdan<tjourdan at neuf.fr> wrote:
> >> I'll take that patch. It makes sense to fill the FLASH from the top down.
> >
> > My patch needs a little more work. File insertion is top down but file
> > chain walk is still bottom up. This is bad because the file chain can
> > easyly break. As a workaround I added a raw file search function : I
> > search the FWH for CBFS file signature.
> Nope. If the file chain can break, that's a bug. How did that happen?
> The whole point
> of adding empty space is to ensure it won't break.

I did succeed breaking the file chain when updating my firmware. It was
voluntary because I needed to test the robustness of my recovery

When you want to walk the file chain, you grab the first file offset
from the cbfs master header. This gives you the first file cbfs header.
Then with master header alignment, header offset and length, you can
easily compute the offset of the next file.

If for any reason (let's say power failure during flash upgrade), a
FWH's block, which contains a cbfs header, is erased, then the file
chain is broken. You can not circumvent it. The only work around is to
use a raw cbfs find file function, which parses the whole rom looking
for the cbfs file signature.

Now let's take the case where only the top block is valid. The idea is
to have bootblock and recover stage in this block. If the chain file
walk starts from the bottom of the rom, you're dead : you won't find the
beginning of the file chain, and you won't find your recover stage.

If the file chain walk is backward, from top to bottom, you'll find the
recover stage (the first file), allowing you to restore your whole rom.
Of course the file chain is still broken because the file following the
recover stage is missing, but you were able to locate the first file,
which really matters.

It's just an idea to make to cbfs code more robust in the case of
recovery procedure. 


More information about the coreboot mailing list