summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2017-07-11 11:34:23 -0500
committerAdriana Kobylak <anoo@us.ibm.com>2017-07-19 12:35:08 -0500
commitecf5269297443e7eb5e2b3d11c51302ece1da822 (patch)
treee4924012b877b065f720d02a37395e00c6e96b10 /meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager
parent9e812c7c9bf2afbce5dda9042158f4383fdfbb63 (diff)
downloadtalos-openbmc-ecf5269297443e7eb5e2b3d11c51302ece1da822.tar.gz
talos-openbmc-ecf5269297443e7eb5e2b3d11c51302ece1da822.zip
phosphor-software-manager: New service file to create ubi ro volumes
Add service file and script to create ubi read-only volumes to store the rofs and kernel. Default the sizes to the current corresponding mtd size. Create a ubi block for the read-only image which is a squashfs. The mtd device locations can be passed through the recipe. Set it to the "pnor" mtd as the default. This can be changed via a per-system bbappend to other chips if desired, such as the alternate bmc chip. Resolves openbmc/openbmc#1651 Change-Id: I76aa9021a2bb5462c0e4c2efef99728d26873df0 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager')
-rw-r--r--meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc50
-rw-r--r--meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-ubiro@.service8
2 files changed, 58 insertions, 0 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
index 16c5f3285..a45150327 100644
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
+++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
@@ -28,12 +28,62 @@ ubi_rw() {
fi
}
+ubi_ro() {
+ romtd="$(findmtd "${reqmtd}")"
+ ro="${romtd#mtd}"
+ ubidev="/dev/ubi${ro}"
+
+ # Create a static ubi volume
+ # TODO Get the actual image size openbmc/openbmc#1840
+ vol="$(findubi "${name}")"
+ if [ -z "${vol}" ]; then
+ ubimkvol "${ubidev}" -N "${name}" -s "${imgsize}" --type=static
+ vol="$(findubi "${name}")"
+ fi
+}
+
+# Squashfs images need a ubi block
+ubi_block() {
+ vol="$(findubi "${name}")"
+ ubidevid="${vol#ubi}"
+ block="/dev/ubiblock${ubidevid}"
+ if [ ! -e "$block" ]; then
+ ubiblock --create "/dev/ubi${ubidevid}"
+ fi
+}
+
+ubi_updatevol() {
+ vol="$(findubi "${name}")"
+ ubidevid="${vol#ubi}"
+ img="/tmp/images/${version}/${imgfile}"
+ ubiupdatevol "/dev/ubi${ubidevid}" "${img}"
+}
+
case "$1" in
ubirw)
reqmtd="$2"
name="$3"
ubi_rw
;;
+ ubiro)
+ reqmtd="$2"
+ name="$3"
+ version="$4"
+ imgfile="image-rofs"
+ imgsize="16MiB"
+ ubi_ro
+ ubi_block
+ ubi_updatevol
+ ;;
+ ubikernel)
+ reqmtd="$2"
+ name="$3"
+ version="$4"
+ imgfile="image-kernel"
+ imgsize="4MiB"
+ ubi_ro
+ ubi_updatevol
+ ;;
*)
echo "Invalid argument"
exit 1
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-ubiro@.service b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-ubiro@.service
new file mode 100644
index 000000000..4dec96efb
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-ubiro@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Create read-only ubi volumes %I
+
+[Service]
+Type=oneshot
+RemainAfterExit=no
+ExecStart={sbindir}/obmc-flash-bmc ubiro {RO_MTD} ro-%i %i
+ExecStart={sbindir}/obmc-flash-bmc ubikernel {KERNEL_MTD} kernel-%i %i
OpenPOWER on IntegriCloud