summaryrefslogtreecommitdiffstats
path: root/static/flash.cpp
blob: 6fc4563afa1fdbc938b80a12e7c013ee6bc1f66d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <experimental/filesystem>

#include "activation.hpp"
#include "config.h"
#include "flash.hpp"
#include "images.hpp"

namespace
{
constexpr auto PATH_INITRAMFS = "/run/initramfs";
} // anonymous

namespace phosphor
{
namespace software
{
namespace updater
{

namespace fs = std::experimental::filesystem;

void Activation::flashWrite()
{
    // For static layout code update, just put images in /run/initramfs.
    // It expects user to trigger a reboot and an updater script will program
    // the image to flash during reboot.
    fs::path uploadDir(IMG_UPLOAD_DIR);
    fs::path toPath(PATH_INITRAMFS);
    for (auto& bmcImage : phosphor::software::image::bmcImages)
    {
        fs::copy_file(uploadDir / versionId / bmcImage, toPath / bmcImage,
                      fs::copy_options::overwrite_existing);
    }
}

void Activation::onStateChanges(sdbusplus::message::message& /*msg*/)
{
    // Empty
}

} // namespace updater
} // namespace software
} // namepsace phosphor
OpenPOWER on IntegriCloud