Add support for full BMC FW flash image
Add BMC flash file name list for full flash image.
Save the information for which images are being updated.
Tested: Update '.static.mtd.all.tar' with redfish API (
UpdateService.SimpleUpdate).
Verified the code update works well.
Change-Id: Icb47e518db61a8d17998179aed328d0cf56db6f5
Signed-off-by: Bright Cheng <bright_cheng@wiwynn.com>
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/item_updater.cpp b/item_updater.cpp
index 4b133f3..e6dd298 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -402,26 +402,24 @@
ItemUpdater::ActivationStatus
ItemUpdater::validateSquashFSImage(const std::string& filePath)
{
- bool invalid = false;
+ bool valid = true;
- for (auto& bmcImage : bmcImages)
+ // Record the images which are being updated
+ // First check for the fullimage, then check for images with partitions
+ imageUpdateList.push_back(bmcFullImages);
+ valid = checkImage(filePath, imageUpdateList);
+ if (!valid)
{
- fs::path file(filePath);
- file /= bmcImage;
- std::ifstream efile(file.c_str());
- if (efile.good() != 1)
+ imageUpdateList.clear();
+ imageUpdateList.assign(bmcImages.begin(), bmcImages.end());
+ valid = checkImage(filePath, imageUpdateList);
+ if (!valid)
{
- log<level::ERR>("Failed to find the BMC image.",
- entry("IMAGE=%s", bmcImage.c_str()));
- invalid = true;
+ log<level::ERR>("Failed to find the needed BMC images.");
+ return ItemUpdater::ActivationStatus::invalid;
}
}
- if (invalid)
- {
- return ItemUpdater::ActivationStatus::invalid;
- }
-
return ItemUpdater::ActivationStatus::ready;
}
@@ -720,6 +718,26 @@
helper.mirrorAlt();
}
+bool ItemUpdater::checkImage(const std::string& filePath,
+ const std::vector<std::string>& imageList)
+{
+ bool valid = true;
+
+ for (auto& bmcImage : imageList)
+ {
+ fs::path file(filePath);
+ file /= bmcImage;
+ std::ifstream efile(file.c_str());
+ if (efile.good() != 1)
+ {
+ valid = false;
+ break;
+ }
+ }
+
+ return valid;
+}
+
} // namespace updater
} // namespace software
} // namespace phosphor