Lei YU | a7853ee | 2018-05-23 11:13:12 +0800 | [diff] [blame] | 1 | #include <experimental/filesystem> |
| 2 | |
| 3 | #include "activation.hpp" |
| 4 | #include "config.h" |
| 5 | #include "flash.hpp" |
Lei YU | 1be8d50 | 2018-06-20 11:48:36 +0800 | [diff] [blame] | 6 | #include "images.hpp" |
Lei YU | a7853ee | 2018-05-23 11:13:12 +0800 | [diff] [blame] | 7 | |
| 8 | namespace |
| 9 | { |
| 10 | constexpr auto PATH_INITRAMFS = "/run/initramfs"; |
| 11 | } // anonymous |
| 12 | |
| 13 | namespace phosphor |
| 14 | { |
| 15 | namespace software |
| 16 | { |
| 17 | namespace updater |
| 18 | { |
| 19 | |
| 20 | namespace fs = std::experimental::filesystem; |
| 21 | |
| 22 | void Activation::flashWrite() |
| 23 | { |
Lei YU | dd69157 | 2018-07-17 17:04:34 +0800 | [diff] [blame^] | 24 | // For static layout code update, just put images in /run/initramfs. |
Lei YU | a7853ee | 2018-05-23 11:13:12 +0800 | [diff] [blame] | 25 | // It expects user to trigger a reboot and an updater script will program |
| 26 | // the image to flash during reboot. |
| 27 | fs::path uploadDir(IMG_UPLOAD_DIR); |
| 28 | fs::path toPath(PATH_INITRAMFS); |
| 29 | for (auto& bmcImage : phosphor::software::image::bmcImages) |
| 30 | { |
| 31 | fs::copy_file(uploadDir / versionId / bmcImage, toPath / bmcImage, |
| 32 | fs::copy_options::overwrite_existing); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | void Activation::onStateChanges(sdbusplus::message::message& /*msg*/) |
| 37 | { |
| 38 | // Empty |
| 39 | } |
| 40 | |
| 41 | } // namespace updater |
| 42 | } // namespace software |
| 43 | } // namepsace phosphor |