i9195/Qualcomm modem support (#1314)
* Qualcomm MSM modem: 'rmtfs' support packages * qcom_rmtfs: Server that talks to modem over IPC to allow it read/write data for its persistent storage. This is needed for it to boot, as well as periodically during usage. Added a patch that it expects the storage path symlinks in /etc instead of /boot. * qrtr: IPC library for rmtfs * libqipcrtr4msmipc: adapter library to make qrtr work on kernels with AF_MSM_IPC support. AF_QIPCRTR is the mainline equivalent since Linux ~4.7. * msmipc-dev: Header files for qrtr and libqipcrtr4msmipc. Thanks to Bjorn Andersson <https://github.com/andersson> for rmtfs and qrtr. * libsmdpkt_wrapper: adapter lib for QMI clients The SMD serial packet driver in Qualcomm kernels has, AFAICT, a bug in poll(); this works around it so that qmicli et al can work. * i9195: firmware (modem only right now) * add ofono (with patch for MSM devices) Based on Alpine's package. * i9195: add modem support * move all modem related packages to aports/modem
This commit is contained in:
parent
d2dda897da
commit
0a2dbea03d
18 changed files with 597 additions and 3 deletions
|
@ -1,13 +1,14 @@
|
|||
# Reference: <https://postmarketos.org/devicepkg>
|
||||
pkgname="device-samsung-i9195"
|
||||
pkgdesc="Samsung Galaxy S4 Mini"
|
||||
pkgver=0.2
|
||||
pkgrel=4
|
||||
pkgver=0.3
|
||||
pkgrel=0
|
||||
url="https://postmarketos.org"
|
||||
license="MIT"
|
||||
arch="noarch"
|
||||
options="!check"
|
||||
depends="postmarketos-base linux-samsung-i9195 mkbootimg"
|
||||
subpackages="$pkgname-nonfree-firmware:nonfree_firmware $pkgname-rmtfs"
|
||||
makedepends="devicepkg-dev"
|
||||
source="deviceinfo"
|
||||
|
||||
|
@ -19,4 +20,22 @@ package() {
|
|||
devicepkg_package $startdir $pkgname
|
||||
}
|
||||
|
||||
nonfree_firmware() {
|
||||
pkgdesc="Modem firmware"
|
||||
# Non-firmware packages placed here, because they aren't useful without firmware
|
||||
depends="firmware-samsung-i9195-modem qcom_rmtfs libqipcrtr4msmipc libsmdpkt_wrapper"
|
||||
mkdir "$subpkgdir"
|
||||
}
|
||||
|
||||
rmtfs() {
|
||||
install_if="$pkgname qcom_rmtfs"
|
||||
|
||||
local _linkpath="$subpkgdir"/etc/qcom_rmtfs/partition-symlinks
|
||||
mkdir -p $_linkpath
|
||||
cd $_linkpath
|
||||
ln -s /dev/disk/by-partlabel/modemst1 modem_fs1
|
||||
ln -s /dev/disk/by-partlabel/modemst2 modem_fs2
|
||||
ln -s /dev/disk/by-partlabel/fsg modem_fsg
|
||||
}
|
||||
|
||||
sha512sums="8e4ff08c7f2a7e7c55370be0547908b088bdb96e1d51d45e8d2840958bacb31fab0b9774b29332509270b2e18d8b569a159ed96fc9c6c2ed2f360fbb9b5cb26e deviceinfo"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Kernel config based on: arch/arm/configs/samsung_serrano_defconfig
|
||||
# Kernel config based on: arch/arm/configs/{samsung_serrano_defconfig, msm8930_serrano_eur_lte_defconfig}
|
||||
|
||||
pkgname="linux-samsung-i9195"
|
||||
pkgver=3.4.113
|
||||
|
|
29
firmware/firmware-samsung-i9195/APKBUILD
Normal file
29
firmware/firmware-samsung-i9195/APKBUILD
Normal file
|
@ -0,0 +1,29 @@
|
|||
pkgname=firmware-samsung-i9195
|
||||
# XDA post explains the meaning of the firmware version, which I've translated into pkgver
|
||||
pkgver=201707.1
|
||||
_ver=I9195XXUCQG1
|
||||
pkgrel=0
|
||||
pkgdesc="Samsung Galaxy S 4 Mini firmware"
|
||||
subpackages="$pkgname-modem"
|
||||
url="https://forum.xda-developers.com/galaxy-s4-mini/general/modem-samsung-galaxy-s4-mini-gt-i9195-t3390780"
|
||||
arch="noarch"
|
||||
license="proprietary"
|
||||
options="!strip !archcheck"
|
||||
|
||||
source="$_ver.tar.xz::https://drive.google.com/uc?export=download&id=1bKQ6m9avN6k2puJTZr55dIeGb8B7K_lT"
|
||||
|
||||
package() {
|
||||
# parent package is empty
|
||||
mkdir -p "$pkgdir"
|
||||
}
|
||||
|
||||
modem() {
|
||||
pkgdesc="Samsung Galaxy S 4 Mini modem firmware"
|
||||
|
||||
cd "$srcdir"
|
||||
for _i in *.b?? *.mdt; do
|
||||
install -Dm644 $_i "$subpkgdir"/lib/firmware/postmarketos/$_i
|
||||
done
|
||||
}
|
||||
|
||||
sha512sums="32e27bf12f40abd9a049562e4830d061518bd9efaf991cdc48c1aa3736bdc8c581eea14fa240fbaead255f83c7692d186f53a491837a662ac6368ca943634684 I9195XXUCQG1.tar.xz"
|
23
modem/libqipcrtr4msmipc/APKBUILD
Normal file
23
modem/libqipcrtr4msmipc/APKBUILD
Normal file
|
@ -0,0 +1,23 @@
|
|||
pkgname=libqipcrtr4msmipc
|
||||
pkgver=0.1
|
||||
pkgrel=0
|
||||
pkgdesc="LD_PRELOADable library to emulate AF_QIPCRTR socket on devices with only AF_MSM_IPC"
|
||||
url="https://github.com/scintill/libqipcrtr4msmipc"
|
||||
arch="armhf aarch64"
|
||||
license="GPL-3.0-or-later"
|
||||
_tag="v${pkgver}"
|
||||
makedepends="msmipc-dev"
|
||||
source="$pkgname-$_tag.tar.gz::https://github.com/scintill/libqipcrtr4msmipc/archive/${_tag}.tar.gz"
|
||||
options="!check"
|
||||
builddir="$srcdir/libqipcrtr4msmipc-$pkgver"
|
||||
|
||||
build() {
|
||||
cd "$builddir"
|
||||
make C_INCLUDE_PATH=/usr/src/msmipc-dev/include
|
||||
}
|
||||
|
||||
package() {
|
||||
install -Dm644 "$builddir"/libqipcrtr4msmipc.so "$pkgdir"/usr/lib/preload/libqipcrtr4msmipc.so
|
||||
}
|
||||
|
||||
sha512sums="5fd22a64d1f5dc743de2d485e3ec5c264abed4af4b63204f73a750847c15c2f91c3d0cf350bb341b61650ecb43e103475f81d77ad7b6ebb43751dcda3abb22d7 libqipcrtr4msmipc-v0.1.tar.gz"
|
26
modem/libsmdpkt_wrapper/APKBUILD
Normal file
26
modem/libsmdpkt_wrapper/APKBUILD
Normal file
|
@ -0,0 +1,26 @@
|
|||
pkgname=libsmdpkt_wrapper
|
||||
pkgver=0.1
|
||||
pkgrel=0
|
||||
pkgdesc="wrapper to get ofonod and qmicli working on smdpkt devices (MSM kernel's SMD)"
|
||||
url="https://github.com/scintill/libsmdpkt_wrapper"
|
||||
arch="all"
|
||||
license="GPL-3.0-or-later"
|
||||
subpackages="$pkgname-doc"
|
||||
_tag=v$pkgver
|
||||
makedepends="linux-headers"
|
||||
source="$pkgname-$_tag.tar.gz::https://github.com/scintill/libsmdpkt_wrapper/archive/$_tag.tar.gz"
|
||||
builddir="$srcdir""/libsmdpkt_wrapper-${pkgver}"
|
||||
options="!check"
|
||||
|
||||
build() {
|
||||
cd "$builddir"
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$builddir"
|
||||
install -Dm644 libsmdpkt_wrapper.so "$pkgdir"/usr/lib/preload/libsmdpkt_wrapper.so
|
||||
install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
|
||||
}
|
||||
|
||||
sha512sums="4979ef87523585ac2baaa901680a4f55fe11036ea591ecd43efc2c48f1681ff79699f7a4896e905397a87bbfb380c94f84f09bb48eb7db42ebfe73f26f95bbe2 libsmdpkt_wrapper-v0.1.tar.gz"
|
30
modem/msmipc-dev/APKBUILD
Normal file
30
modem/msmipc-dev/APKBUILD
Normal file
|
@ -0,0 +1,30 @@
|
|||
pkgname=msmipc-dev
|
||||
pkgver=0.1
|
||||
pkgrel=0
|
||||
pkgdesc="Headers for Qualcomm MSM IPC (AF_MSM_IPC and AF_QRTR)"
|
||||
url="https://android.googlesource.com/kernel/msm/+/e63c5a50c9379ccbee4c7f0e6ba43394e9d89db4/include/linux/msm_ipc.h"
|
||||
arch="noarch"
|
||||
depends="linux-headers"
|
||||
license="GPL-2.0 WITH Linux-syscall-note"
|
||||
source="
|
||||
https://github.com/torvalds/linux/raw/0573fed92b671bfe6a302c67bb66471b18a5004d/include/uapi/linux/qrtr.h
|
||||
msm_ipc.h.base64::https://android.googlesource.com/kernel/msm/+/e63c5a50c9379ccbee4c7f0e6ba43394e9d89db4/include/linux/msm_ipc.h?format=TEXT
|
||||
"
|
||||
options="!check"
|
||||
|
||||
unpack() {
|
||||
default_unpack
|
||||
|
||||
cd $srcdir
|
||||
base64 -d msm_ipc.h.base64 > msm_ipc.h
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$srcdir"
|
||||
for f in qrtr.h msm_ipc.h; do
|
||||
install -Dm644 $f "$pkgdir"/usr/src/msmipc-dev/include/linux/$f
|
||||
done
|
||||
}
|
||||
|
||||
sha512sums="1d424b43806930df079041c97db734572b48848b38b37852c3376a5e69e5257f24684f29381891f164d36cac7fbce2746f9580c0aab4ef4d92b8c72cadcb888c qrtr.h
|
||||
c626c03b567b3e12ca0e7d7d89f7c308f1ca3782c163112a04076060a79a91c1192ffb695ab99b28a952021449657b0fdf1912873b7ca05a16a9848f896ea8d0 msm_ipc.h.base64"
|
44
modem/ofono/APKBUILD
Normal file
44
modem/ofono/APKBUILD
Normal file
|
@ -0,0 +1,44 @@
|
|||
# Based on https://git.alpinelinux.org/cgit/aports/tree/testing/ofono/APKBUILD?id=014ae282b4a9152a5b64451f2815f34fcb53507c
|
||||
pkgname=ofono
|
||||
_upstreamver=1.21
|
||||
pkgver=1.21_p20180307
|
||||
pkgrel=0
|
||||
pkgdesc="Infrastructure for building mobile telephony (GSM/UMTS) applications"
|
||||
url="https://01.org/ofono"
|
||||
arch="all"
|
||||
license="GPL2"
|
||||
depends="bluez mobile-broadband-provider-info"
|
||||
makedepends="glib-dev dbus-dev eudev-dev
|
||||
linux-headers bsd-compat-headers libexecinfo-dev
|
||||
mobile-broadband-provider-info"
|
||||
options="!check"
|
||||
subpackages="$pkgname-dev $pkgname-doc"
|
||||
source="https://www.kernel.org/pub/linux/network/$pkgname/$pkgname-$_upstreamver.tar.xz
|
||||
$pkgname.initd
|
||||
0001-nokia-gpio-do-not-create-links-to-gpios-in-dev-cmt.patch::https://git.alpinelinux.org/cgit/aports/plain/testing/ofono/0001-nokia-gpio-do-not-create-links-to-gpios-in-dev-cmt.patch?id=014ae282b4a9152a5b64451f2815f34fcb53507c
|
||||
support-smdpkt.patch"
|
||||
|
||||
builddir="$srcdir"/$pkgname-$_upstreamver
|
||||
|
||||
build() {
|
||||
cd "$builddir"
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--localstatedir=/var \
|
||||
--sbindir=/usr/sbin
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$builddir"
|
||||
make DESTDIR="$pkgdir" install
|
||||
install -Dm644 "$srcdir/$pkgname-${_upstreamver}/plugins/ofono.rules" "$pkgdir/usr/lib/udev/rules.d/60-ofono.rules"
|
||||
install -Dm644 "$srcdir/$pkgname-${_upstreamver}/plugins/ofono-smdpkt.rules" "$pkgdir/usr/lib/udev/rules.d/60-ofono-smdpkt.rules"
|
||||
install -Dm755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
|
||||
}
|
||||
|
||||
sha512sums="bbc7fdb1d05294839eee5f31ec345866315a80feac8ccc2a67e0ca2c1030c55e0fb4fd6faee82133c00ec287730a5fd8df0610146a4f6a099e6b90703e621945 ofono-1.21.tar.xz
|
||||
fd0d303ca71df6953155aac0624c847f273030ebc5fb12efe2fa2ae7b8d75380e2885ab08d9c65c80cf756ef952569832ffdc25317e86a99552b4caac322b3ed ofono.initd
|
||||
a1f66f3f40c1aa4af5f5b66436414408b46f3c90f2a2c88fa12e09ca6a1732334d2f47687478d652a3a176ee93c1905752635246fd01412834565626c021ca64 0001-nokia-gpio-do-not-create-links-to-gpios-in-dev-cmt.patch
|
||||
1eb3fb4e6181e9b4f0afd1b68045750229e6c383380b98111d8238b397ea8dd26dda40b16d64f56f5187fafa97c0613139393e62a1ce58d2631a072903c273a4 support-smdpkt.patch"
|
21
modem/ofono/ofono.initd
Normal file
21
modem/ofono/ofono.initd
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/sbin/runscript
|
||||
# Copyright 1999-2009 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Purpose License v2
|
||||
# $Header: ./gentoo-x86-cvsroot/net-misc/ofono/files/ofono.initd,v 1.1 2009/08/24 13:20:40 dagger Exp $
|
||||
|
||||
depend() {
|
||||
need dbus
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting oFono"
|
||||
# libsmdpkt_wrapper.so may not exist, if this device doesn't need it
|
||||
start-stop-daemon --start --quiet --exec /usr/bin/env LD_PRELOAD=/usr/lib/preload/libsmdpkt_wrapper.so /usr/sbin/ofonod
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping oFono"
|
||||
start-stop-daemon --stop --quiet --exec /usr/sbin/ofonod
|
||||
eend $?
|
||||
}
|
89
modem/ofono/support-smdpkt.patch
Normal file
89
modem/ofono/support-smdpkt.patch
Normal file
|
@ -0,0 +1,89 @@
|
|||
diff -rN -U3 a/plugins/ofono-smdpkt.rules b/plugins/ofono-smdpkt.rules
|
||||
--- a/plugins/ofono-smdpkt.rules 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ b/plugins/ofono-smdpkt.rules 2018-03-08 05:46:35.000000000 +0000
|
||||
@@ -0,0 +1,2 @@
|
||||
+# SMD serial device on MSM devices
|
||||
+KERNEL=="smdcntl0", ENV{OFONO_DRIVER}="gobi"
|
||||
diff -rN -U3 a/plugins/udevng.c b/plugins/udevng.c
|
||||
--- a/plugins/udevng.c 2017-10-05 14:32:37.000000000 +0000
|
||||
+++ b/plugins/udevng.c 2018-03-08 05:29:16.000000000 +0000
|
||||
@@ -201,39 +201,43 @@
|
||||
|
||||
DBG("%s", modem->syspath);
|
||||
|
||||
- for (list = modem->devices; list; list = list->next) {
|
||||
- struct device_info *info = list->data;
|
||||
+ if (modem->type != MODEM_TYPE_SERIAL) {
|
||||
+ for (list = modem->devices; list; list = list->next) {
|
||||
+ struct device_info *info = list->data;
|
||||
|
||||
- DBG("%s %s %s %s %s %s", info->devnode, info->interface,
|
||||
- info->number, info->label,
|
||||
- info->sysattr, info->subsystem);
|
||||
+ DBG("%s %s %s %s %s %s", info->devnode, info->interface,
|
||||
+ info->number, info->label,
|
||||
+ info->sysattr, info->subsystem);
|
||||
|
||||
- if (g_strcmp0(info->subsystem, "usbmisc") == 0) /* cdc-wdm */
|
||||
- qmi = info->devnode;
|
||||
- else if (g_strcmp0(info->subsystem, "net") == 0) /* wwan */
|
||||
- net = info->devnode;
|
||||
- else if (g_strcmp0(info->subsystem, "tty") == 0) {
|
||||
- if (g_strcmp0(info->interface, "255/255/255") == 0) {
|
||||
- if (g_strcmp0(info->number, "00") == 0)
|
||||
- diag = info->devnode; /* ec20 */
|
||||
- else if (g_strcmp0(info->number, "01") == 0)
|
||||
- diag = info->devnode; /* gobi */
|
||||
- else if (g_strcmp0(info->number, "02") == 0)
|
||||
- mdm = info->devnode; /* gobi */
|
||||
- else if (g_strcmp0(info->number, "03") == 0)
|
||||
- gps = info->devnode; /* gobi */
|
||||
- } else if (g_strcmp0(info->interface, "255/0/0") == 0) {
|
||||
- if (g_strcmp0(info->number, "01") == 0)
|
||||
- gps = info->devnode; /* ec20 */
|
||||
- if (g_strcmp0(info->number, "02") == 0)
|
||||
- mdm = info->devnode; /* ec20 */
|
||||
- /* ignore the 3rd device second AT/mdm iface */
|
||||
+ if (g_strcmp0(info->subsystem, "usbmisc") == 0) /* cdc-wdm */
|
||||
+ qmi = info->devnode;
|
||||
+ else if (g_strcmp0(info->subsystem, "net") == 0) /* wwan */
|
||||
+ net = info->devnode;
|
||||
+ else if (g_strcmp0(info->subsystem, "tty") == 0) {
|
||||
+ if (g_strcmp0(info->interface, "255/255/255") == 0) {
|
||||
+ if (g_strcmp0(info->number, "00") == 0)
|
||||
+ diag = info->devnode; /* ec20 */
|
||||
+ else if (g_strcmp0(info->number, "01") == 0)
|
||||
+ diag = info->devnode; /* gobi */
|
||||
+ else if (g_strcmp0(info->number, "02") == 0)
|
||||
+ mdm = info->devnode; /* gobi */
|
||||
+ else if (g_strcmp0(info->number, "03") == 0)
|
||||
+ gps = info->devnode; /* gobi */
|
||||
+ } else if (g_strcmp0(info->interface, "255/0/0") == 0) {
|
||||
+ if (g_strcmp0(info->number, "01") == 0)
|
||||
+ gps = info->devnode; /* ec20 */
|
||||
+ if (g_strcmp0(info->number, "02") == 0)
|
||||
+ mdm = info->devnode; /* ec20 */
|
||||
+ /* ignore the 3rd device second AT/mdm iface */
|
||||
+ }
|
||||
}
|
||||
}
|
||||
- }
|
||||
|
||||
- if (qmi == NULL || mdm == NULL || net == NULL)
|
||||
- return FALSE;
|
||||
+ if (qmi == NULL || mdm == NULL || net == NULL)
|
||||
+ return FALSE;
|
||||
+ } else {
|
||||
+ qmi = modem->serial->devnode;
|
||||
+ }
|
||||
|
||||
DBG("qmi=%s net=%s mdm=%s gps=%s diag=%s", qmi, net, mdm, gps, diag);
|
||||
|
||||
@@ -1708,6 +1712,7 @@
|
||||
return;
|
||||
|
||||
udev_enumerate_add_match_subsystem(enumerate, "tty");
|
||||
+ udev_enumerate_add_match_subsystem(enumerate, "smdpkt");
|
||||
udev_enumerate_add_match_subsystem(enumerate, "usb");
|
||||
udev_enumerate_add_match_subsystem(enumerate, "usbmisc");
|
||||
udev_enumerate_add_match_subsystem(enumerate, "net");
|
38
modem/qcom_rmtfs/APKBUILD
Normal file
38
modem/qcom_rmtfs/APKBUILD
Normal file
|
@ -0,0 +1,38 @@
|
|||
pkgname=qcom_rmtfs
|
||||
pkgver=0.0_git20180131
|
||||
pkgrel=0
|
||||
pkgdesc="Qualcomm Remote Filesystem Service Implementation"
|
||||
url="https://github.com/andersson/rmtfs"
|
||||
arch="all"
|
||||
license="BSD-3-Clause"
|
||||
depends="qrtr"
|
||||
makedepends="eudev-dev qrtr-dev msmipc-dev"
|
||||
subpackages="$pkgname-doc"
|
||||
_commit="0f800fa4334b03a47941ce1b577f51a69552e414"
|
||||
source="
|
||||
rmtfs.tgz::https://github.com/andersson/rmtfs/archive/"$_commit".tar.gz
|
||||
support-uio.patch
|
||||
point-storage-to-paths-in-etc.patch
|
||||
qcom_rmtfs.initd
|
||||
"
|
||||
builddir="$srcdir""/rmtfs-"$_commit
|
||||
options="!check"
|
||||
install="$pkgname.post-install"
|
||||
|
||||
build() {
|
||||
cd "$builddir"
|
||||
make C_INCLUDE_PATH=/usr/src/msmipc-dev/include rmtfs
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$builddir"
|
||||
install -D -m 755 rmtfs "$pkgdir"/usr/sbin/"$pkgname"
|
||||
mkdir -p "$pkgdir"/etc/qcom_rmtfs/partition-symlinks
|
||||
install -Dm755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
|
||||
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/COPYING
|
||||
}
|
||||
|
||||
sha512sums="4b49cdf9d778bf6ae5e838c1da48e76b1004786a0dafefb0097fe3a73e4652c13ed1b011c051a712017f10b43ffc96b2fa133809715577b65fa4ca30cbdc191b rmtfs.tgz
|
||||
a216dc36a7f12bbc125120ac7cc3e3030f3718f7d894c9e6d5e586375cbd76eae897160fdf780da8e3089dbfc0a31f1631dca4a2e850e193135ab825aa8d05cf support-uio.patch
|
||||
3d205bb7e662cca2a3c87a57c1a129cf6c42afbe179f810069843f521decfd869bc82d1c1a367c507eaf880cf33316a2f7b3dbce9c2d9e8150b1500c3910c843 point-storage-to-paths-in-etc.patch
|
||||
21f5ba8b30d4e39046056e131b8eeb4d3bc7b11897b59b800d2d5162acc1629102fdc00b5df1df1ae7497c0cb6bbb0a40fa983c20733210ac01b76f6eaa848ee qcom_rmtfs.initd"
|
33
modem/qcom_rmtfs/point-storage-to-paths-in-etc.patch
Normal file
33
modem/qcom_rmtfs/point-storage-to-paths-in-etc.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
From c8af1ceccfa1c69845a0afb0068917cb16a4ef5b Mon Sep 17 00:00:00 2001
|
||||
From: Joey Hewitt <joey@joeyhewitt.com>
|
||||
Date: Sat, 10 Mar 2018 17:38:00 -0700
|
||||
Subject: [PATCH] point storage to paths in /etc
|
||||
|
||||
Device packages will put symlinks there pointing to their storage
|
||||
partitions.
|
||||
---
|
||||
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", "/etc/qcom_rmtfs/partition-symlinks/modem_fs1" },
|
||||
+ { "/boot/modem_fs2", "/etc/qcom_rmtfs/partition-symlinks/modem_fs2" },
|
||||
+ { "/boot/modem_fsc", "/etc/qcom_rmtfs/partition-symlinks/modem_fsc" },
|
||||
+ { "/boot/modem_fsg", "/etc/qcom_rmtfs/partition-symlinks/modem_fsg" },
|
||||
{}
|
||||
};
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
10
modem/qcom_rmtfs/qcom_rmtfs.initd
Normal file
10
modem/qcom_rmtfs/qcom_rmtfs.initd
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
# libqipcrtr4msmipc.so may not be present, on devices that don't need it
|
||||
export LD_PRELOAD=/usr/lib/preload/libqipcrtr4msmipc.so
|
||||
|
||||
command="/bin/sh"
|
||||
command_args="-c 'exec /usr/sbin/qcom_rmtfs 2>&1 | logger -t qcom_rmtfs'"
|
||||
command_background="yes"
|
||||
|
||||
pidfile="/var/run/${SVCNAME}.pid"
|
3
modem/qcom_rmtfs/qcom_rmtfs.post-install
Normal file
3
modem/qcom_rmtfs/qcom_rmtfs.post-install
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
rc-update -q add qcom_rmtfs boot
|
186
modem/qcom_rmtfs/support-uio.patch
Normal file
186
modem/qcom_rmtfs/support-uio.patch
Normal file
|
@ -0,0 +1,186 @@
|
|||
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;
|
30
modem/qrtr/APKBUILD
Normal file
30
modem/qrtr/APKBUILD
Normal file
|
@ -0,0 +1,30 @@
|
|||
pkgname=qrtr
|
||||
pkgver=1.0_git20180131
|
||||
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"
|
||||
source="
|
||||
qrtr.tgz::https://github.com/andersson/qrtr/archive/"$_commit".tar.gz
|
||||
fix-cfg-include.patch
|
||||
"
|
||||
builddir="$srcdir""/qrtr-"$_commit
|
||||
options="!check"
|
||||
|
||||
build() {
|
||||
cd "$builddir"
|
||||
make C_INCLUDE_PATH=/usr/src/msmipc-dev/include libqrtr.so
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$builddir"
|
||||
make DESTDIR="$pkgdir" prefix=/usr "$pkgdir"/usr/lib/libqrtr.so.1.0 "$pkgdir"/usr/include/libqrtr.h
|
||||
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/COPYING
|
||||
}
|
||||
|
||||
sha512sums="4fbf9bcb26794a54e9784bafd0ee46a0c628327d6b31a438ca6d907185260cf590fc90a2e22139ebf3b939750277f434d67096396192d1ee3b0542c2feb39075 qrtr.tgz
|
||||
fca4a8b886b7bb6a53a83f3a69e3ae03b8fc462f6f6bf6c812af1a1036aa5a8c1f40b6cabf921e91c55423c37309d4e56ac8ccf0d4c5f7db41c1005afaf19382 fix-cfg-include.patch"
|
13
modem/qrtr/fix-cfg-include.patch
Normal file
13
modem/qrtr/fix-cfg-include.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/Makefile b/Makefile
|
||||
index 2fa026f..200fb92 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -28,6 +28,8 @@ $(proj)-ns-srcs := \
|
||||
|
||||
$(proj)-ns-cflags := -Ilib
|
||||
|
||||
+$(proj)-cfg-cflags := -Ilib
|
||||
+
|
||||
$(proj)-lookup-srcs := \
|
||||
src/lookup.c \
|
||||
src/util.c \
|
Loading…
Reference in a new issue