tools: add bios support
Add type "bios" to burn_my_bmc, such that when used it'll use the
/flash/bios path for writing the bios contents.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I613af23b80eb99936b744d4138a61d2f7b39b962
diff --git a/tools/main.cpp b/tools/main.cpp
index 746e679..a933e67 100644
--- a/tools/main.cpp
+++ b/tools/main.cpp
@@ -44,11 +44,12 @@
#define IPMIBT "ipmibt"
#define STATIC "static"
#define UBITAR "ubitar"
+#define BIOS "bios"
namespace
{
const std::vector<std::string> interfaceList = {IPMIBT, IPMILPC, IPMIPCI};
-const std::vector<std::string> typeList = {STATIC, UBITAR};
+const std::vector<std::string> typeList = {STATIC, UBITAR, BIOS};
} // namespace
void usage(const char* program)
diff --git a/tools/updater.cpp b/tools/updater.cpp
index 4d150db..96f38b1 100644
--- a/tools/updater.cpp
+++ b/tools/updater.cpp
@@ -28,6 +28,7 @@
#include <memory>
#include <string>
#include <thread>
+#include <unordered_map>
#include <vector>
namespace host_tool
@@ -37,9 +38,12 @@
const std::string& signaturePath,
const std::string& layoutType)
{
- const auto& layout = (layoutType == "static")
- ? ipmi_flash::staticLayoutBlobId
- : ipmi_flash::ubiTarballBlobId;
+ static std::unordered_map<std::string, std::string> typesToBlob = {
+ {"static", ipmi_flash::staticLayoutBlobId},
+ {"ubitar", ipmi_flash::ubiTarballBlobId},
+ {"bios", ipmi_flash::biosBlobId}};
+ /* We know it's one of the above types already. */
+ auto& layout = typesToBlob[layoutType];
bool goalSupported = updater->checkAvailable(layout);
if (!goalSupported)