summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0003-Add-logs-to-fwVersionIsSame.patch
blob: 94af679672a24bd623ef835291f976a2c8ce281f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 28525b56161e1b659e85e85c33fc00dc397758aa Mon Sep 17 00:00:00 2001
From: Helen Huang <he.huang@intel.com>
Date: Mon, 19 Apr 2021 16:06:15 +0800
Subject: [PATCH] Add logs to fwVersionIsSame()

Add logs to fwVersionIsSame() to indicate whether the firmware
version is changed or not.

Tested:
Logs are printed as expected when firmware updating and BMC rebooting.

Log of rebooting:
The firmware version is similiar as the last boot,
Hash value of versionFile is:3336889560

Log of Firmware update:
The firmware version is changed since the last boot,
hash value of current versionFile is:3336889560,
hash value of versionFile of last boot is:834871226

Change-Id: I5306917329d2e2e015af58cad1e9c59881f0b217
Signed-off-by: Helen Huang <he.huang@intel.com>
---
 include/Utils.hpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/Utils.hpp b/include/Utils.hpp
index 657af92..8238807 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -116,13 +116,22 @@ inline bool fwVersionIsSame(void)
 
         if (expectedHash == hashString)
         {
+            std::cout << "The firmware version is similiar as the last boot, "
+                         "hash value of versionFile is:"
+                      << hashString.c_str() << "\n";
             return true;
         }
+        std::cout << "The firmware version is changed since the last boot, hash "
+                     "value of current versionFile is:"
+                  << expectedHash.c_str()
+                  << ", hash value of versionFile of last boot is:"
+                  << hashString.c_str() << "\n";
         hashFile.close();
     }
 
     std::ofstream output(versionHashFile);
     output << expectedHash;
+
     return false;
 }
 
-- 
2.17.1