[PATCH 13/20] fwts_clog: add fwts_clog_read

Marcello Sylvester Bauer info at marcellobauer.com
Wed Jun 20 12:14:39 UTC 2018


Signed-off-by: Marcello Sylvester Bauer <info at marcellobauer.com>
---
 src/lib/include/fwts_clog.h |  1 +
 src/lib/src/fwts_clog.c     | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/src/lib/include/fwts_clog.h b/src/lib/include/fwts_clog.h
index 87ecc438..f29aaa3f 100644
--- a/src/lib/include/fwts_clog.h
+++ b/src/lib/include/fwts_clog.h
@@ -24,5 +24,6 @@
 #include "fwts.h"
 
 void       fwts_clog_free(fwts_list *list);
+fwts_list *fwts_clog_read(void);
 
 #endif
diff --git a/src/lib/src/fwts_clog.c b/src/lib/src/fwts_clog.c
index 3887e6fc..fe04e090 100644
--- a/src/lib/src/fwts_clog.c
+++ b/src/lib/src/fwts_clog.c
@@ -20,6 +20,12 @@
 
 #include "fwts.h"
 
+/*
+ *  coreboot logfile exposed by Google firmware module
+ *  Kernel option nessesary (GOOGLE_MEMCONSOLE_COREBOOT=m/y)
+ */
+#define GOOGLE_MEMCONSOLE_COREBOOT_PATH	"/sys/firmware/log"
+
 /*
  *  free coreboot log list
  */
@@ -27,3 +33,18 @@ void fwts_clog_free(fwts_list *clog)
 {
         fwts_log_free(clog);
 }
+
+/*
+ *  read coreboot log and return as list of lines
+ *  TODO:	1) parse coreboot logfile as argument
+ *  		2) find coreboot log in /dev/mem
+ */
+fwts_list *fwts_clog_read(void)
+{
+    fwts_list *list;
+
+    if ((list = fwts_file_open_and_read(GOOGLE_MEMCONSOLE_COREBOOT_PATH)) == NULL)
+        return NULL;
+
+    return list;
+}
-- 
2.16.4




More information about the fwts-devel mailing list