diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-core')
10 files changed, 450 insertions, 6 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb b/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb index 1a1a83dce..ae6303668 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb @@ -13,7 +13,7 @@ LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://LICENSE;md5=43c09494f6b77f344027eea0a1c22830" SRC_URI = "git://github.com/Intel-BMC/crashdump;protocol=git" -SRCREV = "wht-0.9" +SRCREV = "wht-1.0" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_%.bbappend index 869cf5f2f..c95b2c92e 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_%.bbappend @@ -1,5 +1,5 @@ # Enable downstream autobump #SRC_URI = "git://github.com/openbmc/host-error-monitor" -SRCREV = "2fbb9eadeda2ae8a77ac53346b53f2d0a72f3e74" +SRCREV = "9a9bf9846cabf0ef4c7076776f70230e1a7b8b13" EXTRA_OECMAKE = "-DYOCTO=1" diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0001-Fix-cold-redundancy-is-not-runing-as-user-configurat.patch b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0001-Fix-cold-redundancy-is-not-runing-as-user-configurat.patch new file mode 100644 index 000000000..ae5f7b7bf --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0001-Fix-cold-redundancy-is-not-runing-as-user-configurat.patch @@ -0,0 +1,121 @@ +From e45333a83822e8ccb8e3dbc1e547fbe45b8cf959 Mon Sep 17 00:00:00 2001 +From: Kuiying Wang <kuiying.wang@intel.com> +Date: Wed, 22 Jul 2020 22:06:37 +0800 +Subject: [PATCH] Fix cold redundancy is not runing as user configuration. + +Cold redundancy service is not runing as user configuration. +1. Properties are not sync between settings server and daemon. +2. Wrong property is used to config cold redundancy enabling. + +Tested: +Cold redundancy is working as user config. + +Change-Id: Ia0b7aa6aff65be4d86daa82616eefaea575baf5e +Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> +--- + src/oemcommands.cpp | 44 +++++++++----------------------------------- + 1 file changed, 9 insertions(+), 35 deletions(-) + +diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp +index 78f4f82..d2a1811 100644 +--- a/src/oemcommands.cpp ++++ b/src/oemcommands.cpp +@@ -2060,7 +2060,7 @@ int setCRConfig(ipmi::Context::ptr ctx, const std::string& property, + { + boost::system::error_code ec; + ctx->bus->yield_method_call<void>( +- ctx->yield, ec, "xyz.openbmc_project.Settings", ++ ctx->yield, ec, "xyz.openbmc_project.PSURedundancy", + "/xyz/openbmc_project/control/power_supply_redundancy", + "org.freedesktop.DBus.Properties", "Set", + "xyz.openbmc_project.Control.PowerSupplyRedundancy", property, value); +@@ -2074,10 +2074,10 @@ int setCRConfig(ipmi::Context::ptr ctx, const std::string& property, + return 0; + } + +-int getCRConfig(ipmi::Context::ptr ctx, const std::string& property, +- crConfigVariant& value, +- const std::string& service = "xyz.openbmc_project.Settings", +- std::chrono::microseconds timeout = ipmi::IPMI_DBUS_TIMEOUT) ++int getCRConfig( ++ ipmi::Context::ptr ctx, const std::string& property, crConfigVariant& value, ++ const std::string& service = "xyz.openbmc_project.PSURedundancy", ++ std::chrono::microseconds timeout = ipmi::IPMI_DBUS_TIMEOUT) + { + boost::system::error_code ec; + value = ctx->bus->yield_method_call<crConfigVariant>( +@@ -2172,25 +2172,6 @@ ipmi::RspType<uint8_t> ipmiOEMSetCRConfig(ipmi::Context::ptr ctx, + { + switch (static_cast<crParameter>(parameter)) + { +- case crParameter::crFeature: +- { +- uint8_t param1; +- if (payload.unpack(param1) || !payload.fullyUnpacked()) +- { +- return ipmi::responseReqDataLenInvalid(); +- } +- // ColdRedundancy Enable can only be true or flase +- if (param1 > 1) +- { +- return ipmi::responseInvalidFieldRequest(); +- } +- if (setCRConfig(ctx, "ColdRedundancyEnabled", +- static_cast<bool>(param1))) +- { +- return ipmi::responseResponseError(); +- } +- break; +- } + case crParameter::rotationFeature: + { + uint8_t param1; +@@ -2301,13 +2282,6 @@ ipmi::RspType<uint8_t> ipmiOEMSetCRConfig(ipmi::Context::ptr ctx, + } + } + +- // TODO Halfwidth needs to set SetInProgress +- if (setCRConfig(ctx, "ColdRedundancyStatus", +- std::string("xyz.openbmc_project.Control." +- "PowerSupplyRedundancy.Status.completed"))) +- { +- return ipmi::responseResponseError(); +- } + return ipmi::responseSuccess(crSetCompleted); + } + +@@ -2338,11 +2312,11 @@ ipmi::RspType<uint8_t, std::variant<uint8_t, uint32_t, std::vector<uint8_t>>> + { + case server::PowerSupplyRedundancy::Status::inProgress: + return ipmi::responseSuccess(parameter, +- static_cast<uint8_t>(0)); ++ static_cast<uint8_t>(1)); + + case server::PowerSupplyRedundancy::Status::completed: + return ipmi::responseSuccess(parameter, +- static_cast<uint8_t>(1)); ++ static_cast<uint8_t>(0)); + default: + phosphor::logging::log<phosphor::logging::level::ERR>( + "Error to get valid status"); +@@ -2351,7 +2325,7 @@ ipmi::RspType<uint8_t, std::variant<uint8_t, uint32_t, std::vector<uint8_t>>> + } + case crParameter::crFeature: + { +- if (getCRConfig(ctx, "ColdRedundancyEnabled", value)) ++ if (getCRConfig(ctx, "PowerSupplyRedundancyEnabled", value)) + { + return ipmi::responseResponseError(); + } +@@ -2359,7 +2333,7 @@ ipmi::RspType<uint8_t, std::variant<uint8_t, uint32_t, std::vector<uint8_t>>> + if (!pResponse) + { + phosphor::logging::log<phosphor::logging::level::ERR>( +- "Error to get ColdRedundancyEnable property"); ++ "Error to get PowerSupplyRedundancyEnabled property"); + return ipmi::responseResponseError(); + } + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0002-GetFwVersionInfo-Fix-for-Firmware-aux-version.patch b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0002-GetFwVersionInfo-Fix-for-Firmware-aux-version.patch new file mode 100644 index 000000000..514f2dde7 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0002-GetFwVersionInfo-Fix-for-Firmware-aux-version.patch @@ -0,0 +1,120 @@ +From 52a292b8dd1b5705a6e0ce8e260d3b960b2b6edb Mon Sep 17 00:00:00 2001 +From: srikanta mondal <srikantax.mondal@intel.com> +Date: Mon, 27 Jul 2020 23:49:14 +0000 +Subject: [PATCH] GetFwVersionInfo: Fix for Firmware aux version + +Issue: Get Version Information return incorrect Firmware AUX version + +FIX: Firmware aux version was parsing incorrectly. Do the parsing by + correct regex pattern of BMC version. + +Tested: +Verified using ipmitool raw commands +Before fix: +Command: ipmitool raw 0x08 0x20 // Get version Information +Response: 01 02 00 70 01 00 00 00 00 00 00 00 00 00 00 00 + +After fix: +Command: ipmitool raw 0x08 0x20 // Get version Information +Response: 02 01 00 74 0a 8a 37 78 00 00 00 00 00 00 00 00 + 02 00 70 01 00 00 00 00 00 00 00 00 00 00 00 + +Signed-off-by: srikanta mondal <srikantax.mondal@intel.com> +Change-Id: I7c2baf8a0da15e3ca4db5d6f9d6de7bf739aa755 +--- + src/firmware-update.cpp | 56 +++++++++++++++++++++++++---------------- + 1 file changed, 35 insertions(+), 21 deletions(-) + +diff --git a/src/firmware-update.cpp b/src/firmware-update.cpp +index 8c3cc94..ec1d14a 100644 +--- a/src/firmware-update.cpp ++++ b/src/firmware-update.cpp +@@ -1,3 +1,4 @@ ++#include <byteswap.h> + #include <ipmid/api.h> + #include <openssl/evp.h> + #include <openssl/sha.h> +@@ -6,6 +7,7 @@ + #include <sys/types.h> + #include <unistd.h> + ++#include <appcommands.hpp> + #include <boost/algorithm/string.hpp> + #include <boost/container/flat_map.hpp> + #include <boost/process/child.hpp> +@@ -836,26 +838,44 @@ ipmi::RspType<uint8_t, std::vector<fwVersionInfoType>> ipmiGetFwVersionInfo() + continue; + } + +- // BMC Version format: <major>.<minor>-<build bum>-<build hash> +- std::vector<std::string> splitVer; +- boost::split(splitVer, verStr, boost::is_any_of(".-")); +- if (splitVer.size() < 3) +- { +- phosphor::logging::log<phosphor::logging::level::INFO>( +- "Invalid Version format.", +- phosphor::logging::entry("Version=%s", verStr.c_str()), +- phosphor::logging::entry("PATH=%s", fwDev.second)); +- continue; +- } +- + uint8_t majorNum = 0; + uint8_t minorNum = 0; + uint32_t buildNum = 0; + try + { +- majorNum = std::stoul(splitVer[0], nullptr, 16); +- minorNum = std::stoul(splitVer[1], nullptr, 16); +- buildNum = std::stoul(splitVer[2], nullptr, 16); ++ std::optional<ipmi::MetaRevision> rev = ++ ipmi::convertIntelVersion(verStr); ++ if (rev.has_value()) ++ { ++ ipmi::MetaRevision revision = rev.value(); ++ majorNum = revision.major % 10 + (revision.major / 10) * 16; ++ minorNum = (revision.minor > 99 ? 99 : revision.minor); ++ minorNum = minorNum % 10 + (minorNum / 10) * 16; ++ uint32_t hash = std::stoul(revision.metaHash, 0, 16); ++ hash = bswap_32(hash); ++ buildNum = (revision.buildNo & 0xFF) + (hash & 0xFFFFFF00); ++ } ++ else ++ { ++ std::vector<std::string> splitVer; ++ boost::split(splitVer, verStr, boost::is_any_of(".-")); ++ if (splitVer.size() < 3) ++ { ++ phosphor::logging::log<phosphor::logging::level::INFO>( ++ "Invalid Version format.", ++ phosphor::logging::entry("Version=%s", verStr.c_str()), ++ phosphor::logging::entry("PATH=%s", fwDev.second)); ++ continue; ++ } ++ majorNum = std::stoul(splitVer[0], nullptr, 16); ++ minorNum = std::stoul(splitVer[1], nullptr, 16); ++ buildNum = std::stoul(splitVer[2], nullptr, 16); ++ } ++ // Build Timestamp - Not supported. ++ // Update Timestamp - TODO: Need to check with CPLD team. ++ fwVerInfoList.emplace_back( ++ fwVersionInfoType(static_cast<uint8_t>(fwDev.first), majorNum, ++ minorNum, buildNum, 0, 0)); + } + catch (const std::exception& e) + { +@@ -864,12 +884,6 @@ ipmi::RspType<uint8_t, std::vector<fwVersionInfoType>> ipmiGetFwVersionInfo() + phosphor::logging::entry("ERROR=%s", e.what())); + continue; + } +- +- // Build Timestamp - Not supported. +- // Update Timestamp - TODO: Need to check with CPLD team. +- fwVerInfoList.emplace_back( +- fwVersionInfoType(static_cast<uint8_t>(fwDev.first), majorNum, +- minorNum, buildNum, 0, 0)); + } + + return ipmi::responseSuccess(fwVerInfoList.size(), fwVerInfoList); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0003-storagecommands-Fix-for-GetFruAreaInfo-command.patch b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0003-storagecommands-Fix-for-GetFruAreaInfo-command.patch new file mode 100644 index 000000000..32a170d90 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0003-storagecommands-Fix-for-GetFruAreaInfo-command.patch @@ -0,0 +1,48 @@ +From 1e2ab0613dde7d8051052eecf6f5f2381e91ce87 Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> +Date: Mon, 3 Aug 2020 16:57:00 +0000 +Subject: [PATCH] storagecommands: Fix for GetFruAreaInfo command + +Issue: GetFruAreaInfo command is giving incorrect response for Invalid +FRU Device ID's. + +Fix: Add check for invalid FRU Device ID's to return completion code as +0xCB. + +Tested: +Verified using ipmitool raw commands. +Case 1: Valid FRU Device ID: +Command: ipmitool raw 0x0a 0x10 0xce //Get fru Area info +Response: a9 00 00 +Case 2: Invalid FRU Device ID: +Command: ipmitool raw 0x0a 0x10 0x01 //Get fru Area info +Response: Unable to send RAW command (channel=0x0 netfn=0xa lun=0x0 + cmd=0x10 rsp=0xcb): Requested sensor, data, or record not + found + +Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> +Change-Id: I8e3416beff40c133804af9e913d83c2372784439 +--- + src/storagecommands.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp +index f1b98e0..bd43a34 100644 +--- a/src/storagecommands.cpp ++++ b/src/storagecommands.cpp +@@ -538,7 +538,11 @@ ipmi::RspType<uint16_t, // inventorySize + return ipmi::responseInvalidFieldRequest(); + } + +- getFru(ctx, fruDeviceId); ++ ipmi::Cc ret = getFru(ctx, fruDeviceId); ++ if (ret != ipmi::ccSuccess) ++ { ++ return ipmi::response(ret); ++ } + + constexpr uint8_t accessType = + static_cast<uint8_t>(GetFRUAreaAccessType::byte); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0004-firmware-update-Add-Support-to-get-fwSecurityVer.patch b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0004-firmware-update-Add-Support-to-get-fwSecurityVer.patch new file mode 100644 index 000000000..20e94b79d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0004-firmware-update-Add-Support-to-get-fwSecurityVer.patch @@ -0,0 +1,111 @@ +From a8dd197a4b729c10d09c55ebf26ed7d0796fd261 Mon Sep 17 00:00:00 2001 +From: Punith Nadur Basavarajaiah <punitx.basavarajaiah@intel.com> +Date: Wed, 19 Aug 2020 18:05:44 +0000 +Subject: [PATCH] firmware-update:Add Support to get fwSecurityVer + +Add support to read BKC and SVN version for BMC Active and Recovery +image. + +Tested: +Command : ipmitool raw 0x08 0x21 //get firmware security version +Response: 02 01 01 01 02 01 01 + +Signed-off-by: Punith Nadur Basavarajaiah <punitx.basavarajaiah@intel.com> +Change-Id: I25a801fe00fef3c4c65b57aacb59089be1705d58 +--- + src/firmware-update.cpp | 70 +++++++++++++++++++++++++++++++++++++---- + 1 file changed, 64 insertions(+), 6 deletions(-) + +diff --git a/src/firmware-update.cpp b/src/firmware-update.cpp +index ec1d14a..d27b8c6 100644 +--- a/src/firmware-update.cpp ++++ b/src/firmware-update.cpp +@@ -72,6 +72,13 @@ static inline auto responseNotSupportedInPresentState() + } + } // namespace ipmi + ++static constexpr size_t imageCount = 2; ++std::array<std::array<uint8_t, imageCount>, imageCount> imgFwSecurityVersion = { ++ (0, 0), (0, 0)}; ++static constexpr size_t svnActiveVerOffsetInPfm = 0x404; ++static constexpr size_t bkcActiveVerOffsetInPfm = 0x405; ++static constexpr size_t svnRecoveryVerOffsetInPfm = 0x804; ++static constexpr size_t bkcRecoveryVerOffsetInPfm = 0x805; + static constexpr const char* bmcStateIntf = "xyz.openbmc_project.State.BMC"; + static constexpr const char* bmcStatePath = "/xyz/openbmc_project/state/bmc0"; + static constexpr const char* bmcStateReady = +@@ -888,14 +895,65 @@ ipmi::RspType<uint8_t, std::vector<fwVersionInfoType>> ipmiGetFwVersionInfo() + + return ipmi::responseSuccess(fwVerInfoList.size(), fwVerInfoList); + } +-using fwSecurityVersionInfoType = std::tuple<uint8_t, // ID Tag +- uint8_t, // BKC Version +- uint8_t>; // SVN Version +-ipmi::RspType<uint8_t, std::vector<fwSecurityVersionInfoType>> ++ ++std::array<uint8_t, imageCount> getSecurityVersionInfo(const char* mtdDevBuf, ++ size_t svnVerOffsetInPfm, ++ size_t bkcVerOffsetInPfm) ++{ ++ constexpr size_t bufLength = 1; ++ std::array<uint8_t, imageCount> fwSecurityVersionBuf = {0}, temp; ++ constexpr uint8_t svnIndexValue = 0x00; ++ constexpr uint8_t bkcIndexValue = 0x01; ++ constexpr uint8_t tempIndexValue = 0x00; ++ try ++ { ++ SPIDev spiDev(mtdDevBuf); ++ spiDev.spiReadData(svnVerOffsetInPfm, bufLength, temp.data()); ++ fwSecurityVersionBuf.at(svnIndexValue) = temp.at(tempIndexValue); ++ spiDev.spiReadData(bkcVerOffsetInPfm, bufLength, temp.data()); ++ fwSecurityVersionBuf.at(bkcIndexValue) = temp.at(tempIndexValue); ++ } ++ catch (const std::exception& e) ++ { ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Exception caught in getSecurityVersionInfo", ++ phosphor::logging::entry("MSG=%s", e.what())); ++ fwSecurityVersionBuf = {0, 0}; ++ } ++ ++ return fwSecurityVersionBuf; ++} ++ ++ipmi::RspType< ++ uint8_t, // device ID ++ uint8_t, // Active Image Value ++ std::array<uint8_t, imageCount>, // Security version for Active Image ++ uint8_t, // recovery Image Value ++ std::array<uint8_t, imageCount>> // Security version for Recovery Image + ipmiGetFwSecurityVersionInfo() + { +- // TODO: Need to add support. +- return ipmi::responseInvalidCommand(); ++ static bool cacheFlag = false; ++ constexpr std::array<const char*, imageCount> mtdDevBuf = { ++ bmcActivePfmMTDDev, bmcRecoveryImgMTDDev}; ++ ++ // To avoid multiple reading from SPI device ++ if (!cacheFlag) ++ { ++ imgFwSecurityVersion[0] = getSecurityVersionInfo( ++ mtdDevBuf[0], svnActiveVerOffsetInPfm, bkcActiveVerOffsetInPfm); ++ imgFwSecurityVersion[1] = getSecurityVersionInfo( ++ mtdDevBuf[1], svnRecoveryVerOffsetInPfm, bkcRecoveryVerOffsetInPfm); ++ cacheFlag = true; ++ } ++ ++ constexpr uint8_t ActivePfmMTDDev = 0x00; ++ constexpr uint8_t RecoveryImgMTDDev = 0x01; ++ ++ return ipmi::responseSuccess( ++ imageCount, static_cast<uint8_t>(FWDeviceIDTag::bmcActiveImage), ++ imgFwSecurityVersion[ActivePfmMTDDev], ++ static_cast<uint8_t>(FWDeviceIDTag::bmcRecoveryImage), ++ imgFwSecurityVersion[RecoveryImgMTDDev]); + } + + ipmi::RspType<std::array<uint8_t, certKeyLen>, +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend index cd2011b4a..a7486376f 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend @@ -3,3 +3,12 @@ EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsec EXTRA_OECMAKE += "-DUSING_ENTITY_MANAGER_DECORATORS=OFF" SRC_URI = "git://github.com/openbmc/intel-ipmi-oem.git" SRCREV = "04a38ed10db3a0203aa7804bfea6fbd69dafdde8" + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +PROJECT_SRC_DIR := "${THISDIR}/${PN}" + +SRC_URI += "file://0001-Fix-cold-redundancy-is-not-runing-as-user-configurat.patch \ + file://0002-GetFwVersionInfo-Fix-for-Firmware-aux-version.patch \ + file://0003-storagecommands-Fix-for-GetFruAreaInfo-command.patch \ + file://0004-firmware-update-Add-Support-to-get-fwSecurityVer.patch \ + " diff --git a/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync.service b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync.service index bad3329d3..4595541c6 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync.service +++ b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync.service @@ -2,10 +2,8 @@ Description=Overlay sync to NV storage [Service] -# Run rsync periodically to sync the overlay to NV storage -ExecStart=bash -c 'while true; do rsync -a --delete /tmp/.overlay/ /tmp/.rwfs/.overlay; sync /tmp/.rwfs/.overlay; sleep 10; done' -# On shutdown, archive the bash history so we don't lose it and run one last sync -ExecStop=bash -c 'history -a; rsync -a --delete /tmp/.overlay/ /tmp/.rwfs/.overlay; sync /tmp/.rwfs/.overlay; sleep 5' +# Run a job to periodically sync the overlay to NV storage +ExecStart=/usr/bin/nv-syncd # Due to sync delay stopping this service will take more than default 10 seconds TimeoutStopSec=20 diff --git a/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-syncd b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-syncd new file mode 100644 index 000000000..e2bb4bb0c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-syncd @@ -0,0 +1,32 @@ +#!/bin/bash + +NVMP=/tmp/.rwfs +SOMP=/var/sofs + +do_sync() { + rsync -a --delete /tmp/.overlay/ $NVMP/.overlay + sync $NVMP/.overlay +} + +stop_nv() { + history -a + do_sync + mount -o remount,ro $NVMP + mount -o remount,ro $SOMP + exit 0 +} + +# register cleanup function +trap stop_nv SIGINT +trap stop_nv SIGTERM +trap stop_nv EXIT + +# make sure the mount points are RW +mount -o remount,rw $NVMP +mount -o remount,rw $SOMP + +# Run rsync periodically to sync the overlay to NV storage +while true; do + do_sync + sleep 10 +done diff --git a/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb index 0ee70e880..420fc258b 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb @@ -3,6 +3,7 @@ DESCRIPTION = "Script to periodically sync the overlay to NV storage" S = "${WORKDIR}" SRC_URI = "file://nv-sync.service \ + file://nv-syncd \ " LICENSE = "Apache-2.0" @@ -10,11 +11,15 @@ LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fe inherit systemd +RDEPENDS_${PN} += "bash" + FILES_${PN} += "${systemd_system_unitdir}/nv-sync.service" do_install() { install -d ${D}${systemd_system_unitdir} install -m 0644 ${WORKDIR}/nv-sync.service ${D}${systemd_system_unitdir} + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/nv-syncd ${D}${bindir}/nv-syncd } SYSTEMD_SERVICE_${PN} += " nv-sync.service" |