blob: 9bb2bbaff15e954ef32bf167e0585e620a67d2a4 [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"
Lei YUa7853ee2018-05-23 11:13:12 +08007
Adriana Kobylakc98d9122020-05-05 10:36:01 -05008#include <filesystem>
Gunnar Millsb0ce9962018-09-07 13:39:10 -05009
Lei YUa7853ee2018-05-23 11:13:12 +080010namespace
11{
12constexpr auto PATH_INITRAMFS = "/run/initramfs";
Gunnar Millsfa34e022018-09-04 10:05:45 -050013} // namespace
Lei YUa7853ee2018-05-23 11:13:12 +080014
15namespace phosphor
16{
17namespace software
18{
19namespace updater
20{
21
Adriana Kobylakc98d9122020-05-05 10:36:01 -050022namespace fs = std::filesystem;
Lei YUa7853ee2018-05-23 11:13:12 +080023
24void Activation::flashWrite()
25{
Lei YUdd691572018-07-17 17:04:34 +080026 // For static layout code update, just put images in /run/initramfs.
Lei YUa7853ee2018-05-23 11:13:12 +080027 // It expects user to trigger a reboot and an updater script will program
28 // the image to flash during reboot.
29 fs::path uploadDir(IMG_UPLOAD_DIR);
30 fs::path toPath(PATH_INITRAMFS);
31 for (auto& bmcImage : phosphor::software::image::bmcImages)
32 {
33 fs::copy_file(uploadDir / versionId / bmcImage, toPath / bmcImage,
34 fs::copy_options::overwrite_existing);
35 }
36}
37
38void Activation::onStateChanges(sdbusplus::message::message& /*msg*/)
39{
40 // Empty
41}
42
43} // namespace updater
44} // namespace software
Gunnar Millsfa34e022018-09-04 10:05:45 -050045} // namespace phosphor