All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] package: add rasdaemon support.
@ 2025-11-26 10:20 Bastien Curutchet via buildroot
  2025-11-26 10:20 ` [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package Bastien Curutchet via buildroot
  2025-11-26 10:20 ` [Buildroot] [PATCH 2/2] support/testing: add rasdaemon tests Bastien Curutchet via buildroot
  0 siblings, 2 replies; 11+ messages in thread
From: Bastien Curutchet via buildroot @ 2025-11-26 10:20 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni, Fiona Klute, Bastien Curutchet

Hi all,

Rasdaemon is a tool that provides a way to collect all hardware error
events reported by the Linux kernel in a common framework.

My use case is on a PowerPC P2020. I use to it to monitor and react to
the PCIe AER events caught by the SoC's EDAC.

The first patch adds the package. The second one adds a small test for
it in support/testing.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
---
Bastien Curutchet (2):
      package/rasdaemon: Add rasdaemon package
      support/testing: add rasdaemon tests

 DEVELOPERS                                      |  4 ++
 package/Config.in                               |  1 +
 package/rasdaemon/Config.in                     | 23 +++++++++
 package/rasdaemon/S95rasdaemon                  | 62 +++++++++++++++++++++++++
 package/rasdaemon/rasdaemon.hash                |  1 +
 package/rasdaemon/rasdaemon.mk                  | 33 +++++++++++++
 support/testing/tests/package/test_rasdaemon.py | 25 ++++++++++
 7 files changed, 149 insertions(+)
---
base-commit: c8cb1a238de5a803228f12ad32b36cae2acfc778
change-id: 20251125-rasdaemon-1df4904ddfde

Best regards,
-- 
Bastien Curutchet <bastien.curutchet@bootlin.com>

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package
  2025-11-26 10:20 [Buildroot] [PATCH 0/2] package: add rasdaemon support Bastien Curutchet via buildroot
@ 2025-11-26 10:20 ` Bastien Curutchet via buildroot
  2025-11-26 10:59   ` Thomas Petazzoni via buildroot
  2025-11-26 14:32   ` Fiona Klute via buildroot
  2025-11-26 10:20 ` [Buildroot] [PATCH 2/2] support/testing: add rasdaemon tests Bastien Curutchet via buildroot
  1 sibling, 2 replies; 11+ messages in thread
From: Bastien Curutchet via buildroot @ 2025-11-26 10:20 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni, Fiona Klute, Bastien Curutchet

Rasdaemon is a tool that aims to replace the edac-tool and provide a way
to collect all hardware error events reported by the Linux kernel in a
common framework.

Add a new package to support rasdaemon in the 'Hardware handling'
section. It depends on libtraceevents to detect the ftrace events
generated by the kernel and on sqlite to store these events.

Support for the PCIe AER events is optionnal and implies a dependency on
pciutils so also add a dedicated 'sub-option' to enable it.

Add a SYSV init script to start / stop the daemon

Add myself to the DEVELOPERS file.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
---
 DEVELOPERS                       |  3 ++
 package/Config.in                |  1 +
 package/rasdaemon/Config.in      | 23 +++++++++++++++
 package/rasdaemon/S95rasdaemon   | 62 ++++++++++++++++++++++++++++++++++++++++
 package/rasdaemon/rasdaemon.hash |  1 +
 package/rasdaemon/rasdaemon.mk   | 33 +++++++++++++++++++++
 6 files changed, 123 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index db001d6bb0707a5877c0849fa85fa736377e60dd..b1ead6d26c4e8ff160bcc7ed85b0945ac5e551dc 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -341,6 +341,9 @@ F:	package/tcpdump/
 F:	package/ti-uim/
 F:	package/uhubctl/
 
+N:	Bastien Curutchet <bastien.curutchet@bootlin.com>
+F:	package/rasdaemon/
+
 N:	Baxiche Su <baxiche@gmail.com>
 F:	package/qt6/qt6multimedia/
 
diff --git a/package/Config.in b/package/Config.in
index 12f327cb273526781d931b834e24d0df5024e80e..1a93cec2fa22e3a6e70acbf799b32b00d5e8b5de 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -584,6 +584,7 @@ endmenu
 	source "package/pru-software-support/Config.in"
 	source "package/pulseview/Config.in"
 	source "package/qoriq-cadence-dp-firmware/Config.in"
+	source "package/rasdaemon/Config.in"
 	source "package/raspi-gpio/Config.in"
 	source "package/rdma-core/Config.in"
 	source "package/read-edid/Config.in"
diff --git a/package/rasdaemon/Config.in b/package/rasdaemon/Config.in
new file mode 100644
index 0000000000000000000000000000000000000000..f6ceb3585ce5612ba598b182e6538a49d1adb8f8
--- /dev/null
+++ b/package/rasdaemon/Config.in
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_RASDAEMON
+	bool "rasdaemon"
+	depends on !BR2_STATIC_LIBS # libtraceevent
+	select BR2_PACKAGE_LIBTRACEEVENT
+	select BR2_PACKAGE_SQLITE
+	select BR2_PACKAGE_ARGP_STANDALONE if BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_MUSL
+	help
+	  rasdaemon is a tool that collects all hardware error events
+	  reported by the Linux Kernel from several sources (EDAC, MCE
+	  PCI, ...) into one common framework.
+	  See https://github.com/mchehab/rasdaemon for details.
+
+if BR2_PACKAGE_RASDAEMON
+
+config BR2_PACKAGE_RASDAEMON_AER
+	bool "Enable AER support"
+	default y
+	select BR2_PACKAGE_PCIUTILS
+	help
+	  Enable handling of AER (Advanced Error Reporting) events on
+	  PCIe
+
+endif
diff --git a/package/rasdaemon/S95rasdaemon b/package/rasdaemon/S95rasdaemon
new file mode 100644
index 0000000000000000000000000000000000000000..4f211f1eefb8cfe08b1150c91eb027dddf6085b9
--- /dev/null
+++ b/package/rasdaemon/S95rasdaemon
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# S95rasdaemon	Starts Rasdaemon.
+#
+# shellcheck disable=SC2317 # functions are called via variable
+
+DAEMON="rasdaemon"
+
+start() {
+	printf "Starting %s: " "$DAEMON"
+
+	if ! grep -q debugfs /proc/mounts ; then
+		# rasdaemon fails silently if debugfs isn't mounted
+		echo "FAIL"
+		return $?
+	fi
+
+	start-stop-daemon --start --exec "/usr/sbin/$DAEMON"
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+stop() {
+	printf "Stopping %s: " "$DAEMON"
+	start-stop-daemon --stop --exec "/usr/sbin/$DAEMON"
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	# $DAEMON deletes its PID file on exit, wait for it to be gone
+	while [ -f "$PIDFILE" ]; do
+		sleep 0.1
+	done
+	return "$status"
+}
+
+restart() {
+	stop
+	start
+}
+
+reload() {
+	restart
+}
+
+case "$1" in
+	start|stop|reload|restart)
+		"$1"
+		;;
+	*)
+		echo "Usage: $0 {start|stop|reload|restart}"
+		exit 1
+esac
+
+exit $?
diff --git a/package/rasdaemon/rasdaemon.hash b/package/rasdaemon/rasdaemon.hash
new file mode 100644
index 0000000000000000000000000000000000000000..768475ce597a63b1738388c2bdebcc3117f006a8
--- /dev/null
+++ b/package/rasdaemon/rasdaemon.hash
@@ -0,0 +1 @@
+sha256  7e12459f9477036491ac2b1e4c07cc3e8efea6dcd30525a263ab1f83910b773a  rasdaemon-0.8.4.tar.gz
diff --git a/package/rasdaemon/rasdaemon.mk b/package/rasdaemon/rasdaemon.mk
new file mode 100644
index 0000000000000000000000000000000000000000..50ac97a37dcbe63443bddca505ebc7c929116e53
--- /dev/null
+++ b/package/rasdaemon/rasdaemon.mk
@@ -0,0 +1,33 @@
+################################################################################
+#
+# rasdaemon
+#
+################################################################################
+
+RASDAEMON_VERSION = 0.8.4
+RASDAEMON_SITE = $(call github,mchehab,rasdaemon,v$(RASDAEMON_VERSION))
+RASDAEMON_LICENSE = GPL-2.0+
+RASDAEMON_LICENSE_FILES = COPYING
+RASDAEMON_AUTORECONF = YES
+
+RASDAEMON_DEPENDENCIES = libtraceevent sqlite
+# rasdaemon uses argp.h which is not provided by uclibc or musl by default.
+# Use the argp-standalone package to provide this.
+ifeq ($(BR2_PACKAGE_ARGP_STANDALONE),y)
+RASDAEMON_DEPENDENCIES += argp-standalone
+RASDAEMON_CONF_ENV += LIBS="-largp"
+endif
+
+ifeq ($(BR2_PACKAGE_RASDAEMON_AER),y)
+RASDAEMON_DEPENDENCIES += pciutils
+RASDAEMON_CONF_OPTS += --enable-aer
+else
+RASDAEMON_CONF_OPTS += --disable-aer
+endif
+
+define RASDAEMON_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/rasdaemon/S95rasdaemon \
+		$(TARGET_DIR)/etc/init.d/S95rasdaemon
+endef
+
+$(eval $(autotools-package))

-- 
2.51.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/2] support/testing: add rasdaemon tests
  2025-11-26 10:20 [Buildroot] [PATCH 0/2] package: add rasdaemon support Bastien Curutchet via buildroot
  2025-11-26 10:20 ` [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package Bastien Curutchet via buildroot
@ 2025-11-26 10:20 ` Bastien Curutchet via buildroot
  2025-11-26 11:00   ` Thomas Petazzoni via buildroot
  1 sibling, 1 reply; 11+ messages in thread
From: Bastien Curutchet via buildroot @ 2025-11-26 10:20 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni, Fiona Klute, Bastien Curutchet

Rasdaemon was added in previous patch.

Add a test_rasdaemon that allows to build-test it. The test only
consists of getting rasdaemon's version.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
---
 DEVELOPERS                                      |  1 +
 support/testing/tests/package/test_rasdaemon.py | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index b1ead6d26c4e8ff160bcc7ed85b0945ac5e551dc..c9aaa8c9c8aa3d54c930476d9d450e7f990d9aac 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -343,6 +343,7 @@ F:	package/uhubctl/
 
 N:	Bastien Curutchet <bastien.curutchet@bootlin.com>
 F:	package/rasdaemon/
+F:	support/testing/tests/package/test_rasdaemon.py
 
 N:	Baxiche Su <baxiche@gmail.com>
 F:	package/qt6/qt6multimedia/
diff --git a/support/testing/tests/package/test_rasdaemon.py b/support/testing/tests/package/test_rasdaemon.py
new file mode 100644
index 0000000000000000000000000000000000000000..ccc3fcf1cbf3821d2408e2692769166e838088dd
--- /dev/null
+++ b/support/testing/tests/package/test_rasdaemon.py
@@ -0,0 +1,25 @@
+import os
+
+import infra.basetest
+
+
+class TestRasdaemon(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_RASDAEMON=y
+        BR2_PACKAGE_RASDAEMON_AER=y
+        BR2_PACKAGE_LIBTRACEEVENT=y
+        BR2_PACKAGE_SQLITE=y
+        BR2_PACKAGE_PCIUTILS=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv7",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+
+        self.assertRunOk("/usr/sbin/rasdaemon --version")

-- 
2.51.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package
  2025-11-26 10:20 ` [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package Bastien Curutchet via buildroot
@ 2025-11-26 10:59   ` Thomas Petazzoni via buildroot
  2025-11-26 14:57     ` Bastien Curutchet via buildroot
  2025-11-26 14:32   ` Fiona Klute via buildroot
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-11-26 10:59 UTC (permalink / raw)
  To: Bastien Curutchet; +Cc: buildroot, Fiona Klute

Hello Bastien,

Thanks for the patch! Some comments below.

On Wed, 26 Nov 2025 11:20:09 +0100
Bastien Curutchet <bastien.curutchet@bootlin.com> wrote:


> diff --git a/package/rasdaemon/Config.in b/package/rasdaemon/Config.in
> new file mode 100644
> index 0000000000000000000000000000000000000000..f6ceb3585ce5612ba598b182e6538a49d1adb8f8
> --- /dev/null
> +++ b/package/rasdaemon/Config.in
> @@ -0,0 +1,23 @@
> +config BR2_PACKAGE_RASDAEMON
> +	bool "rasdaemon"
> +	depends on !BR2_STATIC_LIBS # libtraceevent
> +	select BR2_PACKAGE_LIBTRACEEVENT
> +	select BR2_PACKAGE_SQLITE
> +	select BR2_PACKAGE_ARGP_STANDALONE if BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_MUSL
> +	help
> +	  rasdaemon is a tool that collects all hardware error events
> +	  reported by the Linux Kernel from several sources (EDAC, MCE
> +	  PCI, ...) into one common framework.
> +	  See https://github.com/mchehab/rasdaemon for details.
> +
> +if BR2_PACKAGE_RASDAEMON
> +
> +config BR2_PACKAGE_RASDAEMON_AER
> +	bool "Enable AER support"
> +	default y
> +	select BR2_PACKAGE_PCIUTILS
> +	help
> +	  Enable handling of AER (Advanced Error Reporting) events on
> +	  PCIe
> +
> +endif

You need here:

comment "rasdaemon needs a toolchain w/ dynamic library"
	depends on BR2_STATIC_LIBS

Also, I'm in fact not sure the "default y" is good for
BR2_PACKAGE_RASDAEMON_AER. We generally try to keep optional features
disabled by default in Buildroot, and especially if they bring
additional dependencies.


> diff --git a/package/rasdaemon/rasdaemon.hash b/package/rasdaemon/rasdaemon.hash
> new file mode 100644
> index 0000000000000000000000000000000000000000..768475ce597a63b1738388c2bdebcc3117f006a8
> --- /dev/null
> +++ b/package/rasdaemon/rasdaemon.hash
> @@ -0,0 +1 @@

Please add:

# Locally calculated

here

> +sha256  7e12459f9477036491ac2b1e4c07cc3e8efea6dcd30525a263ab1f83910b773a  rasdaemon-0.8.4.tar.gz

And also, add the hash of the license file.

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH 2/2] support/testing: add rasdaemon tests
  2025-11-26 10:20 ` [Buildroot] [PATCH 2/2] support/testing: add rasdaemon tests Bastien Curutchet via buildroot
@ 2025-11-26 11:00   ` Thomas Petazzoni via buildroot
  2025-11-26 14:58     ` Bastien Curutchet via buildroot
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-11-26 11:00 UTC (permalink / raw)
  To: Bastien Curutchet; +Cc: buildroot, Fiona Klute

Hello,

On Wed, 26 Nov 2025 11:20:10 +0100
Bastien Curutchet <bastien.curutchet@bootlin.com> wrote:

> +class TestRasdaemon(infra.basetest.BRTest):
> +    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
> +        """
> +        BR2_PACKAGE_RASDAEMON=y
> +        BR2_PACKAGE_RASDAEMON_AER=y
> +        BR2_PACKAGE_LIBTRACEEVENT=y
> +        BR2_PACKAGE_SQLITE=y
> +        BR2_PACKAGE_PCIUTILS=y
> +        BR2_TARGET_ROOTFS_CPIO=y
> +        # BR2_TARGET_ROOTFS_TAR is not set
> +        """
> +
> +    def test_run(self):
> +        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
> +        self.emulator.boot(arch="armv7",
> +                           kernel="builtin",
> +                           options=["-initrd", cpio_file])
> +        self.emulator.login()
> +
> +        self.assertRunOk("/usr/sbin/rasdaemon --version")


Since it installs an init script, what about checking that the daemon
is actually running?

Bonus point if you're actually able to inject an error, and verify that
rasdaemon reacts to it by running some arbitrary action :-)

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package
  2025-11-26 10:20 ` [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package Bastien Curutchet via buildroot
  2025-11-26 10:59   ` Thomas Petazzoni via buildroot
@ 2025-11-26 14:32   ` Fiona Klute via buildroot
  2025-11-26 14:46     ` Bastien Curutchet via buildroot
  1 sibling, 1 reply; 11+ messages in thread
From: Fiona Klute via buildroot @ 2025-11-26 14:32 UTC (permalink / raw)
  To: Bastien Curutchet, buildroot; +Cc: Thomas Petazzoni

Hi Bastien!

Am 26.11.25 um 11:20 schrieb Bastien Curutchet:
> Rasdaemon is a tool that aims to replace the edac-tool and provide a way
> to collect all hardware error events reported by the Linux kernel in a
> common framework.
> 
> Add a new package to support rasdaemon in the 'Hardware handling'
> section. It depends on libtraceevents to detect the ftrace events
> generated by the kernel and on sqlite to store these events.
> 
> Support for the PCIe AER events is optionnal and implies a dependency on
> pciutils so also add a dedicated 'sub-option' to enable it.
> 
> Add a SYSV init script to start / stop the daemon
> 
> Add myself to the DEVELOPERS file.
> 
> Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
> ---
>   DEVELOPERS                       |  3 ++
>   package/Config.in                |  1 +
>   package/rasdaemon/Config.in      | 23 +++++++++++++++
>   package/rasdaemon/S95rasdaemon   | 62 ++++++++++++++++++++++++++++++++++++++++
>   package/rasdaemon/rasdaemon.hash |  1 +
>   package/rasdaemon/rasdaemon.mk   | 33 +++++++++++++++++++++
>   6 files changed, 123 insertions(+)
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index db001d6bb0707a5877c0849fa85fa736377e60dd..b1ead6d26c4e8ff160bcc7ed85b0945ac5e551dc 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -341,6 +341,9 @@ F:	package/tcpdump/
>   F:	package/ti-uim/
>   F:	package/uhubctl/
>   
> +N:	Bastien Curutchet <bastien.curutchet@bootlin.com>
> +F:	package/rasdaemon/
> +
>   N:	Baxiche Su <baxiche@gmail.com>
>   F:	package/qt6/qt6multimedia/
>   
> diff --git a/package/Config.in b/package/Config.in
> index 12f327cb273526781d931b834e24d0df5024e80e..1a93cec2fa22e3a6e70acbf799b32b00d5e8b5de 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -584,6 +584,7 @@ endmenu
>   	source "package/pru-software-support/Config.in"
>   	source "package/pulseview/Config.in"
>   	source "package/qoriq-cadence-dp-firmware/Config.in"
> +	source "package/rasdaemon/Config.in"
>   	source "package/raspi-gpio/Config.in"
>   	source "package/rdma-core/Config.in"
>   	source "package/read-edid/Config.in"
> diff --git a/package/rasdaemon/Config.in b/package/rasdaemon/Config.in
> new file mode 100644
> index 0000000000000000000000000000000000000000..f6ceb3585ce5612ba598b182e6538a49d1adb8f8
> --- /dev/null
> +++ b/package/rasdaemon/Config.in
> @@ -0,0 +1,23 @@
> +config BR2_PACKAGE_RASDAEMON
> +	bool "rasdaemon"
> +	depends on !BR2_STATIC_LIBS # libtraceevent
> +	select BR2_PACKAGE_LIBTRACEEVENT
> +	select BR2_PACKAGE_SQLITE
> +	select BR2_PACKAGE_ARGP_STANDALONE if BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_MUSL
> +	help
> +	  rasdaemon is a tool that collects all hardware error events
> +	  reported by the Linux Kernel from several sources (EDAC, MCE
> +	  PCI, ...) into one common framework.
> +	  See https://github.com/mchehab/rasdaemon for details.
> +
> +if BR2_PACKAGE_RASDAEMON
> +
> +config BR2_PACKAGE_RASDAEMON_AER
> +	bool "Enable AER support"
> +	default y
> +	select BR2_PACKAGE_PCIUTILS
> +	help
> +	  Enable handling of AER (Advanced Error Reporting) events on
> +	  PCIe
> +
> +endif
> diff --git a/package/rasdaemon/S95rasdaemon b/package/rasdaemon/S95rasdaemon
> new file mode 100644
> index 0000000000000000000000000000000000000000..4f211f1eefb8cfe08b1150c91eb027dddf6085b9
> --- /dev/null
> +++ b/package/rasdaemon/S95rasdaemon
> @@ -0,0 +1,62 @@
> +#!/bin/sh
> +#
> +# S95rasdaemon	Starts Rasdaemon.
> +#
> +# shellcheck disable=SC2317 # functions are called via variable
> +
> +DAEMON="rasdaemon"
> +
> +start() {
> +	printf "Starting %s: " "$DAEMON"
> +
> +	if ! grep -q debugfs /proc/mounts ; then
> +		# rasdaemon fails silently if debugfs isn't mounted

Printing that instead of a comment would be helpful, so users without 
debugfs know why rasdaemon fails to start.

> +		echo "FAIL"
> +		return $?

This would return the exit status of "echo", which is practically always 
going to be 0. "return 1" would probably be more appropriate.

> +	fi
> +
> +	start-stop-daemon --start --exec "/usr/sbin/$DAEMON"
> +	status=$?
> +	if [ "$status" -eq 0 ]; then
> +		echo "OK"
> +	else
> +		echo "FAIL"
> +	fi
> +	return "$status"
> +}
> +
> +stop() {
> +	printf "Stopping %s: " "$DAEMON"
> +	start-stop-daemon --stop --exec "/usr/sbin/$DAEMON"
> +	status=$?
> +	if [ "$status" -eq 0 ]; then
> +		echo "OK"
> +	else
> +		echo "FAIL"
> +	fi
> +	# $DAEMON deletes its PID file on exit, wait for it to be gone
> +	while [ -f "$PIDFILE" ]; do

The PIDFILE variable isn't defined anywhere, that can't be right. 
Generally *all* start-stop-daemon calls should use --pidfile $PIDFILE so 
start-stop-daemon can keep track of exact process (in addition to 
--exec). Exactly how to manage the PID file depends on the behavior of 
the daemon, please see:
https://nightly.buildroot.org/#_handling_the_pid_file
(or docs/manual/adding-packages-directory.adoc in the repo, search for 
PID to find the section)

In any case, you need to set the PIDFILE variable in the init script. ;-)

Best regards,
Fiona

> +		sleep 0.1
> +	done
> +	return "$status"
> +}
> +
> +restart() {
> +	stop
> +	start
> +}
> +
> +reload() {
> +	restart
> +}
> +
> +case "$1" in
> +	start|stop|reload|restart)
> +		"$1"
> +		;;
> +	*)
> +		echo "Usage: $0 {start|stop|reload|restart}"
> +		exit 1
> +esac
> +
> +exit $?
> diff --git a/package/rasdaemon/rasdaemon.hash b/package/rasdaemon/rasdaemon.hash
> new file mode 100644
> index 0000000000000000000000000000000000000000..768475ce597a63b1738388c2bdebcc3117f006a8
> --- /dev/null
> +++ b/package/rasdaemon/rasdaemon.hash
> @@ -0,0 +1 @@
> +sha256  7e12459f9477036491ac2b1e4c07cc3e8efea6dcd30525a263ab1f83910b773a  rasdaemon-0.8.4.tar.gz
> diff --git a/package/rasdaemon/rasdaemon.mk b/package/rasdaemon/rasdaemon.mk
> new file mode 100644
> index 0000000000000000000000000000000000000000..50ac97a37dcbe63443bddca505ebc7c929116e53
> --- /dev/null
> +++ b/package/rasdaemon/rasdaemon.mk
> @@ -0,0 +1,33 @@
> +################################################################################
> +#
> +# rasdaemon
> +#
> +################################################################################
> +
> +RASDAEMON_VERSION = 0.8.4
> +RASDAEMON_SITE = $(call github,mchehab,rasdaemon,v$(RASDAEMON_VERSION))
> +RASDAEMON_LICENSE = GPL-2.0+
> +RASDAEMON_LICENSE_FILES = COPYING
> +RASDAEMON_AUTORECONF = YES
> +
> +RASDAEMON_DEPENDENCIES = libtraceevent sqlite
> +# rasdaemon uses argp.h which is not provided by uclibc or musl by default.
> +# Use the argp-standalone package to provide this.
> +ifeq ($(BR2_PACKAGE_ARGP_STANDALONE),y)
> +RASDAEMON_DEPENDENCIES += argp-standalone
> +RASDAEMON_CONF_ENV += LIBS="-largp"
> +endif
> +
> +ifeq ($(BR2_PACKAGE_RASDAEMON_AER),y)
> +RASDAEMON_DEPENDENCIES += pciutils
> +RASDAEMON_CONF_OPTS += --enable-aer
> +else
> +RASDAEMON_CONF_OPTS += --disable-aer
> +endif
> +
> +define RASDAEMON_INSTALL_INIT_SYSV
> +	$(INSTALL) -m 0755 -D package/rasdaemon/S95rasdaemon \
> +		$(TARGET_DIR)/etc/init.d/S95rasdaemon
> +endef
> +
> +$(eval $(autotools-package))
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package
  2025-11-26 14:32   ` Fiona Klute via buildroot
@ 2025-11-26 14:46     ` Bastien Curutchet via buildroot
  2025-11-26 16:35       ` Fiona Klute via buildroot
  0 siblings, 1 reply; 11+ messages in thread
From: Bastien Curutchet via buildroot @ 2025-11-26 14:46 UTC (permalink / raw)
  To: Fiona Klute, buildroot; +Cc: Thomas Petazzoni

Hi Fiona,

On 11/26/25 3:32 PM, Fiona Klute wrote:
> Hi Bastien!
> 
> Am 26.11.25 um 11:20 schrieb Bastien Curutchet:
>> Rasdaemon is a tool that aims to replace the edac-tool and provide a way
>> to collect all hardware error events reported by the Linux kernel in a
>> common framework.
>>
>> Add a new package to support rasdaemon in the 'Hardware handling'
>> section. It depends on libtraceevents to detect the ftrace events
>> generated by the kernel and on sqlite to store these events.
>>
>> Support for the PCIe AER events is optionnal and implies a dependency on
>> pciutils so also add a dedicated 'sub-option' to enable it.
>>
>> Add a SYSV init script to start / stop the daemon
>>
>> Add myself to the DEVELOPERS file.
>>
>> Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
>> ---
>>   DEVELOPERS                       |  3 ++
>>   package/Config.in                |  1 +
>>   package/rasdaemon/Config.in      | 23 +++++++++++++++
>>   package/rasdaemon/S95rasdaemon   | 62 ++++++++++++++++++++++++++++++ 
>> ++++++++++
>>   package/rasdaemon/rasdaemon.hash |  1 +
>>   package/rasdaemon/rasdaemon.mk   | 33 +++++++++++++++++++++
>>   6 files changed, 123 insertions(+)
>>
>> diff --git a/DEVELOPERS b/DEVELOPERS
>> index 
>> db001d6bb0707a5877c0849fa85fa736377e60dd..b1ead6d26c4e8ff160bcc7ed85b0945ac5e551dc 100644
>> --- a/DEVELOPERS
>> +++ b/DEVELOPERS
>> @@ -341,6 +341,9 @@ F:    package/tcpdump/
>>   F:    package/ti-uim/
>>   F:    package/uhubctl/
>> +N:    Bastien Curutchet <bastien.curutchet@bootlin.com>
>> +F:    package/rasdaemon/
>> +
>>   N:    Baxiche Su <baxiche@gmail.com>
>>   F:    package/qt6/qt6multimedia/
>> diff --git a/package/Config.in b/package/Config.in
>> index 
>> 12f327cb273526781d931b834e24d0df5024e80e..1a93cec2fa22e3a6e70acbf799b32b00d5e8b5de 100644
>> --- a/package/Config.in
>> +++ b/package/Config.in
>> @@ -584,6 +584,7 @@ endmenu
>>       source "package/pru-software-support/Config.in"
>>       source "package/pulseview/Config.in"
>>       source "package/qoriq-cadence-dp-firmware/Config.in"
>> +    source "package/rasdaemon/Config.in"
>>       source "package/raspi-gpio/Config.in"
>>       source "package/rdma-core/Config.in"
>>       source "package/read-edid/Config.in"
>> diff --git a/package/rasdaemon/Config.in b/package/rasdaemon/Config.in
>> new file mode 100644
>> index 
>> 0000000000000000000000000000000000000000..f6ceb3585ce5612ba598b182e6538a49d1adb8f8
>> --- /dev/null
>> +++ b/package/rasdaemon/Config.in
>> @@ -0,0 +1,23 @@
>> +config BR2_PACKAGE_RASDAEMON
>> +    bool "rasdaemon"
>> +    depends on !BR2_STATIC_LIBS # libtraceevent
>> +    select BR2_PACKAGE_LIBTRACEEVENT
>> +    select BR2_PACKAGE_SQLITE
>> +    select BR2_PACKAGE_ARGP_STANDALONE if BR2_TOOLCHAIN_USES_UCLIBC 
>> || BR2_TOOLCHAIN_USES_MUSL
>> +    help
>> +      rasdaemon is a tool that collects all hardware error events
>> +      reported by the Linux Kernel from several sources (EDAC, MCE
>> +      PCI, ...) into one common framework.
>> +      See https://github.com/mchehab/rasdaemon for details.
>> +
>> +if BR2_PACKAGE_RASDAEMON
>> +
>> +config BR2_PACKAGE_RASDAEMON_AER
>> +    bool "Enable AER support"
>> +    default y
>> +    select BR2_PACKAGE_PCIUTILS
>> +    help
>> +      Enable handling of AER (Advanced Error Reporting) events on
>> +      PCIe
>> +
>> +endif
>> diff --git a/package/rasdaemon/S95rasdaemon b/package/rasdaemon/ 
>> S95rasdaemon
>> new file mode 100644
>> index 
>> 0000000000000000000000000000000000000000..4f211f1eefb8cfe08b1150c91eb027dddf6085b9
>> --- /dev/null
>> +++ b/package/rasdaemon/S95rasdaemon
>> @@ -0,0 +1,62 @@
>> +#!/bin/sh
>> +#
>> +# S95rasdaemon    Starts Rasdaemon.
>> +#
>> +# shellcheck disable=SC2317 # functions are called via variable
>> +
>> +DAEMON="rasdaemon"
>> +
>> +start() {
>> +    printf "Starting %s: " "$DAEMON"
>> +
>> +    if ! grep -q debugfs /proc/mounts ; then
>> +        # rasdaemon fails silently if debugfs isn't mounted
> 
> Printing that instead of a comment would be helpful, so users without 
> debugfs know why rasdaemon fails to start.
> 

True, will do

>> +        echo "FAIL"
>> +        return $?
> 
> This would return the exit status of "echo", which is practically always 
> going to be 0. "return 1" would probably be more appropriate.
> 

Indeed, thanks

>> +    fi
>> +
>> +    start-stop-daemon --start --exec "/usr/sbin/$DAEMON"
>> +    status=$?
>> +    if [ "$status" -eq 0 ]; then
>> +        echo "OK"
>> +    else
>> +        echo "FAIL"
>> +    fi
>> +    return "$status"
>> +}
>> +
>> +stop() {
>> +    printf "Stopping %s: " "$DAEMON"
>> +    start-stop-daemon --stop --exec "/usr/sbin/$DAEMON"
>> +    status=$?
>> +    if [ "$status" -eq 0 ]; then
>> +        echo "OK"
>> +    else
>> +        echo "FAIL"
>> +    fi
>> +    # $DAEMON deletes its PID file on exit, wait for it to be gone
>> +    while [ -f "$PIDFILE" ]; do
> 
> The PIDFILE variable isn't defined anywhere, that can't be right. 

Indeed ...

> Generally *all* start-stop-daemon calls should use --pidfile $PIDFILE so 
> start-stop-daemon can keep track of exact process (in addition to -- 
> exec). Exactly how to manage the PID file depends on the behavior of the 
> daemon, please see:
> https://nightly.buildroot.org/#_handling_the_pid_file

Thanks for the pointer, I didn't know about the --make-pidfile option, 
I'll use it.

> (or docs/manual/adding-packages-directory.adoc in the repo, search for 
> PID to find the section)
> 
> In any case, you need to set the PIDFILE variable in the init script. ;-)
> 


Best regards,
Bastien
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package
  2025-11-26 10:59   ` Thomas Petazzoni via buildroot
@ 2025-11-26 14:57     ` Bastien Curutchet via buildroot
  0 siblings, 0 replies; 11+ messages in thread
From: Bastien Curutchet via buildroot @ 2025-11-26 14:57 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: buildroot, Fiona Klute

Hi Thomas,

On 11/26/25 11:59 AM, Thomas Petazzoni wrote:
> Hello Bastien,
> 
> Thanks for the patch! Some comments below.
> 
> On Wed, 26 Nov 2025 11:20:09 +0100
> Bastien Curutchet <bastien.curutchet@bootlin.com> wrote:
> 
> 
>> diff --git a/package/rasdaemon/Config.in b/package/rasdaemon/Config.in
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..f6ceb3585ce5612ba598b182e6538a49d1adb8f8
>> --- /dev/null
>> +++ b/package/rasdaemon/Config.in
>> @@ -0,0 +1,23 @@
>> +config BR2_PACKAGE_RASDAEMON
>> +	bool "rasdaemon"
>> +	depends on !BR2_STATIC_LIBS # libtraceevent
>> +	select BR2_PACKAGE_LIBTRACEEVENT
>> +	select BR2_PACKAGE_SQLITE
>> +	select BR2_PACKAGE_ARGP_STANDALONE if BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_MUSL
>> +	help
>> +	  rasdaemon is a tool that collects all hardware error events
>> +	  reported by the Linux Kernel from several sources (EDAC, MCE
>> +	  PCI, ...) into one common framework.
>> +	  See https://github.com/mchehab/rasdaemon for details.
>> +
>> +if BR2_PACKAGE_RASDAEMON
>> +
>> +config BR2_PACKAGE_RASDAEMON_AER
>> +	bool "Enable AER support"
>> +	default y
>> +	select BR2_PACKAGE_PCIUTILS
>> +	help
>> +	  Enable handling of AER (Advanced Error Reporting) events on
>> +	  PCIe
>> +
>> +endif
> 
> You need here:
> 
> comment "rasdaemon needs a toolchain w/ dynamic library"
> 	depends on BR2_STATIC_LIBS
> 

Ok.

> Also, I'm in fact not sure the "default y" is good for
> BR2_PACKAGE_RASDAEMON_AER. We generally try to keep optional features
> disabled by default in Buildroot, and especially if they bring
> additional dependencies.
> 
> 

Yep, I agree, I'll remove it.

>> diff --git a/package/rasdaemon/rasdaemon.hash b/package/rasdaemon/rasdaemon.hash
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..768475ce597a63b1738388c2bdebcc3117f006a8
>> --- /dev/null
>> +++ b/package/rasdaemon/rasdaemon.hash
>> @@ -0,0 +1 @@
> 
> Please add:
> 
> # Locally calculated
> 
> here
> 
>> +sha256  7e12459f9477036491ac2b1e4c07cc3e8efea6dcd30525a263ab1f83910b773a  rasdaemon-0.8.4.tar.gz
> 
> And also, add the hash of the license file.
> 
Ok, I'll do it.


Best regards,
Bastien
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH 2/2] support/testing: add rasdaemon tests
  2025-11-26 11:00   ` Thomas Petazzoni via buildroot
@ 2025-11-26 14:58     ` Bastien Curutchet via buildroot
  0 siblings, 0 replies; 11+ messages in thread
From: Bastien Curutchet via buildroot @ 2025-11-26 14:58 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: buildroot, Fiona Klute

Hi,

On 11/26/25 12:00 PM, Thomas Petazzoni wrote:
> Hello,
> 
> On Wed, 26 Nov 2025 11:20:10 +0100
> Bastien Curutchet <bastien.curutchet@bootlin.com> wrote:
> 
>> +class TestRasdaemon(infra.basetest.BRTest):
>> +    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
>> +        """
>> +        BR2_PACKAGE_RASDAEMON=y
>> +        BR2_PACKAGE_RASDAEMON_AER=y
>> +        BR2_PACKAGE_LIBTRACEEVENT=y
>> +        BR2_PACKAGE_SQLITE=y
>> +        BR2_PACKAGE_PCIUTILS=y
>> +        BR2_TARGET_ROOTFS_CPIO=y
>> +        # BR2_TARGET_ROOTFS_TAR is not set
>> +        """
>> +
>> +    def test_run(self):
>> +        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
>> +        self.emulator.boot(arch="armv7",
>> +                           kernel="builtin",
>> +                           options=["-initrd", cpio_file])
>> +        self.emulator.login()
>> +
>> +        self.assertRunOk("/usr/sbin/rasdaemon --version")
> 
> 
> Since it installs an init script, what about checking that the daemon
> is actually running?
> 
> Bonus point if you're actually able to inject an error, and verify that
> rasdaemon reacts to it by running some arbitrary action :-)
> 

I'll do my best to get that bonus point :)


Best regards,
Bastien
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package
  2025-11-26 14:46     ` Bastien Curutchet via buildroot
@ 2025-11-26 16:35       ` Fiona Klute via buildroot
  2025-11-27  7:45         ` Bastien Curutchet via buildroot
  0 siblings, 1 reply; 11+ messages in thread
From: Fiona Klute via buildroot @ 2025-11-26 16:35 UTC (permalink / raw)
  To: Bastien Curutchet, buildroot; +Cc: Thomas Petazzoni

Am 26.11.25 um 15:46 schrieb Bastien Curutchet:
> Hi Fiona,
> 
> On 11/26/25 3:32 PM, Fiona Klute wrote:
>> Hi Bastien!
>>
>> Am 26.11.25 um 11:20 schrieb Bastien Curutchet:
>>> Rasdaemon is a tool that aims to replace the edac-tool and provide a way
>>> to collect all hardware error events reported by the Linux kernel in a
>>> common framework.
>>>
>>> Add a new package to support rasdaemon in the 'Hardware handling'
>>> section. It depends on libtraceevents to detect the ftrace events
>>> generated by the kernel and on sqlite to store these events.
>>>
>>> Support for the PCIe AER events is optionnal and implies a dependency on
>>> pciutils so also add a dedicated 'sub-option' to enable it.
>>>
>>> Add a SYSV init script to start / stop the daemon
>>>
>>> Add myself to the DEVELOPERS file.
>>>
>>> Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
>>> ---
>>>   DEVELOPERS                       |  3 ++
>>>   package/Config.in                |  1 +
>>>   package/rasdaemon/Config.in      | 23 +++++++++++++++
>>>   package/rasdaemon/S95rasdaemon   | 62 +++++++++++++++++++++++++++++ 
>>> + ++++++++++
>>>   package/rasdaemon/rasdaemon.hash |  1 +
>>>   package/rasdaemon/rasdaemon.mk   | 33 +++++++++++++++++++++
>>>   6 files changed, 123 insertions(+)
>>>
>>> diff --git a/DEVELOPERS b/DEVELOPERS
>>> index 
>>> db001d6bb0707a5877c0849fa85fa736377e60dd..b1ead6d26c4e8ff160bcc7ed85b0945ac5e551dc 100644
>>> --- a/DEVELOPERS
>>> +++ b/DEVELOPERS
>>> @@ -341,6 +341,9 @@ F:    package/tcpdump/
>>>   F:    package/ti-uim/
>>>   F:    package/uhubctl/
>>> +N:    Bastien Curutchet <bastien.curutchet@bootlin.com>
>>> +F:    package/rasdaemon/
>>> +
>>>   N:    Baxiche Su <baxiche@gmail.com>
>>>   F:    package/qt6/qt6multimedia/
>>> diff --git a/package/Config.in b/package/Config.in
>>> index 
>>> 12f327cb273526781d931b834e24d0df5024e80e..1a93cec2fa22e3a6e70acbf799b32b00d5e8b5de 100644
>>> --- a/package/Config.in
>>> +++ b/package/Config.in
>>> @@ -584,6 +584,7 @@ endmenu
>>>       source "package/pru-software-support/Config.in"
>>>       source "package/pulseview/Config.in"
>>>       source "package/qoriq-cadence-dp-firmware/Config.in"
>>> +    source "package/rasdaemon/Config.in"
>>>       source "package/raspi-gpio/Config.in"
>>>       source "package/rdma-core/Config.in"
>>>       source "package/read-edid/Config.in"
>>> diff --git a/package/rasdaemon/Config.in b/package/rasdaemon/Config.in
>>> new file mode 100644
>>> index 
>>> 0000000000000000000000000000000000000000..f6ceb3585ce5612ba598b182e6538a49d1adb8f8
>>> --- /dev/null
>>> +++ b/package/rasdaemon/Config.in
>>> @@ -0,0 +1,23 @@
>>> +config BR2_PACKAGE_RASDAEMON
>>> +    bool "rasdaemon"
>>> +    depends on !BR2_STATIC_LIBS # libtraceevent
>>> +    select BR2_PACKAGE_LIBTRACEEVENT
>>> +    select BR2_PACKAGE_SQLITE
>>> +    select BR2_PACKAGE_ARGP_STANDALONE if BR2_TOOLCHAIN_USES_UCLIBC 
>>> || BR2_TOOLCHAIN_USES_MUSL
>>> +    help
>>> +      rasdaemon is a tool that collects all hardware error events
>>> +      reported by the Linux Kernel from several sources (EDAC, MCE
>>> +      PCI, ...) into one common framework.
>>> +      See https://github.com/mchehab/rasdaemon for details.
>>> +
>>> +if BR2_PACKAGE_RASDAEMON
>>> +
>>> +config BR2_PACKAGE_RASDAEMON_AER
>>> +    bool "Enable AER support"
>>> +    default y
>>> +    select BR2_PACKAGE_PCIUTILS
>>> +    help
>>> +      Enable handling of AER (Advanced Error Reporting) events on
>>> +      PCIe
>>> +
>>> +endif
>>> diff --git a/package/rasdaemon/S95rasdaemon b/package/rasdaemon/ 
>>> S95rasdaemon
>>> new file mode 100644
>>> index 
>>> 0000000000000000000000000000000000000000..4f211f1eefb8cfe08b1150c91eb027dddf6085b9
>>> --- /dev/null
>>> +++ b/package/rasdaemon/S95rasdaemon
>>> @@ -0,0 +1,62 @@
>>> +#!/bin/sh
>>> +#
>>> +# S95rasdaemon    Starts Rasdaemon.
>>> +#
>>> +# shellcheck disable=SC2317 # functions are called via variable
>>> +
>>> +DAEMON="rasdaemon"
>>> +
>>> +start() {
>>> +    printf "Starting %s: " "$DAEMON"
>>> +
>>> +    if ! grep -q debugfs /proc/mounts ; then
>>> +        # rasdaemon fails silently if debugfs isn't mounted
>>
>> Printing that instead of a comment would be helpful, so users without 
>> debugfs know why rasdaemon fails to start.
>>
> 
> True, will do
> 
>>> +        echo "FAIL"
>>> +        return $?
>>
>> This would return the exit status of "echo", which is practically 
>> always going to be 0. "return 1" would probably be more appropriate.
>>
> 
> Indeed, thanks
> 
>>> +    fi
>>> +
>>> +    start-stop-daemon --start --exec "/usr/sbin/$DAEMON"
>>> +    status=$?
>>> +    if [ "$status" -eq 0 ]; then
>>> +        echo "OK"
>>> +    else
>>> +        echo "FAIL"
>>> +    fi
>>> +    return "$status"
>>> +}
>>> +
>>> +stop() {
>>> +    printf "Stopping %s: " "$DAEMON"
>>> +    start-stop-daemon --stop --exec "/usr/sbin/$DAEMON"
>>> +    status=$?
>>> +    if [ "$status" -eq 0 ]; then
>>> +        echo "OK"
>>> +    else
>>> +        echo "FAIL"
>>> +    fi
>>> +    # $DAEMON deletes its PID file on exit, wait for it to be gone
>>> +    while [ -f "$PIDFILE" ]; do
>>
>> The PIDFILE variable isn't defined anywhere, that can't be right. 
> 
> Indeed ...
> 
>> Generally *all* start-stop-daemon calls should use --pidfile $PIDFILE 
>> so start-stop-daemon can keep track of exact process (in addition to 
>> -- exec). Exactly how to manage the PID file depends on the behavior 
>> of the daemon, please see:
>> https://nightly.buildroot.org/#_handling_the_pid_file
> 
> Thanks for the pointer, I didn't know about the --make-pidfile option, 
> I'll use it.
Just to make sure, --pidfile and --make-pidfile are very different 
things. Generally you should always use the former, but the latter only 
if the service doesn't create a PID file on its own (and then only for 
the start operation). I'm not familiar with rasdaemon, so can't say if 
you need it. :-)

Best regards,
Fiona

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package
  2025-11-26 16:35       ` Fiona Klute via buildroot
@ 2025-11-27  7:45         ` Bastien Curutchet via buildroot
  0 siblings, 0 replies; 11+ messages in thread
From: Bastien Curutchet via buildroot @ 2025-11-27  7:45 UTC (permalink / raw)
  To: Fiona Klute, buildroot; +Cc: Thomas Petazzoni

Hi Fiona,

On 11/26/25 5:35 PM, Fiona Klute wrote:
> Am 26.11.25 um 15:46 schrieb Bastien Curutchet:
>> Hi Fiona,
>>
>> On 11/26/25 3:32 PM, Fiona Klute wrote:
>>> Hi Bastien!
>>>
>>> Am 26.11.25 um 11:20 schrieb Bastien Curutchet:
>>>> Rasdaemon is a tool that aims to replace the edac-tool and provide a 
>>>> way
>>>> to collect all hardware error events reported by the Linux kernel in a
>>>> common framework.
>>>>
>>>> Add a new package to support rasdaemon in the 'Hardware handling'
>>>> section. It depends on libtraceevents to detect the ftrace events
>>>> generated by the kernel and on sqlite to store these events.
>>>>
>>>> Support for the PCIe AER events is optionnal and implies a 
>>>> dependency on
>>>> pciutils so also add a dedicated 'sub-option' to enable it.
>>>>
>>>> Add a SYSV init script to start / stop the daemon
>>>>
>>>> Add myself to the DEVELOPERS file.
>>>>
>>>> Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
>>>> ---
>>>>   DEVELOPERS                       |  3 ++
>>>>   package/Config.in                |  1 +
>>>>   package/rasdaemon/Config.in      | 23 +++++++++++++++
>>>>   package/rasdaemon/S95rasdaemon   | 62 ++++++++++++++++++++++++++++ 
>>>> + + ++++++++++
>>>>   package/rasdaemon/rasdaemon.hash |  1 +
>>>>   package/rasdaemon/rasdaemon.mk   | 33 +++++++++++++++++++++
>>>>   6 files changed, 123 insertions(+)
>>>>
>>>> diff --git a/DEVELOPERS b/DEVELOPERS
>>>> index 
>>>> db001d6bb0707a5877c0849fa85fa736377e60dd..b1ead6d26c4e8ff160bcc7ed85b0945ac5e551dc 100644
>>>> --- a/DEVELOPERS
>>>> +++ b/DEVELOPERS
>>>> @@ -341,6 +341,9 @@ F:    package/tcpdump/
>>>>   F:    package/ti-uim/
>>>>   F:    package/uhubctl/
>>>> +N:    Bastien Curutchet <bastien.curutchet@bootlin.com>
>>>> +F:    package/rasdaemon/
>>>> +
>>>>   N:    Baxiche Su <baxiche@gmail.com>
>>>>   F:    package/qt6/qt6multimedia/
>>>> diff --git a/package/Config.in b/package/Config.in
>>>> index 
>>>> 12f327cb273526781d931b834e24d0df5024e80e..1a93cec2fa22e3a6e70acbf799b32b00d5e8b5de 100644
>>>> --- a/package/Config.in
>>>> +++ b/package/Config.in
>>>> @@ -584,6 +584,7 @@ endmenu
>>>>       source "package/pru-software-support/Config.in"
>>>>       source "package/pulseview/Config.in"
>>>>       source "package/qoriq-cadence-dp-firmware/Config.in"
>>>> +    source "package/rasdaemon/Config.in"
>>>>       source "package/raspi-gpio/Config.in"
>>>>       source "package/rdma-core/Config.in"
>>>>       source "package/read-edid/Config.in"
>>>> diff --git a/package/rasdaemon/Config.in b/package/rasdaemon/Config.in
>>>> new file mode 100644
>>>> index 
>>>> 0000000000000000000000000000000000000000..f6ceb3585ce5612ba598b182e6538a49d1adb8f8
>>>> --- /dev/null
>>>> +++ b/package/rasdaemon/Config.in
>>>> @@ -0,0 +1,23 @@
>>>> +config BR2_PACKAGE_RASDAEMON
>>>> +    bool "rasdaemon"
>>>> +    depends on !BR2_STATIC_LIBS # libtraceevent
>>>> +    select BR2_PACKAGE_LIBTRACEEVENT
>>>> +    select BR2_PACKAGE_SQLITE
>>>> +    select BR2_PACKAGE_ARGP_STANDALONE if BR2_TOOLCHAIN_USES_UCLIBC 
>>>> || BR2_TOOLCHAIN_USES_MUSL
>>>> +    help
>>>> +      rasdaemon is a tool that collects all hardware error events
>>>> +      reported by the Linux Kernel from several sources (EDAC, MCE
>>>> +      PCI, ...) into one common framework.
>>>> +      See https://github.com/mchehab/rasdaemon for details.
>>>> +
>>>> +if BR2_PACKAGE_RASDAEMON
>>>> +
>>>> +config BR2_PACKAGE_RASDAEMON_AER
>>>> +    bool "Enable AER support"
>>>> +    default y
>>>> +    select BR2_PACKAGE_PCIUTILS
>>>> +    help
>>>> +      Enable handling of AER (Advanced Error Reporting) events on
>>>> +      PCIe
>>>> +
>>>> +endif
>>>> diff --git a/package/rasdaemon/S95rasdaemon b/package/rasdaemon/ 
>>>> S95rasdaemon
>>>> new file mode 100644
>>>> index 
>>>> 0000000000000000000000000000000000000000..4f211f1eefb8cfe08b1150c91eb027dddf6085b9
>>>> --- /dev/null
>>>> +++ b/package/rasdaemon/S95rasdaemon
>>>> @@ -0,0 +1,62 @@
>>>> +#!/bin/sh
>>>> +#
>>>> +# S95rasdaemon    Starts Rasdaemon.
>>>> +#
>>>> +# shellcheck disable=SC2317 # functions are called via variable
>>>> +
>>>> +DAEMON="rasdaemon"
>>>> +
>>>> +start() {
>>>> +    printf "Starting %s: " "$DAEMON"
>>>> +
>>>> +    if ! grep -q debugfs /proc/mounts ; then
>>>> +        # rasdaemon fails silently if debugfs isn't mounted
>>>
>>> Printing that instead of a comment would be helpful, so users without 
>>> debugfs know why rasdaemon fails to start.
>>>
>>
>> True, will do
>>
>>>> +        echo "FAIL"
>>>> +        return $?
>>>
>>> This would return the exit status of "echo", which is practically 
>>> always going to be 0. "return 1" would probably be more appropriate.
>>>
>>
>> Indeed, thanks
>>
>>>> +    fi
>>>> +
>>>> +    start-stop-daemon --start --exec "/usr/sbin/$DAEMON"
>>>> +    status=$?
>>>> +    if [ "$status" -eq 0 ]; then
>>>> +        echo "OK"
>>>> +    else
>>>> +        echo "FAIL"
>>>> +    fi
>>>> +    return "$status"
>>>> +}
>>>> +
>>>> +stop() {
>>>> +    printf "Stopping %s: " "$DAEMON"
>>>> +    start-stop-daemon --stop --exec "/usr/sbin/$DAEMON"
>>>> +    status=$?
>>>> +    if [ "$status" -eq 0 ]; then
>>>> +        echo "OK"
>>>> +    else
>>>> +        echo "FAIL"
>>>> +    fi
>>>> +    # $DAEMON deletes its PID file on exit, wait for it to be gone
>>>> +    while [ -f "$PIDFILE" ]; do
>>>
>>> The PIDFILE variable isn't defined anywhere, that can't be right. 
>>
>> Indeed ...
>>
>>> Generally *all* start-stop-daemon calls should use --pidfile $PIDFILE 
>>> so start-stop-daemon can keep track of exact process (in addition to 
>>> -- exec). Exactly how to manage the PID file depends on the behavior 
>>> of the daemon, please see:
>>> https://nightly.buildroot.org/#_handling_the_pid_file
>>
>> Thanks for the pointer, I didn't know about the --make-pidfile option, 
>> I'll use it.
> Just to make sure, --pidfile and --make-pidfile are very different 
> things. Generally you should always use the former, but the latter only 
> if the service doesn't create a PID file on its own (and then only for 
> the start operation). I'm not familiar with rasdaemon, so can't say if 
> you need it. :-)
> 

Yes that was clear to me. rasdaemon doesn't create any PID file, this is why I hadn't used the --pidfile initially.

Below how the start()/stop() looks like now (I still need to work on the selftest part before sending a new iteration):

```
start() {
         printf "Starting %s: " "$DAEMON"

         if ! grep -q debugfs /proc/mounts ; then
                 echo "FAIL : debugfs is missing"
                 return 1
         fi

         start-stop-daemon --start --pidfile "$PIDFILE" --make-pidfile \
                 --exec "/usr/sbin/$DAEMON"
         status=$?
         if [ "$status" -eq 0 ]; then
                 echo "OK"
                 # rasdaemon automatically forks itself into background
                 # so the $PIDFILE created by start-stop-daemon doesn't match
                 # the final's rasdaemon PID.
                 pidof "/usr/sbin/$DAEMON" > "$PIDFILE"
         else
                 echo "FAIL"
         fi
         return "$status"
}

stop() {
         printf "Stopping %s: " "$DAEMON"
         start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON"
         status=$?
         if [ "$status" -eq 0 ]; then
                 echo "OK"
         else
                 echo "FAIL"
                 return "$status"
         fi
         while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
                 --exec "/sbin/$DAEMON"; do
                 sleep 0.1
         done
         rm -f "$PIDFILE"
         return "$status"
}

```

Best regards,
Bastien



_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-11-27  7:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-26 10:20 [Buildroot] [PATCH 0/2] package: add rasdaemon support Bastien Curutchet via buildroot
2025-11-26 10:20 ` [Buildroot] [PATCH 1/2] package/rasdaemon: Add rasdaemon package Bastien Curutchet via buildroot
2025-11-26 10:59   ` Thomas Petazzoni via buildroot
2025-11-26 14:57     ` Bastien Curutchet via buildroot
2025-11-26 14:32   ` Fiona Klute via buildroot
2025-11-26 14:46     ` Bastien Curutchet via buildroot
2025-11-26 16:35       ` Fiona Klute via buildroot
2025-11-27  7:45         ` Bastien Curutchet via buildroot
2025-11-26 10:20 ` [Buildroot] [PATCH 2/2] support/testing: add rasdaemon tests Bastien Curutchet via buildroot
2025-11-26 11:00   ` Thomas Petazzoni via buildroot
2025-11-26 14:58     ` Bastien Curutchet via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.