Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Devoogdt <thomas@devoogdt.com>
To: thomas@devoogdt.com
Cc: buildroot@buildroot.org, jorik.devreese@barco.com,
	thomas.petazzoni@bootlin.com
Subject: [Buildroot] [PATCH v7] package/sema-linux: add new unified adlink sema drivers package
Date: Thu, 27 Aug 2026 12:24:06 +0200	[thread overview]
Message-ID: <20260827102406.3088679-1-thomas.devoogdt@barco.com> (raw)
In-Reply-To: <20260827090100.3046806-1-thomas.devoogdt@barco.com>

From: Devreese Jorik <jorik.devreese@barco.com>

Add the unified sema-linux package, which replaces the archived
sema-linux-ec repository from Adlink. This unified upstream repository
provides support for both BMC (Board Management Controller) and EC
(Embedded Controller) devices.

Signed-off-by: Devreese Jorik <jorik.devreese@barco.com>
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
---
v2: reworked patch
 - added user sw step
 - fixed help text
 - fixed hash and license info
v3: fixed build args
v4: fix missing util-linux dependency
v5: reworked patch
 - fix parallel build
 - add and use app_build/app_install
v6: rework to use sema-linux as sema-linux-ec was archived
v7: fix wrong hash entry
---
 package/Config.in                             |  1 +
 ...CC-variable-instead-of-hardcoded-gcc.patch | 54 +++++++++++++++++++
 ...ure-that-lsema-is-always-built-first.patch | 32 +++++++++++
 ...3-Makefile-add-cross-install-support.patch | 38 +++++++++++++
 ...file-add-a-separate-app_build-target.patch | 42 +++++++++++++++
 package/sema-linux/Config.in                  | 14 +++++
 package/sema-linux/sema-linux.hash            |  5 ++
 package/sema-linux/sema-linux.mk              | 34 ++++++++++++
 8 files changed, 220 insertions(+)
 create mode 100644 package/sema-linux/0001-Makefile-use-CC-variable-instead-of-hardcoded-gcc.patch
 create mode 100644 package/sema-linux/0002-Makefile-ensure-that-lsema-is-always-built-first.patch
 create mode 100644 package/sema-linux/0003-Makefile-add-cross-install-support.patch
 create mode 100644 package/sema-linux/0004-Makefile-add-a-separate-app_build-target.patch
 create mode 100644 package/sema-linux/Config.in
 create mode 100644 package/sema-linux/sema-linux.hash
 create mode 100644 package/sema-linux/sema-linux.mk

diff --git a/package/Config.in b/package/Config.in
index 6058800682..b0793ed6cf 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -609,6 +609,7 @@ endmenu
 	source "package/sane-backends/Config.in"
 	source "package/sdparm/Config.in"
 	source "package/sedutil/Config.in"
+	source "package/sema-linux/Config.in"
 	source "package/setserial/Config.in"
 	source "package/sg3_utils/Config.in"
 	source "package/sigrok-cli/Config.in"
diff --git a/package/sema-linux/0001-Makefile-use-CC-variable-instead-of-hardcoded-gcc.patch b/package/sema-linux/0001-Makefile-use-CC-variable-instead-of-hardcoded-gcc.patch
new file mode 100644
index 0000000000..f9b454eef5
--- /dev/null
+++ b/package/sema-linux/0001-Makefile-use-CC-variable-instead-of-hardcoded-gcc.patch
@@ -0,0 +1,54 @@
+From 6492dcc89737799b39555fdcb79e7254332fe2f4 Mon Sep 17 00:00:00 2001
+From: Devreese Jorik <jorik.devreese@barco.com>
+Date: Mon, 19 Jan 2026 15:00:00 +0000
+Subject: [PATCH] Makefile: use CC variable instead of hardcoded gcc
+
+Allow the compiler to be overridden via the CC variable for
+cross-compilation support.
+
+Upstream: https://github.com/ADLINK/sema-linux/pull/2
+Signed-off-by: Devreese Jorik <jorik.devreese@barco.com>
+Signed-off-by: Hendrik De Vloed <hendrik.devloed@dekimo.com>
+Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
+---
+ Makefile | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 1c4274d..cfad0c7 100755
+--- a/Makefile
++++ b/Makefile
+@@ -20,7 +20,7 @@ all: libsema.so semautil wdogtest modules
+ driver: modules
+ 
+ libsema.so: $(SEMA_OBJS)
+-	@gcc -shared -fPIC -g -o lib/$@ $^
++	@$(CC) -shared -fPIC -g -o lib/$@ $^
+ 
+ modules:
+ 	@make -C /lib/modules/`uname -r`/build M=`pwd` $@
+@@ -52,16 +52,16 @@ app_clean:
+ 	@rm -f semautil wdogtest app/*.o lib/*.o lib/*.so
+ 
+ semautil: $(APP_OBJS)
+-	@gcc -g -o $@ $^ -Llib -lsema -luuid
++	@$(CC) -g -o $@ $^ -Llib -lsema -luuid
+ 
+ wdogtest: $(WDOG_OBJS)
+-	@gcc $^ -g -o $@
++	@$(CC) $^ -g -o $@
+ 
+ lib/%.o: lib/%.c
+-	@gcc -Wall -I lib -g -fPIC -c $< -o $@
++	@$(CC) -Wall -I lib -g -fPIC -c $< -o $@
+ 
+ app/%.o: app/%.c
+-	@gcc -Wall -I lib -g -fPIC -c $< -o $@
++	@$(CC) -Wall -I lib -g -fPIC -c $< -o $@
+ 
+ watchdogtest/%.o: watchdogtest/%.c
+-	@gcc -Wall -I lib -g -fPIC -c $< -o $@
++	@$(CC) -Wall -I lib -g -fPIC -c $< -o $@
+-- 
+2.43.0
+
diff --git a/package/sema-linux/0002-Makefile-ensure-that-lsema-is-always-built-first.patch b/package/sema-linux/0002-Makefile-ensure-that-lsema-is-always-built-first.patch
new file mode 100644
index 0000000000..d278b30b06
--- /dev/null
+++ b/package/sema-linux/0002-Makefile-ensure-that-lsema-is-always-built-first.patch
@@ -0,0 +1,32 @@
+From 2f1e58beeee7aedd1000f85e5f3a63766d131bc5 Mon Sep 17 00:00:00 2001
+From: Thomas Devoogdt <thomas.devoogdt@barco.com>
+Date: Tue, 10 Mar 2026 09:08:05 +0100
+Subject: [PATCH] Makefile: ensure that -lsema is always built first
+
+When using parallel builds, there is no guarantee that libsema.so
+is built first.
+
+Upstream: https://github.com/ADLINK/sema-linux/pull/2
+Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
+---
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index cfad0c7..37926e1 100755
+--- a/Makefile
++++ b/Makefile
+@@ -51,8 +51,8 @@ driver_clean:
+ app_clean:
+ 	@rm -f semautil wdogtest app/*.o lib/*.o lib/*.so
+ 
+-semautil: $(APP_OBJS)
+-	@$(CC) -g -o $@ $^ -Llib -lsema -luuid
++semautil: libsema.so $(APP_OBJS)
++	@$(CC) -g -o $@ $(APP_OBJS) -Llib -lsema -luuid
+ 
+ wdogtest: $(WDOG_OBJS)
+ 	@$(CC) $^ -g -o $@
+-- 
+2.43.0
+
diff --git a/package/sema-linux/0003-Makefile-add-cross-install-support.patch b/package/sema-linux/0003-Makefile-add-cross-install-support.patch
new file mode 100644
index 0000000000..0e84e9cbb6
--- /dev/null
+++ b/package/sema-linux/0003-Makefile-add-cross-install-support.patch
@@ -0,0 +1,38 @@
+From dcd82a06551ade5c7dd85c3dbb472bd3593602ef Mon Sep 17 00:00:00 2001
+From: Thomas Devoogdt <thomas.devoogdt@barco.com>
+Date: Tue, 10 Mar 2026 09:09:59 +0100
+Subject: [PATCH] Makefile: add cross install support
+
+Add support to override the DESTDIR & PREFIX.
+
+Upstream: https://github.com/ADLINK/sema-linux/pull/2
+Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
+---
+ Makefile | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 37926e1..1432e0d 100755
+--- a/Makefile
++++ b/Makefile
+@@ -1,3 +1,5 @@
++DESTDIR ?=
++PREFIX ?= /usr
+ 
+ SEMA_OBJS = $(patsubst %.c,%.o,$(wildcard lib/*.c))
+ WDOG_OBJS = $(patsubst %.c,%.o,$(wildcard watchdogtest/*.c))
+@@ -38,8 +40,9 @@ driver_install:
+ 	@depmod -a
+ 
+ app_install:
+-	@cp lib/libsema.so /usr/lib
+-	@cp wdogtest semautil /usr/bin
++	@install -d $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/bin
++	@install -m 755 lib/libsema.so $(DESTDIR)$(PREFIX)/lib
++	@install -m 755 wdogtest semautil $(DESTDIR)$(PREFIX)/bin
+ 
+ driver_clean:
+ 	@make -C /lib/modules/`uname -r`/build M=`pwd` clean
+-- 
+2.43.0
+
diff --git a/package/sema-linux/0004-Makefile-add-a-separate-app_build-target.patch b/package/sema-linux/0004-Makefile-add-a-separate-app_build-target.patch
new file mode 100644
index 0000000000..346d31a75d
--- /dev/null
+++ b/package/sema-linux/0004-Makefile-add-a-separate-app_build-target.patch
@@ -0,0 +1,42 @@
+From 6c7f7a88357c291780236738fabf82229d2598c5 Mon Sep 17 00:00:00 2001
+From: Thomas Devoogdt <thomas.devoogdt@barco.com>
+Date: Tue, 10 Mar 2026 09:25:07 +0100
+Subject: [PATCH] Makefile: add a separate app_build target
+
+By this, there is:
+ - app_build
+ - app_install
+ - app_clean
+
+This makes compilation of the app-only a bit easier to maintain.
+
+Upstream: https://github.com/ADLINK/sema-linux/pull/2
+Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
+---
+ Makefile | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 1432e0d..ee8089d 100755
+--- a/Makefile
++++ b/Makefile
+@@ -17,13 +17,15 @@ obj-m := driver/adl-bmc.o \
+ 
+ adl-bmc-nvmem-sec-m := driver/adl-bmc-nvmem-sec.o driver/nvmem-common.o	 
+ adl-bmc-nvmem-m := driver/adl-bmc-nvmem.o driver/nvmem-common.o	 
+-all: libsema.so semautil wdogtest modules
++all: app_build modules
+ 
+ driver: modules
+ 
+ libsema.so: $(SEMA_OBJS)
+ 	@$(CC) -shared -fPIC -g -o lib/$@ $^
+ 
++app_build: libsema.so semautil wdogtest
++
+ modules:
+ 	@make -C /lib/modules/`uname -r`/build M=`pwd` $@
+ 
+-- 
+2.43.0
+
diff --git a/package/sema-linux/Config.in b/package/sema-linux/Config.in
new file mode 100644
index 0000000000..04a1448444
--- /dev/null
+++ b/package/sema-linux/Config.in
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_SEMA_LINUX
+	bool "sema-linux"
+	depends on !BR2_s390x
+	depends on BR2_LINUX_KERNEL
+	select BR2_PACKAGE_UTIL_LINUX
+	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
+	help
+	  SEMA (Smart Embedded Management Agent) is an agent used to
+	  manage system health and access the I/O pins through an API.
+
+	  https://github.com/ADLINK/sema-linux
+
+comment "sema-linux needs a toolchain w/ dynamic library, Linux kernel"
+	depends on BR2_STATIC_LIBS || !BR2_LINUX_KERNEL
diff --git a/package/sema-linux/sema-linux.hash b/package/sema-linux/sema-linux.hash
new file mode 100644
index 0000000000..20e4d74995
--- /dev/null
+++ b/package/sema-linux/sema-linux.hash
@@ -0,0 +1,5 @@
+# locally computed
+sha256  fe67c77b12db6db02e2c745dce79085b5fc16be2dabd3eedda625d53ccbd5b26  sema-linux-v4.4.3.tar.gz
+sha256  71be2577bc5028f0e15bb170439878b61593967460e88e0d26a889430a32db00  LICENSE.BSD3
+sha256  d8c320ffc0030d1b096ae4732b50d2b811cf95e9a9b7377c1127b2563e0a0388  LICENSE.GPLv2
+sha256  f484be998be05569aa68e5afb1d29a37cbe2cc7947aea66df83bab7bbdfd74f3  LICENSE.dual
diff --git a/package/sema-linux/sema-linux.mk b/package/sema-linux/sema-linux.mk
new file mode 100644
index 0000000000..daabd8b8c0
--- /dev/null
+++ b/package/sema-linux/sema-linux.mk
@@ -0,0 +1,34 @@
+################################################################################
+#
+# sema-linux
+#
+################################################################################
+
+SEMA_LINUX_VERSION = v4.4.3
+SEMA_LINUX_SITE = $(call github,ADLINK,sema-linux,$(SEMA_LINUX_VERSION))
+SEMA_LINUX_LICENSE = BSD-3-Clause or GPL-2.0
+SEMA_LINUX_LICENSE_FILES = LICENSE.BSD3 LICENSE.GPLv2 LICENSE.dual
+SEMA_LINUX_DEPENDENCIES = util-linux
+
+define SEMA_LINUX_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) app_build
+endef
+
+define SEMA_LINUX_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) app_install
+endef
+
+define SEMA_LINUX_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BACKLIGHT_CLASS_DEVICE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_GPIO_SYSFS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_GPIOLIB)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HWMON)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_I2C)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_I2C_BOARDINFO)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NVMEM)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_WATCHDOG)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_WATCHDOG_CORE)
+endef
+
+$(eval $(kernel-module))
+$(eval $(generic-package))
-- 
2.43.0

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

      reply	other threads:[~2026-08-27 10:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23 22:14 [Buildroot] [PATCH] package/sema-linux-ec: add ADLINK sema drivers package Thomas Devoogdt
2026-03-09  7:51 ` [Buildroot] [PATCH v2] package/sema-linux-ec: add new adlink " Thomas Devoogdt
2026-03-09 15:57   ` [Buildroot] [PATCH v3] " Thomas Devoogdt
2026-03-09 21:10     ` [Buildroot] [PATCH v4] " Thomas Devoogdt
2026-03-10  9:09       ` [Buildroot] [PATCH v5] " Thomas Devoogdt
2026-08-27  9:01         ` [Buildroot] [PATCH v6] package/sema-linux: add new unified " Thomas Devoogdt
2026-08-27 10:24           ` Thomas Devoogdt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260827102406.3088679-1-thomas.devoogdt@barco.com \
    --to=thomas@devoogdt.com \
    --cc=buildroot@buildroot.org \
    --cc=jorik.devreese@barco.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox