Author: stepan Date: Sat Apr 24 23:24:06 2010 New Revision: 5487 URL: https://tracker.coreboot.org/trac/coreboot/changeset/5487
Log: print the known cbfs types in cbfstool "usage"
Signed-off-by: Stefan Reinauer stepan@coresystems.de Acked-by: Stefan Reinauer stepan@coresystems.de
Modified: trunk/util/cbfstool/cbfstool.c trunk/util/cbfstool/common.c trunk/util/cbfstool/common.h
Modified: trunk/util/cbfstool/cbfstool.c ============================================================================== --- trunk/util/cbfstool/cbfstool.c Sat Apr 24 09:56:32 2010 (r5486) +++ trunk/util/cbfstool/cbfstool.c Sat Apr 24 23:24:06 2010 (r5487) @@ -254,17 +254,20 @@ void usage(void) { printf - ("cbfstool: Management utility for CBFS formatted ROM images\n" - "USAGE:\n" "cbfstool [-h]\n" - "cbfstool FILE COMMAND [PARAMETERS]...\n\n" "OPTIONs:\n" - " -h Display this help message\n\n" + ("cbfstool: Management utility for CBFS formatted ROM images\n\n" + "USAGE:\n" " cbfstool [-h]\n" + " cbfstool FILE COMMAND [PARAMETERS]...\n\n" "OPTIONs:\n" + " -h Display this help message\n\n" "COMMANDs:\n" - "add FILE NAME TYPE [base address] Add a component\n" - "add-payload FILE NAME [COMP] [base] Add a payload to the ROM\n" - "add-stage FILE NAME [COMP] [base] Add a stage to the ROM\n" - "create SIZE BOOTBLOCK [ALIGN] Create a ROM file\n" - "locate FILE NAME ALIGN Find a place for a file of that size\n" - "print Show the contents of the ROM\n"); + " add FILE NAME TYPE [base address] Add a component\n" + " add-payload FILE NAME [COMP] [base] Add a payload to the ROM\n" + " add-stage FILE NAME [COMP] [base] Add a stage to the ROM\n" + " create SIZE BOOTBLOCK [ALIGN] Create a ROM file\n" + " locate FILE NAME ALIGN Find a place for a file of that size\n" + " print Show the contents of the ROM\n\n" + "TYPEs:\n" + ); + print_supported_filetypes(); }
int main(int argc, char **argv)
Modified: trunk/util/cbfstool/common.c ============================================================================== --- trunk/util/cbfstool/common.c Sat Apr 24 09:56:32 2010 (r5486) +++ trunk/util/cbfstool/common.c Sat Apr 24 23:24:06 2010 (r5487) @@ -137,6 +137,17 @@ {CBFS_COMPONENT_NULL, "null"} };
+void print_supported_filetypes(void) +{ + int i, number = ARRAY_SIZE(filetypes); + + for (i=0; i<number; i++) { + printf(" %s%c", filetypes[i].name, (i==(number-1))?'\n':','); + if ((i%8) == 7) + printf("\n"); + } +} + const char *strfiletype(uint32_t number) { int i;
Modified: trunk/util/cbfstool/common.h ============================================================================== --- trunk/util/cbfstool/common.h Sat Apr 24 09:56:32 2010 (r5486) +++ trunk/util/cbfstool/common.h Sat Apr 24 23:24:06 2010 (r5487) @@ -72,4 +72,6 @@ uint32_t cbfs_find_location(const char *romfile, uint32_t filesize, const char *filename, uint32_t align);
+void print_supported_filetypes(void); + #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))