Mount a specified PNOR UBIFS volume
Create a template systemd unit file to mount a specified PNOR UBIFS
volume (systemd does not support template mount files).
Create it with an arbitrary size of 1MB, it can be dynamically resized
at runtime.
Example usage:
systemctl start obmc-flash-bios-ubimount@N where N is the desired
partition number, ex: 1.
This will create a volume named pnor-rwN (ex: pnor-rw1) under the /media
directory.
Change-Id: I6c4d8662dfb50e83d02bfb946ce11b74726fe3bd
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/common/recipes-phosphor/flash/obmc-flash-bios.bb b/common/recipes-phosphor/flash/obmc-flash-bios.bb
index 9fdd7e3..7398cbd 100644
--- a/common/recipes-phosphor/flash/obmc-flash-bios.bb
+++ b/common/recipes-phosphor/flash/obmc-flash-bios.bb
@@ -13,3 +13,4 @@
DBUS_SERVICE_${PN} += "org.openbmc.control.Flash.service"
SYSTEMD_SERVICE_${PN} += "obmc-flash-init.service"
SYSTEMD_SERVICE_${PN} += "obmc-flash-bios-ubiattach.service"
+SYSTEMD_SERVICE_${PN} += "obmc-flash-bios-ubimount@.service"
diff --git a/common/recipes-phosphor/flash/obmc-flash-bios/obmc-flash-bios-ubimount@.service b/common/recipes-phosphor/flash/obmc-flash-bios/obmc-flash-bios-ubimount@.service
new file mode 100644
index 0000000..331ed6b
--- /dev/null
+++ b/common/recipes-phosphor/flash/obmc-flash-bios/obmc-flash-bios-ubimount@.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Mount UBIFS volume 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'