[coreboot-gerrit] New patch to review for coreboot: cbfstool: Allow "formatting" individual fmap regions

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Wed Oct 21 20:52:56 CEST 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12113

-gerrit

commit 4d556635bc7afd20b11853e4e53a4c476386a876
Author: Patrick Georgi <pgeorgi at google.com>
Date:   Wed Oct 21 19:20:25 2015 +0200

    cbfstool: Allow "formatting" individual fmap regions
    
    cbfstool file create -r regions (no --size nor --fmap arguments)
    now initializes the given regions with an empty CBFS, without
    master header.
    
    Change-Id: I6ce38d66a92fd4f5a7a1c4fc8a34845edd3edc6a
    Signed-off-by: Patrick Georgi <pgeorgi at google.com>
---
 util/cbfstool/cbfstool.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 5d87c9f..6173466 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -638,6 +638,11 @@ static int cbfs_create(void)
 		return cbfs_image_create(&image, image.buffer.size);
 	}
 
+	if (param.image_region) {
+		struct cbfs_file *first_header = (struct cbfs_file *)image.buffer.data;
+		return cbfs_create_empty_entry(first_header, CBFS_COMPONENT_NULL, image.buffer.size, "");
+	}
+
 	if (param.arch == CBFS_ARCHITECTURE_UNKNOWN) {
 		ERROR("You need to specify -m/--machine arch.\n");
 		return 1;
@@ -1081,6 +1086,8 @@ static void usage(char *name)
 			"Create a legacy ROM file with CBFS master header*\n"
 	     " create -M flashmap [-r list,of,regions,containing,cbfses]   "
 			"Create a new-style partitioned firmware image\n"
+	     " create [-r list,of,regions,containing,cbfses]               "
+			"Add empty CBFSes in specified regions\n"
 	     " locate [-r image,regions] -f FILE -n NAME [-P page-size] \\\n"
 	     "        [-a align] [-T]                                      "
 			"Find a place for a file of that size\n"
@@ -1304,8 +1311,11 @@ int main(int argc, char **argv)
 			} else if (param.size) {
 				param.image_file = partitioned_file_create_flat(
 							image_name, param.size);
+			} else if (param.region_name) {
+				param.image_file =
+					partitioned_file_reopen(image_name);
 			} else {
-				ERROR("You need to specify a valid -M/--flashmap or -s/--size.\n");
+				ERROR("You need to specify a valid -M/--flashmap, -s/--size, or -r/--fmap-regions.\n");
 				return 1;
 			}
 		} else {
@@ -1356,7 +1366,7 @@ int main(int argc, char **argv)
 			param.region_name = strtok(NULL, ",");
 		}
 
-		if (commands[i].function == cbfs_create && !seen_primary_cbfs) {
+		if (commands[i].function == cbfs_create && param.fmap && !seen_primary_cbfs) {
 			ERROR("The creation -r list must include the mandatory '%s' section.\n",
 						SECTION_NAME_PRIMARY_CBFS);
 			ERROR("The image will be left unmodified.\n");



More information about the coreboot-gerrit mailing list