summaryrefslogtreecommitdiffstats
path: root/cli_classic.c
diff options
context:
space:
mode:
authorDaniel Campello <campello@chromium.org>2021-04-13 10:47:25 -0600
committerEdward O'Callaghan <quasisec@chromium.org>2021-04-27 23:41:53 +0000
commit45d50a101e8073191e6d88143990ed91d3bfe815 (patch)
treeae1493908fd9a015e09283c8af9609917a59288d /cli_classic.c
parent3f19ba95f1ea2fbd83f96fe9aa3ee78651e33899 (diff)
downloadflashrom-45d50a101e8073191e6d88143990ed91d3bfe815.tar.gz
flashrom-45d50a101e8073191e6d88143990ed91d3bfe815.tar.bz2
flashrom-45d50a101e8073191e6d88143990ed91d3bfe815.zip
layout: Add -i <region>[:<file>] support
Add an optional sub-parameter to the -i parameter to allow building the image to be written from multiple files. This will also allow regions to be read from flash and written to separate image files. This is a rebase of a patch that was ported from chromiumos. A lot of things have changed, but the idea is the same. Original patch by Louis Yung-Chieh Lo <yjlou@chromium.org>: Summary: Support -i partition:file feature for both read and write. Commit: 9c7525f Review URL: http://codereview.chromium.org/6611015 Ported version by Stefan Tauner <stefan.tauner@student.tuwien.ac.at> and Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>: Summary: [PATCH 2/6] layout: Add -i <region>[:<file>] support. Review URL: https://mail.coreboot.org/pipermail/flashrom/2013-October/011729.html Change-Id: Ic5465659605d8431d931053967b40290195cfd99 Signed-off-by: David Hendricks <dhendrix@chromium.org> Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Signed-off-by: Nico Huber <nico.huber@secunet.com> Signed-off-by: Edward O'Callaghan <quasisec@google.com> Signed-off-by: Daniel Campello <campello@chromium.org> Co-Authored-by: Edward O'Callaghan <quasisec@google.com> Co-Authored-by: Daniel Campello <campello@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/23021 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Sam McNally <sammc@google.com> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'cli_classic.c')
-rw-r--r--cli_classic.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/cli_classic.c b/cli_classic.c
index 3160d769e..a22d642d4 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -41,7 +41,7 @@ static void cli_classic_usage(const char *name)
"\n\t-p <programmername>[:<parameters>] [-c <chipname>]\n"
"\t\t(--flash-name|--flash-size|\n"
"\t\t [-E|(-r|-w|-v) <file>]\n"
- "\t\t [(-l <layoutfile>|--ifd| --fmap|--fmap-file <file>) [-i <imagename>]...]\n"
+ "\t\t [(-l <layoutfile>|--ifd| --fmap|--fmap-file <file>) [-i <region>[:<file>]]...]\n"
"\t\t [-n] [-N] [-f])]\n"
"\t[-V[V[V]]] [-o <logfile>]\n\n", name);
@@ -67,7 +67,8 @@ static void cli_classic_usage(const char *name)
" --fmap read ROM layout from fmap embedded in ROM\n"
" --fmap-file <fmapfile> read ROM layout from fmap in <fmapfile>\n"
" --ifd read layout from an Intel Firmware Descriptor\n"
- " -i | --image <name> only flash image <name> from flash layout\n"
+ " -i | --image <region>[:<file>] only read/write image <region> from layout\n"
+ " (optionally with data from <file>)\n"
" -o | --output <logfile> log output to <logfile>\n"
" --flash-contents <ref-file> assume flash contents to be <ref-file>\n"
" -L | --list-supported print supported devices\n"
@@ -337,11 +338,8 @@ int main(int argc, char *argv[])
fmap = 1;
break;
case 'i':
- tempstr = strdup(optarg);
- if (register_include_arg(&include_args, tempstr)) {
- free(tempstr);
+ if (register_include_arg(&include_args, optarg))
cli_classic_abort_usage(NULL);
- }
break;
case OPTION_FLASH_CONTENTS:
if (referencefile)