tools: add support for ubi tarball from host
Add a parameter that specifies the layout type, static or ubitar.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I86c09d8ffeb55ba789279d2568b579a44b3923d7
diff --git a/tools/updater.cpp b/tools/updater.cpp
index a364a4b..438fc4a 100644
--- a/tools/updater.cpp
+++ b/tools/updater.cpp
@@ -35,13 +35,14 @@
{
void updaterMain(UpdateHandlerInterface* updater, const std::string& imagePath,
- const std::string& signaturePath)
+ const std::string& signaturePath,
+ const std::string& layoutType)
{
- /* TODO(venture): Add optional parameter to specify the flash type, default
- * to legacy for now.
- */
- bool goalSupported =
- updater->checkAvailable(ipmi_flash::staticLayoutBlobId);
+ const auto& layout = (layoutType == "static")
+ ? ipmi_flash::staticLayoutBlobId
+ : ipmi_flash::ubiTarballBlobId;
+
+ bool goalSupported = updater->checkAvailable(layout);
if (!goalSupported)
{
throw ToolException("Goal firmware or interface not supported");
@@ -50,10 +51,9 @@
/* Yay, our data handler is supported. */
try
{
-
/* Send over the firmware image. */
std::fprintf(stderr, "Sending over the firmware image.\n");
- updater->sendFile(ipmi_flash::staticLayoutBlobId, imagePath);
+ updater->sendFile(layout, imagePath);
/* Send over the hash contents. */
std::fprintf(stderr, "Sending over the hash file.\n");