add bios update support
The BIOS would be updated using multipart-form update as HTTP Push URI
is being default used for BMC updates.
Tested:
```
> curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/bios_active
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active",
"@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
"Description": "Host image",
"Id": "bios_active",
"Name": "Software Inventory",
"RelatedItem": [
{
"@odata.id": "/redfish/v1/Systems/system/Bios"
}
],
"RelatedItem@odata.count": 1,
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
},
"Updateable": true,
"Version": "null"
}
> curl -k -H "X-Auth-Token: $token" -H "Content-Type:multipart/form-data" -X POST -F UpdateParameters="{\"Targets\":[\"/redfish/v1/UpdateService/FirmwareInventory/bios_active\"],\"@Redfish.OperationApplyTime\":\"OnReset\"};type=appli
cation/json" -F "UpdateFile=@bios_image.tar;type=application/octet-stream" https://${bmc}/redfish/v1/UpdateService/update
{
"@odata.id": "/redfish/v1/TaskService/Tasks/0",
"@odata.type": "#Task.v1_4_3.Task",
"Id": "0",
"TaskState": "Running",
"TaskStatus": "OK"
}
> curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/bios_active
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active",
"@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
"Description": "Host image",
"Id": "bios_active",
"Name": "Software Inventory",
"RelatedItem": [
{
"@odata.id": "/redfish/v1/Systems/system/Bios"
}
],
"RelatedItem@odata.count": 1,
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
},
"Updateable": true,
"Version": "2.17.0-dev-703-g61fd99b720-TestBios"
}
```
Change-Id: I213e28d7d1a00aa15f695ab855a96961113548ae
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/software_manager.cpp b/software_manager.cpp
index 3ee9f1a..651b758 100644
--- a/software_manager.cpp
+++ b/software_manager.cpp
@@ -1,8 +1,12 @@
+#include "config.h"
+
#include "item_updater.hpp"
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/async.hpp>
+#include <string>
+
using ItemUpdaterIntf = phosphor::software::updater::ItemUpdater;
PHOSPHOR_LOG2_USING;
@@ -10,13 +14,19 @@
int main()
{
info("Creating Software Manager");
- auto path = std::string(SOFTWARE_OBJPATH) + "/bmc";
+ auto bmcPath = std::string(SOFTWARE_OBJPATH) + "/bmc";
+ auto biosPath = std::string(SOFTWARE_OBJPATH) + "/bios";
sdbusplus::async::context ctx;
sdbusplus::server::manager_t manager{ctx, SOFTWARE_OBJPATH};
constexpr auto serviceName = "xyz.openbmc_project.Software.Manager";
- ItemUpdaterIntf itemUpdater{ctx, path};
+ ItemUpdaterIntf bmcItemUpdater{ctx, bmcPath,
+ ItemUpdaterIntf::UpdaterType::BMC};
+#ifdef HOST_BIOS_UPGRADE
+ ItemUpdaterIntf biosItemUpdater{ctx, biosPath,
+ ItemUpdaterIntf::UpdaterType::BIOS};
+#endif // HOST_BIOS_UPGRADE
ctx.request_name(serviceName);
ctx.run();