move service files from Yocto layer
This change relocates phosphor-debug-collector service files from
the Yocto layer to the phosphor-debug-collector repository.
It also ensures that non-user executables are installed in the libexec.
[1]: https://github.com/openbmc/docs/blob/master/anti-patterns.md#incorrect-placement-of-executables-in-sbin-usrsbin-or-bin-usrbin
Tested:
```
$ find /tmp/phosphor-debug-collector | grep libexec
/tmp/phosphor-debug-collector/usr/local/libexec
/tmp/phosphor-debug-collector/usr/local/libexec/phosphor-debug-collector
/tmp/phosphor-debug-collector/usr/local/libexec/phosphor-debug-collector/phosphor-dump-manager
/tmp/phosphor-debug-collector/usr/local/libexec/phosphor-debug-collector/phosphor-dump-monitor
/tmp/phosphor-debug-collector/usr/local/libexec/phosphor-debug-collector/phosphor-ramoops-monitor
$ find /tmp/phosphor-debug-collector | grep service
/tmp/phosphor-debug-collector/usr/lib/systemd/system/obmc-dump-monitor.service
/tmp/phosphor-debug-collector/usr/lib/systemd/system/ramoops-monitor.service
/tmp/phosphor-debug-collector/usr/lib/systemd/system/xyz.openbmc_project.Dump.Manager.service
```
Booted image in qemu:
```
root@bmc:~# ls -l /usr/libexec/phosphor-debug-collector/
-rwxr-xr-x 1 root root 367700 Mar 9 2018 phosphor-dump-manager
-rwxr-xr-x 1 root root 34452 Mar 9 2018 phosphor-dump-monitor
-rwxr-xr-x 1 root root 26200 Mar 9 2018 phosphor-ramoops-monitor
root@bmc:~# systemctl status xyz.openbmc_project.Dump.Manager.service
* xyz.openbmc_project.Dump.Manager.service - Phosphor Dump Manager
Loaded: loaded (/usr/lib/systemd/system/xyz.openbmc_project.Dump.Manager.service; enabled; preset: enabled)
Active: active (running) since Thu 2024-12-19 13:27:21 PST; 7 months 15 days ago
Invocation: 8ff137acc50f4d8299b5d999b886896d
Process: 374 ExecStartPre=/bin/sh -c mkdir -p /var/lib/phosphor-debug-collector/dumps (code=exited, status=0/SUCCESS)
Main PID: 479 (phosphor-dump-m)
Tasks: 1 (limit: 4102)
Memory: 1.5M (peak: 16.2M)
CPU: 1min 58.037s
CGroup: /system.slice/xyz.openbmc_project.Dump.Manager.service
`-479 /usr/libexec/phosphor-debug-collector/phosphor-dump-manager
Aug 05 04:33:35 bmc phosphor-dump-manager[479]: Initiating new BMC dump with type: core path: /var/lib/systemd/coredump/core.devmem.0.0b7096e8ddc54ce9a7...3000000.zst
Aug 05 04:33:40 bmc phosphor-dump-manager[2926]: cp: can't stat '/var/lib/systemd/coredump/core.devmem.0.0b7096e8ddc54ce9a7799c4d23eea94a.2881.175439361...r directory
Aug 05 04:33:58 bmc phosphor-dump-manager[2887]: Tue Aug 5 11:33:58 UTC 2025 Report is available in /var/lib/phosphor-debug-collector/dumps/6
Aug 05 04:33:59 bmc phosphor-dump-manager[2887]: Tue Aug 5 11:33:59 UTC 2025 Successfully completed
Aug 05 04:35:41 bmc phosphor-dump-manager[479]: OriginatorId is not provided
Aug 05 04:35:41 bmc phosphor-dump-manager[479]: OriginatorType is not provided. Replacing the string with the default value
Aug 05 04:35:41 bmc phosphor-dump-manager[479]: Initiating new BMC dump with type: core path: /var/lib/systemd/coredump/core.devmem.0.0b7096e8ddc54ce9a7...9000000.zst
Aug 05 04:35:46 bmc phosphor-dump-manager[3322]: cp: can't stat '/var/lib/systemd/coredump/core.devmem.0.0b7096e8ddc54ce9a7799c4d23eea94a.3278.175439373...r directory
Aug 05 04:36:10 bmc phosphor-dump-manager[3284]: Tue Aug 5 11:36:10 UTC 2025 Report is available in /var/lib/phosphor-debug-collector/dumps/7
Aug 05 04:36:11 bmc phosphor-dump-manager[3284]: Tue Aug 5 11:36:11 UTC 2025 Successfully completed
Hint: Some lines were ellipsized, use -l to show in full.
root@bmc:~# systemctl status obmc-dump-monitor.service
* obmc-dump-monitor.service - Phosphor Dump core monitor.
Loaded: loaded (/usr/lib/systemd/system/obmc-dump-monitor.service; enabled; preset: enabled)
Active: active (running) since Thu 2024-12-19 13:26:44 PST; 7 months 15 days ago
Invocation: eeeb2b3224f54287995e8bd9a022d255
Main PID: 350 (phosphor-dump-m)
Tasks: 1 (limit: 4102)
Memory: 276K (peak: 800K)
CPU: 650ms
CGroup: /system.slice/obmc-dump-monitor.service
`-350 /usr/libexec/phosphor-debug-collector/phosphor-dump-monitor
Dec 19 13:26:44 bmc systemd[1]: Started Phosphor Dump core monitor..
root@bmc:~# systemctl status ramoops-monitor.service
* ramoops-monitor.service - Ramoops monitor.
Loaded: loaded (/usr/lib/systemd/system/ramoops-monitor.service; enabled; preset: enabled)
Active: inactive (dead)
Condition: start condition unmet at Thu 2024-12-19 13:27:39 PST; 7 months 15 days ago
`- ConditionPathExistsGlob=/var/lib/systemd/pstore/dmesg-ramoops-* was not met
Dec 19 13:27:39 bmc systemd[1]: Ramoops monitor. was skipped because of an unmet condition check (ConditionPathExistsGlob=/var/lib/systemd/pstore/dmesg-ramoops-*).
```
Change-Id: I23b67ac5651569cc2cefaa29f421bc42c3965741
Signed-off-by: William de Abreu Pinho <williamdapinho@gmail.com>
diff --git a/meson.build b/meson.build
index dd65030..bd246cb 100644
--- a/meson.build
+++ b/meson.build
@@ -306,6 +306,8 @@
#pick any architecture specific dumps
subdir('dump-extensions')
+subdir('service_files')
+
phosphor_dump_monitor_sources = [
dump_types_hpp,
'core_manager.cpp',
@@ -371,6 +373,7 @@
dependencies: executable[2],
install: executable[3],
include_directories: executable[4],
+ install_dir: get_option('libexecdir') / 'phosphor-debug-collector',
)
endforeach
diff --git a/service_files/meson.build b/service_files/meson.build
new file mode 100644
index 0000000..e3a22af
--- /dev/null
+++ b/service_files/meson.build
@@ -0,0 +1,13 @@
+systemd = dependency('systemd')
+systemd_system_unit_dir = systemd.get_variable(
+ pkgconfig: 'systemd_system_unit_dir',
+)
+
+install_data(
+ [
+ 'obmc-dump-monitor.service',
+ 'ramoops-monitor.service',
+ 'xyz.openbmc_project.Dump.Manager.service',
+ ],
+ install_dir: systemd_system_unit_dir,
+)
diff --git a/service_files/obmc-dump-monitor.service b/service_files/obmc-dump-monitor.service
new file mode 100644
index 0000000..447292a
--- /dev/null
+++ b/service_files/obmc-dump-monitor.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Phosphor Dump core monitor.
+ConditionPathExists=/var/lib/systemd/coredump
+
+[Service]
+ExecStart=/usr/libexec/phosphor-debug-collector/phosphor-dump-monitor
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/service_files/ramoops-monitor.service b/service_files/ramoops-monitor.service
new file mode 100644
index 0000000..9a47f10
--- /dev/null
+++ b/service_files/ramoops-monitor.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Ramoops monitor.
+ConditionPathExistsGlob=/var/lib/systemd/pstore/dmesg-ramoops-*
+After=xyz.openbmc_project.Dump.Manager.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/libexec/phosphor-debug-collector/phosphor-ramoops-monitor
+SyslogIdentifier=ramoops-monitor
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/service_files/xyz.openbmc_project.Dump.Manager.service b/service_files/xyz.openbmc_project.Dump.Manager.service
new file mode 100644
index 0000000..a13ba91
--- /dev/null
+++ b/service_files/xyz.openbmc_project.Dump.Manager.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Phosphor Dump Manager
+
+[Service]
+ExecStartPre=/bin/sh -c 'mkdir -p /var/lib/phosphor-debug-collector/dumps'
+ExecStart=/usr/libexec/phosphor-debug-collector/phosphor-dump-manager
+Restart=always
+Type=dbus
+BusName=xyz.openbmc_project.Dump.Manager
+
+[Install]
+WantedBy=multi-user.target