Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Opaniuk via buildroot <buildroot@buildroot.org>
To: buildroot@buildroot.org
Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr>,
	Fiona Klute <fiona.klute@gmx.de>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Sumit Garg <sumit.garg@oss.qualcomm.com>,
	Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>,
	Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Subject: [Buildroot] [PATCH 3/3] package/tqftpserv: new package
Date: Tue, 20 Oct 2026 10:07:47 +0200	[thread overview]
Message-ID: <20261020-qcom-modem-userspace-v1-3-da720723d9ef@oss.qualcomm.com> (raw)
In-Reply-To: <20261020-qcom-modem-userspace-v1-0-da720723d9ef@oss.qualcomm.com>

tqftpserv is a TFTP server over QRTR: the modem of Qualcomm SoCs fetches
files from Linux through it, e.g. the WLAN firmware (wlanmdsp.mbn) on
SoCs whose WLAN firmware runs on the modem. Files are looked up next to
the remoteproc firmware under /lib/firmware; xz and zstd compressed
files are handled when those libraries are enabled.

The systemd units are installed only with systemd as init; a sysv init
script is provided otherwise.

The patch defines _GNU_SOURCE in translate.c, which calls asprintf():
uClibc-ng declares it only then, so the build failed there (test-pkg,
bootlin-armv5-uclibc). Submitted upstream as well.

Tested on an Arduino UNO Q (Qualcomm QRB2210): the modem fetches
wlanmdsp.mbn through it and the ath10k WLAN interface comes up.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
---
 DEVELOPERS                                         |  1 +
 package/Config.in                                  |  1 +
 ...translate-define-_GNU_SOURCE-for-asprintf.patch | 36 +++++++++++++++
 package/tqftpserv/Config.in                        | 14 ++++++
 package/tqftpserv/S44tqftpserv                     | 51 ++++++++++++++++++++++
 package/tqftpserv/tqftpserv.hash                   |  3 ++
 package/tqftpserv/tqftpserv.mk                     | 32 ++++++++++++++
 7 files changed, 138 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index dc0c8f35eb..2d3e525f20 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1497,6 +1497,7 @@ F:	toolchain/toolchain-bare-metal-buildroot/
 N:	Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
 F:	package/qrtr/
 F:	package/rmtfs/
+F:	package/tqftpserv/
 
 N:	Ilias Apalodimas <apalos@gmail.com>
 F:	package/keepalived/
diff --git a/package/Config.in b/package/Config.in
index eb8cf851df..4b90333bf7 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -638,6 +638,7 @@ endmenu
 	source "package/ti-uim/Config.in"
 	source "package/ti-utils/Config.in"
 	source "package/tio/Config.in"
+	source "package/tqftpserv/Config.in"
 	source "package/triggerhappy/Config.in"
 	source "package/uboot-bootcount/Config.in"
 	source "package/uboot-tools/Config.in"
diff --git a/package/tqftpserv/0001-translate-define-_GNU_SOURCE-for-asprintf.patch b/package/tqftpserv/0001-translate-define-_GNU_SOURCE-for-asprintf.patch
new file mode 100644
index 0000000000..06829ed9be
--- /dev/null
+++ b/package/tqftpserv/0001-translate-define-_GNU_SOURCE-for-asprintf.patch
@@ -0,0 +1,36 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
+Date: Mon, 19 Oct 2026 22:02:59 +0200
+Subject: [PATCH] translate: define _GNU_SOURCE for asprintf()
+
+asprintf() is a GNU extension. glibc and musl declare it in their
+default mode, uClibc-ng only with _GNU_SOURCE, so with uClibc-ng
+translate.c fails to build (an error with GCC 14 and later):
+
+  translate.c:298:15: error: implicit declaration of function 'asprintf'
+
+Define _GNU_SOURCE before the includes, as xz-decompress.c and
+zstd-decompress.c already do.
+
+Assisted-by: Claude:claude-opus-5-5
+Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
+Upstream: https://github.com/linux-msm/tqftpserv/pull/56
+---
+ translate.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/translate.c b/translate.c
+index 246b82d..19fdd48 100644
+--- a/translate.c
++++ b/translate.c
+@@ -2,6 +2,7 @@
+ /*
+  * Copyright (c) 2019, Linaro Ltd.
+  */
++#define _GNU_SOURCE /* asprintf() */
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <dirent.h>
+-- 
+2.53.0
+
diff --git a/package/tqftpserv/Config.in b/package/tqftpserv/Config.in
new file mode 100644
index 0000000000..e1acb03225
--- /dev/null
+++ b/package/tqftpserv/Config.in
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_TQFTPSERV
+	bool "tqftpserv"
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15 # qrtr
+	select BR2_PACKAGE_QRTR
+	help
+	  TFTP server over QRTR for the remote processors of Qualcomm
+	  SoCs: hands the modem the files it asks for, e.g. the WLAN
+	  firmware, from /lib/firmware. Serves xz or zstd compressed
+	  files when xz or zstd is enabled.
+
+	  https://github.com/linux-msm/tqftpserv
+
+comment "tqftpserv needs a toolchain w/ headers >= 4.15"
+	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15
diff --git a/package/tqftpserv/S44tqftpserv b/package/tqftpserv/S44tqftpserv
new file mode 100644
index 0000000000..c719cadd49
--- /dev/null
+++ b/package/tqftpserv/S44tqftpserv
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+DAEMON="tqftpserv"
+PIDFILE="/var/run/$DAEMON.pid"
+TQFTPSERV_ARGS=""
+
+# shellcheck disable=SC1090
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
+
+start() {
+	printf 'Starting %s: ' "$DAEMON"
+	# shellcheck disable=SC2086 # we need the word splitting
+	start-stop-daemon -S -q -b -m -p "$PIDFILE" -x "/usr/bin/$DAEMON" \
+		-- $TQFTPSERV_ARGS
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+stop() {
+	printf 'Stopping %s: ' "$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"
+}
+
+restart() {
+	stop
+	sleep 1
+	start
+}
+
+case "$1" in
+start|stop|restart)
+	"$1";;
+reload)
+	restart;;
+*)
+	echo "Usage: $0 {start|stop|restart|reload}"
+	exit 1
+esac
diff --git a/package/tqftpserv/tqftpserv.hash b/package/tqftpserv/tqftpserv.hash
new file mode 100644
index 0000000000..d7660df608
--- /dev/null
+++ b/package/tqftpserv/tqftpserv.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  87a3845e8f47b42f31d8aaad04c5e0707e391b3954d096aeff6f0a03467dc33f  tqftpserv-1.3.tar.gz
+sha256  a6d7cc7891d16f9c74c9a9c2514805e59bb8758db7690bb7ae065c79cec9515a  LICENSE
diff --git a/package/tqftpserv/tqftpserv.mk b/package/tqftpserv/tqftpserv.mk
new file mode 100644
index 0000000000..a8a6220bb0
--- /dev/null
+++ b/package/tqftpserv/tqftpserv.mk
@@ -0,0 +1,32 @@
+################################################################################
+#
+# tqftpserv
+#
+################################################################################
+
+TQFTPSERV_VERSION = 1.3
+TQFTPSERV_SITE = $(call github,linux-msm,tqftpserv,v$(TQFTPSERV_VERSION))
+TQFTPSERV_LICENSE = BSD-3-Clause
+TQFTPSERV_LICENSE_FILES = LICENSE
+TQFTPSERV_DEPENDENCIES = qrtr
+
+ifeq ($(BR2_PACKAGE_XZ),y)
+TQFTPSERV_DEPENDENCIES += xz
+endif
+
+ifeq ($(BR2_PACKAGE_ZSTD),y)
+TQFTPSERV_DEPENDENCIES += zstd
+endif
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+TQFTPSERV_CONF_OPTS += -Dsystemd-unit-prefix=/usr/lib/systemd/system
+else
+TQFTPSERV_CONF_OPTS += -Dsystemd-unit-prefix=
+endif
+
+define TQFTPSERV_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 $(TQFTPSERV_PKGDIR)/S44tqftpserv \
+		$(TARGET_DIR)/etc/init.d/S44tqftpserv
+endef
+
+$(eval $(meson-package))

-- 
2.53.0

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

  parent reply	other threads:[~2026-10-20  8:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  8:07 [Buildroot] [PATCH 0/3] package: add qrtr, rmtfs and tqftpserv for Qualcomm modems Igor Opaniuk via buildroot
2026-10-20  8:07 ` [Buildroot] [PATCH 1/3] package/qrtr: new package Igor Opaniuk via buildroot
2026-10-20  9:41   ` Thomas Petazzoni via buildroot
2026-10-20  8:07 ` [Buildroot] [PATCH 2/3] package/rmtfs: " Igor Opaniuk via buildroot
2026-10-20  8:07 ` Igor Opaniuk via buildroot [this message]
2026-10-20  9:39 ` [Buildroot] [PATCH 0/3] package: add qrtr, rmtfs and tqftpserv for Qualcomm modems Thomas Petazzoni via buildroot

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=20261020-qcom-modem-userspace-v1-3-da720723d9ef@oss.qualcomm.com \
    --to=buildroot@buildroot.org \
    --cc=eric.le.bihan.dev@free.fr \
    --cc=fiona.klute@gmx.de \
    --cc=igor.opaniuk@oss.qualcomm.com \
    --cc=jorge.ramirez@oss.qualcomm.com \
    --cc=sumit.garg@oss.qualcomm.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