Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/47883 )
Change subject: util/cbfstool/fmaptool: Generate list of terminal sections ......................................................................
util/cbfstool/fmaptool: Generate list of terminal sections
This change adds support in fmaptool to generate a macro in C header file that provides a list of section names that do not have any subsections. This is useful for performing build time tests on these sections.
BUG=b:171534504
Change-Id: Ie32bb8af4a722d329f9d4729722b131ca352d47a Signed-off-by: Furquan Shaikh furquan@google.com --- M util/cbfstool/fmaptool.c 1 file changed, 24 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/83/47883/1
diff --git a/util/cbfstool/fmaptool.c b/util/cbfstool/fmaptool.c index 9f5803d..4ba5967 100644 --- a/util/cbfstool/fmaptool.c +++ b/util/cbfstool/fmaptool.c @@ -14,6 +14,12 @@ #define HEADER_FMAP_OFFSET "FMAP_OFFSET" #define HEADER_FMAP_SIZE "FMAP_SIZE"
+/* + * Macro name used in the generated C header file to provide list of section names that do not + * have any sub-sections. + */ +#define HEADER_FMAP_TERMINAL_SECTIONS "FMAP_TERMINAL_SECTIONS" + enum fmaptool_return { FMAPTOOL_EXIT_SUCCESS = 0, FMAPTOOL_EXIT_BAD_ARGS, @@ -71,6 +77,20 @@ fputc('\n', out); }
+static void write_header_fmap_terminal_section_names(FILE *header, + const struct flashmap_descriptor *root) +{ + assert(root); + + if (root->list_len == 0) { + fprintf(header, "%s ", root->name); + return; + } + + fmd_foreach_child(child, root) + write_header_fmap_terminal_section_names(header, child); +} + static void write_header_fmap_sections(FILE *header, const struct flashmap_descriptor *root, unsigned int offset) { @@ -116,6 +136,10 @@ fprintf(header, "#define %s %#x\n", HEADER_FMAP_OFFSET, fmap_offset); fprintf(header, "#define %s %#x\n\n", HEADER_FMAP_SIZE, fmap_size);
+ fprintf(header, "#define %s "", HEADER_FMAP_TERMINAL_SECTIONS); + write_header_fmap_terminal_section_names(header, root); + fprintf(header, ""\n\n"); + write_header_fmap_sections(header, root, 0); fputs("\n", header);
Srinidhi N Kaushik has uploaded a new patch set (#5) to the change originally created by Furquan Shaikh. ( https://review.coreboot.org/c/coreboot/+/47883 )
Change subject: util/cbfstool/fmaptool: Generate list of terminal sections ......................................................................
util/cbfstool/fmaptool: Generate list of terminal sections
This change adds support in fmaptool to generate a macro in C header file that provides a list of section names that do not have any subsections. This is useful for performing build time tests on these sections.
BUG=b:171534504
Change-Id: Ie32bb8af4a722d329f9d4729722b131ca352d47a Signed-off-by: Furquan Shaikh furquan@google.com --- M util/cbfstool/fmaptool.c 1 file changed, 24 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/83/47883/5
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47883 )
Change subject: util/cbfstool/fmaptool: Generate list of terminal sections ......................................................................
Patch Set 8: Code-Review+2
Furquan Shaikh has submitted this change. ( https://review.coreboot.org/c/coreboot/+/47883 )
Change subject: util/cbfstool/fmaptool: Generate list of terminal sections ......................................................................
util/cbfstool/fmaptool: Generate list of terminal sections
This change adds support in fmaptool to generate a macro in C header file that provides a list of section names that do not have any subsections. This is useful for performing build time tests on these sections.
BUG=b:171534504
Change-Id: Ie32bb8af4a722d329f9d4729722b131ca352d47a Signed-off-by: Furquan Shaikh furquan@google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/47883 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Duncan Laurie dlaurie@chromium.org --- M util/cbfstool/fmaptool.c 1 file changed, 24 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Duncan Laurie: Looks good to me, approved
diff --git a/util/cbfstool/fmaptool.c b/util/cbfstool/fmaptool.c index 9f5803d..4ba5967 100644 --- a/util/cbfstool/fmaptool.c +++ b/util/cbfstool/fmaptool.c @@ -14,6 +14,12 @@ #define HEADER_FMAP_OFFSET "FMAP_OFFSET" #define HEADER_FMAP_SIZE "FMAP_SIZE"
+/* + * Macro name used in the generated C header file to provide list of section names that do not + * have any sub-sections. + */ +#define HEADER_FMAP_TERMINAL_SECTIONS "FMAP_TERMINAL_SECTIONS" + enum fmaptool_return { FMAPTOOL_EXIT_SUCCESS = 0, FMAPTOOL_EXIT_BAD_ARGS, @@ -71,6 +77,20 @@ fputc('\n', out); }
+static void write_header_fmap_terminal_section_names(FILE *header, + const struct flashmap_descriptor *root) +{ + assert(root); + + if (root->list_len == 0) { + fprintf(header, "%s ", root->name); + return; + } + + fmd_foreach_child(child, root) + write_header_fmap_terminal_section_names(header, child); +} + static void write_header_fmap_sections(FILE *header, const struct flashmap_descriptor *root, unsigned int offset) { @@ -116,6 +136,10 @@ fprintf(header, "#define %s %#x\n", HEADER_FMAP_OFFSET, fmap_offset); fprintf(header, "#define %s %#x\n\n", HEADER_FMAP_SIZE, fmap_size);
+ fprintf(header, "#define %s "", HEADER_FMAP_TERMINAL_SECTIONS); + write_header_fmap_terminal_section_names(header, root); + fprintf(header, ""\n\n"); + write_header_fmap_sections(header, root, 0); fputs("\n", header);