summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaqib Khan <khansa@us.ibm.com>2017-08-01 09:46:22 -0500
committerSaqib Khan <khansa@us.ibm.com>2017-08-01 11:20:49 -0500
commitbc0d3ed5823e0d2c8ee513e36b212e6f6bfb177e (patch)
tree7c6471c480148a816b1f1f79bbcd5621e0012f38
parent7a5335d4bd8612c23e55929d6efc22abf6da6c68 (diff)
downloadtalos-openbmc-bc0d3ed5823e0d2c8ee513e36b212e6f6bfb177e.tar.gz
talos-openbmc-bc0d3ed5823e0d2c8ee513e36b212e6f6bfb177e.zip
openpower-software-manager:re-attach pnor mtd device to ubi
- Removed the ubiattach dependency from ubiremount.service, since it was attempting to reformat the pnor chip on every BMC reboot. - Attempt to reattach the pnor mtd device to ubi only if it is formatted as ubi. This approach will help preserve the systems that are not formatted as ubi. Resolves openbmc/openbmc#2061 Change-Id: I83698c05fd58a0f01c597583109d4009b02239a0 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-bios17
-rw-r--r--meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubiremount.service2
2 files changed, 16 insertions, 3 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 dffd29871..0896569e4 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
@@ -22,7 +22,7 @@ is_mounted() {
return $?
}
-# Attach the pnor mtd device to ubi
+# Attach the pnor mtd device to ubi.
attach_ubi() {
pnormtd="$(findmtd pnor)"
pnor="${pnormtd#mtd}"
@@ -131,6 +131,21 @@ umount_ubi() {
remount_ubi() {
pnormtd="$(findmtd pnor)"
pnor="${pnormtd#mtd}"
+ pnordev="/dev/mtd${pnor}"
+
+ # Re-Attach the pnor mtd device to ubi
+ ubiattach /dev/ubi_ctrl -m "${pnor}" -d "${pnor}"
+ rc=$?
+ if [ ${rc} -ne 0 ]; then
+ # Check the pnor mtd device is formatted as ubi by reading
+ # the first 3 byes, which should be the ascii chars 'UBI'
+ magic="$(hexdump -C -n 3 ${pnordev})"
+ if [[ ! "${magic}" =~ "UBI" ]]; then
+ # Device not formatted as ubi.
+ return
+ fi
+ fi
+
# Get information on all ubi volumes
ubinfo=$(ubinfo -d ${pnor})
presentVolumes=${ubinfo##*:}
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubiremount.service b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubiremount.service
index fd839f351..0b5a0772f 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubiremount.service
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubiremount.service
@@ -1,7 +1,5 @@
[Unit]
Description=Remount the squashfs and ubi volumes after a reboot
-Requires=obmc-flash-bios-ubiattach.service
-After=obmc-flash-bios-ubiattach.service
Wants=org.open_power.Software.Host.Updater.service
Before=org.open_power.Software.Host.Updater.service
OpenPOWER on IntegriCloud