diff options
author | Eddie James <eajames@linux.ibm.com> | 2022-01-25 00:42:34 +0300 |
---|---|---|
committer | Eddie James <eajames@linux.ibm.com> | 2022-01-28 18:36:37 +0300 |
commit | acd9d072498cf55b8d0f3830cda9c6ca5814b598 (patch) | |
tree | 616a1b5e1b06ab688c40c5a4ee209fd04b6646ba /meta-phosphor/recipes-phosphor | |
parent | 1ebfa83c9f0581514a59a93ad556b942857d2290 (diff) | |
download | openbmc-acd9d072498cf55b8d0f3830cda9c6ca5814b598.tar.xz |
meta-phosphor: Add trace-enable service
The trace-enable service turns on a set of Linux trace events based
on a configuration file. The recipe generates the configuration file
from a variable that can be appended across layers.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Change-Id: I319e21c81b4da10dd08877c2f78cd4698fc94cd7
Diffstat (limited to 'meta-phosphor/recipes-phosphor')
4 files changed, 71 insertions, 0 deletions
diff --git a/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb b/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb index 6d7d76ac68..648cab34e7 100644 --- a/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb +++ b/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb @@ -69,6 +69,7 @@ RDEPENDS:${PN}-devtools = " \ libgpiod-tools \ lrzsz \ rsync \ + trace-enable \ " SUMMARY:${PN}-dbus-monitor = "Support for dbus monitoring" diff --git a/meta-phosphor/recipes-phosphor/trace-enable/trace-enable.bb b/meta-phosphor/recipes-phosphor/trace-enable/trace-enable.bb new file mode 100644 index 0000000000..37d5a035cf --- /dev/null +++ b/meta-phosphor/recipes-phosphor/trace-enable/trace-enable.bb @@ -0,0 +1,35 @@ +SUMMARY = "Enable Linux trace events" +DESCRIPTION = "Enable Linux trace events based on a configuration file" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +RDEPENDS:${PN} = " \ + ${@d.getVar('PREFERRED_PROVIDER_u-boot-fw-utils', True) or 'u-boot-fw-utils'} \ + bash \ +" + +S = "${WORKDIR}" + +SRC_URI += " file://trace-enable" + +TRACE_EVENTS = "" + +FILES:${PN} += "${sysconfdir}/trace-events.conf" +FILES:${PN} += "${libexecdir}/trace-enable" + +do_install:append() { + install -d ${D}${sysconfdir} + for event in ${TRACE_EVENTS} + do + echo ${event} >> ${D}${sysconfdir}/trace-events.conf + done + echo >> ${D}${sysconfdir}/trace-events.conf + chmod 0644 ${D}${sysconfdir}/trace-events.conf + + install -d ${D}${libexecdir} + install -m 0755 ${WORKDIR}/trace-enable ${D}${libexecdir} +} + +SYSTEMD_SERVICE:${PN} = "trace-enable.service" + +inherit obmc-phosphor-systemd diff --git a/meta-phosphor/recipes-phosphor/trace-enable/trace-enable/trace-enable b/meta-phosphor/recipes-phosphor/trace-enable/trace-enable/trace-enable new file mode 100755 index 0000000000..2c02b67d41 --- /dev/null +++ b/meta-phosphor/recipes-phosphor/trace-enable/trace-enable/trace-enable @@ -0,0 +1,25 @@ +#!/bin/bash +set -eu + +events="" + +while read -r line +do + if echo "${line}" >> /sys/kernel/debug/tracing/set_event; + then + if [ -n "${events}" ] + then + events="${events},${line}" + else + events="${line}" + fi + fi +done < "${1}" + +if [ -n "${events}" ] +then + events="trace_events=${events}" + fw_setenv trace_args "${events}" +else + fw_setenv trace_args +fi diff --git a/meta-phosphor/recipes-phosphor/trace-enable/trace-enable/trace-enable.service b/meta-phosphor/recipes-phosphor/trace-enable/trace-enable/trace-enable.service new file mode 100644 index 0000000000..fb630c9b26 --- /dev/null +++ b/meta-phosphor/recipes-phosphor/trace-enable/trace-enable/trace-enable.service @@ -0,0 +1,10 @@ +[Unit] +Description=Enable Linux trace events in the boot loader +RequiresMountsFor=/etc + +[Service] +Type=oneshot +ExecStart=/usr/libexec/trace-enable /etc/trace-events.conf + +[Install] +WantedBy=multi-user.target |