diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2017-07-11 11:34:23 -0500 |
---|---|---|
committer | Adriana Kobylak <anoo@us.ibm.com> | 2017-07-19 12:35:08 -0500 |
commit | ecf5269297443e7eb5e2b3d11c51302ece1da822 (patch) | |
tree | e4924012b877b065f720d02a37395e00c6e96b10 /meta-phosphor/common/recipes-phosphor | |
parent | 9e812c7c9bf2afbce5dda9042158f4383fdfbb63 (diff) | |
download | talos-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')
3 files changed, 65 insertions, 0 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb index b7a1fd101..acdd9a3e2 100644 --- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb +++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb @@ -62,11 +62,18 @@ DBUS_SERVICE_${PN}-updater += "xyz.openbmc_project.Software.BMC.Updater.service" SYSTEMD_SERVICE_${PN}-updater += " \ obmc-flash-bmc-ubirw.service \ + obmc-flash-bmc-ubiro@.service \ " # Name of the mtd device where the ubi volumes should be created BMC_RW_MTD ??= "pnor" +BMC_RO_MTD ??= "pnor" +# TODO Change kernel location to primary BMC chip once the rofs/rwfs mtd devices +# are merged into a single ubi one openbmc/openbmc#1942 +BMC_KERNEL_MTD ??= "pnor" SYSTEMD_SUBSTITUTIONS += "RW_MTD:${BMC_RW_MTD}:obmc-flash-bmc-ubirw.service" +SYSTEMD_SUBSTITUTIONS += "RO_MTD:${BMC_RO_MTD}:obmc-flash-bmc-ubiro@.service" +SYSTEMD_SUBSTITUTIONS += "KERNEL_MTD:${BMC_KERNEL_MTD}:obmc-flash-bmc-ubiro@.service" SRC_URI += "file://obmc-flash-bmc" do_install_append() { 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 |