summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaqib Khan <khansa@us.ibm.com>2017-08-17 11:40:40 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-08-19 00:29:32 +0000
commit405f71df302d259422f44301db5723d71c28822d (patch)
tree876b3c474d0832afa3022eea1c244cbb4dab874e
parentdd7015393fdab93426aab61a08b48a698c9c100d (diff)
downloadtalos-openbmc-405f71df302d259422f44301db5723d71c28822d.tar.gz
talos-openbmc-405f71df302d259422f44301db5723d71c28822d.zip
Check /media for active PNOR versions.
- On several systems we found out that the persistence priority file was not deleted as part of the delete interface. Therefore creating symlinks based just on those files was not a reliable solution. - The new design approach checks both /media and the persistence priority files before updating the symlinks. Change-Id: Ida2a4a5d5daf4ae8b9c9a17d755b6ca0ccd1c132 Signed-off-by: Saqib Khan <khansa@us.ibm.com>
-rw-r--r--meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios41
1 files changed, 24 insertions, 17 deletions
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios
index 1ed25297f..befd08678 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios
@@ -208,26 +208,33 @@ update_symlinks() {
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/"
+
+ # 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
- # Get the current PNOR version using the priorities stored in
- # the persistence storage files.
- persistencePath="/var/lib/obmc/openpower-pnor-code-mgmt/"
- data="$(grep -r "priority" ${persistencePath})"
- if [[ -z "$data" ]]; then
+ # Return if no active version found
+ if [ -z $currentVersion ]; then
return 0;
fi
- IFS=$'\n' array=(${data})
- for element in ${array[@]};
- do
- element="${element#$persistencePath}"
- version="$( cut -d ':' -f 1 <<< "$element" )";
- priority="${element: -1}"
-
- if [[ priority -le lowestPriority ]]; then
- lowestPriority=${priority}
- currentVersion=${version}
- fi
- done
if [ ! -d "${PNOR_ACTIVE_PATH}" ]; then
mkdir -p "${PNOR_ACTIVE_PATH}"
OpenPOWER on IntegriCloud