blob: 59c7a67eccad1d81625a8fd8123332bfa8abb189 [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"
6#include "image_verify.hpp" // For bmcImages
7
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