summaryrefslogtreecommitdiffstats
path: root/meta-openbmc-machines/meta-openpower
diff options
context:
space:
mode:
authorEdward A. James <eajames@us.ibm.com>2017-08-21 16:08:44 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-08-30 19:51:44 +0000
commiteb8644742b22a77f40e6cfe9f3d325e92a602def (patch)
tree7e767cb438d5d14f6edb909142c721d39bf2f716 /meta-openbmc-machines/meta-openpower
parent3dbd8a425065982b4b82b83a92e489774c9d69a1 (diff)
downloadtalos-openbmc-eb8644742b22a77f40e6cfe9f3d325e92a602def.tar.gz
talos-openbmc-eb8644742b22a77f40e6cfe9f3d325e92a602def.zip
Do not allow power on if PNOR doesn't have required image
- The new BMC code requires the UBI based PNOR image to be loaded before HOST turns on. If the PNOR is not formatted as UBI, we want a clear error in the journal and quick fail to boot to notify the user. Resolves openbmc/openbmc#2117 Change-Id: I547ba488a94c5b5871c6327b0fd3af678c656b1b Signed-off-by: Saqib Khan <khansa@us.ibm.com> Signed-off-by: Edward A. James <eajames@us.ibm.com>
Diffstat (limited to 'meta-openbmc-machines/meta-openpower')
-rw-r--r--meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd.bbappend11
-rw-r--r--meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd/check-pnor-format.service11
-rw-r--r--meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd/check_pnor_format.sh18
3 files changed, 40 insertions, 0 deletions
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd.bbappend b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd.bbappend
index 8b6248a46..ac35ae9b4 100644
--- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd.bbappend
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd.bbappend
@@ -1 +1,12 @@
MBOXD_FLASH_SIZE = "64M"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SYSTEMD_SERVICE_${PN} += "check-pnor-format.service"
+
+SRC_URI += "file://check_pnor_format.sh"
+
+do_install_append() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/check_pnor_format.sh ${D}${bindir}/check_pnor_format.sh
+}
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd/check-pnor-format.service b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd/check-pnor-format.service
new file mode 100644
index 000000000..88bf0ad39
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd/check-pnor-format.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Check PNOR UBI format
+Before=mboxd.service
+
+[Service]
+ExecStart={bindir}/check_pnor_format.sh
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+RequiredBy=mboxd.service
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd/check_pnor_format.sh b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd/check_pnor_format.sh
new file mode 100644
index 000000000..ec043eaf9
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/mboxd/mboxd/check_pnor_format.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Get the mtd device number (mtdX)
+findmtd() {
+ m="$(grep -xl "$1" /sys/class/mtd/*/name)"
+ m="${m%/name}"
+ m="${m##*/}"
+ echo "${m}"
+}
+
+pnormtd="$(findmtd pnor)"
+pnor="${pnormtd#mtd}"
+pnordev="/dev/mtd${pnor}"
+
+if [[ ! "$(dd if=${pnordev} bs=1 count=3 2> /dev/null)" = "UBI" ]]; then
+ echo "${pnordev} is not formatted UBI"
+ exit 1
+fi
OpenPOWER on IntegriCloud