Verified Commit 307db4a8 authored by Danct12's avatar Danct12

modem/*: upstreamed rmtfs and qrtr

Signed-off-by: Danct12's avatarDanct12 <danct12@disroot.org>
parent 326dc7b8
Pipeline #71503955 passed with stages
in 2 minutes and 44 seconds
pkgname=qcom_rmtfs
pkgver=0.0_git20180131
pkgrel=3
pkgver=0.1_git20181208
pkgrel=0
pkgdesc="Qualcomm Remote Filesystem Service Implementation"
url="https://github.com/andersson/rmtfs"
arch="all"
......@@ -8,11 +8,9 @@ license="BSD-3-Clause"
depends="qrtr"
makedepends="eudev-dev qrtr-dev msmipc-dev"
subpackages="$pkgname-doc"
_commit="0f800fa4334b03a47941ce1b577f51a69552e414"
_commit="cfb76ff6eecec15636f182009cda50ea0c654c60"
source="
rmtfs.tgz::https://github.com/andersson/rmtfs/archive/"$_commit".tar.gz
support-uio.patch
update-storage-paths.patch
qcom_rmtfs.initd
udev.rules
"
......@@ -33,8 +31,6 @@ package() {
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/COPYING
}
sha512sums="4b49cdf9d778bf6ae5e838c1da48e76b1004786a0dafefb0097fe3a73e4652c13ed1b011c051a712017f10b43ffc96b2fa133809715577b65fa4ca30cbdc191b rmtfs.tgz
a216dc36a7f12bbc125120ac7cc3e3030f3718f7d894c9e6d5e586375cbd76eae897160fdf780da8e3089dbfc0a31f1631dca4a2e850e193135ab825aa8d05cf support-uio.patch
877bdc84fdb4a851d94f29e2c6dd391afdb7812d19d0b10dc4449a6a7d0ed86fb3c01fd315bef7bfe24a644b3af102fc1e24194cb76c4e8966b8044a110ed639 update-storage-paths.patch
5ca3428b540c14a921a6a158833c39c2ac6bea33fd82172fb014cb8aa96684f31cc853b4a3b4359a764583f8da21a56aee617bd36fa1d6ca90a2827204c1ef9a qcom_rmtfs.initd
sha512sums="b055336183d33dbc3bc8736b0a95468aeddaf96132d0f6beaafd302201df22a352bba6a80c101a523c136cd8fafa15bd1a2138d71ed8b0d44945b21878e459b8 rmtfs.tgz
be32903df67af0ae2f6ea8c96f7c2bb003407258047622427097e3e867a6115a69e3ad2ad073a4182977f8d4d99c0283e9272f128ef7836a1d4365a24f7fd7ae qcom_rmtfs.initd
190db2ac5d0850f135738b4bfa9b14a0d0ec6ee66328ba704e4402c9ff76d60d330022f1f74ba96868491a0048fd3c4edb5a44cfc7574aca44afba5a3e4f5754 udev.rules"
......@@ -8,7 +8,7 @@ depend() {
export LD_PRELOAD=/usr/lib/preload/libqipcrtr4msmipc.so
command="/bin/sh"
command_args="-c 'exec /usr/sbin/qcom_rmtfs -v 2>&1 | logger -t qcom_rmtfs'"
command_args="-c 'exec /usr/sbin/qcom_rmtfs -o /dev/disk/qcom_rmtfs -v 2>&1 | logger -t qcom_rmtfs'"
command_background="yes"
pidfile="/var/run/${SVCNAME}.pid"
From b98442bbfaa0b61963c23c6079055c94515e38dd Mon Sep 17 00:00:00 2001
From: Joey Hewitt <joey@joeyhewitt.com>
Date: Mon, 9 Oct 2017 21:41:43 -0700
Subject: [PATCH] add uio dev support
diff --git a/sharedmem.c b/sharedmem.c
index f788b8a..eead258 100644
--- a/sharedmem.c
+++ b/sharedmem.c
@@ -44,6 +44,37 @@ static int parse_hex_sysattr(struct udev_device *dev, const char *name,
return 0;
}
+static int parse_hex_sysfsfile(int dir_fd, const char *name,
+ unsigned long *value)
+{
+ unsigned long val;
+ char buf[32];
+ char *endptr;
+ int fd;
+
+ fd = openat(dir_fd, name, O_RDONLY);
+ if (fd < 0) {
+ return -errno;
+ }
+
+ if (read(fd, buf, sizeof(buf)) < 0) {
+ close(fd);
+ return -errno;
+ }
+
+ close(fd);
+
+ errno = 0;
+ val = strtoul(buf, &endptr, 16);
+ if ((val == LONG_MAX && errno == ERANGE) || endptr == buf) {
+ return -errno;
+ }
+
+ *value = val;
+
+ return 0;
+}
+
static int rmtfs_mem_open_rfsa(struct rmtfs_mem *rmem, int client_id)
{
struct udev_device *dev;
@@ -114,6 +145,88 @@ err_close_fd:
return -saved_errno;
}
+static int rmtfs_mem_open_uio(struct rmtfs_mem *rmem)
+{
+ int saved_errno;
+ char path[64];
+ char buf[32];
+ int ret;
+ int dir_fd;
+ int fd;
+
+ for (int uio_index = 0; uio_index < 8; uio_index++) {
+ snprintf(path, sizeof(path), "/sys/class/uio/uio%d", uio_index);
+ dir_fd = open(path, O_DIRECTORY);
+ if (dir_fd < 0) {
+ saved_errno = errno;
+ if (errno != ENOENT) {
+ fprintf(stderr, "failed to open %s: %s\n", path, strerror(errno));
+ }
+ goto ret;
+ }
+
+ fd = openat(dir_fd, "name", O_RDONLY);
+ if (fd < 0) {
+ saved_errno = errno;
+ fprintf(stderr, "failed to open %s/name: %s\n", path, strerror(errno));
+ goto close_dirfd;
+ }
+
+ if (read(fd, buf, sizeof(buf)) < 0) {
+ saved_errno = errno;
+ fprintf(stderr, "failed to read %s/name: %s\n", path, strerror(errno));
+ close(fd);
+ goto close_dirfd;
+ }
+
+ close(fd);
+
+ if (strncmp(buf, "rmtfs\n", 6)) {
+ continue;
+ }
+
+ ret = parse_hex_sysfsfile(dir_fd, "maps/map0/addr", &rmem->address);
+ if (ret < 0) {
+ fprintf(stderr, "failed to parse addr of %s\n", path);
+ saved_errno = -ret;
+ goto close_dirfd;
+ }
+
+ ret = parse_hex_sysfsfile(dir_fd, "maps/map0/size", &rmem->size);
+ if (ret < 0) {
+ fprintf(stderr, "failed to parse size of %s\n", path);
+ saved_errno = -ret;
+ goto close_dirfd;
+ }
+
+ snprintf(path, sizeof(path), "/dev/uio%d", uio_index);
+ rmem->fd = open(path, O_RDWR);
+ if (rmem->fd < 0) {
+ saved_errno = errno;
+ fprintf(stderr, "failed to open %s: %s\n", path, strerror(errno));
+ goto close_dirfd;
+ }
+
+ rmem->base = mmap(0, rmem->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+ if (rmem->base == MAP_FAILED) {
+ saved_errno = errno;
+ fprintf(stderr, "failed to mmap: %s\n", strerror(errno));
+ close(rmem->fd);
+ goto close_dirfd;
+ }
+
+ saved_errno = 0;
+ goto close_dirfd;
+ }
+
+ saved_errno = ENOENT;
+
+close_dirfd:
+ close(dir_fd);
+ret:
+ return -saved_errno;
+}
+
struct rmtfs_mem *rmtfs_mem_open(void)
{
struct rmtfs_mem *rmem;
@@ -131,26 +244,31 @@ struct rmtfs_mem *rmtfs_mem_open(void)
if (ret < 0 && ret != -ENOENT) {
goto err;
} else if (ret < 0) {
- fprintf(stderr, "falling back to /dev/mem access\n");
-
- ret = rmtfs_mem_enumerate(rmem);
- if (ret < 0)
- goto err;
-
- fd = open("/dev/mem", O_RDWR|O_SYNC);
- if (fd < 0) {
- fprintf(stderr, "failed to open /dev/mem\n");
+ ret = rmtfs_mem_open_uio(rmem);
+ if (ret < 0 && ret != -ENOENT) {
goto err;
+ } else if (ret < 0) {
+ fprintf(stderr, "falling back to /dev/mem access\n");
+
+ ret = rmtfs_mem_enumerate(rmem);
+ if (ret < 0)
+ goto err;
+
+ fd = open("/dev/mem", O_RDWR|O_SYNC);
+ if (fd < 0) {
+ fprintf(stderr, "failed to open /dev/mem\n");
+ goto err;
+ }
+
+ base = mmap(0, rmem->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, rmem->address);
+ if (base == MAP_FAILED) {
+ fprintf(stderr, "failed to mmap: %s\n", strerror(errno));
+ goto err_close_fd;
+ }
+
+ rmem->base = base;
+ rmem->fd = fd;
}
-
- base = mmap(0, rmem->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, rmem->address);
- if (base == MAP_FAILED) {
- fprintf(stderr, "failed to mmap: %s\n", strerror(errno));
- goto err_close_fd;
- }
-
- rmem->base = base;
- rmem->fd = fd;
}
return rmem;
From c8af1ceccfa1c69845a0afb0068917cb16a4ef5b Mon Sep 17 00:00:00 2001
From: Joey Hewitt <joey@joeyhewitt.com>
Date: Sat, 2 Apr 2018 17:38:00 -0700
Subject: [PATCH] point storage to udev-linked paths
udev rules in this package create symlinks the daemon opens
---
storage.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/storage.c b/storage.c
index 997b428..8754b98 100644
--- a/storage.c
+++ b/storage.c
@@ -23,10 +23,10 @@ struct caller {
};
static const struct partition partition_table[] = {
- { "/boot/modem_fs1", "/boot/modem_fs1" },
- { "/boot/modem_fs2", "/boot/modem_fs2" },
- { "/boot/modem_fsc", "/boot/modem_fsc" },
- { "/boot/modem_fsg", "/boot/modem_fsg" },
+ { "/boot/modem_fs1", "/dev/disk/qcom_rmtfs/modem_fs1" },
+ { "/boot/modem_fs2", "/dev/disk/qcom_rmtfs/modem_fs2" },
+ { "/boot/modem_fsc", "/dev/disk/qcom_rmtfs/modem_fsc" },
+ { "/boot/modem_fsg", "/dev/disk/qcom_rmtfs/modem_fsg" },
{}
};
--
2.7.4
pkgname=qrtr
pkgver=1.0_git20180131
pkgrel=1
pkgver=1.1_git20190228
pkgrel=0
pkgdesc="Userspace reference for net/qrtr in the Linux kernel"
url="https://github.com/andersson/qrtr"
arch="all"
license="BSD-3-Clause"
makedepends="msmipc-dev"
subpackages="$pkgname-doc $pkgname-dev"
_commit="dbffdd0193996723fdc9456e09736a30a32daf25"
_commit="111403fe72805468d760a8f3a41f5a24dee8d081"
source="
qrtr.tgz::https://github.com/andersson/qrtr/archive/"$_commit".tar.gz
fix-cfg-include.patch
......@@ -29,6 +29,6 @@ package() {
install -Dm755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
}
sha512sums="4fbf9bcb26794a54e9784bafd0ee46a0c628327d6b31a438ca6d907185260cf590fc90a2e22139ebf3b939750277f434d67096396192d1ee3b0542c2feb39075 qrtr.tgz
sha512sums="58463ee8788aae73dec328a98bcf92a1504837cb65eac6cee6892bdb4bcd8fe3d6cddb39e97d73f761a6de99addcb820a93b5187f621423885ccadce19046e67 qrtr.tgz
fca4a8b886b7bb6a53a83f3a69e3ae03b8fc462f6f6bf6c812af1a1036aa5a8c1f40b6cabf921e91c55423c37309d4e56ac8ccf0d4c5f7db41c1005afaf19382 fix-cfg-include.patch
fcd9b8e4c4df9236ec778f1ffb231e547e0d65c718e0caf351bee821b1549aecafbfdb21b4c1d1e3d049d541d87b6bf98746414e88e5d70d05131e0496e1ef37 qrtr.initd"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment