From 147a795bfabe5c16a211447643bbfeac9c57c1f9 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Mon, 30 Mar 2020 12:03:28 -0700 Subject: phosphor-ipmi-fru: Add eeprom detection by OF name This allows us to provide names without hardcoding an i2c bus path. (From meta-phosphor rev: 1eada36d06cfa40e7c9ba98fd74414c270a9e477) Change-Id: Iba6950ced1e49af1ace3cdde84345f42cd8f57fd Signed-off-by: William A. Kennington III Signed-off-by: Andrew Geissler --- .../ipmi/phosphor-ipmi-fru/obmc-read-eeprom@.service | 1 + .../ipmi/phosphor-ipmi-fru/of-name-to-eeprom.sh | 5 +++++ meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru_git.bb | 10 ++++++++++ 3 files changed, 16 insertions(+) create mode 100755 meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru/of-name-to-eeprom.sh diff --git a/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc-read-eeprom@.service b/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc-read-eeprom@.service index ae8c0388e7..1486cace0b 100644 --- a/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc-read-eeprom@.service +++ b/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc-read-eeprom@.service @@ -7,6 +7,7 @@ After=mapper-wait@-xyz-openbmc_project-inventory.service Restart=no Type=oneshot EnvironmentFile={envfiledir}/obmc/eeproms/%I +ExecStartPre={bindir}/of-name-to-eeprom.sh {envfiledir}/obmc/eeproms/%I ExecStart=/usr/bin/env phosphor-read-eeprom --eeprom $SYSFS_PATH --fruid $FRUID SyslogIdentifier=phosphor-read-eeprom diff --git a/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru/of-name-to-eeprom.sh b/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru/of-name-to-eeprom.sh new file mode 100755 index 0000000000..40c489613d --- /dev/null +++ b/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru/of-name-to-eeprom.sh @@ -0,0 +1,5 @@ +#!/bin/bash -eu +[ -n "${OF_NAME+1}" ] || exit 0 +path="$(grep -xl "$OF_NAME" /sys/bus/i2c/devices/*/of_node/name)" +eeprom="${path%/of_node/name}/eeprom" +sed -i "s,^SYSFS_PATH=.*$,SYSFS_PATH=$eeprom," "$1" diff --git a/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru_git.bb b/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru_git.bb index d79078a1b7..7d803424b2 100644 --- a/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru_git.bb +++ b/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-fru_git.bb @@ -25,12 +25,17 @@ DEPENDS += " \ cli11 \ " +RDEPENDS_${PN} += "bash" + +SRC_URI += "file://of-name-to-eeprom.sh" + SYSTEMD_SERVICE_${PN} += "obmc-read-eeprom@.service" S = "${WORKDIR}/git" HOSTIPMI_PROVIDER_LIBRARY += "libstrgfnhandler.so" +FILES_${PN} += "${bindir}/of-name-to-eeprom.sh" FILES_${PN}_append = " ${libdir}/ipmid-providers/lib*${SOLIBS}" FILES_${PN}_append = " ${libdir}/host-ipmid/lib*${SOLIBS}" FILES_${PN}-dev_append = " ${libdir}/ipmid-providers/lib*${SOLIBSDEV} ${libdir}/ipmid-providers/*.la" @@ -39,3 +44,8 @@ EXTRA_OECONF = " \ YAML_GEN=${STAGING_DIR_NATIVE}${config_datadir}/config.yaml \ PROP_YAML=${STAGING_DIR_NATIVE}${properties_datadir}/extra-properties.yaml \ " + +do_install_append() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/of-name-to-eeprom.sh ${D}${bindir} +} -- cgit v1.2.3