blob: 101828b1ade57917d879a23f837457fbdbf1eb73 [file] [log] [blame]
Gunnar Millsb0ce9962018-09-07 13:39:10 -05001#include "config.h"
2
3#include "flash.hpp"
Lei YUa7853ee2018-05-23 11:13:12 +08004
5#include "activation.hpp"
Lei YU1be8d502018-06-20 11:48:36 +08006#include "images.hpp"
Bright Cheng8e9ccfe2019-11-18 16:18:44 +08007#include "item_updater.hpp"
Lei YUa7853ee2018-05-23 11:13:12 +08008
Adriana Kobylakc98d9122020-05-05 10:36:01 -05009#include <filesystem>
Gunnar Millsb0ce9962018-09-07 13:39:10 -050010
Lei YUa7853ee2018-05-23 11:13:12 +080011namespace
12{
13constexpr auto PATH_INITRAMFS = "/run/initramfs";
Gunnar Millsfa34e022018-09-04 10:05:45 -050014} // namespace
Lei YUa7853ee2018-05-23 11:13:12 +080015
16namespace phosphor
17{
18namespace software
19{
20namespace updater
21{
22
Adriana Kobylakc98d9122020-05-05 10:36:01 -050023namespace fs = std::filesystem;
Bright Cheng8e9ccfe2019-11-18 16:18:44 +080024using namespace phosphor::software::image;
Lei YUa7853ee2018-05-23 11:13:12 +080025
26void Activation::flashWrite()
27{
Lei YUdd691572018-07-17 17:04:34 +080028 // For static layout code update, just put images in /run/initramfs.
Lei YUa7853ee2018-05-23 11:13:12 +080029 // 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);
Bright Cheng8e9ccfe2019-11-18 16:18:44 +080033
34 for (const auto& bmcImage : parent.imageUpdateList)
Lei YUa7853ee2018-05-23 11:13:12 +080035 {
36 fs::copy_file(uploadDir / versionId / bmcImage, toPath / bmcImage,
37 fs::copy_options::overwrite_existing);
38 }
39}
40
41void Activation::onStateChanges(sdbusplus::message::message& /*msg*/)
42{
43 // Empty
44}
45
46} // namespace updater
47} // namespace software
Gunnar Millsfa34e022018-09-04 10:05:45 -050048} // namespace phosphor