blob: 6794a09c3038991e1ca7ad1305cab71a67e7c6dd [file] [log] [blame]
vishwabmc2ac6f932015-10-09 15:51:50 +05301SUMMARY = "Phosphor OpenBMC IPMI daemon"
2DESCRIPTION = "Phosphor OpenBMC IPMI router and plugin libraries"
vishwabmc2ac6f932015-10-09 15:51:50 +05303PR = "r1"
Patrick Ventured3728702018-10-21 08:27:22 -07004PV = "1.0+git${SRCPV}"
Brad Bishop75f03872018-11-03 09:41:57 -07005LICENSE = "Apache-2.0"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
vishwabmc2ac6f932015-10-09 15:51:50 +05307
Patrick Williams12fc9392021-08-06 09:16:53 -05008RRECOMMENDS:${PN} += "packagegroup-obmc-ipmid-providers-libs"
Chris Austen9d3325a2015-10-24 19:34:11 -05009
Andrew Geissler2cf105f2022-06-15 22:00:48 -050010inherit meson pkgconfig
Patrick Venturecb675692017-12-22 14:36:07 -080011inherit obmc-phosphor-ipmiprovider-symlink
Patrick Williams89b11a12015-10-15 15:20:20 -050012inherit obmc-phosphor-sdbus-service
Patrick Venturecb675692017-12-22 14:36:07 -080013inherit obmc-phosphor-systemd
Ratan Gupta3aa591f2017-03-06 17:05:11 +053014inherit phosphor-ipmi-host
Andrew Geissler04b85e92020-03-30 14:31:19 +000015inherit python3native
vishwabmc2ac6f932015-10-09 15:51:50 +053016
Brad Bishop01e6b172018-01-26 22:11:36 -050017def ipmi_whitelists(d):
18 whitelists = d.getVar(
19 'VIRTUAL-RUNTIME_phosphor-ipmi-providers', True) or ''
20 whitelists = whitelists.split()
21 whitelists = [ '{}-whitelist-native'.format(x) for x in whitelists ]
22 return ' '.join(whitelists)
23
Vernon Mauerye4dedc52022-05-11 15:23:20 -070024PACKAGECONFIG ??= "allowlist i2c-allowlist boot-flag-safe-mode softoff libuserlayer"
Andrew Geissler2cf105f2022-06-15 22:00:48 -050025PACKAGECONFIG[dynamic-sensors] = "-Ddynamic-sensors=enabled,-Ddynamic-sensors=disabled"
26PACKAGECONFIG[hybrid-sensors] = "-Dhybrid-sensors=enabled,-Dhybrid-sensors=disabled"
27PACKAGECONFIG[sel-logger-clears-sel] = "-Dsel-logger-clears-sel=enabled,-Dsel-logger-clears-sel=disabled"
28PACKAGECONFIG[allowlist] = "-Dipmi-whitelist=enabled,-Dipmi-whitelist=disabled"
29PACKAGECONFIG[i2c-allowlist] = "-Di2c-whitelist-check=enabled,-Di2c-whitelist-check=disabled"
30PACKAGECONFIG[transport-oem] = "-Dtransport-oem=enabled,-Dtransport-oem=disabled"
31PACKAGECONFIG[boot-flag-safe-mode] = "-Dboot-flag-safe-mode-support=enabled,-Dboot-flag-safe-mode-support=disabled"
32PACKAGECONFIG[softoff] = "-Dsoftoff=enabled,-Dsoftoff=disabled"
33PACKAGECONFIG[update-functional-on-fail] = "-Dupdate-functional-on-fail=enabled,-Dupdate-functional-on-fail=disabled"
34PACKAGECONFIG[libuserlayer] = "-Dlibuserlayer=enabled,-Dlibuserlayer=disabled"
35PACKAGECONFIG[sensors-cache] = "-Dsensors-cache=enabled,-Dsensors-cache=disabled"
Vernon Mauerye4dedc52022-05-11 15:23:20 -070036
William A. Kennington III10f19dc2021-04-29 13:59:48 -070037
David Cobbleyf9236522017-11-21 16:17:40 -080038DEPENDS += "nlohmann-json"
Jason M. Bills0be39b32022-08-25 11:40:15 -070039DEPENDS += "openssl"
Andrew Geissler024c25d2020-01-14 14:21:24 -060040DEPENDS += "phosphor-state-manager"
Brad Bishop01e6b172018-01-26 22:11:36 -050041DEPENDS += "${@ipmi_whitelists(d)}"
Patrick Venturecb675692017-12-22 14:36:07 -080042DEPENDS += "phosphor-dbus-interfaces"
Adriana Kobylakc009f892017-02-17 08:21:42 -060043DEPENDS += "phosphor-logging"
Patrick Williams0450a022022-10-07 21:23:47 -050044DEPENDS += "libmapper"
Ratan Guptaca8fd9d2017-03-20 18:20:47 +053045DEPENDS += "sdbusplus"
Patrick Williams4b32c9a2020-03-31 16:43:15 -050046DEPENDS += "${PYTHON_PN}-sdbus++-native"
Tom Joseph4d4c8492019-02-04 03:54:06 -060047DEPENDS += "virtual/phosphor-ipmi-inventory-sel"
Marri Devender Rao53c55032017-07-26 02:11:32 -050048DEPENDS += "virtual/phosphor-ipmi-fru-merge-config"
Patrick Venturecb675692017-12-22 14:36:07 -080049DEPENDS += "virtual/phosphor-ipmi-sensor-inventory"
Andrew Geissler126e7842018-09-25 19:50:20 +000050DEPENDS += "boost"
Patrick Venture34bc61e2018-11-07 17:48:53 -080051DEPENDS += "sdeventplus"
Tom Josephf4db3792020-03-05 10:08:45 -060052DEPENDS += "${PYTHON_PN}-native"
53DEPENDS += "${PYTHON_PN}-pyyaml-native"
54DEPENDS += "${PYTHON_PN}-mako-native"
Ratan Gupta3aa591f2017-03-06 17:05:11 +053055
Andrew Jeffery1b77f28e2018-04-06 14:13:14 +093056VIRTUAL-RUNTIME_ipmi-config ?= "phosphor-ipmi-config"
57
Patrick Williams12fc9392021-08-06 09:16:53 -050058RDEPENDS:${PN} += "clear-once"
59RDEPENDS:${PN} += "phosphor-network"
60RDEPENDS:${PN} += "phosphor-time-manager"
61RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_ipmi-config}"
62RDEPENDS:${PN} += "virtual/obmc-watchdog"
63RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_obmc-bmc-state-manager}"
64RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_obmc-bmc-version}"
65RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_obmc-bmc-updater}"
Ratan Guptaca8fd9d2017-03-20 18:20:47 +053066
Richard Marian Thomaiyar8ac94ce2018-08-20 20:14:16 +053067inherit useradd
68
69USERADD_PACKAGES = "${PN}"
70# add ipmi group
Patrick Williams12fc9392021-08-06 09:16:53 -050071GROUPADD_PARAM:${PN} = "ipmi"
Richard Marian Thomaiyar8ac94ce2018-08-20 20:14:16 +053072
Patrick Williams12fc9392021-08-06 09:16:53 -050073SYSTEMD_SERVICE:${PN} += "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service phosphor-ipmi-host.service"
Vishwanatha Subbannacaff3fa2017-03-31 14:41:11 +053074
Patrick Williams12fc9392021-08-06 09:16:53 -050075RRECOMMENDS:${PN} += "phosphor-settings-manager"
Andrew Geisslera36894f2018-02-05 12:02:35 -080076
vishwabmc2ac6f932015-10-09 15:51:50 +053077
Patrick Williamsfb700fd2020-04-03 15:48:30 -050078require ${BPN}.inc
Chris Austen9d3325a2015-10-24 19:34:11 -050079
Tom Joseph1562bbc2017-02-20 12:01:43 +053080# Setup IPMI Whitelist Conf files
81WHITELIST_CONF = " \
Patrick Williams43b61b72017-02-24 13:04:06 -060082 ${STAGING_DATADIR_NATIVE}/phosphor-ipmi-host/*.conf \
Tom Joseph1562bbc2017-02-20 12:01:43 +053083 ${S}/host-ipmid-whitelist.conf \
84 "
Andrew Geissler2cf105f2022-06-15 22:00:48 -050085EXTRA_OEMESON = " \
86 -Dsensor-yaml-gen=${STAGING_DIR_NATIVE}${sensor_datadir}/sensor.yaml \
87 -Dinvsensor-yaml-gen=${STAGING_DIR_NATIVE}${sensor_datadir}/invsensor.yaml \
88 -Dfru-yaml-gen=${STAGING_DIR_NATIVE}${config_datadir}/fru_config.yaml \
Tom Joseph1562bbc2017-02-20 12:01:43 +053089 "
Andrew Geissler2cf105f2022-06-15 22:00:48 -050090EXTRA_OEMESON:append = " \
91 -Dwhitelist-conf="${WHITELIST_CONF}" \
Brad Bishopfee41872019-06-09 22:57:35 -040092 "
Tom Joseph1562bbc2017-02-20 12:01:43 +053093
Andrew Geissler2cf105f2022-06-15 22:00:48 -050094EXTRA_OEMESON:append = " -Dtests=disabled"
95
vishwabmc2ac6f932015-10-09 15:51:50 +053096S = "${WORKDIR}/git"
97
Andrew Jeffery1b77f28e2018-04-06 14:13:14 +093098SRC_URI += "file://merge_yamls.py "
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -050099
Vernon Mauery91944682018-07-30 15:49:09 -0700100HOSTIPMI_PROVIDER_LIBRARY += "libipmi20.so"
Tom Josephdcdc8ea2017-02-01 19:47:27 +0530101HOSTIPMI_PROVIDER_LIBRARY += "libsysintfcmds.so"
William A. Kennington III4b04e1f2018-12-19 14:53:22 -0800102HOSTIPMI_PROVIDER_LIBRARY += "libusercmds.so"
Tom Josephdcdc8ea2017-02-01 19:47:27 +0530103
Vernon Mauery91944682018-07-30 15:49:09 -0700104NETIPMI_PROVIDER_LIBRARY += "libipmi20.so"
William A. Kennington III4b04e1f2018-12-19 14:53:22 -0800105NETIPMI_PROVIDER_LIBRARY += "libusercmds.so"
Tom Josephdcdc8ea2017-02-01 19:47:27 +0530106
Patrick Williams12fc9392021-08-06 09:16:53 -0500107FILES:${PN}:append = " ${libdir}/host-ipmid/lib*${SOLIBS}"
108FILES:${PN}:append = " ${libdir}/ipmid-providers/lib*${SOLIBS}"
109FILES:${PN}:append = " ${libdir}/net-ipmid/lib*${SOLIBS}"
Patrick Williams60043fe2022-03-03 15:48:33 -0600110FILES:${PN}:append = " ${systemd_system_unitdir}/phosphor-ipmi-host.service.d/*.conf"
Patrick Williams12fc9392021-08-06 09:16:53 -0500111FILES:${PN}-dev:append = " ${libdir}/ipmid-providers/lib*${SOLIBSDEV} ${libdir}/ipmid-providers/*.la"
Brad Bishop6371e702016-09-06 13:03:39 -0400112
Andrew Geissler41e3cb32017-01-04 11:11:50 -0600113# Soft Power Off
Andrew Geisslerecfa6622017-05-11 16:16:27 -0500114# install the soft power off service in the host shutdown target
115SOFT_SVC = "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
116SOFT_TGTFMT = "obmc-host-shutdown@{0}.target"
117SOFT_FMT = "../${SOFT_SVC}:${SOFT_TGTFMT}.requires/${SOFT_SVC}"
Patrick Williamse83c2202021-09-01 16:17:33 -0500118SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'SOFT_FMT', 'OBMC_HOST_INSTANCES')}"
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -0500119
120#Collect all hardcoded sensor yamls from different recipes and
121#merge all of them with sensor.yaml.
122python do_merge_sensors () {
123 import subprocess
124
125 # TODO: Perform the merge in a temporary directory?
126 workdir = d.getVar('WORKDIR', True)
127 nativedir = d.getVar('STAGING_DIR_NATIVE', True)
128 sensorsdir = d.getVar('sensor_datadir', True)
129 sensorsdir = sensorsdir[1:]
130 sensorsdir = os.path.join(nativedir, sensorsdir)
131 cmd = []
132 cmd.append(os.path.join(workdir, 'merge_yamls.py'))
133 cmd.append(os.path.join(sensorsdir, 'sensor.yaml'))
134
135 if os.stat(os.path.join(sensorsdir, 'sensor.yaml')).st_size == 0:
136 return
137 fetch = bb.fetch2.Fetch([], d)
Kun Yicdc3b232017-10-09 23:17:08 -0700138 override_urls = [url for url in fetch.urls if url.endswith('.hardcoded.yaml')]
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -0500139 for url in override_urls:
140 bb.debug(2, 'Overriding with source: ' + url)
141 local_base = os.path.basename(fetch.localpath(url))
142 filename = os.path.join(workdir, local_base)
143 cmd.append(filename)
144
145 # Invoke the script and don't catch any resulting exception.
146 subprocess.check_call(cmd)
147}
Andrew Jeffery1b77f28e2018-04-06 14:13:14 +0930148
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -0500149# python-pyyaml-native is installed by do_configure, so put this task after
150addtask merge_sensors after do_configure before do_compile
Patrick Williams60043fe2022-03-03 15:48:33 -0600151
152IPMI_HOST_NEEDED_SERVICES = "\
153 mapper-wait@-xyz-openbmc_project-control-host{}-boot.service \
154 mapper-wait@-xyz-openbmc_project-control-host{}-boot-one_time.service \
155 mapper-wait@-xyz-openbmc_project-control-host{}-power_restore_policy.service \
156 mapper-wait@-xyz-openbmc_project-control-host{}-restriction_mode.service \
157 "
158
159do_install:append() {
160
161 # Create service override file.
162 override_dir=${D}${systemd_system_unitdir}/phosphor-ipmi-host.service.d
163 override_file=${override_dir}/10-override.conf
164 mkdir -p ${override_dir}
165 echo "[Unit]" > ${override_file}
166
167 # Insert host-instance based service dependencies.
168 for i in ${OBMC_HOST_INSTANCES};
169 do
170 for s in ${IPMI_HOST_NEEDED_SERVICES};
171 do
172 service=$(echo ${s} | sed "s/{}/${i}/g")
173 echo "Wants=${service}" >> ${override_file}
174 echo "After=${service}" >> ${override_file}
175 done
176 done
177}