Set BIOS version
Get parsed BIOS version from oem ipmi command, and set to bios_active
D-Bus object.
Tested: Verify the BIOS version is set after host is powered on.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I864aeb92c63c7cc6ca5f158d309bab51b9d2c145
diff --git a/meson.build b/meson.build
index 3edce7d..9da20c2 100644
--- a/meson.build
+++ b/meson.build
@@ -18,4 +18,10 @@
phosphor_logging = dependency('phosphor-logging')
libipmid = dependency('libipmid')
+# Common configurations for src and test
+cdata = configuration_data()
+cdata.set_quoted('VERSION_IFACE', 'xyz.openbmc_project.Software.Version')
+cdata.set_quoted('VERSION', 'Version')
+cdata.set_quoted('BIOS_OBJPATH', get_option('BIOS_OBJPATH'))
+
subdir('src')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..7b1d3da
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,5 @@
+option('BIOS_OBJPATH',
+ type: 'string',
+ value: '/xyz/openbmc_project/software/bios_active',
+ description: 'The BIOS software Dbus object path')
+
diff --git a/src/inspur_oem.cpp b/src/inspur_oem.cpp
index e427af8..04df3fb 100644
--- a/src/inspur_oem.cpp
+++ b/src/inspur_oem.cpp
@@ -1,5 +1,9 @@
+#include "config.h"
+
#include "inspur_oem.hpp"
+#include "utils.hpp"
+
#include <ipmid/api.h>
#include <phosphor-logging/log.hpp>
@@ -125,6 +129,11 @@
buildTime.assign(reinterpret_cast<const char*>(
data.data() + FIRMWARE_BUILDTIME_OFFSET),
FIRMWARE_BUILDTIME_SIZE);
+
+ // Set BIOS version
+ auto service = utils::getService(bus, BIOS_OBJPATH, VERSION_IFACE);
+ utils::setProperty(bus, service.c_str(), BIOS_OBJPATH, VERSION_IFACE,
+ VERSION, version);
}
printf("Dev %s, version %s, build time %s\n",
diff --git a/src/meson.build b/src/meson.build
index c668624..b6828c7 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,3 +1,7 @@
+configure_file(output: 'config.h',
+ configuration: cdata,
+)
+
src_inc = include_directories('.')
so_version = '0.1.0'