diff options
author | Eddie James <eajames@us.ibm.com> | 2018-03-01 10:09:10 -0600 |
---|---|---|
committer | Edward A. James <eajames@us.ibm.com> | 2018-05-03 15:35:54 +0000 |
commit | eaa1ee05ea9287acfea0dfd9ccf84b9180caff58 (patch) | |
tree | a49da6bf62653b79b0771a08da65f821765cd876 | |
parent | 6097e04402d5c11c841660b986cfcbbb5adb13ea (diff) | |
download | phosphor-bmc-code-mgmt-eaa1ee05ea9287acfea0dfd9ccf84b9180caff58.tar.gz phosphor-bmc-code-mgmt-eaa1ee05ea9287acfea0dfd9ccf84b9180caff58.zip |
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 <eajames@us.ibm.com>
-rw-r--r-- | item_updater.cpp | 17 | ||||
-rw-r--r-- | item_updater.hpp | 5 |
2 files changed, 22 insertions, 0 deletions
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<level::ERR>(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<level::ERR>("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 |