diff options
author | Saqib Khan <khansa@us.ibm.com> | 2017-07-26 23:48:20 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-07-31 15:44:15 +0000 |
commit | bea768cabf335b2519bf34d0fd0b23341623196e (patch) | |
tree | 3b35bb7f7b58064a38d36c2b0ff4bea0ad366073 /meta-openbmc-machines | |
parent | 27b0f10a9c480f4b207ebeda322735797cedd3c4 (diff) | |
download | talos-openbmc-bea768cabf335b2519bf34d0fd0b23341623196e.tar.gz talos-openbmc-bea768cabf335b2519bf34d0fd0b23341623196e.zip |
PNOR: Mount ubi volumes on BMC reboot
- Create a static service file that will be
run on all BMC boot to remount the ubi volumes.
- Read the ubinfo for all available volumes from
obmc/flash-bios script.
- Re-Mount the available volumes on /media/ dir
using the volume names.
Resolves openbmc/openbmc#1848
Change-Id: I9e336340a04f335d034438406e5f0fff9b21d1b9
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
Diffstat (limited to 'meta-openbmc-machines')
3 files changed, 46 insertions, 0 deletions
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb index 14f7d1083..1aacf2881 100644 --- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb +++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb @@ -45,4 +45,5 @@ SYSTEMD_SERVICE_${PN} += " \ obmc-flash-bios-ubiumount-prsv.service \ obmc-flash-bios-ubiumount-rw@.service \ obmc-flash-bios-squashfsmount@.service \ + obmc-flash-bios-ubiremount.service \ " 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 226527524..dffd29871 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 @@ -128,6 +128,34 @@ umount_ubi() { fi } +remount_ubi() { + pnormtd="$(findmtd pnor)" + pnor="${pnormtd#mtd}" + # Get information on all ubi volumes + ubinfo=$(ubinfo -d ${pnor}) + presentVolumes=${ubinfo##*:} + IFS=', ' read -r -a array <<< "$presentVolumes" + for element in ${array[@]}; + do + elementProperties=$(ubinfo -d $pnor -n $element) + # Get ubi volume name by getting rid of additional properties + name=${elementProperties#*Name:} + name="${name%Character*}" + name="$(echo -e "${name}" | tr -d '[:space:]')" + + if [[ ${name} == pnor-prsv ]] || [[ ${name} == pnor-rw* ]] || [[ ${name} == pnor-ro* ]]; then + mountdir="/media/${name}" + if [[ ${name} == pnor-ro* ]] + then + ubiblock --create /dev/ubi${pnor}_${element} + mount -t squashfs -o ro "/dev/ubiblock${pnor}_${element}" "${mountdir}" + else + mount -t ubifs "ubi${pnor}:${name}" "${mountdir}" + fi + fi + done +} + case "$1" in ubiattach) attach_ubi @@ -145,6 +173,9 @@ case "$1" in name="$2" umount_ubi ;; + ubiremount) + remount_ubi + ;; *) echo "Invalid argument" exit 1 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 new file mode 100644 index 000000000..fd839f351 --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubiremount.service @@ -0,0 +1,14 @@ +[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 + +[Service] +Type=oneshot +RemainAfterExit=no +ExecStart={sbindir}/obmc-flash-bios ubiremount + +[Install] +WantedBy=multi-user.target |