blob: 3ca7bfc868ada983ab705f6dd18e8aea0f85d637 [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";
11} // anonymous
12
13namespace phosphor
14{
15namespace software
16{
17namespace updater
18{
19
20namespace fs = std::experimental::filesystem;
21
22void Activation::flashWrite()
23{
24 // For static layout code update, just put image in /run/initramfs.
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
36void Activation::onStateChanges(sdbusplus::message::message& /*msg*/)
37{
38 // Empty
39}
40
41} // namespace updater
42} // namespace software
43} // namepsace phosphor