openpower-software-manager: Create ubi volume for pnor patches
Create a ubi volume to store pnor patches and mount it under
/usr/local/share/pnor/.
Resolves openbmc/openbmc#1333
Change-Id: Id62549e5e0dc0e5373510a59193736fcf87bb18a
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
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 565c640..3c15757 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,6 +45,7 @@
obmc-flash-bios-ubiumount-prsv.service \
obmc-flash-bios-ubiumount-ro@.service \
obmc-flash-bios-ubiumount-rw@.service \
+ obmc-flash-bios-ubipatch.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 bfd9592..19878d4 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
@@ -85,7 +85,12 @@
pnormtd="$(findmtd pnor)"
pnor="${pnormtd#mtd}"
ubidev="/dev/ubi${pnor}"
- mountdir="/media/${name}"
+
+ if [[ "${name}" == "pnor-patch" ]]; then
+ mountdir="/usr/local/share/pnor"
+ else
+ mountdir="/media/${name}"
+ fi
if [[ "${name}" == "pnor-prsv" ]]; then
size="2MiB"
@@ -94,7 +99,7 @@
fi
if [ ! -d "${mountdir}" ]; then
- mkdir "${mountdir}"
+ mkdir -p "${mountdir}"
fi
vol="$(findubi "${name}")"
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubipatch.service b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubipatch.service
new file mode 100644
index 0000000..c280193
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubipatch.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Create a ubi volume for pnor patches
+Wants=usr-local.mount
+After=usr-local.mount
+
+[Service]
+Type=oneshot
+RemainAfterExit=no
+ExecStart={sbindir}/obmc-flash-bios ubimount pnor-patch
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/org.open_power.Software.Host.Updater.service b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/org.open_power.Software.Host.Updater.service
index 12ad4ea..2e7f83b 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/org.open_power.Software.Host.Updater.service
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/org.open_power.Software.Host.Updater.service
@@ -5,6 +5,8 @@
Before=mboxd.service
Wants=usr-local.mount
Before=usr-local.mount
+Wants=obmc-flash-bios-ubipatch.service
+Before=obmc-flash-bios-ubipatch.service
[Service]
ExecStart={sbindir}/openpower-update-manager