fw_update:Enable software object creation without EM
Previously, software objects were only created if Entity-Manager
provided an inventory path mapping. Without EM config, the function
would error out and no software object would be created.
This change introduces a fallback board path for platforms where
Entity-Manager is not configured or unavailable, allowing firmware
inventory to work independently of Entity-Manager.
Entity-Manager configuration may be missing in environments where EM
is not installed, disabled, or deliberately excluded—for example, in
minimal or custom OpenBMC/PLDM deployments.
Tested: Software objects created successfully without EM configs on B40.
'''
root@gb200nvl-obmc:/tmp# busctl tree xyz.openbmc_project.PLDM
`- /xyz
`- /xyz/openbmc_project
|- /xyz/openbmc_project/inventory
|- /xyz/openbmc_project/pldm
|- /xyz/openbmc_project/sensors
`- /xyz/openbmc_project/software
|- /xyz/openbmc_project/software/PLDM_Device_Firmware_Device_12_Component_65282_ffdfb9c8
|- /xyz/openbmc_project/software/PLDM_Device_Firmware_Device_13_Component_49152_3986fd47
`- /xyz/openbmc_project/software/PLDM_Device_Firmware_Device_13_Component_49168_d9f7864f
'''
Change-Id: I71deedf355c199c704947d7089262201e3b289fe
Signed-off-by: Rajeev Ranjan <ranjan.rajeev1609@gmail.com>
Signed-off-by: Unive Tien <unive.tien.wiwynn@gmail.com>
diff --git a/fw-update/firmware_inventory_manager.cpp b/fw-update/firmware_inventory_manager.cpp
index 4b09b4f..bb9a6aa 100644
--- a/fw-update/firmware_inventory_manager.cpp
+++ b/fw-update/firmware_inventory_manager.cpp
@@ -20,19 +20,21 @@
unsigned seed = ts.tv_nsec ^ getpid();
srandom(seed);
+ // Determine the inventory board path for this EID. If Entity-Manager
+ // has provided a mapping, use it; otherwise fall back to a default
+ // placeholder path so that a software object can still be created.
+
+ std::optional<std::filesystem::path> boardPath;
+
auto& eid = softwareIdentifier.first;
const auto inventoryPath = getInventoryPath(eid);
- if (!inventoryPath)
+ if (inventoryPath)
{
- error("No inventory path found for EID {EID}", "EID", eid);
- return;
+ boardPath = getBoardPath(*dbusHandler, *inventoryPath);
}
- auto boardPath = getBoardPath(*dbusHandler, *inventoryPath);
-
- if (!boardPath)
+ else
{
- error("Failed to get board path for EID {EID}", "EID", eid);
- return;
+ boardPath = "/xyz/openbmc_project/inventory/system/board/PLDM_Device";
}
const auto boardName = boardPath->filename().string();
const auto softwarePath =