blob: 203a64b70d296e1ca33034ec8fec821a9dd5d594 [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"
Andrew Geissler024c25d2020-01-14 14:21:24 -060039DEPENDS += "phosphor-state-manager"
Brad Bishop01e6b172018-01-26 22:11:36 -050040DEPENDS += "${@ipmi_whitelists(d)}"
Patrick Venturecb675692017-12-22 14:36:07 -080041DEPENDS += "phosphor-dbus-interfaces"
Adriana Kobylakc009f892017-02-17 08:21:42 -060042DEPENDS += "phosphor-logging"
Brad Bishop12e3d602016-10-05 20:10:23 -040043DEPENDS += "phosphor-mapper"
Ratan Guptaca8fd9d2017-03-20 18:20:47 +053044DEPENDS += "sdbusplus"
Patrick Williams4b32c9a2020-03-31 16:43:15 -050045DEPENDS += "${PYTHON_PN}-sdbus++-native"
Tom Joseph4d4c8492019-02-04 03:54:06 -060046DEPENDS += "virtual/phosphor-ipmi-inventory-sel"
Marri Devender Rao53c55032017-07-26 02:11:32 -050047DEPENDS += "virtual/phosphor-ipmi-fru-merge-config"
Patrick Venturecb675692017-12-22 14:36:07 -080048DEPENDS += "virtual/phosphor-ipmi-sensor-inventory"
Andrew Geissler126e7842018-09-25 19:50:20 +000049DEPENDS += "boost"
Patrick Venture34bc61e2018-11-07 17:48:53 -080050DEPENDS += "sdeventplus"
Tom Josephf4db3792020-03-05 10:08:45 -060051DEPENDS += "${PYTHON_PN}-native"
52DEPENDS += "${PYTHON_PN}-pyyaml-native"
53DEPENDS += "${PYTHON_PN}-mako-native"
Ratan Gupta3aa591f2017-03-06 17:05:11 +053054
Andrew Jeffery1b77f28e2018-04-06 14:13:14 +093055VIRTUAL-RUNTIME_ipmi-config ?= "phosphor-ipmi-config"
56
Patrick Williams12fc9392021-08-06 09:16:53 -050057RDEPENDS:${PN} += "clear-once"
58RDEPENDS:${PN} += "phosphor-network"
59RDEPENDS:${PN} += "phosphor-time-manager"
60RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_ipmi-config}"
61RDEPENDS:${PN} += "virtual/obmc-watchdog"
62RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_obmc-bmc-state-manager}"
63RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_obmc-bmc-version}"
64RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_obmc-bmc-updater}"
Ratan Guptaca8fd9d2017-03-20 18:20:47 +053065
Richard Marian Thomaiyar8ac94ce2018-08-20 20:14:16 +053066inherit useradd
67
68USERADD_PACKAGES = "${PN}"
69# add ipmi group
Patrick Williams12fc9392021-08-06 09:16:53 -050070GROUPADD_PARAM:${PN} = "ipmi"
Richard Marian Thomaiyar8ac94ce2018-08-20 20:14:16 +053071
Patrick Williams12fc9392021-08-06 09:16:53 -050072SYSTEMD_SERVICE:${PN} += "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service phosphor-ipmi-host.service"
Vishwanatha Subbannacaff3fa2017-03-31 14:41:11 +053073
Patrick Williams12fc9392021-08-06 09:16:53 -050074RRECOMMENDS:${PN} += "phosphor-settings-manager"
Andrew Geisslera36894f2018-02-05 12:02:35 -080075
vishwabmc2ac6f932015-10-09 15:51:50 +053076
Patrick Williamsfb700fd2020-04-03 15:48:30 -050077require ${BPN}.inc
Chris Austen9d3325a2015-10-24 19:34:11 -050078
Tom Joseph1562bbc2017-02-20 12:01:43 +053079# Setup IPMI Whitelist Conf files
80WHITELIST_CONF = " \
Patrick Williams43b61b72017-02-24 13:04:06 -060081 ${STAGING_DATADIR_NATIVE}/phosphor-ipmi-host/*.conf \
Tom Joseph1562bbc2017-02-20 12:01:43 +053082 ${S}/host-ipmid-whitelist.conf \
83 "
Andrew Geissler2cf105f2022-06-15 22:00:48 -050084EXTRA_OEMESON = " \
85 -Dsensor-yaml-gen=${STAGING_DIR_NATIVE}${sensor_datadir}/sensor.yaml \
86 -Dinvsensor-yaml-gen=${STAGING_DIR_NATIVE}${sensor_datadir}/invsensor.yaml \
87 -Dfru-yaml-gen=${STAGING_DIR_NATIVE}${config_datadir}/fru_config.yaml \
Tom Joseph1562bbc2017-02-20 12:01:43 +053088 "
Andrew Geissler2cf105f2022-06-15 22:00:48 -050089EXTRA_OEMESON:append = " \
90 -Dwhitelist-conf="${WHITELIST_CONF}" \
Brad Bishopfee41872019-06-09 22:57:35 -040091 "
Tom Joseph1562bbc2017-02-20 12:01:43 +053092
Andrew Geissler2cf105f2022-06-15 22:00:48 -050093EXTRA_OEMESON:append = " -Dtests=disabled"
94
vishwabmc2ac6f932015-10-09 15:51:50 +053095S = "${WORKDIR}/git"
96
Andrew Jeffery1b77f28e2018-04-06 14:13:14 +093097SRC_URI += "file://merge_yamls.py "
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -050098
Vernon Mauery91944682018-07-30 15:49:09 -070099HOSTIPMI_PROVIDER_LIBRARY += "libipmi20.so"
Tom Josephdcdc8ea2017-02-01 19:47:27 +0530100HOSTIPMI_PROVIDER_LIBRARY += "libsysintfcmds.so"
William A. Kennington III4b04e1f2018-12-19 14:53:22 -0800101HOSTIPMI_PROVIDER_LIBRARY += "libusercmds.so"
Tom Josephdcdc8ea2017-02-01 19:47:27 +0530102
Vernon Mauery91944682018-07-30 15:49:09 -0700103NETIPMI_PROVIDER_LIBRARY += "libipmi20.so"
William A. Kennington III4b04e1f2018-12-19 14:53:22 -0800104NETIPMI_PROVIDER_LIBRARY += "libusercmds.so"
Tom Josephdcdc8ea2017-02-01 19:47:27 +0530105
Patrick Williams12fc9392021-08-06 09:16:53 -0500106FILES:${PN}:append = " ${libdir}/host-ipmid/lib*${SOLIBS}"
107FILES:${PN}:append = " ${libdir}/ipmid-providers/lib*${SOLIBS}"
108FILES:${PN}:append = " ${libdir}/net-ipmid/lib*${SOLIBS}"
Patrick Williams60043fe2022-03-03 15:48:33 -0600109FILES:${PN}:append = " ${systemd_system_unitdir}/phosphor-ipmi-host.service.d/*.conf"
Patrick Williams12fc9392021-08-06 09:16:53 -0500110FILES:${PN}-dev:append = " ${libdir}/ipmid-providers/lib*${SOLIBSDEV} ${libdir}/ipmid-providers/*.la"
Brad Bishop6371e702016-09-06 13:03:39 -0400111
Andrew Geissler41e3cb32017-01-04 11:11:50 -0600112# Soft Power Off
Andrew Geisslerecfa6622017-05-11 16:16:27 -0500113# install the soft power off service in the host shutdown target
114SOFT_SVC = "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
115SOFT_TGTFMT = "obmc-host-shutdown@{0}.target"
116SOFT_FMT = "../${SOFT_SVC}:${SOFT_TGTFMT}.requires/${SOFT_SVC}"
Patrick Williamse83c2202021-09-01 16:17:33 -0500117SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'SOFT_FMT', 'OBMC_HOST_INSTANCES')}"
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -0500118
119#Collect all hardcoded sensor yamls from different recipes and
120#merge all of them with sensor.yaml.
121python do_merge_sensors () {
122 import subprocess
123
124 # TODO: Perform the merge in a temporary directory?
125 workdir = d.getVar('WORKDIR', True)
126 nativedir = d.getVar('STAGING_DIR_NATIVE', True)
127 sensorsdir = d.getVar('sensor_datadir', True)
128 sensorsdir = sensorsdir[1:]
129 sensorsdir = os.path.join(nativedir, sensorsdir)
130 cmd = []
131 cmd.append(os.path.join(workdir, 'merge_yamls.py'))
132 cmd.append(os.path.join(sensorsdir, 'sensor.yaml'))
133
134 if os.stat(os.path.join(sensorsdir, 'sensor.yaml')).st_size == 0:
135 return
136 fetch = bb.fetch2.Fetch([], d)
Kun Yicdc3b232017-10-09 23:17:08 -0700137 override_urls = [url for url in fetch.urls if url.endswith('.hardcoded.yaml')]
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -0500138 for url in override_urls:
139 bb.debug(2, 'Overriding with source: ' + url)
140 local_base = os.path.basename(fetch.localpath(url))
141 filename = os.path.join(workdir, local_base)
142 cmd.append(filename)
143
144 # Invoke the script and don't catch any resulting exception.
145 subprocess.check_call(cmd)
146}
Andrew Jeffery1b77f28e2018-04-06 14:13:14 +0930147
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -0500148# python-pyyaml-native is installed by do_configure, so put this task after
149addtask merge_sensors after do_configure before do_compile
Patrick Williams60043fe2022-03-03 15:48:33 -0600150
151IPMI_HOST_NEEDED_SERVICES = "\
152 mapper-wait@-xyz-openbmc_project-control-host{}-boot.service \
153 mapper-wait@-xyz-openbmc_project-control-host{}-boot-one_time.service \
154 mapper-wait@-xyz-openbmc_project-control-host{}-power_restore_policy.service \
155 mapper-wait@-xyz-openbmc_project-control-host{}-restriction_mode.service \
156 "
157
158do_install:append() {
159
160 # Create service override file.
161 override_dir=${D}${systemd_system_unitdir}/phosphor-ipmi-host.service.d
162 override_file=${override_dir}/10-override.conf
163 mkdir -p ${override_dir}
164 echo "[Unit]" > ${override_file}
165
166 # Insert host-instance based service dependencies.
167 for i in ${OBMC_HOST_INSTANCES};
168 do
169 for s in ${IPMI_HOST_NEEDED_SERVICES};
170 do
171 service=$(echo ${s} | sed "s/{}/${i}/g")
172 echo "Wants=${service}" >> ${override_file}
173 echo "After=${service}" >> ${override_file}
174 done
175 done
176}