dual-image: Detect the running image slot
Add detect-slot-aspeed to detect which slot it is running on, and
assign the member variable, which will be used in future commits.
Tested:
* In normal case, verify the primary slot is 0 and secondary slot
is 1.
* Manually assign value 1 in /run/media/slot, and verify the slot
number is reversed.
* Manually trigger wdt2 timeout and verify in secondary flash that
the slot number is correct, that the running slot is 1 and the
other slot is 0.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I69edb1961b4c4bb79e7897c38b9ce8dded42f829
diff --git a/item_updater.hpp b/item_updater.hpp
index 794aa4d..4c47c8b 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -59,6 +59,7 @@
std::bind(std::mem_fn(&ItemUpdater::createActivation),
this, std::placeholders::_1))
{
+ getRunningSlot();
setBMCInventoryPath();
processBMCImage();
restoreFieldModeStatus();
@@ -168,6 +169,9 @@
/** @brief Vector of needed BMC images in the tarball*/
std::vector<std::string> imageUpdateList;
+ /** @breif The slot of running BMC image */
+ uint32_t runningImageSlot = 0;
+
private:
/** @brief Callback function for Software.Version match.
* @details Creates an Activation D-Bus object.
@@ -273,6 +277,9 @@
/** @brief Persistent Version D-Bus object for BIOS */
std::unique_ptr<VersionClass> biosVersion;
#endif
+
+ /** @brief Get the slot number of running image */
+ void getRunningSlot();
};
} // namespace updater