Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
To: buildroot@buildroot.org
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>,
	James Hilliard <james.hilliard1@gmail.com>,
	Angelo Compagnucci <angelo.compagnucci@gmail.com>
Subject: [Buildroot] [PATCH v3] package/swupdate: add embedded lua handler config option
Date: Sat, 21 Nov 2026 17:50:37 +0100	[thread overview]
Message-ID: <20261121165037.2913283-1-angelo.compagnucci@gmail.com> (raw)
In-Reply-To: <20230919042236.557974-1-james.hilliard1@gmail.com>

From: James Hilliard <james.hilliard1@gmail.com>

We are able to configure most swupdate options using a swupdate
config file, however the embedded lua source option may need to point
to a buildroot generated source path.

To simplify configuration of this swupdate option add a buildroot
config option which will pass a source file path to swupdate when
enabled in buildroot. We also need a config option to enable this
feature in swupdate which the source file path config option will
depend on.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Co-authored-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
Changes v2 -> v3:
  - do not enable CONFIG_HANDLER_IN_LUA: swupdate removed it, and the
    embedded handler now only needs CONFIG_LUA
  - do not enable CONFIG_LUASCRIPTHANDLER: the Lua script handler is
    another feature, not needed by the embedded handler
  - strip the quotes of the source path with qstrip
  - help text: say to use an absolute path, as swupdate looks for a
    relative path in its own source tree
  - rebase on master (swupdate 2026.05.1)

Changes v1 -> v2:
  - pass path via make opts instead of kconfig

Supersedes v2: https://patchwork.buildroot.org/project/buildroot/patch/20230919042236.557974-1-james.hilliard1@gmail.com/

 package/swupdate/Config.in   | 15 +++++++++++++++
 package/swupdate/swupdate.mk | 21 +++++++++++++++------
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/package/swupdate/Config.in b/package/swupdate/Config.in
index 112e53a127..0ad32950ed 100644
--- a/package/swupdate/Config.in
+++ b/package/swupdate/Config.in
@@ -60,6 +60,21 @@ config BR2_PACKAGE_SWUPDATE_CONFIG
 	  I you wish to use your own modified swupdate configuration
 	  file specify the config file location with this option.
 
+config BR2_PACKAGE_SWUPDATE_EMBEDDED_LUA_HANDLER
+	bool "swupdate embedded lua handler"
+	depends on BR2_PACKAGE_HAS_LUAINTERPRETER
+	help
+	  Enable the embedded lua handler.
+
+config BR2_PACKAGE_SWUPDATE_EMBEDDED_LUA_HANDLER_SOURCE
+	string "swupdate embedded lua handler source"
+	depends on BR2_PACKAGE_SWUPDATE_EMBEDDED_LUA_HANDLER
+	help
+	  Path to the Lua handler source file to embed in the
+	  swupdate binary. Use an absolute path, for example in a
+	  br2-external:
+	  $(BR2_EXTERNAL_<NAME>_PATH)/swupdate_handlers.lua
+
 config BR2_PACKAGE_SWUPDATE_USB
 	bool "swupdate usb"
 	depends on BR2_PACKAGE_SYSTEMD
diff --git a/package/swupdate/swupdate.mk b/package/swupdate/swupdate.mk
index 2384dea33a..def4248fbd 100644
--- a/package/swupdate/swupdate.mk
+++ b/package/swupdate/swupdate.mk
@@ -28,6 +28,12 @@ SWUPDATE_MAKE_ENV = CC="$(TARGET_CC)" LD="$(TARGET_CC)" SKIP_STRIP=y
 # we don't package EFI Boot Guard/libebgenv
 SWUPDATE_MAKE_ENV += HAVE_LIBEBGENV=n
 
+SWUPDATE_MAKE_OPTS = \
+	SWU_VER="$(SWUPDATE_VERSION) (Buildroot $(BR2_VERSION_FULL))" \
+	CROSS_COMPILE="$(TARGET_CROSS)" \
+	CONFIG_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
+	CONFIG_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)"
+
 # swupdate bundles its own version of mongoose (version 6.16)
 
 ifeq ($(BR2_PACKAGE_E2FSPROGS),y)
@@ -103,6 +109,14 @@ define SWUPDATE_SET_LUA_VERSION
 	$(call KCONFIG_SET_OPT,CONFIG_LUAPKG,$(BR2_PACKAGE_PROVIDES_LUAINTERPRETER))
 endef
 SWUPDATE_MAKE_ENV += HAVE_LUA=y
+ifeq ($(BR2_PACKAGE_SWUPDATE_EMBEDDED_LUA_HANDLER),y)
+define SWUPDATE_SET_EMBEDDED_LUA
+	$(call KCONFIG_ENABLE_OPT,CONFIG_LUA)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_EMBEDDED_LUA_HANDLER)
+endef
+SWUPDATE_MAKE_OPTS += \
+	CONFIG_EMBEDDED_LUA_HANDLER_SOURCE="$(call qstrip,$(BR2_PACKAGE_SWUPDATE_EMBEDDED_LUA_HANDLER_SOURCE))"
+endif
 else
 SWUPDATE_MAKE_ENV += HAVE_LUA=n
 endif
@@ -205,14 +219,9 @@ endif
 SWUPDATE_KCONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_SWUPDATE_CONFIG))
 SWUPDATE_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
 
-SWUPDATE_MAKE_OPTS = \
-	SWU_VER="$(SWUPDATE_VERSION) (Buildroot $(BR2_VERSION_FULL))" \
-	CROSS_COMPILE="$(TARGET_CROSS)" \
-	CONFIG_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
-	CONFIG_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)"
-
 define SWUPDATE_KCONFIG_FIXUP_CMDS
 	$(SWUPDATE_SET_LUA_VERSION)
+	$(SWUPDATE_SET_EMBEDDED_LUA)
 	$(SWUPDATE_SET_SYSTEMD)
 	$(SWUPDATE_SET_WEBSERVER)
 endef
-- 
2.53.0

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

      reply	other threads:[~2026-11-21 16:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19  4:22 [Buildroot] [PATCH v2 1/1] package/swupdate: add embedded lua handler config option James Hilliard
2026-11-21 16:50 ` Angelo Compagnucci [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=20261121165037.2913283-1-angelo.compagnucci@gmail.com \
    --to=angelo.compagnucci@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=james.hilliard1@gmail.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