Parcourir la source

package/rasdaemon: new package

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

This commit adds a new package to support rasdaemon in the 'Hardware
handling' section. It depends on libtraceevent to detect the ftrace
events generated by the kernel. There is currently a build issue when
sqlite isn't availaible while it's supposed to be an optional
dependency. This build issue is fixed by patch 0001 (which has been
also submitted to the rasdaemon project itself).

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.

Reviewed-by: Fiona Klute <fiona.klute@gmx.de>
Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Bastien Curutchet il y a 3 semaines
Parent
commit
7b8892e900

+ 3 - 0
DEVELOPERS

@@ -344,6 +344,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/
 

+ 1 - 0
package/Config.in

@@ -581,6 +581,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"

+ 46 - 0
package/rasdaemon/0001-rasdaemon-fix-build-when-sqlite-isn-t-enabled.patch

@@ -0,0 +1,46 @@
+From 8eaf25c30554c7cc457406ce5895b8087904cb2b Mon Sep 17 00:00:00 2001
+From: Bastien Curutchet <bastien.curutchet@bootlin.com>
+Date: Wed, 17 Dec 2025 11:38:52 +0100
+Subject: [PATCH] rasdaemon: fix build when sqlite isn't enabled
+
+Build without SQLite enabled through --enable-sqlite3 still fails if
+sqlite isn't available:
+>   CC       rasdaemon-rasdaemon.o
+> In file included from rasdaemon.c:17:
+> ras-record.h:11:10: fatal error: sqlite3.h: No such file or directory
+>    11 | #include <sqlite3.h>
+>       |          ^~~~~~~~~~~
+> compilation terminated.
+
+Include the sqlite header only if the SQLite feature is enabled.
+
+Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
+Upstream: https://github.com/mchehab/rasdaemon/pull/234
+---
+ ras-record.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/ras-record.h b/ras-record.h
+index 21edcd6..cb03f4e 100644
+--- a/ras-record.h
++++ b/ras-record.h
+@@ -8,7 +8,6 @@
+ #ifndef __RAS_RECORD_H
+ #define __RAS_RECORD_H
+ 
+-#include <sqlite3.h>
+ #include <fcntl.h>
+ #include <stdbool.h>
+ #include <stdint.h>
+@@ -320,6 +319,8 @@ struct ras_cxl_memory_sparing_event;
+ 
+ #ifdef HAVE_SQLITE3
+ 
++#include <sqlite3.h>
++
+ struct sqlite3_priv {
+ 	sqlite3		*db;
+ 	sqlite3_stmt	*stmt_mc_event;
+-- 
+2.52.0
+

+ 26 - 0
package/rasdaemon/Config.in

@@ -0,0 +1,26 @@
+config BR2_PACKAGE_RASDAEMON
+	bool "rasdaemon"
+	depends on !BR2_STATIC_LIBS # libtraceevent
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	select BR2_PACKAGE_LIBTRACEEVENT
+	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.
+
+	  https://github.com/mchehab/rasdaemon
+
+if BR2_PACKAGE_RASDAEMON
+
+config BR2_PACKAGE_RASDAEMON_AER
+	bool "Enable AER support"
+	select BR2_PACKAGE_PCIUTILS
+	help
+	  Enable handling of AER (Advanced Error Reporting) events on
+	  PCIe
+
+endif
+
+comment "rasdaemon needs a toolchain w/ threads, dynamic library"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS

+ 63 - 0
package/rasdaemon/S95rasdaemon

@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# S95rasdaemon	Starts Rasdaemon.
+#
+# shellcheck disable=SC2317 # functions are called via variable
+
+DAEMON="rasdaemon"
+PIDFILE="/var/run/$DAEMON.pid"
+
+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 \
+		--background --exec "/usr/sbin/$DAEMON" -- -f
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	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"
+}
+
+restart() {
+	stop
+	start
+}
+
+reload() {
+	restart
+}
+
+case "$1" in
+	start|stop|reload|restart)
+		"$1"
+		;;
+	*)
+		echo "Usage: $0 {start|stop|reload|restart}"
+		exit 1
+esac

+ 3 - 0
package/rasdaemon/rasdaemon.hash

@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  7e12459f9477036491ac2b1e4c07cc3e8efea6dcd30525a263ab1f83910b773a  rasdaemon-0.8.4.tar.gz
+sha256  39bc367cd7cd291d217447632b28a74be414a52b142b1875ac8789184aeca7b2  COPYING

+ 40 - 0
package/rasdaemon/rasdaemon.mk

@@ -0,0 +1,40 @@
+################################################################################
+#
+# 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
+# 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_SQLITE),y)
+RASDAEMON_CONF_OPTS += --enable-sqlite3
+RASDAEMON_DEPENDENCIES += sqlite
+else
+RASDAEMON_CONF_OPTS += --disable-sqlite3
+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))