From 45d50a101e8073191e6d88143990ed91d3bfe815 Mon Sep 17 00:00:00 2001 From: Daniel Campello Date: Tue, 13 Apr 2021 10:47:25 -0600 Subject: layout: Add -i [:] 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 : 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 and Carl-Daniel Hailfinger : Summary: [PATCH 2/6] layout: Add -i [:] support. Review URL: https://mail.coreboot.org/pipermail/flashrom/2013-October/011729.html Change-Id: Ic5465659605d8431d931053967b40290195cfd99 Signed-off-by: David Hendricks Signed-off-by: Stefan Tauner Signed-off-by: Carl-Daniel Hailfinger Signed-off-by: Arthur Heymans Signed-off-by: Nico Huber Signed-off-by: Edward O'Callaghan Signed-off-by: Daniel Campello Co-Authored-by: Edward O'Callaghan Co-Authored-by: Daniel Campello Reviewed-on: https://review.coreboot.org/c/flashrom/+/23021 Tested-by: build bot (Jenkins) Reviewed-by: Sam McNally Reviewed-by: Edward O'Callaghan --- cli_classic.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'cli_classic.c') 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 [:] [-c ]\n" "\t\t(--flash-name|--flash-size|\n" "\t\t [-E|(-r|-w|-v) ]\n" - "\t\t [(-l |--ifd| --fmap|--fmap-file ) [-i ]...]\n" + "\t\t [(-l |--ifd| --fmap|--fmap-file ) [-i [:]]...]\n" "\t\t [-n] [-N] [-f])]\n" "\t[-V[V[V]]] [-o ]\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 read ROM layout from fmap in \n" " --ifd read layout from an Intel Firmware Descriptor\n" - " -i | --image only flash image from flash layout\n" + " -i | --image [:] only read/write image from layout\n" + " (optionally with data from )\n" " -o | --output log output to \n" " --flash-contents assume flash contents to be \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) -- cgit v1.2.3