diff options
author | Hung-Te Lin <hungte@chromium.org> | 2013-01-29 02:29:49 +0800 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2013-02-05 22:25:20 +0100 |
commit | 0f8af71f1a40e8ae960ba616cb9a5bf14f10fb13 (patch) | |
tree | 307b6c6ed395745f8769563bb3a32afe0922966a /util/cbfstool/cbfstool.c | |
parent | 3bb035b095a0e4144adfa55fa45b2332e3a6c7d5 (diff) |
cbfstool: Use cbfs_image API for "extract" command.
Change the "extract" command to use cbfs_export_entry API. Nothing changed in
its usage.
To verify, run "cbfstool coreboot.rom extract -f blah -n blah" and check if the
raw type file is correctly extracted.
Change-Id: I1ed280d47a2224a9d1213709f6b459b403ce5055
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: http://review.coreboot.org/2207
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/cbfstool/cbfstool.c')
-rw-r--r-- | util/cbfstool/cbfstool.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index d70f757fc5..9d22552b35 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -401,8 +401,8 @@ static int cbfs_print(void) static int cbfs_extract(void) { - void *rom; - int ret; + int result = 0; + struct cbfs_image image; if (!param.filename) { ERROR("You need to specify -f/--filename.\n"); @@ -414,17 +414,17 @@ static int cbfs_extract(void) return 1; } - rom = loadrom(param.cbfs_name); - if (rom == NULL) { + if (cbfs_image_from_file(&image, param.cbfs_name) != 0) { ERROR("Could not load ROM image '%s'.\n", param.cbfs_name); - return 1; + result = 1; + } else if (cbfs_export_entry(&image, param.name, + param.filename) != 0) { + result = 1; } - ret = extract_file_from_cbfs(param.cbfs_name, param.name, param.filename); - - free(rom); - return ret; + cbfs_image_delete(&image); + return result; } static const struct command commands[] = { |