[coreboot-gerrit] New patch to review for coreboot: util/cbfstool: Allow overwriting CBFS regions with raw data on request
Patrick Georgi (pgeorgi@google.com)
gerrit at coreboot.org
Wed Oct 12 16:48:28 CEST 2016
Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16998
-gerrit
commit 32a5ce4031ca3623c281b8227c1ccb4589b0ab9c
Author: Patrick Georgi <pgeorgi at chromium.org>
Date: Wed Oct 12 16:46:13 2016 +0200
util/cbfstool: Allow overwriting CBFS regions with raw data on request
Add a --force/-F option and enable it for cbfstool write, where it has
the effect of not testing if the fmap region contains a CBFS or if the
data to write is a CBFS image.
Change-Id: I02f72841a20db3d86d1b67ccf371bd40bb9a4d51
Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
---
util/cbfstool/cbfstool.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index e70cb4b..c695e55 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -82,6 +82,7 @@ static struct param {
/* for linux payloads */
char *initrd;
char *cmdline;
+ int force;
} param = {
/* All variables not listed are initialized as zero. */
.arch = CBFS_ARCHITECTURE_UNKNOWN,
@@ -935,7 +936,7 @@ static int cbfs_write(void)
return 1;
}
- if (region_is_modern_cbfs(param.region_name)) {
+ if (!param.force && region_is_modern_cbfs(param.region_name)) {
ERROR("Target image region '%s' is a CBFS and must be manipulated using add and remove\n",
param.region_name);
return 1;
@@ -952,7 +953,7 @@ static int cbfs_write(void)
buffer_delete(&new_content);
return 1;
}
- if (buffer_check_magic(&new_content, CBFS_FILE_MAGIC,
+ if (!param.force && buffer_check_magic(&new_content, CBFS_FILE_MAGIC,
strlen(CBFS_FILE_MAGIC))) {
ERROR("File '%s' appears to be a CBFS and cannot be inserted into a raw region\n",
param.filename);
@@ -1088,7 +1089,7 @@ static const struct command commands[] = {
{"read", "r:f:vh?", cbfs_read, true, false},
{"remove", "H:r:n:vh?", cbfs_remove, true, true},
{"update-fit", "H:r:n:x:vh?", cbfs_update_fit, true, true},
- {"write", "r:f:udvh?", cbfs_write, true, true},
+ {"write", "r:f:Fudvh?", cbfs_write, true, true},
};
static struct option long_options[] = {
@@ -1104,6 +1105,7 @@ static struct option long_options[] = {
{"fill-upward", no_argument, 0, 'u' },
{"flashmap", required_argument, 0, 'M' },
{"fmap-regions", required_argument, 0, 'r' },
+ {"force", no_argument, 0, 'F' },
{"source-region", required_argument, 0, 'R' },
{"hash-algorithm",required_argument, 0, 'A' },
{"header-offset", required_argument, 0, 'H' },
@@ -1444,6 +1446,9 @@ int main(int argc, char **argv)
case 'f':
param.filename = optarg;
break;
+ case 'F':
+ param.force = 1;
+ break;
case 'i':
param.u64val = strtoull(optarg, &suffix, 0);
if (!*optarg || (suffix && *suffix)) {
More information about the coreboot-gerrit
mailing list