phosphor-ipmi-host: Move configuration to phosphor-ipmi-config
Witherspoon requires an dev_id.json file whose content is partially
derived from data provided by the os-release package. os-release is
updated for each commit, as some of its content (VERSION and
VERSION_ID) can be derived from `git describe`. As dev_id.json was
provided by the phosphor-ipmi-host package, every commit transitively
triggered a rebuild of phosphor-ipmi-host in order to satisfy
Witherspoon's requirements.
Always rebuilding phosphor-ipmi-host is unhelpful for several reasons:
* It needlessly reduces CI throughput, as it is likely the commits in
question do not modify the phosphor-ipmi-host package.
* GCC suffers from what appears to be an unfixable[1] bug[2] that causes
phoshor-ipmi-host to consume large (>5GiB) amounts of RAM when
compiling some (at least Witherspoon) sensor configurations.
To avoid this, separate the configuration files out into
virtual/phosphor-ipmi-config and phosphor-ipmi-config packages that
phosphor-ipmi-host RDEPENDS on. Witherspoon provides an alternative
implementation in witherspoon-ipmi-config to mangle dev_id.json to its
particular requirements.
A virtual is used rather than a simple bbappends for Witherspoon, as the
bbappend approach breaks builds of machines other than Witherspoon if
Witherspoon is built first: The Witherspoon-specific dev_id.json file is
deployed in its mangled form into e.g. a Zaius image. Specifically, the
following sequence will trigger the issue:
$ TEMPLATECONF=.../witherspoon.conf . openbmc-env
$ bitbake obmc-phosphor-image
$ rm -rf conf
$ TEMPLATECONF=.../zaius.conf . openbmc-env
$ bitbake obmc-phosphor-image
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80290#c26
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80290
Change-Id: Ib9629fc77b29e2deeab3f1c3a145d9e966c14ec4
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf
index 0b17762..1ccd1cf 100644
--- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf
@@ -19,6 +19,9 @@
# Inhibit phosphor-hwmon-config-mrw
VIRTUAL-RUNTIME_phosphor-hwmon-config_df-mrw = ""
+# Pick up the Witherspoon-specific IPMI configuration
+VIRTUAL-RUNTIME_ipmi-config = "witherspoon-ipmi-config"
+
# Inhibit phosphor-fan-presence-mrw-native
PREFERRED_PROVIDER_virtual/phosphor-fan-presence-config_df-mrw = \
"phosphor-fan-presence-config-native"
@@ -26,3 +29,5 @@
# Inhibit phosphor-fan-control-fan-config-mrw-native
PREFERRED_PROVIDER_virtual/phosphor-fan-control-fan-config_df-mrw = \
"phosphor-fan-control-fan-config-native"
+
+PREFERRED_RPROVIDER_virtual/phosphor-ipmi-config = "witherspoon-ipmi-config"
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host.bbappend b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host.bbappend
index 27678bf..748fa73 100644
--- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host.bbappend
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host.bbappend
@@ -1,49 +1,5 @@
FILESEXTRAPATHS_append_witherspoon := ":${THISDIR}/${PN}"
-SRC_URI_append_witherspoon = " file://occ_sensors.hardcoded.yaml \
- file://dev_id.json \
- file://dcmi_sensors.json \
- file://power_reading.json \
- file://hwmon_sensors.hardcoded.yaml \
- file://cipher_list.json \
- "
-inherit image_version
-
-# Calculate the auxiliary firmware revision to be updated in the dev_id.json
-# file. It is calculated from the VERSION_ID field which currently has two
-# formats. The revision field is 4 bytes, the first two bytes represent the
-# count of commits from the tagging and next two bytes represent the version.
-# Both fields are represented in BCD encoded format, so 9999 is the maximum
-# value both fields can take. With the format "v2.1-216-ga78ace8", Petitboot
-# would display the firmware revision as "Firmware version: 2.01.02160000",
-# "0216" is count and the revision is "0000". With the format
-# "ibm-v2.0-10-r41-0-gd0c319e" Petitboot would display the firmware revision
-# as "Firmware version: 2.00.00100041", "0010" is count and the revision
-# is "0041".
-
-python do_populate_aux_version() {
- import json
- import re
- version_id = do_get_version(d)
-
- # count from the commit version
- count = re.findall("-(\d{1,4})-", version_id)
-
- release = re.findall("-r(\d{1,4})", version_id)
- if release:
- auxVer = count[0] + "{0:0>4}".format(release[0])
- else:
- auxVer = count[0] + "0000"
-
- # Update dev_id.json with the auxiliary firmware revision
- workdir = d.getVar('WORKDIR', True)
- file = os.path.join(workdir, 'dev_id.json')
-
- with open(file, "r+") as jsonFile:
- data = json.load(jsonFile)
- jsonFile.seek(0)
- jsonFile.truncate()
- data["aux"] = int(auxVer, 16)
- json.dump(data, jsonFile)
-}
-
-addtask populate_aux_version after do_configure before do_compile
+SRC_URI_append_witherspoon = " \
+ file://occ_sensors.hardcoded.yaml \
+ file://hwmon_sensors.hardcoded.yaml \
+ "
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config.bb b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config.bb
new file mode 100644
index 0000000..8ab47c6
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config.bb
@@ -0,0 +1,82 @@
+SUMMARY = "Witherspoon IPMI daemon configuration"
+PR = "r1"
+
+inherit obmc-phosphor-license
+inherit allarch
+
+SRC_URI = " \
+ file://cipher_list.json \
+ file://dcmi_cap.json \
+ file://dcmi_sensors.json \
+ file://dev_id.json \
+ file://power_reading.json \
+ "
+
+FILES_${PN} = " \
+ ${datadir}/ipmi-providers/cipher_list.json \
+ ${datadir}/ipmi-providers/dcmi_cap.json \
+ ${datadir}/ipmi-providers/dcmi_sensors.json \
+ ${datadir}/ipmi-providers/dev_id.json \
+ ${datadir}/ipmi-providers/power_reading.json \
+ "
+
+do_fetch[noexec] = "1"
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+# Calculate the auxiliary firmware revision to be updated in the dev_id.json
+# file. It is calculated from the VERSION_ID field which currently has two
+# formats. The revision field is 4 bytes, the first two bytes represent the
+# count of commits from the tagging and next two bytes represent the version.
+# Both fields are represented in BCD encoded format, so 9999 is the maximum
+# value both fields can take. With the format "v2.1-216-ga78ace8", Petitboot
+# would display the firmware revision as "Firmware version: 2.01.02160000",
+# "0216" is count and the revision is "0000". With the format
+# "ibm-v2.0-10-r41-0-gd0c319e" Petitboot would display the firmware revision
+# as "Firmware version: 2.00.00100041", "0010" is count and the revision
+# is "0041".
+
+inherit image_version
+
+do_patch[depends] = "os-release:do_populate_sysroot"
+
+python do_patch() {
+ import json
+ import re
+ from shutil import copyfile
+ version_id = do_get_version(d)
+
+ # count from the commit version
+ count = re.findall("-(\d{1,4})-", version_id)
+
+ release = re.findall("-r(\d{1,4})", version_id)
+ if release:
+ auxVer = count[0] + "{0:0>4}".format(release[0])
+ else:
+ auxVer = count[0] + "0000"
+
+ workdir = d.getVar('WORKDIR', True)
+ file = os.path.join(workdir, 'dev_id.json')
+
+ # Update dev_id.json with the auxiliary firmware revision
+ with open(file, "r+") as jsonFile:
+ data = json.load(jsonFile)
+ jsonFile.seek(0)
+ jsonFile.truncate()
+ data["aux"] = int(auxVer, 16)
+ json.dump(data, jsonFile)
+}
+
+do_install() {
+ install -d ${D}${datadir}/ipmi-providers
+ install -m 0644 -D ${WORKDIR}/cipher_list.json \
+ ${D}${datadir}/ipmi-providers/cipher_list.json
+ install -m 0644 -D ${WORKDIR}/dcmi_cap.json \
+ ${D}${datadir}/ipmi-providers/dcmi_cap.json
+ install -m 0644 -D ${WORKDIR}/dcmi_sensors.json \
+ ${D}${datadir}/ipmi-providers/dcmi_sensors.json
+ install -m 0644 -D ${WORKDIR}/dev_id.json \
+ ${D}${datadir}/ipmi-providers/dev_id.json
+ install -m 0644 -D ${WORKDIR}/power_reading.json \
+ ${D}${datadir}/ipmi-providers/power_reading.json
+}
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host/cipher_list.json b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config/cipher_list.json
similarity index 100%
rename from meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host/cipher_list.json
rename to meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config/cipher_list.json
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/dcmi_cap.json b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config/dcmi_cap.json
similarity index 100%
copy from meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/dcmi_cap.json
copy to meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config/dcmi_cap.json
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host/dcmi_sensors.json b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config/dcmi_sensors.json
similarity index 100%
rename from meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host/dcmi_sensors.json
rename to meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config/dcmi_sensors.json
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host/dev_id.json b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config/dev_id.json
similarity index 100%
rename from meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host/dev_id.json
rename to meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config/dev_id.json
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host/power_reading.json b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config/power_reading.json
similarity index 100%
rename from meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host/power_reading.json
rename to meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/witherspoon-ipmi-config/power_reading.json
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config.bb b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config.bb
new file mode 100644
index 0000000..933fd3b
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config.bb
@@ -0,0 +1,40 @@
+SUMMARY = "Phosphor IPMI daemon configuration"
+PR = "r1"
+
+inherit obmc-phosphor-license
+inherit allarch
+
+SRC_URI = " \
+ file://cipher_list.json \
+ file://dcmi_cap.json \
+ file://dcmi_sensors.json \
+ file://dev_id.json \
+ file://power_reading.json \
+ "
+
+FILES_${PN} = " \
+ ${datadir}/ipmi-providers/cipher_list.json \
+ ${datadir}/ipmi-providers/dcmi_cap.json \
+ ${datadir}/ipmi-providers/dcmi_sensors.json \
+ ${datadir}/ipmi-providers/dev_id.json \
+ ${datadir}/ipmi-providers/power_reading.json \
+ "
+
+do_fetch[noexec] = "1"
+do_patch[noexec] = "1"
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+do_install() {
+ install -d ${D}${datadir}/ipmi-providers
+ install -m 0644 -D ${WORKDIR}/cipher_list.json \
+ ${D}${datadir}/ipmi-providers/cipher_list.json
+ install -m 0644 -D ${WORKDIR}/dcmi_cap.json \
+ ${D}${datadir}/ipmi-providers/dcmi_cap.json
+ install -m 0644 -D ${WORKDIR}/dcmi_sensors.json \
+ ${D}${datadir}/ipmi-providers/dcmi_sensors.json
+ install -m 0644 -D ${WORKDIR}/dev_id.json \
+ ${D}${datadir}/ipmi-providers/dev_id.json
+ install -m 0644 -D ${WORKDIR}/power_reading.json \
+ ${D}${datadir}/ipmi-providers/power_reading.json
+}
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/cipher_list.json b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/cipher_list.json
similarity index 100%
rename from meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/cipher_list.json
rename to meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/cipher_list.json
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/dcmi_cap.json b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/dcmi_cap.json
similarity index 100%
rename from meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/dcmi_cap.json
rename to meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/dcmi_cap.json
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/dcmi_sensors.json b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/dcmi_sensors.json
similarity index 100%
rename from meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/dcmi_sensors.json
rename to meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/dcmi_sensors.json
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/dev_id.json b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json
similarity index 100%
rename from meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/dev_id.json
rename to meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/power_reading.json b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/power_reading.json
similarity index 100%
rename from meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host/power_reading.json
rename to meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/power_reading.json
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
index aeb1d50..f79974a 100644
--- a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
+++ b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
@@ -19,7 +19,6 @@
whitelists = [ '{}-whitelist-native'.format(x) for x in whitelists ]
return ' '.join(whitelists)
-
DEPENDS += "autoconf-archive-native"
DEPENDS += "nlohmann-json"
DEPENDS += "obmc-targets"
@@ -34,6 +33,8 @@
DEPENDS += "virtual/phosphor-ipmi-sensor-inventory"
DEPENDS += "virtual/phosphor-ipmi-channel-config"
+VIRTUAL-RUNTIME_ipmi-config ?= "phosphor-ipmi-config"
+
RDEPENDS_${PN}-dev += "phosphor-logging"
RDEPENDS_${PN}-dev += "phosphor-mapper-dev"
RDEPENDS_${PN} += "clear-once"
@@ -43,6 +44,7 @@
RDEPENDS_${PN} += "phosphor-mapper"
RDEPENDS_${PN} += "phosphor-time-manager"
RDEPENDS_${PN} += "sdbusplus"
+RDEPENDS_${PN} += "${VIRTUAL-RUNTIME_ipmi-config}"
RDEPENDS_${PN} += "virtual/obmc-watchdog"
SYSTEMD_SERVICE_${PN} += "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service phosphor-ipmi-host.service"
@@ -68,13 +70,7 @@
S = "${WORKDIR}/git"
-SRC_URI += "file://merge_yamls.py \
- file://dev_id.json \
- file://dcmi_cap.json \
- file://power_reading.json \
- file://dcmi_sensors.json \
- file://cipher_list.json \
- "
+SRC_URI += "file://merge_yamls.py "
HOSTIPMI_PROVIDER_LIBRARY += "libapphandler.so"
HOSTIPMI_PROVIDER_LIBRARY += "libsysintfcmds.so"
@@ -84,11 +80,6 @@
FILES_${PN}_append = " ${libdir}/host-ipmid/lib*${SOLIBS}"
FILES_${PN}_append = " ${libdir}/ipmid-providers/lib*${SOLIBS}"
FILES_${PN}_append = " ${libdir}/net-ipmid/lib*${SOLIBS}"
-FILES_${PN}_append = " ${datadir}/ipmi-providers/dev_id.json"
-FILES_${PN}_append = " ${datadir}/ipmi-providers/dcmi_cap.json"
-FILES_${PN}_append = " ${datadir}/ipmi-providers/power_reading.json"
-FILES_${PN}_append = " ${datadir}/ipmi-providers/dcmi_sensors.json"
-FILES_${PN}_append = " ${datadir}/ipmi-providers/cipher_list.json"
FILES_${PN}-dev_append = " ${libdir}/ipmid-providers/lib*${SOLIBSDEV} ${libdir}/ipmid-providers/*.la"
# Soft Power Off
@@ -126,18 +117,6 @@
# Invoke the script and don't catch any resulting exception.
subprocess.check_call(cmd)
}
-do_install_append(){
- install -d ${D}${datadir}/ipmi-providers
- install -m 0644 -D ${WORKDIR}/dev_id.json \
- ${D}${datadir}/ipmi-providers/dev_id.json
- install -m 0644 -D ${WORKDIR}/dcmi_cap.json \
- ${D}${datadir}/ipmi-providers/dcmi_cap.json
- install -m 0644 -D ${WORKDIR}/power_reading.json \
- ${D}${datadir}/ipmi-providers/power_reading.json
- install -m 0644 -D ${WORKDIR}/dcmi_sensors.json \
- ${D}${datadir}/ipmi-providers/dcmi_sensors.json
- install -m 0644 -D ${WORKDIR}/cipher_list.json \
- ${D}${datadir}/ipmi-providers/cipher_list.json
-}
+
# python-pyyaml-native is installed by do_configure, so put this task after
addtask merge_sensors after do_configure before do_compile