1 #include "config.h"
2 
3 #include "flash.hpp"
4 
5 #include "activation.hpp"
6 #include "images.hpp"
7 #include "item_updater.hpp"
8 
9 #include <filesystem>
10 
11 namespace
12 {
13 constexpr auto PATH_INITRAMFS = "/run/initramfs";
14 } // namespace
15 
16 namespace phosphor
17 {
18 namespace software
19 {
20 namespace updater
21 {
22 
23 namespace fs = std::filesystem;
24 using namespace phosphor::software::image;
25 
26 void Activation::flashWrite()
27 {
28     // For static layout code update, just put images in /run/initramfs.
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);
33 
34     for (const auto& bmcImage : parent.imageUpdateList)
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
48 } // namespace phosphor
49