aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2016-05-17 13:57:06 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-05-18 15:27:17 +1000
commit2b2047fbf4630574058398c86d683f7696dbeb4e (patch)
treed080578c7f32e510c8901d20704e55ecf8103fe3 /external
parentbd943b976e2b9218ee9e981427724af3ed12e840 (diff)
downloadskiboot-2b2047fbf4630574058398c86d683f7696dbeb4e.zip
skiboot-2b2047fbf4630574058398c86d683f7696dbeb4e.tar.gz
skiboot-2b2047fbf4630574058398c86d683f7696dbeb4e.tar.bz2
pflash: add support for manipulating file rather than flash
Add command line parameters for passing into libflash to have pflash manipulate a file rather than flash. This is useful for testing. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com>
Diffstat (limited to 'external')
-rw-r--r--external/pflash/pflash.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
index da7d7f5..fddfe1d 100644
--- a/external/pflash/pflash.c
+++ b/external/pflash/pflash.c
@@ -461,6 +461,8 @@ static void print_help(const char *pname)
printf("\t\tTarget BMC flash instead of host flash.\n");
printf("\t\tNote: This carries a high chance of bricking your BMC if you\n");
printf("\t\tdon't know what you're doing. Consider --mtd to be safe(r)\n\n");
+ printf("\t-F filename, --flash-file filename\n");
+ printf("\t\tTarget filename instead of actual flash.\n\n");
printf("\t-S, --side\n");
printf("\t\tSide of the flash on which to operate, 0 (default) or 1\n\n");
printf("\t-T, --toc\n");
@@ -527,6 +529,7 @@ int main(int argc, char *argv[])
char *write_file = NULL, *read_file = NULL, *part_name = NULL;
bool ffs_toc_seen = false, mtd = false;
int rc;
+ const char *flashfilename = NULL;
while(1) {
struct option long_opts[] = {
@@ -542,6 +545,7 @@ int main(int argc, char *argv[])
{"erase", no_argument, NULL, 'e'},
{"program", required_argument, NULL, 'p'},
{"force", no_argument, NULL, 'f'},
+ {"flash-file", required_argument, NULL, 'F'},
{"info", no_argument, NULL, 'i'},
{"tune", no_argument, NULL, 't'},
{"dummy", no_argument, NULL, 'd'},
@@ -555,7 +559,7 @@ int main(int argc, char *argv[])
};
int c, oidx = 0;
- c = getopt_long(argc, argv, "+:a:s:P:r:43Eemp:fdihvbtgS:T:c",
+ c = getopt_long(argc, argv, "+:a:s:P:r:43Eemp:fdihvbtgS:T:cF:",
long_opts, &oidx);
if (c == -1)
break;
@@ -595,6 +599,9 @@ int main(int argc, char *argv[])
case 'f':
must_confirm = false;
break;
+ case 'F':
+ flashfilename = optarg;
+ break;
case 'd':
must_confirm = false;
dummy_run = true;
@@ -763,7 +770,7 @@ int main(int argc, char *argv[])
}
}
- if (arch_flash_init(&bl, NULL, true)) {
+ if (arch_flash_init(&bl, flashfilename, true)) {
fprintf(stderr, "Couldn't initialise architecture flash structures\n");
exit(1);
}