diff options
author | Hung-Te Lin <hungte@chromium.org> | 2013-01-29 02:38:40 +0800 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2013-02-05 22:26:53 +0100 |
commit | c03d9b0c4387f7218e6c9c7d94cf86a5e2b3943e (patch) | |
tree | 57295c32e24b6da782da44789f4664c218f26883 /util/cbfstool/cbfstool.c | |
parent | 0f8af71f1a40e8ae960ba616cb9a5bf14f10fb13 (diff) | |
download | coreboot-c03d9b0c4387f7218e6c9c7d94cf86a5e2b3943e.tar.xz |
cbfstool: Use cbfs_image API for "remove" command.
To delete a component (file) from existing CBFS ROM image.
To test:
cbfstool coreboot.rom remove -n fallback/romstage
# and compare with old cbfstool output result.
Change-Id: If39ef9be0b34d8e3df77afb6c9f944e02f08bc4e
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: http://review.coreboot.org/2208
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, 8 insertions, 10 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 9d22552b35..e653a33bd5 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -312,33 +312,31 @@ static int cbfs_add_flat_binary(void) static int cbfs_remove(void) { - void *rom; + struct cbfs_image image; if (!param.name) { ERROR("You need to specify -n/--name.\n"); 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; } - if (remove_file_from_cbfs(param.name)) { + if (cbfs_remove_entry(&image, param.name) != 0) { ERROR("Removing file '%s' failed.\n", - param.name); - free(rom); + param.name); + cbfs_image_delete(&image); return 1; } - - if (writerom(param.cbfs_name, rom, romsize)) { - free(rom); + if (cbfs_image_write_file(&image, param.cbfs_name) != 0) { + cbfs_image_delete(&image); return 1; } - free(rom); + cbfs_image_delete(&image); return 0; } |