blob: bcaf6b5eac3d9e4eea0472df77b53868224b3855 [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
Matthew Barth6b136a42016-08-16 16:51:35 -050010inherit autotools 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
William A. Kennington III10f19dc2021-04-29 13:59:48 -070024PACKAGECONFIG ??= ""
25PACKAGECONFIG[dynamic-sensors] = "--enable-dynamic-sensors,--disable-dynamic-sensors"
Andrei Kartashev62412962021-12-09 12:38:40 +030026PACKAGECONFIG[hybrid-sensors] = "--enable-hybrid-sensors,--disable-hybrid-sensors"
William A. Kennington III10f19dc2021-04-29 13:59:48 -070027
Patrick Venturecb675692017-12-22 14:36:07 -080028DEPENDS += "autoconf-archive-native"
David Cobbleyf9236522017-11-21 16:17:40 -080029DEPENDS += "nlohmann-json"
Andrew Geissler024c25d2020-01-14 14:21:24 -060030DEPENDS += "phosphor-state-manager"
Brad Bishop01e6b172018-01-26 22:11:36 -050031DEPENDS += "${@ipmi_whitelists(d)}"
Patrick Venturecb675692017-12-22 14:36:07 -080032DEPENDS += "phosphor-dbus-interfaces"
Adriana Kobylakc009f892017-02-17 08:21:42 -060033DEPENDS += "phosphor-logging"
Brad Bishop12e3d602016-10-05 20:10:23 -040034DEPENDS += "phosphor-mapper"
Ratan Guptaca8fd9d2017-03-20 18:20:47 +053035DEPENDS += "sdbusplus"
Patrick Williams4b32c9a2020-03-31 16:43:15 -050036DEPENDS += "${PYTHON_PN}-sdbus++-native"
Tom Joseph4d4c8492019-02-04 03:54:06 -060037DEPENDS += "virtual/phosphor-ipmi-inventory-sel"
Marri Devender Rao53c55032017-07-26 02:11:32 -050038DEPENDS += "virtual/phosphor-ipmi-fru-merge-config"
Patrick Venturecb675692017-12-22 14:36:07 -080039DEPENDS += "virtual/phosphor-ipmi-sensor-inventory"
Andrew Geissler126e7842018-09-25 19:50:20 +000040DEPENDS += "boost"
Patrick Venture34bc61e2018-11-07 17:48:53 -080041DEPENDS += "sdeventplus"
Tom Josephf4db3792020-03-05 10:08:45 -060042DEPENDS += "${PYTHON_PN}-native"
43DEPENDS += "${PYTHON_PN}-pyyaml-native"
44DEPENDS += "${PYTHON_PN}-mako-native"
Ratan Gupta3aa591f2017-03-06 17:05:11 +053045
Andrew Jeffery1b77f28e2018-04-06 14:13:14 +093046VIRTUAL-RUNTIME_ipmi-config ?= "phosphor-ipmi-config"
47
Patrick Williams12fc9392021-08-06 09:16:53 -050048RDEPENDS:${PN}-dev += "phosphor-logging"
49RDEPENDS:${PN}-dev += "phosphor-mapper-dev"
50RDEPENDS:${PN} += "clear-once"
51RDEPENDS:${PN} += "phosphor-network"
52RDEPENDS:${PN} += "phosphor-time-manager"
53RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_ipmi-config}"
54RDEPENDS:${PN} += "virtual/obmc-watchdog"
55RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_obmc-bmc-state-manager}"
56RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_obmc-bmc-version}"
57RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_obmc-bmc-updater}"
Ratan Guptaca8fd9d2017-03-20 18:20:47 +053058
Richard Marian Thomaiyar8ac94ce2018-08-20 20:14:16 +053059inherit useradd
60
61USERADD_PACKAGES = "${PN}"
62# add ipmi group
Patrick Williams12fc9392021-08-06 09:16:53 -050063GROUPADD_PARAM:${PN} = "ipmi"
Richard Marian Thomaiyar8ac94ce2018-08-20 20:14:16 +053064
Patrick Williams12fc9392021-08-06 09:16:53 -050065SYSTEMD_SERVICE:${PN} += "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service phosphor-ipmi-host.service"
Vishwanatha Subbannacaff3fa2017-03-31 14:41:11 +053066
Patrick Williams12fc9392021-08-06 09:16:53 -050067RRECOMMENDS:${PN} += "phosphor-settings-manager"
Andrew Geisslera36894f2018-02-05 12:02:35 -080068
vishwabmc2ac6f932015-10-09 15:51:50 +053069
Patrick Williamsfb700fd2020-04-03 15:48:30 -050070require ${BPN}.inc
Chris Austen9d3325a2015-10-24 19:34:11 -050071
Tom Joseph1562bbc2017-02-20 12:01:43 +053072# Setup IPMI Whitelist Conf files
73WHITELIST_CONF = " \
Patrick Williams43b61b72017-02-24 13:04:06 -060074 ${STAGING_DATADIR_NATIVE}/phosphor-ipmi-host/*.conf \
Tom Joseph1562bbc2017-02-20 12:01:43 +053075 ${S}/host-ipmid-whitelist.conf \
76 "
77EXTRA_OECONF = " \
Ratan Gupta3aa591f2017-03-06 17:05:11 +053078 SENSOR_YAML_GEN=${STAGING_DIR_NATIVE}${sensor_datadir}/sensor.yaml \
Tom Joseph4d4c8492019-02-04 03:54:06 -060079 INVSENSOR_YAML_GEN=${STAGING_DIR_NATIVE}${sensor_datadir}/invsensor.yaml \
Marri Devender Rao53c55032017-07-26 02:11:32 -050080 FRU_YAML_GEN=${STAGING_DIR_NATIVE}${config_datadir}/fru_config.yaml \
Tom Joseph1562bbc2017-02-20 12:01:43 +053081 "
Patrick Williams12fc9392021-08-06 09:16:53 -050082EXTRA_OECONF:append = " \
Brad Bishopfee41872019-06-09 22:57:35 -040083 WHITELIST_CONF="${WHITELIST_CONF}" \
84 "
Tom Joseph1562bbc2017-02-20 12:01:43 +053085
vishwabmc2ac6f932015-10-09 15:51:50 +053086S = "${WORKDIR}/git"
87
Andrew Jeffery1b77f28e2018-04-06 14:13:14 +093088SRC_URI += "file://merge_yamls.py "
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -050089
Vernon Mauery91944682018-07-30 15:49:09 -070090HOSTIPMI_PROVIDER_LIBRARY += "libipmi20.so"
Tom Josephdcdc8ea2017-02-01 19:47:27 +053091HOSTIPMI_PROVIDER_LIBRARY += "libsysintfcmds.so"
William A. Kennington III4b04e1f2018-12-19 14:53:22 -080092HOSTIPMI_PROVIDER_LIBRARY += "libusercmds.so"
Tom Josephdcdc8ea2017-02-01 19:47:27 +053093
Vernon Mauery91944682018-07-30 15:49:09 -070094NETIPMI_PROVIDER_LIBRARY += "libipmi20.so"
William A. Kennington III4b04e1f2018-12-19 14:53:22 -080095NETIPMI_PROVIDER_LIBRARY += "libusercmds.so"
Tom Josephdcdc8ea2017-02-01 19:47:27 +053096
Patrick Williams12fc9392021-08-06 09:16:53 -050097FILES:${PN}:append = " ${libdir}/host-ipmid/lib*${SOLIBS}"
98FILES:${PN}:append = " ${libdir}/ipmid-providers/lib*${SOLIBS}"
99FILES:${PN}:append = " ${libdir}/net-ipmid/lib*${SOLIBS}"
Patrick Williams60043fe2022-03-03 15:48:33 -0600100FILES:${PN}:append = " ${systemd_system_unitdir}/phosphor-ipmi-host.service.d/*.conf"
Patrick Williams12fc9392021-08-06 09:16:53 -0500101FILES:${PN}-dev:append = " ${libdir}/ipmid-providers/lib*${SOLIBSDEV} ${libdir}/ipmid-providers/*.la"
Brad Bishop6371e702016-09-06 13:03:39 -0400102
Andrew Geissler41e3cb32017-01-04 11:11:50 -0600103# Soft Power Off
Andrew Geisslerecfa6622017-05-11 16:16:27 -0500104# install the soft power off service in the host shutdown target
105SOFT_SVC = "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
106SOFT_TGTFMT = "obmc-host-shutdown@{0}.target"
107SOFT_FMT = "../${SOFT_SVC}:${SOFT_TGTFMT}.requires/${SOFT_SVC}"
Patrick Williamse83c2202021-09-01 16:17:33 -0500108SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'SOFT_FMT', 'OBMC_HOST_INSTANCES')}"
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -0500109
110#Collect all hardcoded sensor yamls from different recipes and
111#merge all of them with sensor.yaml.
112python do_merge_sensors () {
113 import subprocess
114
115 # TODO: Perform the merge in a temporary directory?
116 workdir = d.getVar('WORKDIR', True)
117 nativedir = d.getVar('STAGING_DIR_NATIVE', True)
118 sensorsdir = d.getVar('sensor_datadir', True)
119 sensorsdir = sensorsdir[1:]
120 sensorsdir = os.path.join(nativedir, sensorsdir)
121 cmd = []
122 cmd.append(os.path.join(workdir, 'merge_yamls.py'))
123 cmd.append(os.path.join(sensorsdir, 'sensor.yaml'))
124
125 if os.stat(os.path.join(sensorsdir, 'sensor.yaml')).st_size == 0:
126 return
127 fetch = bb.fetch2.Fetch([], d)
Kun Yicdc3b232017-10-09 23:17:08 -0700128 override_urls = [url for url in fetch.urls if url.endswith('.hardcoded.yaml')]
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -0500129 for url in override_urls:
130 bb.debug(2, 'Overriding with source: ' + url)
131 local_base = os.path.basename(fetch.localpath(url))
132 filename = os.path.join(workdir, local_base)
133 cmd.append(filename)
134
135 # Invoke the script and don't catch any resulting exception.
136 subprocess.check_call(cmd)
137}
Andrew Jeffery1b77f28e2018-04-06 14:13:14 +0930138
Dhruvaraj Subhashchandran12352762017-08-04 16:09:15 -0500139# python-pyyaml-native is installed by do_configure, so put this task after
140addtask merge_sensors after do_configure before do_compile
Patrick Williams60043fe2022-03-03 15:48:33 -0600141
142IPMI_HOST_NEEDED_SERVICES = "\
143 mapper-wait@-xyz-openbmc_project-control-host{}-boot.service \
144 mapper-wait@-xyz-openbmc_project-control-host{}-boot-one_time.service \
145 mapper-wait@-xyz-openbmc_project-control-host{}-power_restore_policy.service \
146 mapper-wait@-xyz-openbmc_project-control-host{}-restriction_mode.service \
147 "
148
149do_install:append() {
150
151 # Create service override file.
152 override_dir=${D}${systemd_system_unitdir}/phosphor-ipmi-host.service.d
153 override_file=${override_dir}/10-override.conf
154 mkdir -p ${override_dir}
155 echo "[Unit]" > ${override_file}
156
157 # Insert host-instance based service dependencies.
158 for i in ${OBMC_HOST_INSTANCES};
159 do
160 for s in ${IPMI_HOST_NEEDED_SERVICES};
161 do
162 service=$(echo ${s} | sed "s/{}/${i}/g")
163 echo "Wants=${service}" >> ${override_file}
164 echo "After=${service}" >> ${override_file}
165 done
166 done
167}