[coreboot] cbfstool: CBFS alignment broken due to FMAP

Ben Gardner gardner.ben at gmail.com
Mon Jan 18 21:34:25 CET 2016


Hi all,

With the latest cbfstool in master, the alignment option is broken in cbfstool.
Or rather, the alignment is relative to the CBFS start, not the actual
ROM address, and the 256-byte FMAP throws off the alignment.

In my case, I have a ROM size of 16 MB and the BIOS region starts at 0x200000.
Layout from ifdtool (sorted):
  00000000:00000fff fd
  00001000:001fffff me
  00200000:00ffffff bios

Layout from cbfstool:
  'BIOS' (read-only, size 14680064)
  'FMAP' (read-only, size 256)
  'COREBOOT' (CBFS, size 14679808)

When I add a 16 KB file with alignment 4096:
$ cbfstool coreboot.rom add -f 16kb_ff.bin -n alignment.bin -t raw -a 4096

The new file is aligned in the CBFS at 0x99000.
$ cbfstool output/coreboot.rom print
Performing operation on 'COREBOOT' region...
Name                           Offset     Type         Size
... snip ...
(empty)                        0x98640    null         2392
alignment.bin                  0x98fc0    raw          16384
(empty)                        0x9d000    null         13774488
... snip ...

But due to the FMAP, that address is really 0x99100, not 0x99000,
which is not 4 KB aligned.

002990c0  4c 41 52 43 48 49 56 45  00 00 40 00 00 00 00 50  |LARCHIVE.. at ....P|
002990d0  00 00 00 28 00 00 00 40  61 6c 69 67 6e 6d 65 6e  |...(... at alignmen|
002990e0  74 2e 62 69 6e 00 00 00  42 43 5a 4c 00 00 00 10  |t.bin...BCZL....|
002990f0  00 00 00 00 00 00 40 00  ff ff ff ff ff ff ff ff  |...... at .........|
00299100  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

And this is because the CBFS starts at 0x2000100 instead of 0x2000000.
Is there a work-around for this? For example, is there an option to
pad the FMAP out to 4 KB?
Or maybe a way to force the CBFS to be place at a 4 KB alignment?
Is someone working on a patch?

Thanks,
Ben



More information about the coreboot mailing list