bmc: implement reboot update mechanism
Implement an update mechanism that simply triggers a reboot of the BMC.
This implementation isn't tied into anything in the firmware handler
yet.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I116d4f631a44e7a4a999cf8ad403a00935f58710
diff --git a/main.cpp b/main.cpp
index 00ced2a..7e9b5a3 100644
--- a/main.cpp
+++ b/main.cpp
@@ -23,6 +23,7 @@
#include "lpc_handler.hpp"
#include "lpc_nuvoton.hpp"
#include "pci_handler.hpp"
+#include "update_systemd.hpp"
#include "util.hpp"
#include "verify.hpp"
#include "verify_systemd.hpp"
@@ -99,6 +100,17 @@
{
using namespace phosphor::logging;
+#ifdef ENABLE_REBOOT_UPDATE
+ static constexpr auto rebootTarget = "reboot.target";
+ static constexpr auto rebootMode = "replace-irreversibly";
+
+ auto updater = ipmi_flash::SystemdUpdateMechanism::CreateSystemdUpdate(
+ sdbusplus::bus::new_default(), rebootTarget, rebootMode);
+#else
+ auto updater = ipmi_flash::SystemdUpdateMechanism::CreateSystemdUpdate(
+ sdbusplus::bus::new_default(), UPDATE_DBUS_SERVICE);
+#endif
+
auto handler = ipmi_flash::FirmwareBlobHandler::CreateFirmwareBlobHandler(
ipmi_flash::supportedFirmware, ipmi_flash::supportedTransports,
ipmi_flash::SystemdVerification::CreateVerification(