obmc-vpnor-util: Don't delete the HB_VOLATILE symlink
When symlinks to PNOR partitions were introduced in the emmc layout,
clearing of the HB_VOLATILE partition was done by deleting the symlink,
restoring the original lid file, and recreating the symlink. This leaves
a small time window when mboxd (hiomapd) can try to read this partition
and fail (since it expects that all partitions always exist because if
the partitions are regular files, there's always a read-only copy).
To mimic this behavior and avoid the mboxd error, don't delete and
recreate the symlink but instead just restore the original data.
Tested: The symlink modification time did not change as part of the
clear volatile operation.
Change-Id: Id7c4470130197d151eea89fdb529b87bc42511d5
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/vpnor/obmc-vpnor-util b/vpnor/obmc-vpnor-util
index fe3414a..e5decfc 100644
--- a/vpnor/obmc-vpnor-util
+++ b/vpnor/obmc-vpnor-util
@@ -23,19 +23,20 @@
volatileName="$(echo "${volatiles[${index}]}" | awk -F '=' '{print $2}')"
rwVolatile="${PNOR_RW_ACTIVE_PATH}${volatileName}"
- if [ -f "${rwVolatile}" ]; then
- echo "Clear $rwVolatile"
- rm "${rwVolatile}"
- fi
- prsvVolatile="${PNOR_PRSV_ACTIVE_PATH}${volatileName}"
- if [ -f "${prsvVolatile}" ]; then
- echo "Clear $prsvVolatile"
- rm "${prsvVolatile}"
- fi
if [ ! -f "${PNOR_RO_ACTIVE_PATH}${volatileName}" ]; then
+ echo "Clear ${volatileName} lid 81e0066f.lid"
cp -a "${PNOR_RO_ACTIVE_PATH}81e0066f.lid" "${PNOR_PRSV_ACTIVE_PATH}"
- ln -s "81e0066f.lid" "${PNOR_PRSV_ACTIVE_PATH}${volatileName}"
+ else
+ if [ -f "${rwVolatile}" ]; then
+ echo "Clear $rwVolatile"
+ rm "${rwVolatile}"
+ fi
+ prsvVolatile="${PNOR_PRSV_ACTIVE_PATH}${volatileName}"
+ if [ -f "${prsvVolatile}" ]; then
+ echo "Clear $prsvVolatile"
+ rm "${prsvVolatile}"
+ fi
fi
done
# Always reset the sensor after clearing