Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/cfm: new package
@ 2021-12-12 13:07 Horatiu Vultur via buildroot
  2021-12-26 23:14 ` Thomas Petazzoni
  2025-12-16  8:39 ` Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 4+ messages in thread
From: Horatiu Vultur via buildroot @ 2021-12-12 13:07 UTC (permalink / raw)
  To: buildroot; +Cc: Samuel Martin, Horatiu Vultur

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 DEVELOPERS              |  1 +
 package/Config.in       |  1 +
 package/cfm/Config.in   | 17 +++++++++++++
 package/cfm/S65cfm      | 55 +++++++++++++++++++++++++++++++++++++++++
 package/cfm/cfm.hash    |  3 +++
 package/cfm/cfm.mk      | 23 +++++++++++++++++
 package/cfm/cfm.service | 10 ++++++++
 7 files changed, 110 insertions(+)
 create mode 100644 package/cfm/Config.in
 create mode 100644 package/cfm/S65cfm
 create mode 100644 package/cfm/cfm.hash
 create mode 100644 package/cfm/cfm.mk
 create mode 100644 package/cfm/cfm.service

diff --git a/DEVELOPERS b/DEVELOPERS
index 3023526427..f77d473df4 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1169,6 +1169,7 @@ F:	package/squeezelite/
 N:	Horatiu Vultur <horatiu.vultur@microchip.com>
 F:	package/easyframes/
 F:	package/mrp/
+F:	package/cfm/
 
 N:	Ian Haylock <haylocki@yahoo.co.uk>
 F:	package/python-rpi-gpio/
diff --git a/package/Config.in b/package/Config.in
index a73e1fb38f..0a5a96afc3 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2140,6 +2140,7 @@ menu "Networking applications"
 	source "package/can-utils/Config.in"
 	source "package/cannelloni/Config.in"
 	source "package/casync/Config.in"
+	source "package/cfm/Config.in"
 	source "package/chrony/Config.in"
 	source "package/civetweb/Config.in"
 	source "package/connman/Config.in"
diff --git a/package/cfm/Config.in b/package/cfm/Config.in
new file mode 100644
index 0000000000..1c2e92be67
--- /dev/null
+++ b/package/cfm/Config.in
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_CFM
+	bool "cfm"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_0
+	select BR2_PACKAGE_LIBEV
+	select BR2_PACKAGE_LIBMNL
+	select BR2_PACKAGE_LIBNL
+	help
+	  This is the userspace application that configures the kernel
+	  to run CFM protocol. The userspace application is made of 2
+	  applications, one daemon and a client.
+
+	  https://github.com/microchip-ung/cfm
+
+comment "cfm needs a toolchain w/ threads, kernel headers >= 5.0"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS \
+		|| !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_0
diff --git a/package/cfm/S65cfm b/package/cfm/S65cfm
new file mode 100644
index 0000000000..1019268608
--- /dev/null
+++ b/package/cfm/S65cfm
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Start cfm
+#
+
+DAEMON="cfm_server"
+
+PIDFILE="/var/run/$DAEMON.pid"
+
+# shellcheck source=/dev/null
+[ -r "/etc/default/cfm_server" ] && . "/etc/default/cfm_server"
+
+start() {
+	printf "Starting cfm daemon: "
+	start-stop-daemon -S -b -q -m -p $PIDFILE \
+		-x /usr/bin/$DAEMON
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return $status
+}
+
+stop() {
+	printf "Stopping cfm daemon: "
+	start-stop-daemon -K -q -p $PIDFILE
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		rm -f "$PIDFILE"
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return $status
+}
+
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart|reload)
+	stop
+	start
+	;;
+  *)
+	echo "Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
diff --git a/package/cfm/cfm.hash b/package/cfm/cfm.hash
new file mode 100644
index 0000000000..a1805d81be
--- /dev/null
+++ b/package/cfm/cfm.hash
@@ -0,0 +1,3 @@
+# locally calculated
+sha256  b5ce096e8c496c397d108201f1a46855f735da6c4163b7a9af345916e75a7126  cfm-0.3.tar.gz
+sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  LICENSE
diff --git a/package/cfm/cfm.mk b/package/cfm/cfm.mk
new file mode 100644
index 0000000000..a998bb11ca
--- /dev/null
+++ b/package/cfm/cfm.mk
@@ -0,0 +1,23 @@
+################################################################################
+#
+# cfm
+#
+################################################################################
+
+CFM_VERSION = 0.3
+CFM_SITE = $(call github,microchip-ung,cfm,v$(CFM_VERSION))
+CFM_DEPENDENCIES = libev libmnl libnl
+CFM_LICENSE = GPL-2.0
+CFM_LICENSE_FILES = LICENSE
+
+define CFM_INSTALL_INIT_SYSV
+	$(INSTALL) -m 755 -D $(CFM_PKGDIR)/S65cfm \
+		$(TARGET_DIR)/etc/init.d/S65cfm
+endef
+
+define CFM_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 $(CFM_PKGDIR)/cfm.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/cfm.service
+endef
+
+$(eval $(cmake-package))
diff --git a/package/cfm/cfm.service b/package/cfm/cfm.service
new file mode 100644
index 0000000000..1a00c5ba08
--- /dev/null
+++ b/package/cfm/cfm.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Connectivity Fault Management
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/cfm_server
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
-- 
2.33.0

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

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

end of thread, other threads:[~2026-01-05  8:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-12 13:07 [Buildroot] [PATCH] package/cfm: new package Horatiu Vultur via buildroot
2021-12-26 23:14 ` Thomas Petazzoni
2025-12-16  8:39 ` Thomas Petazzoni via buildroot
2026-01-05  8:23   ` Horatiu Vultur via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox