Attention is currently required from: Aaron Durbin, Furquan Shaikh, Julius Werner.

Hung-Te Lin uploaded patch set #14 to this change.

View Change

The following approvals got outdated and were removed: Verified+1 by build bot (Jenkins)

util: cbfstool: Add '%<alignment>' in flashmap descriptor

Most FMAP sections that need to be updated independently should be
aligned to the erase block size. Otherwise a power failure during update
may corrupt other sections (because we have to erase across multiple
sections before writing).

Flashmap descriptor (FMD) allows implicit offset and size, so sometimes
the sections may not be properly aligned. To prevent that, we want to
add an alignment argument to the descriptor.

Because most sections (especially in chromeos.fmd) do need alignment,
the patch is assuming "aligned to 4k blocks" as default. 4k is chosen
because that's what most flash chipsets support. For individual non-4k
SPI flash chipsets they may need more runtime checks and that is not
covered by this patch.

For sections that don't need to be aligned (or aligned to different
values), use the '%<num>' after section name (or offset) explicitly to
change the alignment. For example '%0' means unaligned and '%512' aligns
to 512 bytes. For example:

FMAP@0x1000 %0 0x800

Declared an FMAP section to be in offset 0x1000, size 0x800, and no need
to be aligned.


Declared a CBFS section to be not aligned, using auto offset/size.

Most boards already have CBFS and FMAP being unaligned, so the patch
only warns when seeing unaligned sections. Follow up patches will fix
FMD files, and eventually change warnings to errors.

TEST=make -j # pass

Change-Id: I26b394590c28667a4afcd521c7caa2009b5b98a9
Signed-off-by: Hung-Te Lin <>
M Documentation/lib/
M util/cbfstool/default-x86.fmd
M util/cbfstool/default.fmd
M util/cbfstool/fmap_from_fmd.c
M util/cbfstool/fmd.h
M util/cbfstool/fmd_parser.c_shipped
M util/cbfstool/fmd_parser.h_shipped
M util/cbfstool/fmd_parser.y
M util/cbfstool/fmd_scanner.c_shipped
M util/cbfstool/fmd_scanner.h_shipped
M util/cbfstool/fmd_scanner.l
11 files changed, 965 insertions(+), 867 deletions(-)

git pull ssh:// refs/changes/62/37262/14

To view, visit change 37262. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I26b394590c28667a4afcd521c7caa2009b5b98a9
Gerrit-Change-Number: 37262
Gerrit-PatchSet: 14
Gerrit-Owner: Hung-Te Lin <>
Gerrit-Reviewer: Arthur Heymans <>
Gerrit-Reviewer: Furquan Shaikh <>
Gerrit-Reviewer: Hung-Te Lin <>
Gerrit-Reviewer: Julius Werner <>
Gerrit-Reviewer: Yu-Ping Wu <>
Gerrit-Reviewer: build bot (Jenkins) <>
Gerrit-CC: Aaron Durbin <>
Gerrit-CC: Paul Menzel <>
Gerrit-CC: Wim Vervoorn <>
Gerrit-Attention: Furquan Shaikh <>
Gerrit-Attention: Julius Werner <>
Gerrit-Attention: Aaron Durbin <>
Gerrit-MessageType: newpatchset