From 49a44505637ecfa3a6c1606bc0986e70397966b0 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Mon, 4 Mar 2019 15:41:09 +0800 Subject: cbfstool: Support new FMD flag "PRESERVE" When updating firmware, it is very often that we may want to preserve few sections, for example vital product data (VPD) including serial number, calibration data and cache. A firmware updater has to hard-code the section names that need to be preserved and is hard to maintain. A better approach is to specify that in FMAP area flags (the `area_flag` field) using FMAP_AREA_PRESERVE. With this patchset, a FMD parser flag "PRESERVE" is introduced and will be converted to FMAP_AREA_PRESERVE when generating FMAP data (by fmap_from_fmd.c). For example, The FMD statement: RO_VPD(PRESERVE)@0x0 16k will generate an FMAP firmware section that: area_name = "RO_VPD" area_offset = 0 area_size = 16384 area_flags = FMAP_AREA_PRESERVE BUG=chromium:936768 TEST=make; boots on x86 "google/eve" and arm "google/kukui" devices Manually added 'PRESERVE' to some FMD files, and verify (by running fmap.py) the output coreboot.rom has FMAP_AREA_PRESERVE set Change-Id: I51e7d31029b98868a1cab0d26bf04a14db01b1c0 Signed-off-by: Hung-Te Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/31707 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- util/cbfstool/fmd_parser.y | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util/cbfstool/fmd_parser.y') diff --git a/util/cbfstool/fmd_parser.y b/util/cbfstool/fmd_parser.y index 4ca418efea..3ba710c289 100644 --- a/util/cbfstool/fmd_parser.y +++ b/util/cbfstool/fmd_parser.y @@ -60,6 +60,7 @@ void yyerror(const char *s); %token OCTAL %token STRING %token FLAG_CBFS +%token FLAG_PRESERVE %type flash_region %type region_name @@ -107,6 +108,7 @@ region_flags_opt: { $$ = (union flashmap_flags){ .v=0 }; } | '(' region_flags ')' { $$ = $2; }; region_flags: region_flag | region_flag region_flags { $$.v = $1.v | $2.v; }; region_flag: FLAG_CBFS { $$.v = 0; $$.f.cbfs = 1; }; +region_flag: FLAG_PRESERVE { $$.v = 0; $$.f.preserve = 1; }; region_offset_opt: { $$ = (struct unsigned_option){false, 0}; } | region_offset; region_offset: '@' INTEGER { $$ = (struct unsigned_option){true, $2}; }; -- cgit v1.2.3