vishwabmc | 2ac6f93 | 2015-10-09 15:51:50 +0530 | [diff] [blame] | 1 | SUMMARY = "Phosphor OpenBMC IPMI daemon" |
| 2 | DESCRIPTION = "Phosphor OpenBMC IPMI router and plugin libraries" |
vishwabmc | 2ac6f93 | 2015-10-09 15:51:50 +0530 | [diff] [blame] | 3 | PR = "r1" |
Patrick Venture | d372870 | 2018-10-21 08:27:22 -0700 | [diff] [blame] | 4 | PV = "1.0+git${SRCPV}" |
Brad Bishop | 75f0387 | 2018-11-03 09:41:57 -0700 | [diff] [blame] | 5 | LICENSE = "Apache-2.0" |
| 6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" |
vishwabmc | 2ac6f93 | 2015-10-09 15:51:50 +0530 | [diff] [blame] | 7 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 8 | RRECOMMENDS:${PN} += "packagegroup-obmc-ipmid-providers-libs" |
Chris Austen | 9d3325a | 2015-10-24 19:34:11 -0500 | [diff] [blame] | 9 | |
Andrew Geissler | 2cf105f | 2022-06-15 22:00:48 -0500 | [diff] [blame] | 10 | inherit meson pkgconfig |
Patrick Venture | cb67569 | 2017-12-22 14:36:07 -0800 | [diff] [blame] | 11 | inherit obmc-phosphor-ipmiprovider-symlink |
Patrick Williams | 89b11a1 | 2015-10-15 15:20:20 -0500 | [diff] [blame] | 12 | inherit obmc-phosphor-sdbus-service |
Patrick Venture | cb67569 | 2017-12-22 14:36:07 -0800 | [diff] [blame] | 13 | inherit obmc-phosphor-systemd |
Ratan Gupta | 3aa591f | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 14 | inherit phosphor-ipmi-host |
Andrew Geissler | 04b85e9 | 2020-03-30 14:31:19 +0000 | [diff] [blame] | 15 | inherit python3native |
vishwabmc | 2ac6f93 | 2015-10-09 15:51:50 +0530 | [diff] [blame] | 16 | |
Brad Bishop | 01e6b17 | 2018-01-26 22:11:36 -0500 | [diff] [blame] | 17 | def 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 Mauery | e4dedc5 | 2022-05-11 15:23:20 -0700 | [diff] [blame] | 24 | PACKAGECONFIG ??= "allowlist i2c-allowlist boot-flag-safe-mode softoff libuserlayer" |
Andrew Geissler | 2cf105f | 2022-06-15 22:00:48 -0500 | [diff] [blame] | 25 | PACKAGECONFIG[dynamic-sensors] = "-Ddynamic-sensors=enabled,-Ddynamic-sensors=disabled" |
| 26 | PACKAGECONFIG[hybrid-sensors] = "-Dhybrid-sensors=enabled,-Dhybrid-sensors=disabled" |
| 27 | PACKAGECONFIG[sel-logger-clears-sel] = "-Dsel-logger-clears-sel=enabled,-Dsel-logger-clears-sel=disabled" |
| 28 | PACKAGECONFIG[allowlist] = "-Dipmi-whitelist=enabled,-Dipmi-whitelist=disabled" |
| 29 | PACKAGECONFIG[i2c-allowlist] = "-Di2c-whitelist-check=enabled,-Di2c-whitelist-check=disabled" |
| 30 | PACKAGECONFIG[transport-oem] = "-Dtransport-oem=enabled,-Dtransport-oem=disabled" |
| 31 | PACKAGECONFIG[boot-flag-safe-mode] = "-Dboot-flag-safe-mode-support=enabled,-Dboot-flag-safe-mode-support=disabled" |
| 32 | PACKAGECONFIG[softoff] = "-Dsoftoff=enabled,-Dsoftoff=disabled" |
| 33 | PACKAGECONFIG[update-functional-on-fail] = "-Dupdate-functional-on-fail=enabled,-Dupdate-functional-on-fail=disabled" |
| 34 | PACKAGECONFIG[libuserlayer] = "-Dlibuserlayer=enabled,-Dlibuserlayer=disabled" |
| 35 | PACKAGECONFIG[sensors-cache] = "-Dsensors-cache=enabled,-Dsensors-cache=disabled" |
Vernon Mauery | e4dedc5 | 2022-05-11 15:23:20 -0700 | [diff] [blame] | 36 | |
William A. Kennington III | 10f19dc | 2021-04-29 13:59:48 -0700 | [diff] [blame] | 37 | |
David Cobbley | f923652 | 2017-11-21 16:17:40 -0800 | [diff] [blame] | 38 | DEPENDS += "nlohmann-json" |
Jason M. Bills | 0be39b3 | 2022-08-25 11:40:15 -0700 | [diff] [blame] | 39 | DEPENDS += "openssl" |
Andrew Geissler | 024c25d | 2020-01-14 14:21:24 -0600 | [diff] [blame] | 40 | DEPENDS += "phosphor-state-manager" |
Brad Bishop | 01e6b17 | 2018-01-26 22:11:36 -0500 | [diff] [blame] | 41 | DEPENDS += "${@ipmi_whitelists(d)}" |
Patrick Venture | cb67569 | 2017-12-22 14:36:07 -0800 | [diff] [blame] | 42 | DEPENDS += "phosphor-dbus-interfaces" |
Adriana Kobylak | c009f89 | 2017-02-17 08:21:42 -0600 | [diff] [blame] | 43 | DEPENDS += "phosphor-logging" |
Patrick Williams | 0450a02 | 2022-10-07 21:23:47 -0500 | [diff] [blame] | 44 | DEPENDS += "libmapper" |
Ratan Gupta | ca8fd9d | 2017-03-20 18:20:47 +0530 | [diff] [blame] | 45 | DEPENDS += "sdbusplus" |
Patrick Williams | 4b32c9a | 2020-03-31 16:43:15 -0500 | [diff] [blame] | 46 | DEPENDS += "${PYTHON_PN}-sdbus++-native" |
Tom Joseph | 4d4c849 | 2019-02-04 03:54:06 -0600 | [diff] [blame] | 47 | DEPENDS += "virtual/phosphor-ipmi-inventory-sel" |
Marri Devender Rao | 53c5503 | 2017-07-26 02:11:32 -0500 | [diff] [blame] | 48 | DEPENDS += "virtual/phosphor-ipmi-fru-merge-config" |
Patrick Venture | cb67569 | 2017-12-22 14:36:07 -0800 | [diff] [blame] | 49 | DEPENDS += "virtual/phosphor-ipmi-sensor-inventory" |
Andrew Geissler | 126e784 | 2018-09-25 19:50:20 +0000 | [diff] [blame] | 50 | DEPENDS += "boost" |
Patrick Venture | 34bc61e | 2018-11-07 17:48:53 -0800 | [diff] [blame] | 51 | DEPENDS += "sdeventplus" |
Tom Joseph | f4db379 | 2020-03-05 10:08:45 -0600 | [diff] [blame] | 52 | DEPENDS += "${PYTHON_PN}-native" |
| 53 | DEPENDS += "${PYTHON_PN}-pyyaml-native" |
| 54 | DEPENDS += "${PYTHON_PN}-mako-native" |
Ratan Gupta | 3aa591f | 2017-03-06 17:05:11 +0530 | [diff] [blame] | 55 | |
Andrew Jeffery | 1b77f28e | 2018-04-06 14:13:14 +0930 | [diff] [blame] | 56 | VIRTUAL-RUNTIME_ipmi-config ?= "phosphor-ipmi-config" |
| 57 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 58 | RDEPENDS:${PN} += "clear-once" |
| 59 | RDEPENDS:${PN} += "phosphor-network" |
| 60 | RDEPENDS:${PN} += "phosphor-time-manager" |
| 61 | RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_ipmi-config}" |
Brad Bishop | 5747dac | 2022-10-12 17:45:15 -0400 | [diff] [blame] | 62 | RDEPENDS:${PN} += "phosphor-watchdog" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 63 | RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_obmc-bmc-state-manager}" |
Brad Bishop | 5747dac | 2022-10-12 17:45:15 -0400 | [diff] [blame] | 64 | RDEPENDS:${PN} += "phosphor-software-manager-version" |
| 65 | RDEPENDS:${PN} += "phosphor-software-manager-updater" |
Ratan Gupta | ca8fd9d | 2017-03-20 18:20:47 +0530 | [diff] [blame] | 66 | |
Richard Marian Thomaiyar | 8ac94ce | 2018-08-20 20:14:16 +0530 | [diff] [blame] | 67 | inherit useradd |
| 68 | |
| 69 | USERADD_PACKAGES = "${PN}" |
| 70 | # add ipmi group |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 71 | GROUPADD_PARAM:${PN} = "ipmi" |
Richard Marian Thomaiyar | 8ac94ce | 2018-08-20 20:14:16 +0530 | [diff] [blame] | 72 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 73 | SYSTEMD_SERVICE:${PN} += "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service phosphor-ipmi-host.service" |
Vishwanatha Subbanna | caff3fa | 2017-03-31 14:41:11 +0530 | [diff] [blame] | 74 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 75 | RRECOMMENDS:${PN} += "phosphor-settings-manager" |
Andrew Geissler | a36894f | 2018-02-05 12:02:35 -0800 | [diff] [blame] | 76 | |
vishwabmc | 2ac6f93 | 2015-10-09 15:51:50 +0530 | [diff] [blame] | 77 | |
Patrick Williams | fb700fd | 2020-04-03 15:48:30 -0500 | [diff] [blame] | 78 | require ${BPN}.inc |
Chris Austen | 9d3325a | 2015-10-24 19:34:11 -0500 | [diff] [blame] | 79 | |
Tom Joseph | 1562bbcb | 2017-02-20 12:01:43 +0530 | [diff] [blame] | 80 | # Setup IPMI Whitelist Conf files |
| 81 | WHITELIST_CONF = " \ |
Patrick Williams | 43b61b7 | 2017-02-24 13:04:06 -0600 | [diff] [blame] | 82 | ${STAGING_DATADIR_NATIVE}/phosphor-ipmi-host/*.conf \ |
Tom Joseph | 1562bbcb | 2017-02-20 12:01:43 +0530 | [diff] [blame] | 83 | ${S}/host-ipmid-whitelist.conf \ |
| 84 | " |
Andrew Geissler | 2cf105f | 2022-06-15 22:00:48 -0500 | [diff] [blame] | 85 | EXTRA_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 Joseph | 1562bbcb | 2017-02-20 12:01:43 +0530 | [diff] [blame] | 89 | " |
Andrew Geissler | 2cf105f | 2022-06-15 22:00:48 -0500 | [diff] [blame] | 90 | EXTRA_OEMESON:append = " \ |
| 91 | -Dwhitelist-conf="${WHITELIST_CONF}" \ |
Brad Bishop | fee4187 | 2019-06-09 22:57:35 -0400 | [diff] [blame] | 92 | " |
Tom Joseph | 1562bbcb | 2017-02-20 12:01:43 +0530 | [diff] [blame] | 93 | |
Andrew Geissler | 2cf105f | 2022-06-15 22:00:48 -0500 | [diff] [blame] | 94 | EXTRA_OEMESON:append = " -Dtests=disabled" |
| 95 | |
vishwabmc | 2ac6f93 | 2015-10-09 15:51:50 +0530 | [diff] [blame] | 96 | S = "${WORKDIR}/git" |
| 97 | |
Andrew Jeffery | 1b77f28e | 2018-04-06 14:13:14 +0930 | [diff] [blame] | 98 | SRC_URI += "file://merge_yamls.py " |
Dhruvaraj Subhashchandran | 1235276 | 2017-08-04 16:09:15 -0500 | [diff] [blame] | 99 | |
Vernon Mauery | 9194468 | 2018-07-30 15:49:09 -0700 | [diff] [blame] | 100 | HOSTIPMI_PROVIDER_LIBRARY += "libipmi20.so" |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 101 | HOSTIPMI_PROVIDER_LIBRARY += "libsysintfcmds.so" |
William A. Kennington III | 4b04e1f | 2018-12-19 14:53:22 -0800 | [diff] [blame] | 102 | HOSTIPMI_PROVIDER_LIBRARY += "libusercmds.so" |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 103 | |
Vernon Mauery | 9194468 | 2018-07-30 15:49:09 -0700 | [diff] [blame] | 104 | NETIPMI_PROVIDER_LIBRARY += "libipmi20.so" |
William A. Kennington III | 4b04e1f | 2018-12-19 14:53:22 -0800 | [diff] [blame] | 105 | NETIPMI_PROVIDER_LIBRARY += "libusercmds.so" |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 106 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 107 | FILES:${PN}:append = " ${libdir}/host-ipmid/lib*${SOLIBS}" |
| 108 | FILES:${PN}:append = " ${libdir}/ipmid-providers/lib*${SOLIBS}" |
| 109 | FILES:${PN}:append = " ${libdir}/net-ipmid/lib*${SOLIBS}" |
Patrick Williams | 60043fe | 2022-03-03 15:48:33 -0600 | [diff] [blame] | 110 | FILES:${PN}:append = " ${systemd_system_unitdir}/phosphor-ipmi-host.service.d/*.conf" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 111 | FILES:${PN}-dev:append = " ${libdir}/ipmid-providers/lib*${SOLIBSDEV} ${libdir}/ipmid-providers/*.la" |
Brad Bishop | 6371e70 | 2016-09-06 13:03:39 -0400 | [diff] [blame] | 112 | |
Andrew Geissler | 41e3cb3 | 2017-01-04 11:11:50 -0600 | [diff] [blame] | 113 | # Soft Power Off |
Andrew Geissler | ecfa662 | 2017-05-11 16:16:27 -0500 | [diff] [blame] | 114 | # install the soft power off service in the host shutdown target |
| 115 | SOFT_SVC = "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service" |
| 116 | SOFT_TGTFMT = "obmc-host-shutdown@{0}.target" |
| 117 | SOFT_FMT = "../${SOFT_SVC}:${SOFT_TGTFMT}.requires/${SOFT_SVC}" |
Patrick Williams | e83c220 | 2021-09-01 16:17:33 -0500 | [diff] [blame] | 118 | SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'SOFT_FMT', 'OBMC_HOST_INSTANCES')}" |
Dhruvaraj Subhashchandran | 1235276 | 2017-08-04 16:09:15 -0500 | [diff] [blame] | 119 | |
| 120 | #Collect all hardcoded sensor yamls from different recipes and |
| 121 | #merge all of them with sensor.yaml. |
| 122 | python 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 Yi | cdc3b23 | 2017-10-09 23:17:08 -0700 | [diff] [blame] | 138 | override_urls = [url for url in fetch.urls if url.endswith('.hardcoded.yaml')] |
Dhruvaraj Subhashchandran | 1235276 | 2017-08-04 16:09:15 -0500 | [diff] [blame] | 139 | 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 Jeffery | 1b77f28e | 2018-04-06 14:13:14 +0930 | [diff] [blame] | 148 | |
Dhruvaraj Subhashchandran | 1235276 | 2017-08-04 16:09:15 -0500 | [diff] [blame] | 149 | # python-pyyaml-native is installed by do_configure, so put this task after |
| 150 | addtask merge_sensors after do_configure before do_compile |
Patrick Williams | 60043fe | 2022-03-03 15:48:33 -0600 | [diff] [blame] | 151 | |
| 152 | IPMI_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 | |
| 159 | do_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 | } |