bmc-state: Add property signal for lastRebootTime
This sends the changedProperty signal for lastRebootTime when it is
updated via the timesync signal. It will allow us to use the correct
lastRebootTime instead of the pre-sync time.
Google-Bug-Id: 313338463
Change-Id: I40b574331d18c4fe91db6057f93175d283a6af12
Signed-off-by: Willy Tu <wltu@google.com>
(cherry picked from commit 6cdfe281beb9b2ef3915d60719f7f812a7dade81)
diff --git a/recipes-phosphor/state/phosphor-state-manager/0001-bmc-state-Add-property-signal-for-lastRebootTime.patch b/recipes-phosphor/state/phosphor-state-manager/0001-bmc-state-Add-property-signal-for-lastRebootTime.patch
new file mode 100644
index 0000000..4f3a7a0
--- /dev/null
+++ b/recipes-phosphor/state/phosphor-state-manager/0001-bmc-state-Add-property-signal-for-lastRebootTime.patch
@@ -0,0 +1,37 @@
+From 57d82854ebfc8dad64f1e58dbd597519b31462d9 Mon Sep 17 00:00:00 2001
+From: Willy Tu <wltu@google.com>
+Date: Tue, 9 Jan 2024 14:04:03 -0800
+Subject: [PATCH] bmc-state: Add property signal for lastRebootTime
+
+This sends the changedProperty signal for lastRebootTime when it is
+updated via the timesync signal. It will allow us to use the correct
+lastRebootTime instead of the pre-sync time.
+
+Patch Tracking Bug: b/319329476
+Upstream info / review:
+ https://gerrit.openbmc.org/c/openbmc/phosphor-state-manager/+/68683
+Upstream-Status: Submitted
+Justification: LastRebootTime is updated on timesync, however, it is not signal properly... so
+ metric-collector doesn't know that it is using the wrong time.
+
+Change-Id: I7c651e28de2bb3f2b86746e043dcaa2def0a6bc3
+Signed-off-by: Willy Tu <wltu@google.com>
+---
+ bmc_state_manager.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/bmc_state_manager.cpp b/bmc_state_manager.cpp
+index efaa0a2..a64ebbf 100644
+--- a/bmc_state_manager.cpp
++++ b/bmc_state_manager.cpp
+@@ -254,6 +254,7 @@ void BMC::updateLastRebootTime()
+ auto rebootTimeTs = now - seconds(info.uptime);
+ rebootTime =
+ duration_cast<milliseconds>(rebootTimeTs.time_since_epoch()).count();
++ BMCInherit::lastRebootTime(rebootTime);
+ }
+
+ uint64_t BMC::lastRebootTime() const
+--
+2.43.0.472.g3155946c3a-goog
+
diff --git a/recipes-phosphor/state/phosphor-state-manager_%.bbappend b/recipes-phosphor/state/phosphor-state-manager_%.bbappend
new file mode 100644
index 0000000..490545a
--- /dev/null
+++ b/recipes-phosphor/state/phosphor-state-manager_%.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS:prepend:gbmc := "${THISDIR}/${PN}:"
+
+SRC_URI:append:gbmc = " \
+ file://0001-bmc-state-Add-property-signal-for-lastRebootTime.patch \
+"