summaryrefslogtreecommitdiff
path: root/meta-ibs/meta-cp2-5422/recipes-phosphor/flash/phosphor-software-manager/0002-Added-reading-BIOS-version-from-file.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-ibs/meta-cp2-5422/recipes-phosphor/flash/phosphor-software-manager/0002-Added-reading-BIOS-version-from-file.patch')
-rw-r--r--meta-ibs/meta-cp2-5422/recipes-phosphor/flash/phosphor-software-manager/0002-Added-reading-BIOS-version-from-file.patch97
1 files changed, 97 insertions, 0 deletions
diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/flash/phosphor-software-manager/0002-Added-reading-BIOS-version-from-file.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/flash/phosphor-software-manager/0002-Added-reading-BIOS-version-from-file.patch
new file mode 100644
index 0000000000..e1a395565b
--- /dev/null
+++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/flash/phosphor-software-manager/0002-Added-reading-BIOS-version-from-file.patch
@@ -0,0 +1,97 @@
+From ef7f6eb7107c2c7116ddc20de8d251d6a55db75f Mon Sep 17 00:00:00 2001
+From: Nikita Kosenkov <NKosenkov@IBS.RU>
+Date: Thu, 22 Sep 2022 11:46:44 +0300
+Subject: [PATCH] Added reading BIOS version from file
+
+---
+ item_updater.cpp | 9 ++++++++-
+ version.cpp | 11 +++++++++--
+ version.hpp | 10 ++++++++++
+ 3 files changed, 27 insertions(+), 3 deletions(-)
+
+diff --git a/item_updater.cpp b/item_updater.cpp
+index 96782f2..48fb698 100644
+--- a/item_updater.cpp
++++ b/item_updater.cpp
+@@ -849,7 +849,6 @@ void ItemUpdater::createBIOSObject()
+ createFunctionalAssociation(path);
+
+ auto versionId = path.substr(pos + 1);
+- auto version = "null";
+ AssociationList assocs = {};
+ biosActivation = std::make_unique<Activation>(
+ bus, path, *this, versionId, server::Activation::Activations::Active,
+@@ -857,6 +856,14 @@ void ItemUpdater::createBIOSObject()
+ auto dummyErase = [](std::string /*entryId*/) {
+ // Do nothing;
+ };
++
++ auto version = VersionClass::getVersion(
++ "/var/lib/phosphor-bmc-code-mgmt/bios-release");
++ if(version.empty())
++ {
++ version = "null";
++ }
++
+ biosVersion = std::make_unique<VersionClass>(
+ bus, path, version, VersionPurpose::Host, "", "",
+ std::vector<std::string>(),
+diff --git a/version.cpp b/version.cpp
+index 847148e..523a855 100644
+--- a/version.cpp
++++ b/version.cpp
+@@ -179,14 +179,14 @@ std::string Version::getBMCExtendedVersion(const std::string& releaseFilePath)
+ return extendedVersion;
+ }
+
+-std::string Version::getBMCVersion(const std::string& releaseFilePath)
++std::string Version::getVersion(const std::string& versionFilePath)
+ {
+ std::string versionKey = "VERSION_ID=";
+ std::string versionValue{};
+ std::string version{};
+ std::ifstream efile;
+ std::string line;
+- efile.open(releaseFilePath);
++ efile.open(versionFilePath);
+
+ while (getline(efile, line))
+ {
+@@ -216,6 +216,13 @@ std::string Version::getBMCVersion(const std::string& releaseFilePath)
+ }
+ efile.close();
+
++ return version;
++}
++
++std::string Version::getBMCVersion(const std::string& releaseFilePath)
++{
++ auto version = getVersion(releaseFilePath);
++
+ if (version.empty())
+ {
+ error("BMC current version is empty");
+diff --git a/version.hpp b/version.hpp
+index 5c74f99..e8956fa 100644
+--- a/version.hpp
++++ b/version.hpp
+@@ -150,6 +150,16 @@ class Version : public VersionInherit
+ static std::string
+ getBMCExtendedVersion(const std::string& releaseFilePath);
+
++ /**
++ * @brief Get the active VERSION_ID string.
++ *
++ * @param[in] releaseFilePath - The path to the file which contains
++ * the release version string.
++ *
++ * @return The version string (e.g. v1.99.10-19).
++ */
++ static std::string getVersion(const std::string& versionFilePath);
++
+ /**
+ * @brief Get the active BMC version string.
+ *
+--
+2.35.1
+