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>
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 @@
log<level::ERR>(e.what());
}
}
+
+ mirrorUbootToAlt();
return;
}
@@ -640,6 +642,21 @@
}
}
+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