[coreboot-gerrit] New patch to review for coreboot: 182f59b lbtdump: Support version timestamp.

Vladimir Serbinenko (phcoder@gmail.com) gerrit at coreboot.org
Sat Aug 23 01:22:08 CEST 2014


Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6748

-gerrit

commit 182f59b8ce3e890c5798c11bb7cd7a6ab18e4c35
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date:   Sat Aug 23 01:11:30 2014 +0200

    lbtdump: Support version timestamp.
    
    Change-Id: Ie923134a538879fca33e66ca96ce480495ddef2f
    Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
 util/lbtdump/lbtdump.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/util/lbtdump/lbtdump.c b/util/lbtdump/lbtdump.c
index cde1cc7..6069ac6 100644
--- a/util/lbtdump/lbtdump.c
+++ b/util/lbtdump/lbtdump.c
@@ -8,6 +8,7 @@
 #include <errno.h>
 #include <sys/mman.h>
 #include <getopt.h>
+#include <time.h>
 #include "../../src/include/boot/coreboot_tables.h"
 
 #define PRINT_ALL 0xffffffff
@@ -194,6 +195,19 @@ void print_string(struct lb_record *ptr, unsigned long addr)
 	printf("%.*s\n", max_size, rec->string);
 }
 
+void print_timestamp(struct lb_record *ptr, unsigned long addr)
+{
+	struct lb_timestamp *rec;
+	time_t t;
+	struct tm *tt;
+	rec = (struct lb_timestamp *)ptr;
+	t = rec->timestamp;
+	tt = gmtime(&t);
+	printf("%04d-%02d-%02dT%02d:%02d:%02dZ\n", tt->tm_year + 1900,
+	       tt->tm_mon + 1, tt->tm_mday, tt->tm_hour,
+	       tt->tm_min, tt->tm_sec);
+}
+
 void print_option_table(struct lb_record *ptr, unsigned long addr)
 {
 	struct lb_record *rec, *last;
@@ -264,6 +278,7 @@ struct {
 	{ LB_TAG_HWRPB,             "HWRPB",              nop_print },
 	{ LB_TAG_MAINBOARD,         "Mainboard",          print_mainboard },
 	{ LB_TAG_VERSION,           "Version",            print_string },
+	{ LB_TAG_VERSION_TIMESTAMP, "Version timestamp",  print_timestamp },
 	{ LB_TAG_EXTRA_VERSION,     "Extra Version",      print_string },
 	{ LB_TAG_BUILD,             "Build",              print_string },
 	{ LB_TAG_COMPILE_TIME,      "Compile Time",       print_string },
@@ -368,6 +383,7 @@ static void print_usage(const char *name)
 	printf("\n"
 	     "   -m | --mainboard-id:              print mainboard id\n"
 	     "   -w | --coreboot-version:          dump coreboot version\n"
+	     "   -t | --coreboot-version-timestamp: dump coreboot version timestamp\n"
 	     "   -V | --verbose:                   verbose (debugging) output\n"
 	     "   -h | --help:                      print this help\n"
 	     "\n");
@@ -385,11 +401,12 @@ int main(int argc, char **argv)
 	static struct option long_options[] = {
 		{"mainboard-id", 0, 0, 'm'},
 		{"coreboot-version", 0, 0, 'w'},
+		{"coreboot-version-timestamp", 0, 0, 't'},
 		{"verbose", 0, 0, 'V'},
 		{"help", 0, 0, 'h'},
 		{0, 0, 0, 0}
 	};
-	while ((opt = getopt_long(argc, argv, "Vmwh?",
+	while ((opt = getopt_long(argc, argv, "Vtmwh?",
 				  long_options, &option_index)) != EOF) {
 		switch (opt) {
 		case 'm':
@@ -398,6 +415,9 @@ int main(int argc, char **argv)
 		case 'w':
 			target = LB_TAG_VERSION;
 			break;
+		case 't':
+			target = LB_TAG_VERSION_TIMESTAMP;
+			break;
 		case 'V':
 			verbose = 1;
 			break;



More information about the coreboot-gerrit mailing list