summaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2018-05-23 11:13:12 +0800
committerLei YU <mine260309@gmail.com>2018-07-17 01:45:16 +0000
commita7853ee8d0d6331c150b8341df1d0b417a1bd467 (patch)
treea240cf5fc401a40d8afd603c8e92840988c69a11 /static
parentaea48f27e46be9454e79a77e3594e021464ec903 (diff)
downloadphosphor-bmc-code-mgmt-a7853ee8d0d6331c150b8341df1d0b417a1bd467.tar.gz
phosphor-bmc-code-mgmt-a7853ee8d0d6331c150b8341df1d0b417a1bd467.zip
Support non-ubifs layout
Add ubifs_layout as config argument, so a build could select if it needs ubifs_layout feature or not. Add code to update non-ubifs layout image by 1. Putting the bmc image in /run/initramfs; 2. Set its state as Active when it is ready to update 3. Let user to initiate the reboot request Tested: Generate a tarball with Romulus bmc image and manifest, update it with REST API (image upload, activation, and reboot) Verify the code update works well in WebUI. Change-Id: I5b122211fafb7cb9d96ee67317db139ed0b7d0a7 Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'static')
-rw-r--r--static/Makefile.am.include2
-rw-r--r--static/flash.cpp43
2 files changed, 45 insertions, 0 deletions
diff --git a/static/Makefile.am.include b/static/Makefile.am.include
new file mode 100644
index 0000000..7bcfcb2
--- /dev/null
+++ b/static/Makefile.am.include
@@ -0,0 +1,2 @@
+phosphor_image_updater_SOURCES += \
+ %reldir%/flash.cpp
diff --git a/static/flash.cpp b/static/flash.cpp
new file mode 100644
index 0000000..59c7a67
--- /dev/null
+++ b/static/flash.cpp
@@ -0,0 +1,43 @@
+#include <experimental/filesystem>
+
+#include "activation.hpp"
+#include "config.h"
+#include "flash.hpp"
+#include "image_verify.hpp" // For bmcImages
+
+namespace
+{
+constexpr auto PATH_INITRAMFS = "/run/initramfs";
+} // anonymous
+
+namespace phosphor
+{
+namespace software
+{
+namespace updater
+{
+
+namespace fs = std::experimental::filesystem;
+
+void Activation::flashWrite()
+{
+ // For static layout code update, just put image in /run/initramfs.
+ // It expects user to trigger a reboot and an updater script will program
+ // the image to flash during reboot.
+ fs::path uploadDir(IMG_UPLOAD_DIR);
+ fs::path toPath(PATH_INITRAMFS);
+ for (auto& bmcImage : phosphor::software::image::bmcImages)
+ {
+ fs::copy_file(uploadDir / versionId / bmcImage, toPath / bmcImage,
+ fs::copy_options::overwrite_existing);
+ }
+}
+
+void Activation::onStateChanges(sdbusplus::message::message& /*msg*/)
+{
+ // Empty
+}
+
+} // namespace updater
+} // namespace software
+} // namepsace phosphor
OpenPOWER on IntegriCloud