aboutsummaryrefslogtreecommitdiff
path: root/util/nvramtool/lbtable.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/lbtable.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/lbtable.c')
-rw-r--r--util/nvramtool/lbtable.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/util/nvramtool/lbtable.c b/util/nvramtool/lbtable.c
index 142937a6d8..bc3cb45ce3 100644
--- a/util/nvramtool/lbtable.c
+++ b/util/nvramtool/lbtable.c
@@ -29,6 +29,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
\*****************************************************************************/
+#include <arpa/inet.h>
#include <string.h>
#include <sys/mman.h>
#include "common.h"
@@ -38,6 +39,7 @@
#include "layout.h"
#include "cmos_lowlevel.h"
#include "hexdump.h"
+#include "cbfs.h"
typedef void (*lbtable_print_fn_t) (const struct lb_record * rec);
@@ -315,6 +317,21 @@ void get_lbtable(void)
exit(1);
}
+static void process_layout(void)
+{
+ if ((cmos_table) == NULL) {
+ fprintf(stderr,
+ "%s: CMOS option table not found in coreboot table. "
+ "Apparently, the coreboot installed on this system was "
+ "built without specifying CONFIG_HAVE_OPTION_TABLE.\n",
+ prog_name);
+ exit(1);
+ }
+
+ process_cmos_table();
+ get_cmos_checksum_info();
+}
+
/****************************************************************************
* get_layout_from_cmos_table
*
@@ -327,18 +344,18 @@ void get_layout_from_cmos_table(void)
get_lbtable();
cmos_table = (const struct cmos_option_table *)
find_lbrec(LB_TAG_CMOS_OPTION_TABLE);
+ process_layout();
+}
- if ((cmos_table) == NULL) {
- fprintf(stderr,
- "%s: CMOS option table not found in coreboot table. "
- "Apparently, the coreboot installed on this system was "
- "built without specifying CONFIG_HAVE_OPTION_TABLE.\n",
- prog_name);
- exit(1);
- }
-
- process_cmos_table();
- get_cmos_checksum_info();
+void get_layout_from_cbfs_file(void)
+{
+ static struct lb_header header;
+ u32 len;
+ cmos_table = cbfs_find_file("cmos_layout.bin", CBFS_COMPONENT_CMOS_LAYOUT, &len);
+ lbtable = &header;
+ header.header_bytes = (u32)cmos_table-(u32)lbtable;
+ header.table_bytes = ntohl(len);
+ process_layout();
}
/****************************************************************************