diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-12-08 00:45:20 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-12-10 01:15:05 +0300 |
commit | 82dbc15a05125a812c140a3c8cff81c366482229 (patch) | |
tree | 9c8f1ad262a2e281f20340cf8646aca6f8596044 /meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch | |
parent | 8d6ae7f2a817751fad151168fa10ce28ee0869d8 (diff) | |
download | openbmc-82dbc15a05125a812c140a3c8cff81c366482229.tar.xz |
Update to internal 0.26
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch')
-rw-r--r-- | meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch | 163 |
1 files changed, 80 insertions, 83 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch index 92b3ced38..49bdc138f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch @@ -10,65 +10,23 @@ Testing: tested PFR image uploads and updates Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> + --- - Makefile.am | 18 +++- activation.cpp | 2 +- - configure.ac | 7 ++ - item_updater.cpp | 6 +- + item_updater.cpp | 7 +- + meson.build | 7 +- + meson_options.txt | 3 + pfr_image_manager.cpp | 217 ++++++++++++++++++++++++++++++++++++++++++ pfr_image_manager.hpp | 75 +++++++++++++++ - 6 files changed, 320 insertions(+), 5 deletions(-) + 6 files changed, 306 insertions(+), 5 deletions(-) create mode 100644 pfr_image_manager.cpp create mode 100644 pfr_image_manager.hpp -diff --git a/Makefile.am b/Makefile.am -index 6c3ec16..59ebecc 100755 ---- a/Makefile.am -+++ b/Makefile.am -@@ -6,13 +6,20 @@ noinst_HEADERS = \ - watch.hpp \ - version.hpp \ - images.hpp \ -- image_manager.hpp \ - item_updater.hpp \ - activation.hpp \ - flash.hpp \ - item_updater_helper.hpp \ - utils.hpp - -+if PFR_UPDATE -+noinst_HEADERS += \ -+ pfr_image_manager.hpp -+else -+noinst_HEADERS += \ -+ image_manager.hpp -+endif -+ - bin_PROGRAMS = \ - phosphor-version-software-manager \ - phosphor-download-manager \ -@@ -24,8 +31,15 @@ dist_bin_SCRIPTS = \ - phosphor_version_software_manager_SOURCES = \ - image_manager_main.cpp \ - watch.cpp \ -- version.cpp \ -+ version.cpp -+ -+if PFR_UPDATE -+phosphor_version_software_manager_SOURCES += \ -+ pfr_image_manager.cpp -+else -+phosphor_version_software_manager_SOURCES += \ - image_manager.cpp -+endif - - BUILT_SOURCES = \ - xyz/openbmc_project/Software/Image/error.cpp \ diff --git a/activation.cpp b/activation.cpp -index cea1e50..7ff4196 100644 +index bad17b8..3363230 100644 --- a/activation.cpp +++ b/activation.cpp -@@ -197,7 +197,7 @@ auto Activation::activation(Activations value) -> Activations +@@ -119,7 +119,7 @@ auto Activation::activation(Activations value) -> Activations } else if (activationProgress->progress() == 100) { @@ -77,31 +35,13 @@ index cea1e50..7ff4196 100644 if (!redundancyPriority) { redundancyPriority = -diff --git a/configure.ac b/configure.ac -index 720e704..e527682 100755 ---- a/configure.ac -+++ b/configure.ac -@@ -191,6 +191,13 @@ AS_IF([test "x$enable_fwupd_script" == "xyes"], \ - [AC_DEFINE([FWUPD_SCRIPT],[],[Enable fwupd script support.])]) - AM_CONDITIONAL([FWUPD_SCRIPT], [test "x$enable_fwupd_script" == "xyes"]) - -+# setup pfr image update support -+AC_ARG_ENABLE([pfr_update], -+ AS_HELP_STRING([--enable-pfr_update], [Enable pfr image update support.])) -+AS_IF([test "x$enable_pfr_update" == "xyes"], \ -+ [AC_DEFINE([PFR_UPDATE],[],[Enable pfr image update support.])]) -+AM_CONDITIONAL([PFR_UPDATE], [test "x$enable_pfr_update" == "xyes"]) -+ - # Check for header files. - AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])]) - AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...openbmc/sdbusplus package required])]) diff --git a/item_updater.cpp b/item_updater.cpp -index 21fb6e0..fd76a7f 100644 +index df8595c..694975f 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -64,10 +64,10 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) auto value = SVersion::convertVersionPurposeFromString( - variant_ns::get<std::string>(property.second)); + std::get<std::string>(property.second)); if (value == VersionPurpose::BMC || -#ifdef HOST_BIOS_UPGRADE +#if defined(HOST_BIOS_UPGRADE) || defined(PFR_UPDATE) @@ -112,29 +52,84 @@ index 21fb6e0..fd76a7f 100644 { purpose = value; } -@@ -356,6 +357,7 @@ void ItemUpdater::deleteAll() +@@ -399,6 +399,7 @@ void ItemUpdater::deleteAll() ItemUpdater::ActivationStatus ItemUpdater::validateSquashFSImage(const std::string& filePath) { +#ifndef PFR_UPDATE - bool invalid = false; + bool valid = true; - for (auto& bmcImage : bmcImages) -@@ -375,7 +377,7 @@ ItemUpdater::ActivationStatus - { - return ItemUpdater::ActivationStatus::invalid; + // Record the images which are being updated +@@ -416,7 +417,7 @@ ItemUpdater::ActivationStatus + return ItemUpdater::ActivationStatus::invalid; + } } - +#endif return ItemUpdater::ActivationStatus::ready; } +@@ -690,8 +691,8 @@ void ItemUpdater::freeSpace(Activation& caller) + // Failed activations don't have priority, assign them a large value + // for sorting purposes. + auto priority = 999; +- if ((iter.second.get()->activation() == +- server::Activation::Activations::Active)&& ++ if ((iter.second.get()->activation() == ++ server::Activation::Activations::Active) && + iter.second->redundancyPriority.get()) + { + priority = iter.second->redundancyPriority.get()->priority(); +diff --git a/meson.build b/meson.build +index 08d6f71..c61d59f 100644 +--- a/meson.build ++++ b/meson.build +@@ -55,6 +55,7 @@ conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc')) + conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled()) + conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').enabled()) + conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) ++conf.set('PFR_UPDATE', get_option('pfr-update').enabled()) + + # Configurable variables + conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) +@@ -195,12 +196,16 @@ executable( + install: true + ) + ++image_manager_source = files('image_manager.cpp') ++if get_option('pfr-update').enabled() ++ image_manager_source = files('pfr_image_manager.cpp') ++endif + executable( + 'phosphor-version-software-manager', + image_error_cpp, + image_error_hpp, +- 'image_manager.cpp', + 'image_manager_main.cpp', ++ image_manager_source, + 'version.cpp', + 'watch.cpp', + dependencies: [deps, ssl], +diff --git a/meson_options.txt b/meson_options.txt +index 4f7e62a..1593502 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -25,6 +25,9 @@ option('verify-signature', type: 'feature', + option('fwupd-script', type: 'feature', + description: 'Enable fwupd script support.') + ++option('pfr-update', type: 'feature', ++ description: 'Enable fwupd script support.') ++ + # Variables + option( + 'active-bmc-max-allowed', type: 'integer', diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp new file mode 100644 index 0000000..242a6ca --- /dev/null +++ b/pfr_image_manager.cpp -@@ -0,0 +1,217 @@ +@@ -0,0 +1,218 @@ +#include "config.h" + +#include "pfr_image_manager.hpp" @@ -149,15 +144,16 @@ index 0000000..242a6ca +#include <time.h> +#include <unistd.h> + ++#include <elog-errors.hpp> ++#include <xyz/openbmc_project/Software/Image/error.hpp> ++ +#include <algorithm> +#include <cstring> -+#include <elog-errors.hpp> +#include <filesystem> +#include <fstream> +#include <iomanip> +#include <sstream> +#include <string> -+#include <xyz/openbmc_project/Software/Image/error.hpp> + +namespace phosphor +{ @@ -357,7 +353,7 @@ new file mode 100644 index 0000000..c6ee6a4 --- /dev/null +++ b/pfr_image_manager.hpp -@@ -0,0 +1,75 @@ +@@ -0,0 +1,76 @@ +#pragma once +#include "version.hpp" + @@ -370,7 +366,8 @@ index 0000000..c6ee6a4 +namespace manager +{ + -+enum pfrImgPCType { ++enum pfrImgPCType ++{ + pfrCPLDUpdateCap = 0x00, + pfrPCHPFM = 0x01, + pfrPCHUpdateCap = 0x02, @@ -379,7 +376,8 @@ index 0000000..c6ee6a4 +}; + +/* PFR image block 0 - As defined in HAS */ -+struct pfrImgBlock0 { ++struct pfrImgBlock0 ++{ + uint8_t tag[4]; + uint8_t pcLength[4]; + uint8_t pcType[4]; @@ -387,7 +385,7 @@ index 0000000..c6ee6a4 + uint8_t hash256[32]; + uint8_t hash384[48]; + uint8_t reserved2[32]; -+}__attribute__((packed)); ++} __attribute__((packed)); + +/** @class Manager + * @brief Contains a map of Version dbus objects. @@ -427,7 +425,6 @@ index 0000000..c6ee6a4 + + /** @brief Persistent sdbusplus DBus bus connection. */ + sdbusplus::bus::bus& bus; -+ +}; + +} // namespace manager |