meta-phosphor: static-norootfs-init: reformat ubi rwfs if vol not exit
We notice that when the UBI device (/dev/ubi0) is attached but no rwfs
UBI volume exists, it causes the mount command failed.
Add an extra checking to ensure rwfs UBI volume is exist, and require
formatting process if volume is not exist.
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I94dfa76fd8833cb7a5423e644717c31918c0c4b4
diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-static-norootfs-init/30-ubiattach-or-format b/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-static-norootfs-init/30-ubiattach-or-format
index 39aa876..1676004 100644
--- a/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-static-norootfs-init/30-ubiattach-or-format
+++ b/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-static-norootfs-init/30-ubiattach-or-format
@@ -8,6 +8,12 @@
if ! ubiattach -p /dev/mtd/rwfs > /dev/null ; then
echo "unformatted-ubi" >> /run/format-persist
fi
+
+ if ! ubinfo /dev/ubi0 -N rwfs > /dev/null ; then
+ # ubi device attached, but volume not exist
+ ubidetach -p /dev/mtd/rwfs
+ echo "missing-ubi-volume" >> /run/format-persist
+ fi
fi
if [ -e /run/format-persist ]; then