diff options
| author | Adriana Kobylak <anoo@us.ibm.com> | 2019-10-08 11:35:55 -0500 |
|---|---|---|
| committer | Adriana Kobylak <anoo@us.ibm.com> | 2019-10-25 09:20:20 -0500 |
| commit | f3dfe65de8487364c21b7b49396cf912821ea339 (patch) | |
| tree | 97117eca8fcb20c478dfbffa9d7d0a45b9246198 /ubi | |
| parent | 85f25407598494d8f91890df5152501680a067dd (diff) | |
| download | openpower-pnor-code-mgmt-f3dfe65de8487364c21b7b49396cf912821ea339.tar.gz openpower-pnor-code-mgmt-f3dfe65de8487364c21b7b49396cf912821ea339.zip | |
Move updatesymlinks to new vpnor feature
The updatesymlinks functionality is to support virtual pnor and it
does not depend on the filesystem type. Move it to a new vpnor
feature so that users can make use of this feature without being
tied to UBI, for example on a eMMC that has a combined BMC+PNOR
image.
Tested: Verified that the witherspoon image contained the new
script and service file and that it powered on to the host.
Change-Id: Ic5e51dfde81718e5e285f010be67afbd58eac2e1
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'ubi')
| -rw-r--r-- | ubi/Makefile.am.include | 5 | ||||
| -rw-r--r-- | ubi/obmc-flash-bios | 62 | ||||
| -rw-r--r-- | ubi/obmc-flash-bios-updatesymlinks.service | 15 |
3 files changed, 2 insertions, 80 deletions
diff --git a/ubi/Makefile.am.include b/ubi/Makefile.am.include index 98ea30119..2e5b6e50e 100644 --- a/ubi/Makefile.am.include +++ b/ubi/Makefile.am.include @@ -4,7 +4,7 @@ openpower_update_manager_SOURCES += \ %reldir%/serialize.cpp \ %reldir%/watch.cpp -dist_bin_SCRIPTS = \ +dist_bin_SCRIPTS += \ %reldir%/obmc-flash-bios if HAVE_SYSTEMD @@ -17,6 +17,5 @@ systemdsystemunit_DATA += \ %reldir%/obmc-flash-bios-ubipatch.service \ %reldir%/obmc-flash-bios-ubiremount.service \ %reldir%/obmc-flash-bios-ubiumount-ro@.service \ - %reldir%/obmc-flash-bios-ubiumount-rw@.service \ - %reldir%/obmc-flash-bios-updatesymlinks.service + %reldir%/obmc-flash-bios-ubiumount-rw@.service endif diff --git a/ubi/obmc-flash-bios b/ubi/obmc-flash-bios index ff8818518..b15ddc698 100644 --- a/ubi/obmc-flash-bios +++ b/ubi/obmc-flash-bios @@ -207,65 +207,6 @@ remount_ubi() { done } -update_symlinks() { - PNOR_ACTIVE_PATH="/var/lib/phosphor-software-manager/pnor/" - PNOR_RO_ACTIVE_PATH="/var/lib/phosphor-software-manager/pnor/ro" - PNOR_RO_PREFIX="/media/pnor-ro-" - PNOR_RW_ACTIVE_PATH="/var/lib/phosphor-software-manager/pnor/rw" - PNOR_RW_PREFIX="/media/pnor-rw-" - PNOR_PRSV_ACTIVE_PATH="/var/lib/phosphor-software-manager/pnor/prsv" - PNOR_PRSV="/media/pnor-prsv" - PERSISTENCE_PATH="/var/lib/obmc/openpower-pnor-code-mgmt/" - PNOR_PATCH_LOCATION="/usr/local/share/pnor/" - - # Get a list of all active PNOR versions - data="$(ls -d ${PNOR_RO_PREFIX}*)" - IFS=$'\n' array=(${data}) - - currentVersion="" - lowestPriority=255 - for element in ${array[@]}; do - #Remove the PNOR_RO_PREFIX from the path to get version ID. - versionId="${element#${PNOR_RO_PREFIX}}" - - # Get the priority of active versions from persistence files. - if [[ -f "${PERSISTENCE_PATH}${versionId}" ]]; then - data="$(grep -r "priority" ${PERSISTENCE_PATH}${versionId})" - priority="${data: -1}" - if [[ priority -le lowestPriority ]]; then - lowestPriority=${priority} - currentVersion=${versionId} - fi - fi - done - - # Return if no active version found - if [ -z $currentVersion ]; then - return 0; - fi - - if [ ! -d "${PNOR_ACTIVE_PATH}" ]; then - mkdir -p "${PNOR_ACTIVE_PATH}" - fi - - # If the RW or RO active links doesn't point to the version with - # lowest priority, then remove the symlink and create new ones. - if [[ $(readlink -f "${PNOR_RO_ACTIVE_PATH}") != ${PNOR_RO_PREFIX}${currentVersion} ]]; then - rm -f ${PNOR_RO_ACTIVE_PATH} - rm -rf ${PNOR_PATCH_LOCATION}* - ln -sfv ${PNOR_RO_PREFIX}${currentVersion} ${PNOR_RO_ACTIVE_PATH} - fi - - if [[ $(readlink -f "${PNOR_RW_ACTIVE_PATH}") != ${PNOR_RW_PREFIX}${currentVersion} ]]; then - rm -f ${PNOR_RW_ACTIVE_PATH} - ln -sfv ${PNOR_RW_PREFIX}${currentVersion} ${PNOR_RW_ACTIVE_PATH} - fi - - if [[ ! -h ${PNOR_PRSV_ACTIVE_PATH} ]]; then - ln -sfv ${PNOR_PRSV} ${PNOR_PRSV_ACTIVE_PATH} - fi -} - ubi_cleanup() { # When ubi_cleanup is run, it expects one or no active version. activeVersion=$(busctl --list --no-pager tree \ @@ -341,9 +282,6 @@ case "$1" in ubiremount) remount_ubi ;; - updatesymlinks) - update_symlinks - ;; ubicleanup) ubi_cleanup ;; diff --git a/ubi/obmc-flash-bios-updatesymlinks.service b/ubi/obmc-flash-bios-updatesymlinks.service deleted file mode 100644 index d486088ec..000000000 --- a/ubi/obmc-flash-bios-updatesymlinks.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Updates symlinks for active PNOR version -Before=mboxd.service -Before=mboxd-reload@0.service -After=org.open_power.Software.Host.Updater.service -After=op-reset-chassis-running@0.service -ConditionPathExists=!/run/openbmc/chassis@0-on - -[Service] -Type=oneshot -RemainAfterExit=no -ExecStart=/usr/bin/obmc-flash-bios updatesymlinks - -[Install] -WantedBy=mboxd.service mboxd-reload@.service |

