dual-image: Mount alt dirs
To support dual image in static layout, it needs to mount secondary's
rofs/rwfs.
Update obmc-flash-bmc tool to support mounting 'alt-xxx' directories in
/run/media/alt-xxx, and try to mount the alt-rofs, alt-rwfs before
xyz.openbmc_project.Software.BMC.Updater.service starts.
The ExecStart command is prepended with `-` so that it does not matter
if the mount fails, because the alt chip may be empty or contain invalid
data.
Tested: Verify the obmc-flash-bmc-static-mount-alt.service starts before
xyz.openbmc_project.Software.BMC.Updater.service, and verify it
mounts alt-rofs for dual image systems.
The alt-rwfs will be mounted by the needed service in future
commits.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I2133a99d5324a1008c3508154f865ae54a716219
diff --git a/obmc-flash-bmc b/obmc-flash-bmc
index 30c3fcd..ab353bf 100644
--- a/obmc-flash-bmc
+++ b/obmc-flash-bmc
@@ -245,7 +245,7 @@
done
}
-mount_alt_rwfs() {
+mount_ubi_alt_rwfs() {
altNum="$(findmtdnum "alt-bmc")"
if [ ! -z "${altNum}" ]; then
altRwfs=$(ubinfo -a -d ${altNum} | grep -w "rwfs") || true
@@ -304,6 +304,19 @@
set_wdt2bite
}
+mount_static_alt() {
+ typ=$1
+ altFs=$2
+ mountName=$3
+ altNum="$(findmtdnum ${altFs})"
+ if [ ! -z "${altNum}" ]; then
+ altFsMount="/run/media/${mountName}"
+ mkdir -p "${altFsMount}"
+ altFsBlock="/dev/mtdblock${altNum}"
+ mount -t "${typ}" "${altFsBlock}" "${altFsMount}"
+ fi
+}
+
# Read the current env variable and set it on the alternate boot env
copy_env_var_to_alt() {
varName=$1
@@ -656,7 +669,7 @@
;;
ubiremount)
remount_ubi
- mount_alt_rwfs
+ mount_ubi_alt_rwfs
;;
createenvbackup)
backup_env_vars
@@ -691,6 +704,9 @@
flashid="$2"
mmc_setprimary
;;
+ static-altfs)
+ mount_static_alt "$2" "$3" "$4"
+ ;;
*)
echo "Invalid argument"
exit 1