Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,18 @@
SUMMARY = "OpenPower OCC Control with example occ sensor IDs"
PR = "r1"
PV = "1.0+git${SRCPV}"
require openpower-occ-control.inc
inherit openpower-occ-control
inherit native
PROVIDES += "virtual/openpower-occ-control-config-native"
S = "${WORKDIR}/git"
# Copies example occ sensor ID yaml file
do_install() {
SRC=${S}
install -d ${YAML_DEST}/
install -D ${SRC}/example/occ_sensor.yaml ${YAML_DEST}/occ_sensor.yaml
}
@@ -0,0 +1,20 @@
SUMMARY = "OpenPower OCC Control with MRW generated sensor IDs"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
inherit openpower-occ-control
inherit mrw-xml
inherit native
PROVIDES += "virtual/openpower-occ-control-config-native"
DEPENDS += "mrw-native mrw-perl-tools-native"
# Generate a YAML files based on MRW input
do_install:append() {
install -d ${YAML_DEST}/
${STAGING_BINDIR_NATIVE}/perl-native/perl \
${STAGING_BINDIR_NATIVE}/gen_occ_map.pl \
-i ${mrw_datadir}/${MRW_XML} \
-o ${YAML_DEST}/occ_sensor.yaml
}
@@ -0,0 +1,10 @@
SUMMARY = "openpower-occ-control: install phosphor-logging yaml"
PR = "r1"
PV = "1.0+git${SRCPV}"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
inherit phosphor-logging-yaml-provider
require openpower-occ-control.inc
S = "${WORKDIR}/git"
@@ -0,0 +1,5 @@
HOMEPAGE = "https://github.com/openbmc/openpower-occ-control"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
SRC_URI += "git://github.com/openbmc/openpower-occ-control;branch=master;protocol=https"
SRCREV = "423187e6479516af95465de10895edd501c68ebf"
@@ -0,0 +1,20 @@
#!/bin/sh
# set and unset occ active for all occ's in system
if [ "$1" = "disable" ]; then
value='false'
elif [ "$1" = "enable" ]; then
value='true'
else
echo "Usage: occ-active.sh [argument]"
echo " enable - set occ's to active state"
echo " disable - set occ's to inactive state"
exit 1
fi
OCC_CONTROL_SERVICE="org.open_power.OCC.Control"
busctl tree $OCC_CONTROL_SERVICE --list | grep -i occ | xargs -r -n1 -I{} \
busctl set-property $OCC_CONTROL_SERVICE {} org.open_power.OCC.Status \
OccActive b $value
exit 0
@@ -0,0 +1,13 @@
[Unit]
Description=OpenPOWER OCC Active Disable
Before=obmc-host-stop-pre@%i.target
Before=op-enter-mpreboot@%i.service
Before=op-stop-instructions@%i.service
Conflicts=op-occ-enable@%i.service
[Service]
ExecStart=/usr/bin/occ-active.sh disable
Type=oneshot
[Install]
WantedBy=obmc-host-stop@%i.target
@@ -0,0 +1,16 @@
[Unit]
Description=OpenPOWER OCC Active Enable for host %I
Conflicts=obmc-host-stop@%i.target
Conflicts=op-occ-disable@%i.service
Wants=org.open_power.OCC.Control.service
After=org.open_power.OCC.Control.service
Wants=fsi-scan@%i.service
After=fsi-scan@%i.service
ConditionPathExists=/run/openbmc/host@%i-on
[Service]
ExecStart=/usr/bin/occ-active.sh enable
Type=oneshot
[Install]
WantedBy=obmc-host-start@%i.target
@@ -0,0 +1,17 @@
[Unit]
Description=OpenPOWER OCC controller
Wants=mapper-wait@-xyz-openbmc_project-inventory.service
After=mapper-wait@-xyz-openbmc_project-inventory.service
Wants=obmc-host-reset-running@0.target
After=obmc-host-reset-running@0.target
Wants=xyz.openbmc_project.PLDM
After=xyz.openbmc_project.PLDM
[Service]
ExecStart=/usr/bin/openpower-occ-control
Restart=always
Type=dbus
BusName={BUSNAME}
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,108 @@
SUMMARY = "OpenPOWER OCC controller"
DESCRIPTION = "Application to control the OpenPOWER On-Chip-Controller"
HOMEPAGE = "https://github.com/openbmc/openpower-occ-control"
PR = "r1"
PV = "1.0+git${SRCPV}"
inherit meson \
pkgconfig \
obmc-phosphor-dbus-service \
python3native \
phosphor-dbus-yaml
require ${BPN}.inc
SRC_URI += "file://occ-active.sh"
do_install:append() {
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/occ-active.sh \
${D}${bindir}/occ-active.sh
}
DBUS_SERVICE:${PN} += "org.open_power.OCC.Control.service"
SYSTEMD_SERVICE:${PN} += "op-occ-enable@.service"
SYSTEMD_SERVICE:${PN} += "op-occ-disable@.service"
DEPENDS += "virtual/${PN}-config-native"
DEPENDS += " \
sdbusplus \
${PYTHON_PN}-sdbus++-native \
phosphor-logging \
phosphor-dbus-interfaces \
autoconf-archive-native \
systemd \
${PYTHON_PN}-native \
${PYTHON_PN}-pyyaml-native \
${PYTHON_PN}-setuptools-native \
${PYTHON_PN}-mako-native \
nlohmann-json \
"
RDEPENDS:${PN} += "phosphor-state-manager-obmc-targets"
EXTRA_OEMESON = " \
-Dyamldir=${STAGING_DATADIR_NATIVE}/${PN} \
-Dps-derating-factor=${POWER_SUPPLY_DERATING_FACTOR} \
-Dtests=disabled \
"
EXTRA_OEMESON:append = "${@bb.utils.contains('MACHINE_FEATURES', 'i2c-occ', ' -Di2c-occ=enabled', '', d)}"
OCC_ENABLE = "enable"
OCC_DISABLE = "disable"
HOST_START = "startmin"
HOST_STOP = "stop"
# Ensure host-stop and host-startmin targets wants needed occ states
OCC_TMPL = "op-occ-{0}@.service"
HOST_TGTFMT = "obmc-host-{1}@{2}.target"
OCC_INSTFMT = "op-occ-{0}@{2}.service"
HOST_OCC_FMT = "../${OCC_TMPL}:${HOST_TGTFMT}.wants/${OCC_INSTFMT}"
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_OCC_FMT', 'OCC_ENABLE', 'HOST_START', 'OBMC_HOST_INSTANCES')}"
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_OCC_FMT', 'OCC_DISABLE', 'HOST_STOP', 'OBMC_HOST_INSTANCES')}"
# Set the occ disable service to be executed on host error
HOST_ERROR_TARGETS = "crash timeout"
OCC_DISABLE_TMPL = "op-occ-disable@.service"
HOST_ERROR_TGTFMT = "obmc-host-{0}@{1}.target"
OCC_DISABLE_INSTFMT = "op-occ-disable@{1}.service"
HOST_ERROR_FMT = "../${OCC_DISABLE_TMPL}:${HOST_ERROR_TGTFMT}.wants/${OCC_DISABLE_INSTFMT}"
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'HOST_ERROR_FMT', 'HOST_ERROR_TARGETS', 'OBMC_HOST_INSTANCES')}"
S = "${WORKDIR}/git"
# Remove packages not required for native build
DEPENDS:remove:class-native = " \
phosphor-logging \
systemd \
sdbusplus \
virtual/${PN}-config-native \
"
RDEPENDS:${PN}:remove:class-native = "phosphor-state-manager-obmc-targets"
# Remove packages not required for native SDK build
DEPENDS:remove:class-nativesdk = " \
phosphor-logging \
systemd \
sdbusplus \
virtual/${PN}-config-native \
"
RDEPENDS:${PN}:remove:class-nativesdk = "phosphor-state-manager-obmc-targets"
# Provide a means to enable/disable install_error_yaml feature
PACKAGECONFIG ??= "install_error_yaml"
PACKAGECONFIG[install_error_yaml] = "\
-Dinstall-error-yaml=enabled,\
-Dinstall-error-yaml=disabled,\
,\
"
# Enable install_error_yaml during native and native SDK build
PACKAGECONFIG:add:class-native = "install_error_yaml"
PACKAGECONFIG:add:class-nativesdk = "install_error_yaml"
# Disable install_error_yaml during target build
PACKAGECONFIG:remove:class-target = "install_error_yaml"
BBCLASSEXTEND += "native nativesdk"