cbfstool: Use cbfs_image API for "print" command.

Process CBFS ROM image by new cbfs_image API.
To verify, run "cbfstool coreboot.rom print -v" and compare with old cbfstool.

Change-Id: I3a5a9ef176596d825e6cdba28a8ad732f69f5600
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: http://review.coreboot.org/2206
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Hung-Te Lin
2013-01-29 02:15:49 +08:00
committed by Stefan Reinauer
parent eab2c81949
commit 3bb035b095
4 changed files with 235 additions and 8 deletions

View File

@@ -27,6 +27,7 @@
#include <getopt.h>
#include "common.h"
#include "cbfs.h"
#include "cbfs_image.h"
struct command {
const char *name;
@@ -387,18 +388,14 @@ static int cbfs_locate(void)
static int cbfs_print(void)
{
void *rom;
rom = loadrom(param.cbfs_name);
if (rom == NULL) {
struct cbfs_image image;
if (cbfs_image_from_file(&image, param.cbfs_name) != 0) {
ERROR("Could not load ROM image '%s'.\n",
param.cbfs_name);
return 1;
}
print_cbfs_directory(param.cbfs_name);
free(rom);
cbfs_print_directory(&image);
cbfs_image_delete(&image);
return 0;
}