blob: d06d08c4d1bc93c84a9677481cb9630533fb9e00 [file] [log] [blame]
Lei YUa7853ee2018-05-23 11:13:12 +08001#include <experimental/filesystem>
2
3#include "activation.hpp"
4#include "config.h"
5#include "flash.hpp"
Lei YU1be8d502018-06-20 11:48:36 +08006#include "images.hpp"
Lei YUa7853ee2018-05-23 11:13:12 +08007
8namespace
9{
10constexpr auto PATH_INITRAMFS = "/run/initramfs";
Gunnar Millsfa34e022018-09-04 10:05:45 -050011} // namespace
Lei YUa7853ee2018-05-23 11:13:12 +080012
13namespace phosphor
14{
15namespace software
16{
17namespace updater
18{
19
20namespace fs = std::experimental::filesystem;
21
22void Activation::flashWrite()
23{
Lei YUdd691572018-07-17 17:04:34 +080024 // For static layout code update, just put images in /run/initramfs.
Lei YUa7853ee2018-05-23 11:13:12 +080025 // 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
36void Activation::onStateChanges(sdbusplus::message::message& /*msg*/)
37{
38 // Empty
39}
40
41} // namespace updater
42} // namespace software
Gunnar Millsfa34e022018-09-04 10:05:45 -050043} // namespace phosphor