add upstream patch after 1.1.1

This commit is contained in:
Super Tecno Gym 2026-01-07 17:45:54 +01:00
parent 514f9a3fd8
commit 1d9bd674da
5 changed files with 262 additions and 3 deletions

View file

@ -1,7 +1,7 @@
pkgbase = rmtfs
pkgdesc = Qualcomm Remote Filesystem Service Implementation
pkgver = 1.1.1
pkgrel = 1
pkgrel = 2
url = https://github.com/linux-msm/rmtfs
arch = aarch64
arch = x86_64
@ -10,7 +10,13 @@ pkgbase = rmtfs
depends = libudev.so
source = rmtfs-1.1.1.tar.gz::https://github.com/linux-msm/rmtfs/archive/refs/tags/v1.1.1.tar.gz
source = udev.rules
source = 0001-sharedmem-Fix-build-warning-on-32-bit-arm.patch
source = 0002-storage-Try-opening-the-slot-suffixed-partition.patch
source = 0003-storage-Add-modem_study-into-partition_table.patch
sha256sums = 190b50e97d2bb2cfa2ea20137a91aa5b113351f53f8c05fbb152ab97f31b57f7
sha256sums = 0c2f26d40d9d18e3089c6d836b64231c4f7e0c1ca41686fe7c9d1eb495dc6bbe
sha256sums = a86309dfe9272accab23f0e0cd2367e5481b56a0eb6f72a6b147916eea2249b7
sha256sums = a60a6f5d37b56ae013c805bae246b43a1c8637a29b681b083cc3e270d97a2814
sha256sums = 11296c19676c977dda256ee480ba1be2c681573656095ab4cd4cdece6548a1c0
pkgname = rmtfs

View file

@ -0,0 +1,37 @@
From 19d1acb728c673a5e014ef29d504800c651600db Mon Sep 17 00:00:00 2001
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Date: Mon, 30 Jun 2025 17:34:56 +0200
Subject: [PATCH 1/3] sharedmem: Fix build warning on 32-bit arm
Format specifiers won't stop biting.
Closes: https://github.com/linux-msm/rmtfs/issues/25
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
sharedmem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sharedmem.c b/sharedmem.c
index 77fbcd4..c37a58d 100644
--- a/sharedmem.c
+++ b/sharedmem.c
@@ -4,6 +4,7 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
+#include <inttypes.h>
#ifndef ANDROID
#include <libudev.h>
#else
@@ -322,7 +323,7 @@ int64_t rmtfs_mem_alloc(struct rmtfs_mem *rmem, size_t alloc_size)
{
if (alloc_size > rmem->size) {
fprintf(stderr,
- "[RMTFS] rmtfs shared memory not large enough for allocation request 0x%zx vs 0x%lx\n",
+ "[RMTFS] rmtfs shared memory not large enough for allocation request 0x%zx vs %" PRIu64 "\n",
alloc_size, rmem->size);
return -EINVAL;
}
--
2.52.0

View file

@ -0,0 +1,176 @@
From 2ee01bf7521d6a343e51458d082b30541eb3b7f2 Mon Sep 17 00:00:00 2001
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Date: Tue, 1 Jul 2025 12:06:15 +0200
Subject: [PATCH 2/3] storage: Try opening the slot-suffixed partition
Some devices ship 2 copies of remote partitions (see e.g. #22), which
the current code can't cope with.
Add parsing of a slot suffix (via '-S', single character) and if
passed, retry opening partition (via a partlabel) with it.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
rmtfs.c | 19 +++++++++++++++--
rmtfs.h | 3 ++-
storage.c | 61 +++++++++++++++++++++++++++++++++++--------------------
3 files changed, 58 insertions(+), 25 deletions(-)
diff --git a/rmtfs.c b/rmtfs.c
index 0d697b5..f48d738 100644
--- a/rmtfs.c
+++ b/rmtfs.c
@@ -27,6 +27,7 @@
static struct rmtfs_mem *rmem;
static sig_atomic_t sig_int_count;
+static char slot_suffix[SLOT_SUFFIX_LEN];
static bool dbgprintf_enabled;
static void dbgprintf(const char *fmt, ...)
@@ -69,7 +70,7 @@ static void rmtfs_open(int sock, const struct qrtr_packet *pkt)
goto respond;
}
- rmtfd = storage_open(pkt->node, req.path);
+ rmtfd = storage_open(pkt->node, req.path, slot_suffix);
if (!rmtfd) {
qmi_result_error(&resp.result, QMI_RMTFS_ERR_INTERNAL);
goto respond;
@@ -504,7 +505,7 @@ int main(int argc, char **argv)
int option;
const char *storage_root = NULL;
- while ((option = getopt(argc, argv, "o:Prsv")) != -1) {
+ while ((option = getopt(argc, argv, "oS:Prsv")) != -1) {
switch (option) {
/*
* -o sets the directory where EFS images are stored,
@@ -535,6 +536,20 @@ int main(int argc, char **argv)
break;
+ /* Partlabel slot suffix on A/B devices */
+ case 'S':
+ if (strnlen(optarg, 1 + 1) != 1) {
+ fprintf(stderr, "Couldn't parse slot name (too long?)\n");
+ return -1;
+ }
+
+ ret = snprintf(slot_suffix, SLOT_SUFFIX_LEN, "_%s", optarg);
+ if (ret != SLOT_SUFFIX_LEN - 1)
+ return -1;
+
+ dbgprintf("Using slot %s\n", slot_suffix);
+ break;
+
/* -v is for verbose */
case 'v':
dbgprintf_enabled = 1;
diff --git a/rmtfs.h b/rmtfs.h
index fa4b806..649b240 100644
--- a/rmtfs.h
+++ b/rmtfs.h
@@ -26,7 +26,8 @@ ssize_t rmtfs_mem_write(struct rmtfs_mem *rmem, unsigned long phys_address, cons
struct rmtfd;
int storage_init(const char *storage_root, bool read_only, bool use_partitions);
-struct rmtfd *storage_open(unsigned node, const char *path);
+#define SLOT_SUFFIX_LEN (2 + 1) /* "_a" or "_b", null-terminated */
+struct rmtfd *storage_open(unsigned node, const char *path, const char *slot_suffix);
struct rmtfd *storage_get(unsigned node, int caller_id);
void storage_close(struct rmtfd *rmtfd);
int storage_get_caller_id(const struct rmtfd *rmtfd);
diff --git a/storage.c b/storage.c
index 140c6bf..a1ecea2 100644
--- a/storage.c
+++ b/storage.c
@@ -74,16 +74,43 @@ int storage_init(const char *storage_root, bool read_only, bool use_partitions)
return 0;
}
-struct rmtfd *storage_open(unsigned node, const char *path)
+static int fd_open(struct rmtfd *rmtfd, const char *fspath, const struct partition *part)
+{
+ int saved_errno;
+ int ret;
+ int fd;
+
+ if (!storage_read_only) {
+ fd = open(fspath, O_RDWR);
+ if (fd < 0) {
+ saved_errno = errno;
+ fprintf(stderr, "[storage] failed to open '%s' (requested '%s'): %s\n",
+ fspath, part->path, strerror(saved_errno));
+ return saved_errno;
+ }
+ rmtfd->fd = fd;
+ rmtfd->shadow_len = 0;
+ } else {
+ ret = storage_populate_shadow_buf(rmtfd, fspath);
+ if (ret < 0) {
+ saved_errno = errno;
+ fprintf(stderr, "[storage] failed to open '%s' (requested '%s'): %s\n",
+ fspath, part->path, strerror(saved_errno));
+ return saved_errno;
+ }
+ }
+
+ return 0;
+}
+
+struct rmtfd *storage_open(unsigned node, const char *path, const char *slot_suffix)
{
char *fspath;
const struct partition *part;
struct rmtfd *rmtfd = NULL;
const char *file;
size_t pathlen;
- int saved_errno;
int ret;
- int fd;
int i;
for (part = partition_table; part->path; part++) {
@@ -119,29 +146,19 @@ found:
else
file = part->actual;
- pathlen = strlen(storage_dir) + strlen(file) + 2;
+ pathlen = strlen(storage_dir) + strlen(file) + 2 + strnlen(slot_suffix, SLOT_SUFFIX_LEN);
fspath = alloca(pathlen);
snprintf(fspath, pathlen, "%s/%s", storage_dir, file);
- if (!storage_read_only) {
- fd = open(fspath, O_RDWR);
- if (fd < 0) {
- saved_errno = errno;
- fprintf(stderr, "[storage] failed to open '%s' (requested '%s'): %s\n",
- fspath, part->path, strerror(saved_errno));
- errno = saved_errno;
+ ret = fd_open(rmtfd, fspath, part);
+ if (ret) {
+ /* Try again with the slot suffix before giving up */
+ if (!slot_suffix)
return NULL;
- }
- rmtfd->fd = fd;
- rmtfd->shadow_len = 0;
- } else {
- ret = storage_populate_shadow_buf(rmtfd, fspath);
- if (ret < 0) {
- saved_errno = errno;
- fprintf(stderr, "[storage] failed to open '%s' (requested '%s'): %s\n",
- fspath, part->path, strerror(saved_errno));
- errno = saved_errno;
+
+ snprintf(fspath, pathlen, "%s/%s%s", storage_dir, file, slot_suffix);
+ ret = fd_open(rmtfd, fspath, part);
+ if (ret)
return NULL;
- }
}
rmtfd->node = node;
--
2.52.0

View file

@ -0,0 +1,28 @@
From 27b3a6f00f121a0f8195e25c40faf97b57e2cec1 Mon Sep 17 00:00:00 2001
From: Luca Weiss <luca.weiss@fairphone.com>
Date: Mon, 28 Jul 2025 13:40:48 +0200
Subject: [PATCH 3/3] storage: Add modem_study into partition_table
The partition /boot/modem_study needs to be served on the Milos/SM7635
Fairphone (Gen. 6) smartphone.
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
storage.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/storage.c b/storage.c
index 140c6bf..001464d 100644
--- a/storage.c
+++ b/storage.c
@@ -41,6 +41,7 @@ static const struct partition partition_table[] = {
{ "/boot/modem_fs2", "modem_fs2", "modemst2" },
{ "/boot/modem_fsc", "modem_fsc", "fsc" },
{ "/boot/modem_fsg", "modem_fsg", "fsg" },
+ { "/boot/modem_study", "modem_study", "study" },
{ "/boot/modem_tunning", "modem_tunning", "tunning" },
{ "/boot/modem_tng", "modem_tng", "tunning" },
{}
--
2.52.0

View file

@ -4,7 +4,7 @@
pkgname="rmtfs"
pkgdesc="Qualcomm Remote Filesystem Service Implementation"
pkgver=1.1.1
pkgrel=1
pkgrel=2
arch=(aarch64 x86_64)
url="https://github.com/linux-msm/rmtfs"
license=("BSD-3-Clause")
@ -14,13 +14,25 @@ _srcname="${pkgname}-${pkgver}"
source=(
"${_srcname}.tar.gz::https://github.com/linux-msm/rmtfs/archive/refs/tags/v${pkgver}.tar.gz"
"udev.rules"
"0001-sharedmem-Fix-build-warning-on-32-bit-arm.patch"
"0002-storage-Try-opening-the-slot-suffixed-partition.patch"
"0003-storage-Add-modem_study-into-partition_table.patch"
)
sha256sums=('190b50e97d2bb2cfa2ea20137a91aa5b113351f53f8c05fbb152ab97f31b57f7'
'0c2f26d40d9d18e3089c6d836b64231c4f7e0c1ca41686fe7c9d1eb495dc6bbe')
'0c2f26d40d9d18e3089c6d836b64231c4f7e0c1ca41686fe7c9d1eb495dc6bbe'
'a86309dfe9272accab23f0e0cd2367e5481b56a0eb6f72a6b147916eea2249b7'
'a60a6f5d37b56ae013c805bae246b43a1c8637a29b681b083cc3e270d97a2814'
'11296c19676c977dda256ee480ba1be2c681573656095ab4cd4cdece6548a1c0'
)
build() {
cd "$_srcname"
patch -p1 < ../0001-sharedmem-Fix-build-warning-on-32-bit-arm.patch
patch -p1 < ../0002-storage-Try-opening-the-slot-suffixed-partition.patch
patch -p1 < ../0003-storage-Add-modem_study-into-partition_table.patch
make prefix=/usr
}