aboutsummaryrefslogtreecommitdiff
path: root/util/nvramtool/nvramtool.c
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@secunet.com>2011-01-21 07:24:08 +0000
committerPatrick Georgi <patrick.georgi@coresystems.de>2011-01-21 07:24:08 +0000
commit269e932340869696abfaeb63736ba887d88ef690 (patch)
treed37feee820644896be53f8a3e1b909042c414344 /util/nvramtool/nvramtool.c
parent9cd7eba1180396cbd91776a94444696f6b4069c4 (diff)
Add nvramtool -C option that takes a CBFS file as argument.
When using this option, nvramtool looks for a cmos_layout.bin and cmos.default in the image and uses these for layout information and CMOS data. Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com> Acked-by: Stefan Reinauer <stepan@coreboot.org> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6285 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/nvramtool/nvramtool.c')
-rw-r--r--util/nvramtool/nvramtool.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/util/nvramtool/nvramtool.c b/util/nvramtool/nvramtool.c
index e82d0ac9d8..6ad5d2f269 100644
--- a/util/nvramtool/nvramtool.c
+++ b/util/nvramtool/nvramtool.c
@@ -38,6 +38,7 @@
#include "cmos_lowlevel.h"
#include "reg_expr.h"
#include "hexdump.h"
+#include "cbfs.h"
typedef void (*op_fn_t) (void);
@@ -92,7 +93,7 @@ static const hexdump_format_t cmos_dump_format =
****************************************************************************/
int main(int argc, char *argv[])
{
- cmos_layout_get_fn_t fn;
+ cmos_layout_get_fn_t fn = get_layout_from_cmos_table;
parse_nvramtool_args(argc, argv);
@@ -100,8 +101,18 @@ int main(int argc, char *argv[])
set_layout_filename(nvramtool_op_modifiers
[NVRAMTOOL_MOD_USE_CMOS_LAYOUT_FILE].param);
fn = get_layout_from_file;
- } else
+ } else if (nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_OPT_TABLE].found) {
fn = get_layout_from_cmos_table;
+ } else if (nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CBFS_FILE].found) {
+ open_cbfs(nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CBFS_FILE].param);
+ void *cmosdefault = cbfs_find_file("cmos.default", CBFS_COMPONENT_CMOS_DEFAULT, NULL);
+ if (cmosdefault == NULL) {
+ printf("Need a cmos.default in the CBFS image for now.\n");
+ exit(1);
+ }
+ select_hal(HAL_MEMORY, cmosdefault);
+ fn = get_layout_from_cbfs_file;
+ }
register_cmos_layout_get_fn(fn);
op_fns[nvramtool_op.op] ();