summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2013-07-16 08:17:17 -0700
committerChromeBot <chrome-bot@google.com>2013-07-16 09:50:30 -0700
commitd5702792793859c78b10a34aa59f386c0356d500 (patch)
tree2db004eff5ba2fc4d3b80d056df970650b74a92b
parentc1bbc75e3ba77019c62eda69db556109faeba607 (diff)
downloadvboot-d5702792793859c78b10a34aa59f386c0356d500.tar.gz
Revert "futility: Use flashrom for 'dump_fmap -x'"
It seems likely that this is causing the reported autoupdate failure, although it will take a bit of time to understand the mechanism. For now, a revert seems safest. BUG=chromium:20939 BRANCH=none TEST=none This revert should be safe since it takes us back to the previous behavior. I will work on repeating the problem and diagnosing it properly. This reverts commit c1bbc75e3ba77019c62eda69db556109faeba607. Original-Change-Id: I303fcbf45d835639b6d5a7f5f6423d0c18890ddf Reviewed-on: https://gerrit.chromium.org/gerrit/62004 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> (cherry picked from commit abd06d1270fe5a48551d85a332bbc11f72805990) Change-Id: I6ac5da12c00d67c1ed708aa34b102a76915270a5 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62105
-rw-r--r--futility/cmd_dump_fmap.c58
1 files changed, 24 insertions, 34 deletions
diff --git a/futility/cmd_dump_fmap.c b/futility/cmd_dump_fmap.c
index 18a75de2..4faf2212 100644
--- a/futility/cmd_dump_fmap.c
+++ b/futility/cmd_dump_fmap.c
@@ -79,6 +79,30 @@ static int dump_fmap(const void *ptr, int argc, char *argv[])
printf("area_size: 0x%08x (%d)\n", ah->area_size, ah->area_size);
printf("area_name: %s\n", buf);
}
+
+ if (opt_extract) {
+ char *s;
+ for (s = buf; *s; s++)
+ if (*s == ' ')
+ *s = '_';
+ FILE *fp = fopen(buf,"wb");
+ if (!fp) {
+ fprintf(stderr, "%s: can't open %s: %s\n",
+ progname, buf, strerror(errno));
+ retval = 1;
+ } else {
+ if (ah->area_size &&
+ 1 != fwrite(base_of_rom + ah->area_offset, ah->area_size, 1, fp)) {
+ fprintf(stderr, "%s: can't write %s: %s\n",
+ progname, buf, strerror(errno));
+ retval = 1;
+ } else {
+ if (FMT_NORMAL == opt_format)
+ printf("saved as \"%s\"\n", buf);
+ }
+ fclose(fp);
+ }
+ }
}
return retval;
@@ -327,35 +351,6 @@ static int human_fmap(void *p)
/* End of human-reable stuff */
/****************************************************************************/
-/**
- * Extract components from an image and write them to separate files
- *
- * This uses flashrom so that we don't repeat the FMAP code
- */
-static int extract_components(const char *fname)
-{
- static char *flashrom = "/usr/sbin/flashrom";
- char image_arg[256];
- char * const argv[] = {
- flashrom,
- "-p",
- image_arg,
- "-x",
- "--ignore-lock",
- "-V",
- NULL,
- };
-
- snprintf(image_arg, sizeof(image_arg),
- "dummy:emulate=VARIABLE_SIZE,size=auto,image=%s",
- fname);
-
- if (execv(flashrom, argv))
- fprintf(stderr, "%s: Cannot run flashrom\n", progname);
-
- return 1;
-}
-
static int do_dump_fmap(int argc, char *argv[])
{
int c;
@@ -430,11 +425,6 @@ static int do_dump_fmap(int argc, char *argv[])
return 1;
}
- if (opt_extract) {
- retval = extract_components(argv[optind]);
- return retval;
- }
-
fd = open(argv[optind], O_RDONLY);
if (fd < 0) {
fprintf(stderr, "%s: can't open %s: %s\n",