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 2/3] package/rmtfs: new package
Date: Tue, 20 Oct 2026 10:07:46 +0200	[thread overview]
Message-ID: <20261020-qcom-modem-userspace-v1-2-da720723d9ef@oss.qualcomm.com> (raw)
In-Reply-To: <20261020-qcom-modem-userspace-v1-0-da720723d9ef@oss.qualcomm.com>

rmtfs serves the EFS partitions of the modem of Qualcomm SoCs (modemst1,
modemst2, fsg, fsc) over QRTR and the rmtfs shared memory; without it
the modem firmware stalls during its boot.

The tarball ships the QMI encoders pre-generated, so the qmic code
generator is not needed; the .c/.h files are touched before the build
so make does not try to regenerate them. The sysv init script starts
the daemon with -P (EFS partitions by GPT label) and skips when there is
no rmtfs shared memory; RMTFS_ARGS can be overridden in
/etc/default/rmtfs (e.g. -s to let rmtfs start the modem). With systemd
the upstream unit and udev rule are installed.

Tested on an Arduino UNO Q (Qualcomm QRB2210): with sysv init the modem
boots, its EFS is served from the modemst1/modemst2/fsg partitions and
its WLAN firmware 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 +
 package/rmtfs/Config.in  | 17 ++++++++++++++
 package/rmtfs/S45rmtfs   | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
 package/rmtfs/rmtfs.hash |  3 +++
 package/rmtfs/rmtfs.mk   | 45 +++++++++++++++++++++++++++++++++++++
 6 files changed, 125 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index 56c919d00d..dc0c8f35eb 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1496,6 +1496,7 @@ F:	toolchain/toolchain-bare-metal-buildroot/
 
 N:	Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
 F:	package/qrtr/
+F:	package/rmtfs/
 
 N:	Ilias Apalodimas <apalos@gmail.com>
 F:	package/keepalived/
diff --git a/package/Config.in b/package/Config.in
index 9416c35458..eb8cf851df 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -593,6 +593,7 @@ endmenu
 	source "package/raspi-gpio/Config.in"
 	source "package/rdma-core/Config.in"
 	source "package/read-edid/Config.in"
+	source "package/rmtfs/Config.in"
 	source "package/rng-tools/Config.in"
 	source "package/rockchip-mali/Config.in"
 	source "package/rockchip-rkbin/Config.in"
diff --git a/package/rmtfs/Config.in b/package/rmtfs/Config.in
new file mode 100644
index 0000000000..9a27f9c373
--- /dev/null
+++ b/package/rmtfs/Config.in
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_RMTFS
+	bool "rmtfs"
+	depends on BR2_PACKAGE_HAS_UDEV
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15 # qrtr
+	select BR2_PACKAGE_QRTR
+	help
+	  Remote file system service for the modem of Qualcomm SoCs:
+	  serves the modem's EFS partitions (modemst1, modemst2, fsg,
+	  fsc) over QRTR and the rmtfs shared memory. Without it the
+	  modem firmware stalls at boot.
+
+	  https://github.com/linux-msm/rmtfs
+
+comment "rmtfs needs udev /dev management and a toolchain w/ threads, headers >= 4.15"
+	depends on !BR2_PACKAGE_HAS_UDEV || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15
diff --git a/package/rmtfs/S45rmtfs b/package/rmtfs/S45rmtfs
new file mode 100644
index 0000000000..4e110c0ae2
--- /dev/null
+++ b/package/rmtfs/S45rmtfs
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+DAEMON="rmtfs"
+PIDFILE="/var/run/$DAEMON.pid"
+# -P: find the EFS partitions by GPT label; add -s to let rmtfs also
+# start the modem remoteproc, -r for read-only EFS.
+RMTFS_ARGS="-P"
+
+# shellcheck disable=SC1090
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
+
+start() {
+	printf 'Starting %s: ' "$DAEMON"
+	# No rmtfs shared memory: not a Qualcomm modem, nothing to serve
+	if [ ! -e /dev/qcom_rmtfs_mem1 ]; then
+		echo "SKIP"
+		return 0
+	fi
+	# shellcheck disable=SC2086 # we need the word splitting
+	start-stop-daemon -S -q -b -m -p "$PIDFILE" -x "/usr/bin/$DAEMON" \
+		-- $RMTFS_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/rmtfs/rmtfs.hash b/package/rmtfs/rmtfs.hash
new file mode 100644
index 0000000000..680926947f
--- /dev/null
+++ b/package/rmtfs/rmtfs.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  4b6c398806a1046e2256a685d592833de0f37b7245b8adc4797e1791f0e117ee  rmtfs-1.3.tar.gz
+sha256  1e1e2972bd05841b6a009bd6f7aef9d847f9a2b721d1a308340e642faa2482cd  LICENSE
diff --git a/package/rmtfs/rmtfs.mk b/package/rmtfs/rmtfs.mk
new file mode 100644
index 0000000000..3fd21063d1
--- /dev/null
+++ b/package/rmtfs/rmtfs.mk
@@ -0,0 +1,45 @@
+################################################################################
+#
+# rmtfs
+#
+################################################################################
+
+RMTFS_VERSION = 1.3
+RMTFS_SITE = $(call github,linux-msm,rmtfs,v$(RMTFS_VERSION))
+RMTFS_LICENSE = BSD-3-Clause
+RMTFS_LICENSE_FILES = LICENSE
+RMTFS_DEPENDENCIES = qrtr udev
+
+# qmi_rmtfs.c/.h are shipped pre-generated: keep make from regenerating
+# them with qmic, which is not packaged, when the tarball timestamps make
+# qmi_rmtfs.qmi look newer.
+define RMTFS_TOUCH_GENERATED
+	touch $(@D)/qmi_rmtfs.c $(@D)/qmi_rmtfs.h
+endef
+RMTFS_PRE_BUILD_HOOKS += RMTFS_TOUCH_GENERATED
+
+# The Makefile appends the libraries to LDFLAGS, which a command-line
+# LDFLAGS would override.
+define RMTFS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
+		LDFLAGS="$(TARGET_LDFLAGS) -lqrtr -ludev -lpthread" \
+		-C $(@D) rmtfs rmtfs.service prefix=/usr
+endef
+
+define RMTFS_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/rmtfs $(TARGET_DIR)/usr/bin/rmtfs
+endef
+
+define RMTFS_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 $(RMTFS_PKGDIR)/S45rmtfs \
+		$(TARGET_DIR)/etc/init.d/S45rmtfs
+endef
+
+define RMTFS_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 0644 $(@D)/rmtfs.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/rmtfs.service
+	$(INSTALL) -D -m 0644 $(@D)/rmtfs.rules \
+		$(TARGET_DIR)/usr/lib/udev/rules.d/rmtfs.rules
+endef
+
+$(eval $(generic-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 ` Igor Opaniuk via buildroot [this message]
2026-10-20  8:07 ` [Buildroot] [PATCH 3/3] package/tqftpserv: " Igor Opaniuk via buildroot
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-2-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