diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2017-05-01 20:23:17 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-05-25 16:18:43 +0300 |
commit | 8f42fb8b4523948aec1f0b524a94711408f978e3 (patch) | |
tree | f03c0d2148a31e9188ef8bb34cb6b5883fb9640f /meta-openbmc-machines | |
parent | fcaf72e102830f0be043b58edea60fbb40f3bd73 (diff) | |
download | openbmc-8f42fb8b4523948aec1f0b524a94711408f978e3.tar.xz |
obmc-flash-bios-ubimount: Create UBI vol for pnor preserved partitions
In addition to create a UBI volume for the read-write (rw) pnor
partitions, create a UBI volume for the preserved (prsv) pnor
partitions to store the host data that should be preserved during
a code update. This volume has a common name instead of a unique
id because only one copy (the active one) needs to be available
in the system.
Add checks to only execute the commands to create the volumes if
needed (they don't exist). This is needed since the preserved one
doesn't need to be created after it's first created.
Change-Id: Ib21d7d5343f3cb48ff71edca29631249dc5717a0
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'meta-openbmc-machines')
2 files changed, 18 insertions, 6 deletions
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-squashfsmount@.service b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-squashfsmount@.service index 1bf15bfd45..5cca34748e 100644 --- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-squashfsmount@.service +++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-squashfsmount@.service @@ -5,7 +5,7 @@ After=obmc-flash-bios-ubiattach.service [Service] Type=oneshot -RemainAfterExit=yes +RemainAfterExit=no ExecStart=/bin/sh -c '{sbindir}/ubimkvol /dev/ubi0 -N pnor-ro-%i -s 32MiB --type=static; \ mkdir /media/pnor-ro-%i; \ volumeid%i=`ubinfo -d 0 -N pnor-ro-%i | grep "Volume ID" | sed -e "s|Volume ID:||" -e "s/^ *//" | grep -o "^\S*"`; \ diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubimount@.service b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubimount@.service index 5abab7f211..a2147ea758 100644 --- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubimount@.service +++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubimount@.service @@ -1,11 +1,23 @@ [Unit] -Description=Mount UBIFS volume pnor-rw-%I +Description=Mount UBIFS volume pnor-prsv and pnor-rw-%I Requires=obmc-flash-bios-ubiattach.service After=obmc-flash-bios-ubiattach.service [Service] Type=oneshot -RemainAfterExit=yes -ExecStart=/bin/sh -c '{sbindir}/ubimkvol /dev/ubi0 -N pnor-rw-%i -s 1MiB; \ - mkdir /media/pnor-rw-%i; \ - mount -t ubifs ubi0:pnor-rw-%i /media/pnor-rw-%i' +RemainAfterExit=no +ExecStart=/bin/sh -c 'rw=pnor-rw-%i; \ + if [ ! -d "/media/$rw" ]; then \ + mkdir /media/$rw; fi; \ + if [ ! -d "/media/pnor-prsv" ]; then \ + mkdir /media/pnor-prsv; fi; \ + rw_ubi=`ubinfo -d 0 -a | grep $rw`; \ + if [ -z "$rw_ubi" ]; then \ + {sbindir}/ubimkvol /dev/ubi0 -N $rw -s 1MiB; fi; \ + prsv_ubi=`ubinfo -d 0 -a | grep pnor-prsv`; \ + if [ -z "$prsv_ubi" ]; then \ + {sbindir}/ubimkvol /dev/ubi0 -N pnor-prsv -s 1MiB; fi; \ + if ! grep -q $rw /proc/mounts; then \ + mount -t ubifs ubi0:$rw /media/$rw; fi; \ + if ! grep -q pnor-prsv /proc/mounts; then \ + mount -t ubifs ubi0:pnor-prsv /media/pnor-prsv; fi;' |