From eaa1ee05ea9287acfea0dfd9ccf84b9180caff58 Mon Sep 17 00:00:00 2001 From: Eddie James Date: Thu, 1 Mar 2018 10:09:10 -0600 Subject: Perform uboot mirroring operation during BMC boot Add a function to call the "mirror u-boot" service when the BMC boots. Since the BMC is booting, we know we had a good u-boot and u-boot environment, so we can safely copy the current one to the alternate chip. Change-Id: Ib628ea4a5fc9ae8d80f1047bddf94eb3fa52cdba Signed-off-by: Eddie James --- item_updater.cpp | 17 +++++++++++++++++ item_updater.hpp | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/item_updater.cpp b/item_updater.cpp index df73fc5..03bc591 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -255,6 +255,8 @@ void ItemUpdater::processBMCImage() log(e.what()); } } + + mirrorUbootToAlt(); return; } @@ -640,6 +642,21 @@ void ItemUpdater::freeSpace() } } +void ItemUpdater::mirrorUbootToAlt() +{ + auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH, + SYSTEMD_INTERFACE, "StartUnit"); + auto mirrorUbootFile = "obmc-flash-bmc-mirroruboot.service"; + method.append(mirrorUbootFile, "replace"); + auto result = bus.call(method); + + // Check that the bus call didn't result in an error + if (result.is_method_error()) + { + log("Failed to copy U-Boot to alternate chip"); + } +} + } // namespace updater } // namespace software } // namespace phosphor diff --git a/item_updater.hpp b/item_updater.hpp index d4d72bd..9fda860 100644 --- a/item_updater.hpp +++ b/item_updater.hpp @@ -208,6 +208,11 @@ class ItemUpdater : public ItemUpdaterInherit * @param[in] versionId - The version id. */ void removeReadOnlyPartition(std::string versionId); + + /** @brief Copies U-Boot from the currently booted BMC chip to the + * alternate chip. + */ + void mirrorUbootToAlt(); }; } // namespace updater -- cgit v1.2.3