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