mirror of
https://review.coreboot.org/flashrom.git
synced 2025-08-17 04:14:42 +02:00
cli_classic.c: Make -r/-w/-v argument optional when using -i
Make the filename parameter directly following -r/-w/-v optional, since the -i parameter allows the image to be written to be sourced from multiple files, regions to be read from flash and written to separate image files, and regions to be verified using an image file only containing that region. Since the filename parameter following -w/-v was ignored when a filename was specified following `-i <region>:<filename>`, this patch essentially removes the requirement to provide an unused parameter. Based on https://review.coreboot.org/c/flashrom/+/52362. TEST=run the following commands on a supported board: flashrom -p internal -r /tmp/coreboot.rom flashrom -p internal -r --ifd -i bios:/tmp/coreboot.rom flashrom -p internal -r /tmp/coreboot.rom --ifd -i bios:/tmp/bios.bin flashrom -p internal -w /tmp/coreboot.rom flashrom -p internal -w --ifd -i bios:/tmp/coreboot.rom flashrom -p internal -w /tmp/coreboot.rom --ifd -i bios:/tmp/bios.bin flashrom -p internal -v /tmp/coreboot.rom flashrom -p internal -v --ifd -i bios:/tmp/coreboot.rom flashrom -p internal -v /tmp/coreboot.rom --ifd -i bios:/tmp/bios.bin Change-Id: I6eba095d478f1a7bdbc3854627a656f93dd9e452 Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/85159 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:

committed by
Anastasia Klimchuk

parent
d07cd9f515
commit
b9e0a3ce70
13
layout.c
13
layout.c
@@ -288,6 +288,19 @@ int process_include_args(struct flashrom_layout *l, const struct layout_include_
|
||||
return 0;
|
||||
}
|
||||
|
||||
int check_include_args_filename(const struct layout_include_args *include_args)
|
||||
{
|
||||
const struct layout_include_args *arg;
|
||||
for (arg = include_args; arg; arg = arg->next) {
|
||||
if (!arg->file || (arg->file[0] == '\0')) {
|
||||
fprintf(stderr, "Error: No region file specified for -i/--include option.\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* returns boolean 1 if any regions overlap, 0 otherwise */
|
||||
int included_regions_overlap(const struct flashrom_layout *const l)
|
||||
{
|
||||
|
Reference in New Issue
Block a user