[coreboot] [PATCH] cbfstool default type for add command.

Kevin O'Connor kevin at koconnor.net
Mon Sep 6 15:49:14 CEST 2010


The "raw" type is a good default for the "add" command.  Allow the
user to add files without specifying a type ("raw" will be assumed).

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 util/cbfstool/cbfstool.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 7c22a65..311a3e8 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -70,15 +70,13 @@ static int cbfs_add(int argc, char **argv)
 	uint32_t base = 0;
 	void *cbfsfile = NULL;
 
-	if (argc < 6) {
-		printf("not enough arguments to 'add'.\n");
-		return 1;
+	uint32_t type = CBFS_COMPONENT_RAW;
+	if (argc > 5) {
+		if (intfiletype(argv[5]) != ((uint64_t) - 1))
+			type = intfiletype(argv[5]);
+		else
+			type = strtoul(argv[5], NULL, 0);
 	}
-	uint32_t type;
-	if (intfiletype(argv[5]) != ((uint64_t) - 1))
-		type = intfiletype(argv[5]);
-	else
-		type = strtoul(argv[5], NULL, 0);
 	if (argc > 6) {
 		base = strtoul(argv[6], NULL, 0);
 	}
@@ -332,7 +330,7 @@ void usage(void)
 	     " 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 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"
 	     " add-lzma FILE NAME [TYPE] [base]     Lzma compress and add\n"
-- 
1.7.2.2





More information about the coreboot mailing list