bmc: add ActionPack notion to bundle actions

Each firmware type will provide its own set of action implementations
for each step, preparation, verification, and update.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Id6409ac356a74e9094272b37709861e2a33d9862
diff --git a/bmc/main.cpp b/bmc/main.cpp
index ce2ca9f..d89369c 100644
--- a/bmc/main.cpp
+++ b/bmc/main.cpp
@@ -34,6 +34,7 @@
 #include <memory>
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/bus.hpp>
+#include <unordered_map>
 
 namespace ipmi_flash
 {
@@ -119,9 +120,28 @@
         sdbusplus::bus::new_default(), VERIFY_STATUS_FILENAME,
         VERIFY_DBUS_SERVICE);
 
+    ipmi_flash::ActionMap actionPacks = {};
+
+    /* TODO: for bios should the name be, bios or /flash/bios?, these are
+     * /flash/... and it simplifies a few other things later (open/etc)
+     */
+    std::string bmcName;
+#ifdef ENABLE_STATIC_LAYOUT
+    bmcName = ipmi_flash::staticLayoutBlobId;
+#endif
+#ifdef ENABLE_TARBALL_UBI
+    bmcName = ipmi_flash::ubiTarballBlobId;
+#endif
+
+    auto bmcPack = std::make_unique<ipmi_flash::ActionPack>();
+    bmcPack->preparation = std::move(prepare);
+    bmcPack->verification = std::move(verifier);
+    bmcPack->update = std::move(updater);
+    actionPacks[bmcName] = std::move(bmcPack);
+
     auto handler = ipmi_flash::FirmwareBlobHandler::CreateFirmwareBlobHandler(
         ipmi_flash::supportedFirmware, ipmi_flash::supportedTransports,
-        std::move(prepare), std::move(verifier), std::move(updater));
+        std::move(actionPacks));
 
     if (!handler)
     {