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