Log firmware boot times and eventlog

BUG=none
TEST=boot ChromeOS, see /var/log/bios_times.txt and
     /var/log/eventlog.txt

Change-Id: I055ab782de35ad61cb359c7c7a3822530ee400a5
Reviewed-on: https://gerrit.chromium.org/gerrit/35951
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
diff --git a/init/firmware-version.conf b/init/firmware-version.conf
index 1e2c57b..e995814 100644
--- a/init/firmware-version.conf
+++ b/init/firmware-version.conf
@@ -9,4 +9,6 @@
 script
   /usr/share/userfeedback/scripts/bios_info
   /usr/share/userfeedback/scripts/ec_info
+  /usr/share/userfeedback/scripts/bios_times
+  /usr/share/userfeedback/scripts/eventlog
 end script
diff --git a/scripts/bios_times b/scripts/bios_times
new file mode 100755
index 0000000..1d0f6f9
--- /dev/null
+++ b/scripts/bios_times
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# File to store firmware timing information
+BIOS_TIMES_FILE="/var/log/bios_times.txt"
+
+if ! /usr/bin/cbmem > ${BIOS_TIMES_FILE} 2> /dev/null; then
+  echo "unavailable" > ${BIOS_TIMES_FILE}
+fi
+
diff --git a/scripts/eventlog b/scripts/eventlog
new file mode 100755
index 0000000..a0464ee
--- /dev/null
+++ b/scripts/eventlog
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# File to store firmware information derived from firmware event log
+EVENTLOG_FILE="/var/log/eventlog.txt"
+
+# Set up bios information for chrome://system and userfeedback
+# Need to do this before user can request it in Chrome.
+# Moved here to keep out of critical boot path
+
+if ! mosys eventlog list > ${EVENTLOG_FILE} 2> /dev/null; then
+  # If a sub-command is not available on a platform, mosys will fail with
+  # a non-zero exit code (EXIT_FAILURE) and print the help menu. For example,
+  # this will happen if a "mosys smbios" sub-command is run on ARM since ARM
+  # platforms do not support SMBIOS. If mosys fails, delete the output file to
+  # avoid placing non-relevant or confusing output in /var/log.
+  echo "unavailable" > ${EVENTLOG_FILE}
+fi
+