diff options
| author | Patrick Venture <venture@google.com> | 2019-05-17 08:52:20 -0700 |
|---|---|---|
| committer | Patrick Venture <venture@google.com> | 2019-05-17 14:09:20 -0700 |
| commit | 7dad86fd4478a08f706b6c7ea17f7aacb37f9b4e (patch) | |
| tree | e987b31acbdb627974afde5faec6a73684c56ab0 /tools | |
| parent | 3676670d7c9b81ed50cbdba8863e05b08185a7eb (diff) | |
| download | phosphor-ipmi-flash-7dad86fd4478a08f706b6c7ea17f7aacb37f9b4e.tar.gz phosphor-ipmi-flash-7dad86fd4478a08f706b6c7ea17f7aacb37f9b4e.zip | |
util: create util object for bmc and tool
Create a common util object for the BMC library and host tool. Place in
blobs namespace favoring BMC.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I036fd65d924c65fcfa71aba5cd76275a2941ff14
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/Makefile.am | 3 | ||||
| -rw-r--r-- | tools/updater.cpp | 17 |
2 files changed, 7 insertions, 13 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index 7d07434..f8879b0 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -8,10 +8,11 @@ noinst_LTLIBRARIES = libupdater.la libupdater_la_LDFLAGS = -static $(CODE_COVERAGE_LIBS) $(IPMIBLOB_LIBS) $(PCILIB_LIBS) libupdater_la_CXXFLAGS = -I$(top_srcdir) $(CODE_COVERAGE_CXXFLAGS) $(IPMIBLOB_CFLAGS) $(PCILIB_CFLAGS) libupdater_la_SOURCES = \ + $(top_srcdir)/util.cpp \ updater.cpp \ bt.cpp \ lpc.cpp \ io.cpp \ pci.cpp \ p2a.cpp \ - ../internal/sys.cpp + $(top_srcdir)/internal/sys.cpp diff --git a/tools/updater.cpp b/tools/updater.cpp index 92afe5d..f2a0264 100644 --- a/tools/updater.cpp +++ b/tools/updater.cpp @@ -18,6 +18,7 @@ #include "firmware_handler.hpp" #include "tool_errors.hpp" +#include "util.hpp" #include <algorithm> #include <blobs-ipmid/blobs.hpp> @@ -238,16 +239,8 @@ void updaterMain(UpdateHandler* updater, const std::string& imagePath, { /* TODO(venture): Add optional parameter to specify the flash type, default * to legacy for now. - * - * TODO(venture): Move the strings from the FirmwareHandler object to a - * boring utils object so it will be more happly linked cleanly to both the - * BMC and host-side. */ - std::string goalFirmware = "/flash/image"; - std::string hashFilename = "/flash/hash"; - std::string verifyFilename = "/flash/verify"; - - bool goalSupported = updater->checkAvailable(goalFirmware); + bool goalSupported = updater->checkAvailable(blobs::staticLayoutBlobId); if (!goalSupported) { throw ToolException("Goal firmware or interface not supported"); @@ -257,15 +250,15 @@ void updaterMain(UpdateHandler* updater, const std::string& imagePath, /* Send over the firmware image. */ std::fprintf(stderr, "Sending over the firmware image.\n"); - updater->sendFile(goalFirmware, imagePath); + updater->sendFile(blobs::staticLayoutBlobId, imagePath); /* Send over the hash contents. */ std::fprintf(stderr, "Sending over the hash file.\n"); - updater->sendFile(hashFilename, signaturePath); + updater->sendFile(blobs::hashBlobId, signaturePath); /* Trigger the verification by opening the verify file. */ std::fprintf(stderr, "Opening the verification file\n"); - if (updater->verifyFile(verifyFilename)) + if (updater->verifyFile(blobs::verifyBlobId)) { std::fprintf(stderr, "succeeded\n"); } |

