diff options
Diffstat (limited to 'meta-phosphor/common')
3 files changed, 71 insertions, 1 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 5641cffc4..b7a1fd101 100644 --- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb +++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb @@ -52,11 +52,28 @@ RDEPENDS_${PN}-updater += " \ FILES_${PN}-version += "${sbindir}/phosphor-version-software-manager" FILES_${PN}-download-mgr += "${sbindir}/phosphor-download-manager" -FILES_${PN}-updater += "${sbindir}/phosphor-image-updater" +FILES_${PN}-updater += " \ + ${sbindir}/phosphor-image-updater \ + ${sbindir}/obmc-flash-bmc \ + " DBUS_SERVICE_${PN}-version += "xyz.openbmc_project.Software.Version.service" DBUS_SERVICE_${PN}-download-mgr += "xyz.openbmc_project.Software.Download.service" DBUS_SERVICE_${PN}-updater += "xyz.openbmc_project.Software.BMC.Updater.service" +SYSTEMD_SERVICE_${PN}-updater += " \ + obmc-flash-bmc-ubirw.service \ + " + +# Name of the mtd device where the ubi volumes should be created +BMC_RW_MTD ??= "pnor" +SYSTEMD_SUBSTITUTIONS += "RW_MTD:${BMC_RW_MTD}:obmc-flash-bmc-ubirw.service" + +SRC_URI += "file://obmc-flash-bmc" +do_install_append() { + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/obmc-flash-bmc ${D}${sbindir}/obmc-flash-bmc +} + SRC_URI += "git://github.com/openbmc/phosphor-bmc-code-mgmt" SRCREV = "4c1aec09c68f27fcdcf0f419c9eb08a56c3ab772" 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 new file mode 100644 index 000000000..16c5f3285 --- /dev/null +++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc @@ -0,0 +1,46 @@ +#!/bin/sh + +# Get the mtd device number (mtdX) +findmtd() { + m="$(grep -xl "$1" /sys/class/mtd/*/name)" + m="${m%/name}" + m="${m##*/}" + echo "${m}" +} + +# Get the ubi device number (ubiX_Y) +findubi() { + u="$(grep -xl "$1" /sys/class/ubi/ubi?/subsystem/ubi*/name)" + u="${u%/name}" + u="${u##*/}" + echo "${u}" +} + +ubi_rw() { + rwmtd="$(findmtd "${reqmtd}")" + rw="${rwmtd#mtd}" + ubidev="/dev/ubi${rw}" + + # Create a ubi volume of size 4MB, that is the current size of the rwfs image + vol="$(findubi "${name}")" + if [ -z "${vol}" ]; then + ubimkvol "${ubidev}" -N "${name}" -s 4MiB + fi +} + +case "$1" in + ubirw) + reqmtd="$2" + name="$3" + ubi_rw + ;; + *) + echo "Invalid argument" + exit 1 + ;; +esac +rc=$? +if [ ${rc} -ne 0 ]; then + echo "$0: error ${rc}" + exit ${rc} +fi diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-ubirw.service b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-ubirw.service new file mode 100644 index 000000000..cef57e008 --- /dev/null +++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-ubirw.service @@ -0,0 +1,7 @@ +[Unit] +Description=Create BMC read-write ubi volume + +[Service] +Type=oneshot +RemainAfterExit=no +ExecStart={sbindir}/obmc-flash-bmc ubirw {RW_MTD} rw |