summaryrefslogtreecommitdiff
path: root/util/nvramtool/cli
diff options
context:
space:
mode:
Diffstat (limited to 'util/nvramtool/cli')
-rw-r--r--util/nvramtool/cli/nvramtool.c18
-rw-r--r--util/nvramtool/cli/opts.c9
-rw-r--r--util/nvramtool/cli/opts.h4
3 files changed, 28 insertions, 3 deletions
diff --git a/util/nvramtool/cli/nvramtool.c b/util/nvramtool/cli/nvramtool.c
index bcb10bbf34..f3fb16d1b1 100644
--- a/util/nvramtool/cli/nvramtool.c
+++ b/util/nvramtool/cli/nvramtool.c
@@ -62,6 +62,8 @@ static void op_write_cmos_dump(void);
static void op_read_cmos_dump(void);
static void op_show_cmos_hex_dump(void);
static void op_show_cmos_dumpfile(void);
+static void op_write_cmos_layout_bin(void);
+static void op_write_cmos_layout_header(void);
static int list_one_param(const char name[], int show_name);
static int list_all_params(void);
static void list_param_enums(const char name[]);
@@ -86,9 +88,23 @@ static const op_fn_t op_fns[] = { op_show_version,
op_write_cmos_dump,
op_read_cmos_dump,
op_show_cmos_hex_dump,
- op_show_cmos_dumpfile
+ op_show_cmos_dumpfile,
+ op_write_cmos_layout_bin,
+ op_write_cmos_layout_header
};
+static void op_write_cmos_layout_bin(void)
+{
+ get_layout_from_file();
+ write_cmos_output_bin(nvramtool_op.param);
+}
+
+static void op_write_cmos_layout_header(void)
+{
+ get_layout_from_file();
+ write_cmos_layout_header(nvramtool_op.param);
+}
+
static const hexdump_format_t cmos_dump_format =
{ 16, 2, "", " | ", " ", " | ", '.' };
diff --git a/util/nvramtool/cli/opts.c b/util/nvramtool/cli/opts.c
index 49496495eb..8e920e8694 100644
--- a/util/nvramtool/cli/opts.c
+++ b/util/nvramtool/cli/opts.c
@@ -41,7 +41,7 @@ static void register_op_modifier(nvramtool_op_modifier_t mod, char mod_param[]);
static void resolve_op_modifiers(void);
static void sanity_check_args(void);
-static const char getopt_string[] = "-ab:B:c::C:dD:e:hil::np:r:tvw:xX:y:Y";
+static const char getopt_string[] = "-ab:B:c::C:dD:e:hH:iL:l::np:r:tvw:xX:y:Y";
/****************************************************************************
* parse_nvramtool_args
@@ -100,6 +100,9 @@ void parse_nvramtool_args(int argc, char *argv[])
case 'h':
register_op(&op_found, NVRAMTOOL_OP_SHOW_USAGE, NULL);
break;
+ case 'H':
+ register_op(&op_found, NVRAMTOOL_OP_WRITE_HEADER_FILE, optarg);
+ break;
case 'i':
register_op(&op_found,
NVRAMTOOL_OP_CMOS_SET_PARAMS_STDIN, NULL);
@@ -108,6 +111,10 @@ void parse_nvramtool_args(int argc, char *argv[])
register_op(&op_found, NVRAMTOOL_OP_LBTABLE_SHOW_INFO,
handle_optional_arg(argc, argv));
break;
+ case 'L':
+ register_op(&op_found, NVRAMTOOL_OP_WRITE_BINARY_FILE,
+ optarg);
+ break;
case 'n':
register_op_modifier(NVRAMTOOL_MOD_SHOW_VALUE_ONLY,
NULL);
diff --git a/util/nvramtool/cli/opts.h b/util/nvramtool/cli/opts.h
index f46f254b88..a011ef1136 100644
--- a/util/nvramtool/cli/opts.h
+++ b/util/nvramtool/cli/opts.h
@@ -48,7 +48,9 @@ typedef enum { NVRAMTOOL_OP_SHOW_VERSION = 0,
NVRAMTOOL_OP_WRITE_CMOS_DUMP,
NVRAMTOOL_OP_READ_CMOS_DUMP,
NVRAMTOOL_OP_SHOW_CMOS_HEX_DUMP,
- NVRAMTOOL_OP_SHOW_CMOS_DUMPFILE
+ NVRAMTOOL_OP_SHOW_CMOS_DUMPFILE,
+ NVRAMTOOL_OP_WRITE_BINARY_FILE,
+ NVRAMTOOL_OP_WRITE_HEADER_FILE
} nvramtool_op_t;
typedef struct {