mirror of
https://github.com/linux-msm/tqftpserv.git
synced 2026-10-07 06:28:28 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
128cd6e0a3 | ||
|
|
49f6a862b4 | ||
|
|
80a65872be | ||
|
|
c0da4aa516 | ||
|
|
998ea7dabc | ||
|
|
c4aee5ebc4 | ||
|
|
1d25793a68 | ||
|
|
c2559a2609 | ||
|
|
33e310c141 | ||
|
|
3d2774d60e | ||
|
|
dec7b7e543 | ||
|
|
836161d68d | ||
|
|
1085b1f948 | ||
|
|
b6bb92d40c | ||
|
|
eda00d2917 | ||
|
|
566445f44f | ||
|
|
fc66ee26a4 | ||
|
|
7259073ad9 | ||
|
|
e3533ef115 | ||
|
|
238de1c6a2 | ||
|
|
3828238cff | ||
|
|
ac0e4ac2df | ||
|
|
614a2de2ed | ||
|
|
a8a29e947d | ||
|
|
cbc47b5855 | ||
|
|
9ef11c0902 | ||
|
|
a5107244ce | ||
|
|
0e78f03409 | ||
|
|
e2a2ecd226 | ||
|
|
6e6d765eda | ||
|
|
7557ca4754 | ||
|
|
006afcbefe | ||
|
|
d2b8ad5f07 | ||
|
|
dd4eebcf5e | ||
|
|
477f031648 | ||
|
|
f84cefc24e | ||
|
|
af9bb54a43 | ||
|
|
b3f80df192 | ||
|
|
f47b088a89 | ||
|
|
0a041debc7 | ||
|
|
f6f9b15284 | ||
|
|
465ced8be7 | ||
|
|
c7cf88b05e | ||
|
|
1995188db0 | ||
|
|
443c82aada | ||
|
|
3e568ebf78 | ||
|
|
0ed681362b | ||
|
|
d4c7f06435 | ||
|
|
408ca1ed5e | ||
|
|
33a3b4891e | ||
|
|
ad282fcab3 | ||
|
|
7d5fcd440a | ||
|
|
44748aa794 | ||
|
|
4b3054aed3 | ||
|
|
9fc5fdc53b | ||
|
|
1a516e7a78 | ||
|
|
72aad03e24 | ||
|
|
b0f786c1a7 | ||
|
|
e2bfdbb52f | ||
|
|
533779cb8a | ||
|
|
cab8b18f9a | ||
|
|
859c6e3969 | ||
|
|
bbfff09e16 | ||
|
|
4744c0ce07 | ||
|
|
f9da0667fb | ||
|
|
0f7fd27524 | ||
|
|
95d0c67322 | ||
|
|
085a87c279 | ||
|
|
48e143d273 | ||
|
|
0197df8e61 | ||
|
|
47e8957271 | ||
|
|
5f9f263ae2 | ||
|
|
3a10a7dd6f | ||
|
|
a09948e5e3 | ||
|
|
588a8d3c8f | ||
|
|
e167336fca | ||
|
|
69c7cfcf73 | ||
|
|
2dd48a2899 | ||
|
|
98d162c9ff | ||
|
|
37669ab1e2 | ||
|
|
a4c755db17 | ||
|
|
289214a5d1 | ||
|
|
00fe2775de | ||
|
|
fb20008c86 | ||
|
|
a540a1c307 | ||
|
|
3fa49eafe0 | ||
|
|
aaba76c6ba | ||
|
|
de42697a24 | ||
|
|
538efb3096 | ||
|
|
48b9e1cbb1 | ||
|
|
3488007880 | ||
|
|
783425b550 | ||
|
|
2324458f18 | ||
|
|
fe53d2a810 | ||
|
|
75a7a89398 | ||
|
|
6348c52f20 | ||
|
|
7167c88ead | ||
|
|
2ae2758cba |
No files matched your search
@@ -0,0 +1,147 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
||||
#
|
||||
# Loosely based on the cdba project CI:
|
||||
# https://github.com/linux-msm/cdba
|
||||
#
|
||||
name: "Builds"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
schedule:
|
||||
# Run at 1:01 PM, every Tuesday
|
||||
- cron: '1 13 * * 2'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler: [gcc, clang]
|
||||
# zstd and xz support are autodetected: the "enabled" variant installs
|
||||
# the corresponding development package, the "disabled" one does not.
|
||||
zstd: [enabled, disabled]
|
||||
xz: [enabled, disabled]
|
||||
container:
|
||||
- alpine:latest
|
||||
- archlinux:latest
|
||||
- debian:testing
|
||||
- debian:stable
|
||||
- fedora:latest
|
||||
- ubuntu:latest
|
||||
- ubuntu:noble
|
||||
exclude:
|
||||
# zstd and xz ship in the Arch base image and cannot be removed, so
|
||||
# the "disabled" builds cannot be exercised there.
|
||||
- container: archlinux:latest
|
||||
zstd: disabled
|
||||
- container: archlinux:latest
|
||||
xz: disabled
|
||||
|
||||
container:
|
||||
image: ${{ matrix.container }}
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
ZSTD: ${{ matrix.zstd }}
|
||||
XZ: ${{ matrix.xz }}
|
||||
|
||||
steps:
|
||||
- name: Show OS
|
||||
run: cat /etc/os-release
|
||||
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install additional packages
|
||||
run: |
|
||||
INSTALL=${{ matrix.container }}
|
||||
INSTALL="${INSTALL%%:*}"
|
||||
INSTALL="${INSTALL%%/*}"
|
||||
./ci/$INSTALL.sh
|
||||
|
||||
- name: Compiler version
|
||||
run: $CC --version
|
||||
|
||||
- name: Meson setup
|
||||
run: meson setup --errorlogs --werror build .
|
||||
|
||||
- name: Compile
|
||||
run: ninja -C build
|
||||
|
||||
- name: Verify zstd autodetection
|
||||
run: ./ci/check-zstd.sh
|
||||
|
||||
- name: Verify xz autodetection
|
||||
run: ./ci/check-xz.sh
|
||||
|
||||
- name: Install
|
||||
run: ninja -C build install
|
||||
|
||||
android:
|
||||
name: Android
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
abi: [arm64-v8a, armeabi-v7a, x86_64]
|
||||
|
||||
env:
|
||||
NDK_VERSION: r27d
|
||||
QRTR_REF: v1.2
|
||||
API: "24"
|
||||
ABI: ${{ matrix.abi }}
|
||||
QRTR_SRC: ${{ github.workspace }}/qrtr
|
||||
QRTR_PREFIX: ${{ github.workspace }}/qrtr-install/${{ matrix.abi }}
|
||||
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install build tools
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y --no-install-recommends meson ninja-build pkg-config
|
||||
|
||||
- name: Cache Android NDK
|
||||
id: ndk-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: android-ndk-${{ env.NDK_VERSION }}
|
||||
key: ndk-${{ env.NDK_VERSION }}-linux
|
||||
|
||||
- name: Download Android NDK
|
||||
if: steps.ndk-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
curl -sSLO https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-linux.zip
|
||||
unzip -q android-ndk-${NDK_VERSION}-linux.zip
|
||||
rm android-ndk-${NDK_VERSION}-linux.zip
|
||||
|
||||
- name: Cache libqrtr
|
||||
id: qrtr-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: qrtr-install/${{ matrix.abi }}
|
||||
key: qrtr-android-${{ matrix.abi }}-${{ env.QRTR_REF }}-ndk-${{ env.NDK_VERSION }}
|
||||
|
||||
- name: Checkout qrtr
|
||||
if: steps.qrtr-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
repository: linux-msm/qrtr
|
||||
ref: ${{ env.QRTR_REF }}
|
||||
path: qrtr
|
||||
|
||||
- name: Build for Android
|
||||
run: |
|
||||
export ANDROID_NDK="$GITHUB_WORKSPACE/android-ndk-${NDK_VERSION}"
|
||||
./ci/android.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
cc_binary {
|
||||
name: "tqftpserv",
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"tqftpserv.c",
|
||||
"translate.c",
|
||||
],
|
||||
shared_libs: ["libqrtr"],
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Linaro Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
@@ -1,17 +0,0 @@
|
||||
TQFTPSERV := tqftpserv
|
||||
|
||||
CFLAGS := -Wall -g -O2
|
||||
LDFLAGS := -lqrtr
|
||||
|
||||
SRCS := tqftpserv.c
|
||||
|
||||
OBJS := $(SRCS:.c=.o)
|
||||
|
||||
$(TQFTPSERV): $(OBJS)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
install: $(TQFTPSERV)
|
||||
install -D -m 755 $< $(DESTDIR)$(prefix)/bin/$<
|
||||
|
||||
clean:
|
||||
rm -f $(TQFTPSERV) $(OBJS)
|
||||
@@ -0,0 +1,53 @@
|
||||
# tqftpserv
|
||||
|
||||
The tqftpserv software is an implementation of a TFTP (Trivial File Transfer Protocol) server which runs on top of the AF_QIPCRTR (a.k.a QRTR) socket type.
|
||||
|
||||
The main purpose of tqftpserv is to serve files from the Linux file system to other processors on the Qualcomm SoCs as requested.
|
||||
|
||||
The protocol implemented here is (loosely) based on RFC 1350 including some extensions to the protocol.
|
||||
|
||||
In basic terms, the protocol supports RRQ (Read Request) and WRQ (Write Request) messages which read and write files respectively. A request can have some extra options, like `blksize` ior `wsize`. The meaning of those is documented in the `parse_options` function.
|
||||
|
||||
For reference, the proprietary implementation of this that is used on practically all Qualcomm-based Android devices is called "tftp_server".
|
||||
|
||||
## File paths
|
||||
|
||||
There's two different virtual paths prefixes that are supported:
|
||||
* `/readonly/firmware/image/` for read-only files such as firmware files
|
||||
* `/readwrite/` for read-write (temporary) files
|
||||
|
||||
Requests to those paths are "translated" (see `translate.c`) to paths in the Linux filesystem. In a regular setup readonly requests go to `/lib/firmware/` and readwrite requests go to `/tmp/tqftpserv/`.
|
||||
|
||||
Translating those readonly request paths tries to take into account custom Linux firmware paths, custom "firmware-name" paths for remoteprocs, .zstd compressed firmware and more. In case of doubt, please consult the source code.
|
||||
|
||||
For example on a QCM6490 Fairphone 5 smartphone the path for `/readonly/firmware/image/modem_pr/so/901_0_0.mbn` will be translated to `/lib/firmware/qcom/qcm6490/fairphone5/modem_pr/so/901_0_0.mbn`, based on the devicetree property `firmware-name = "qcom/qcm6490/fairphone5/modem.mbn";` in the modem/mpss DT node.
|
||||
|
||||
The actual paths that are used and requested are dependent on the TFTP clients, which is usually the firmware that is running on the Hexagon-based modem processor on the SoC.
|
||||
|
||||
## Example requests
|
||||
|
||||
The following are some example requests which are grabbed from the tqftpserv log during modem bootup.
|
||||
|
||||
* Write content to a file called "server_check.txt":
|
||||
```
|
||||
[TQFTP] WRQ: /readwrite/server_check.txt (octet)
|
||||
```
|
||||
|
||||
* Read a file called "ota_firewall/ruleset" which does not exist:
|
||||
```
|
||||
[TQFTP] RRQ: /readwrite/ota_firewall/ruleset (mode=octet rsize=0 seek=0)
|
||||
tqftpserv: failed to open ota_firewall/ruleset: No such file or directory
|
||||
[TQFTP] unable to open /readwrite/ota_firewall/ruleset (2), reject
|
||||
```
|
||||
|
||||
* Stat a file with the path "modem_pr/so/901_0_0.mbn", and then read it:
|
||||
```
|
||||
[TQFTP] RRQ: /readonly/firmware/image/modem_pr/so/901_0_0.mbn (mode=octet rsize=0 seek=0)
|
||||
[TQFTP] Remote returned END OF TRANSFER: 9 - End of Transfer
|
||||
[TQFTP] RRQ: /readonly/firmware/image/modem_pr/so/901_0_0.mbn (mode=octet rsize=52 seek=0)
|
||||
```
|
||||
|
||||
In binary such a request can look like the following:
|
||||
```
|
||||
\0\1/readonly/firmware/image/modem_pr/so/901_0_0.mbn\0octet\0blksize\0007680\0timeoutms\0001000\0tsize\0000\0wsize\00010\0
|
||||
```
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
||||
#
|
||||
# Install build dependencies on Alpine Linux.
|
||||
|
||||
set -ex
|
||||
|
||||
# build-base pulls in binutils (the linker/assembler) and the musl headers,
|
||||
# which clang needs as well; add clang on top when it is the compiler.
|
||||
PKGS_CC=""
|
||||
case $CC in
|
||||
clang*)
|
||||
PKGS_CC="clang"
|
||||
;;
|
||||
esac
|
||||
|
||||
PKGS_ZSTD=""
|
||||
if [ "$ZSTD" = "enabled" ]; then
|
||||
PKGS_ZSTD="zstd-dev"
|
||||
fi
|
||||
|
||||
PKGS_XZ=""
|
||||
if [ "$XZ" = "enabled" ]; then
|
||||
PKGS_XZ="xz-dev"
|
||||
fi
|
||||
|
||||
apk add \
|
||||
build-base \
|
||||
pkgconf \
|
||||
meson \
|
||||
ninja \
|
||||
qrtr-dev \
|
||||
$PKGS_ZSTD \
|
||||
$PKGS_XZ \
|
||||
$PKGS_CC
|
||||
|
||||
echo "Install finished: $0"
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
||||
#
|
||||
# Cross-build tqftpserv (and its libqrtr dependency) for Android using the NDK.
|
||||
#
|
||||
# Expects the following environment variables:
|
||||
# ABI - Android ABI (arm64-v8a, armeabi-v7a, x86_64)
|
||||
# API - Android API level to target
|
||||
# ANDROID_NDK - path to an unpacked Android NDK
|
||||
# QRTR_SRC - path to a checked-out qrtr source tree
|
||||
# QRTR_PREFIX - prefix into which libqrtr is (or was) installed
|
||||
|
||||
set -ex
|
||||
|
||||
TOOLCHAIN="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64"
|
||||
|
||||
case "$ABI" in
|
||||
arm64-v8a)
|
||||
CPU_FAMILY=aarch64
|
||||
CPU=aarch64
|
||||
TRIPLE=aarch64-linux-android
|
||||
ELF_MACHINE=AArch64
|
||||
;;
|
||||
armeabi-v7a)
|
||||
CPU_FAMILY=arm
|
||||
CPU=armv7a
|
||||
TRIPLE=armv7a-linux-androideabi
|
||||
ELF_MACHINE=ARM
|
||||
;;
|
||||
x86_64)
|
||||
CPU_FAMILY=x86_64
|
||||
CPU=x86_64
|
||||
TRIPLE=x86_64-linux-android
|
||||
ELF_MACHINE=X86-64
|
||||
;;
|
||||
*)
|
||||
echo "Unknown ABI '$ABI'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# The per-ABI clang wrapper already selects the correct target and sysroot, so
|
||||
# the cross file does not need to spell those out.
|
||||
cat > android-cross.txt <<EOF
|
||||
[binaries]
|
||||
c = '$TOOLCHAIN/bin/${TRIPLE}${API}-clang'
|
||||
ar = '$TOOLCHAIN/bin/llvm-ar'
|
||||
strip = '$TOOLCHAIN/bin/llvm-strip'
|
||||
pkg-config = 'pkg-config'
|
||||
|
||||
[host_machine]
|
||||
system = 'android'
|
||||
cpu_family = '$CPU_FAMILY'
|
||||
cpu = '$CPU'
|
||||
endian = 'little'
|
||||
|
||||
[properties]
|
||||
pkg_config_libdir = '$QRTR_PREFIX/lib/pkgconfig'
|
||||
EOF
|
||||
cat android-cross.txt
|
||||
|
||||
# Build and install libqrtr, unless it was already restored from the cache.
|
||||
if [ ! -f "$QRTR_PREFIX/lib/pkgconfig/qrtr.pc" ]; then
|
||||
meson setup --cross-file android-cross.txt \
|
||||
--prefix="$QRTR_PREFIX" --libdir=lib \
|
||||
"$QRTR_SRC/build-$ABI" "$QRTR_SRC"
|
||||
ninja -C "$QRTR_SRC/build-$ABI" install
|
||||
fi
|
||||
|
||||
meson setup --errorlogs --werror --cross-file android-cross.txt build .
|
||||
ninja -C build
|
||||
|
||||
# Confirm the resulting binary really is for the requested ABI.
|
||||
"$TOOLCHAIN/bin/llvm-readelf" -h build/tqftpserv | grep -q "Machine:.*$ELF_MACHINE"
|
||||
echo "Android build for $ABI ($ELF_MACHINE) succeeded"
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
||||
#
|
||||
# Install build dependencies on Arch Linux.
|
||||
#
|
||||
# qrtr is only packaged in the AUR, which is not available in the CI
|
||||
# container, so build and install it from source.
|
||||
|
||||
set -ex
|
||||
|
||||
PKGS_CC="gcc"
|
||||
case $CC in
|
||||
clang*)
|
||||
PKGS_CC="clang"
|
||||
;;
|
||||
esac
|
||||
|
||||
# zstd and xz (liblzma) ship as part of the Arch base image and cannot be
|
||||
# removed, so there is no "disabled" variant to install here.
|
||||
pacman -Syu --noconfirm \
|
||||
pkgconf \
|
||||
meson \
|
||||
ninja \
|
||||
git \
|
||||
zstd \
|
||||
xz \
|
||||
$PKGS_CC
|
||||
|
||||
QRTR_SRC=$(mktemp -d)
|
||||
git clone --depth 1 https://github.com/linux-msm/qrtr "$QRTR_SRC"
|
||||
meson setup --prefix=/usr "$QRTR_SRC/build" "$QRTR_SRC"
|
||||
ninja -C "$QRTR_SRC/build"
|
||||
ninja -C "$QRTR_SRC/build" install
|
||||
rm -rf "$QRTR_SRC"
|
||||
|
||||
echo "Install finished: $0"
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
||||
#
|
||||
# Verify that xz support was autodetected as expected: xz-decompress.c is
|
||||
# only compiled when liblzma is available.
|
||||
|
||||
set -eu
|
||||
|
||||
OBJ=build/tqftpserv.p/xz-decompress.c.o
|
||||
|
||||
case "$XZ" in
|
||||
enabled)
|
||||
if [ ! -f "$OBJ" ]; then
|
||||
echo "ERROR: expected xz support, but xz-decompress.c was not built"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
disabled)
|
||||
if [ -f "$OBJ" ]; then
|
||||
echo "ERROR: expected no xz support, but xz-decompress.c was built"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unexpected XZ value '$XZ'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "xz support check ($XZ) passed"
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
||||
#
|
||||
# Verify that zstd support was autodetected as expected: zstd-decompress.c is
|
||||
# only compiled when libzstd is available.
|
||||
|
||||
set -eu
|
||||
|
||||
OBJ=build/tqftpserv.p/zstd-decompress.c.o
|
||||
|
||||
case "$ZSTD" in
|
||||
enabled)
|
||||
if [ ! -f "$OBJ" ]; then
|
||||
echo "ERROR: expected zstd support, but zstd-decompress.c was not built"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
disabled)
|
||||
if [ -f "$OBJ" ]; then
|
||||
echo "ERROR: expected no zstd support, but zstd-decompress.c was built"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unexpected ZSTD value '$ZSTD'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "zstd support check ($ZSTD) passed"
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
||||
#
|
||||
# Install build dependencies on Debian and Ubuntu.
|
||||
|
||||
set -ex
|
||||
|
||||
apt update
|
||||
|
||||
# Some distros might pull tzdata which asks questions
|
||||
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
|
||||
PKGS_CC="build-essential"
|
||||
case $CC in
|
||||
clang*)
|
||||
PKGS_CC="clang"
|
||||
;;
|
||||
esac
|
||||
|
||||
PKGS_ZSTD=""
|
||||
if [ "$ZSTD" = "enabled" ]; then
|
||||
PKGS_ZSTD="libzstd-dev"
|
||||
fi
|
||||
|
||||
PKGS_XZ=""
|
||||
if [ "$XZ" = "enabled" ]; then
|
||||
PKGS_XZ="liblzma-dev"
|
||||
fi
|
||||
|
||||
apt install -y --no-install-recommends \
|
||||
pkg-config \
|
||||
meson \
|
||||
ninja-build \
|
||||
libqrtr-dev \
|
||||
$PKGS_ZSTD \
|
||||
$PKGS_XZ \
|
||||
$PKGS_CC
|
||||
|
||||
echo "Install finished: $0"
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
||||
#
|
||||
# Install build dependencies on Fedora.
|
||||
|
||||
set -ex
|
||||
|
||||
PKGS_CC="gcc"
|
||||
case $CC in
|
||||
clang*)
|
||||
PKGS_CC="clang"
|
||||
;;
|
||||
esac
|
||||
|
||||
PKGS_ZSTD=""
|
||||
if [ "$ZSTD" = "enabled" ]; then
|
||||
PKGS_ZSTD="libzstd-devel"
|
||||
fi
|
||||
|
||||
PKGS_XZ=""
|
||||
if [ "$XZ" = "enabled" ]; then
|
||||
PKGS_XZ="xz-devel"
|
||||
fi
|
||||
|
||||
dnf -y install \
|
||||
pkgconf-pkg-config \
|
||||
meson \
|
||||
ninja-build \
|
||||
qrtr-devel \
|
||||
$PKGS_ZSTD \
|
||||
$PKGS_XZ \
|
||||
$PKGS_CC
|
||||
|
||||
echo "Install finished: $0"
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
debian.sh
|
||||
@@ -1,32 +1,6 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
/*
|
||||
* Copyright (c) 2016, Linaro Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __LIST_H__
|
||||
#define __LIST_H__
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
project('tqftpserv',
|
||||
'c',
|
||||
version: '1.1.1',
|
||||
default_options: [
|
||||
'warning_level=1',
|
||||
'buildtype=release',
|
||||
])
|
||||
|
||||
prefix = get_option('prefix')
|
||||
|
||||
if host_machine.system() == 'android'
|
||||
add_project_arguments('-DANDROID', language : 'c')
|
||||
endif
|
||||
|
||||
tqftpserv_srcs = ['translate.c',
|
||||
'tqftpserv.c']
|
||||
tqftpserv_deps = []
|
||||
|
||||
xz_dep = dependency('liblzma', required : false)
|
||||
if xz_dep.found()
|
||||
add_project_arguments('-DHAVE_XZ', language : 'c')
|
||||
tqftpserv_srcs += 'xz-decompress.c'
|
||||
tqftpserv_deps += xz_dep
|
||||
endif
|
||||
|
||||
zstd_dep = dependency('libzstd', required : false)
|
||||
if zstd_dep.found()
|
||||
add_project_arguments('-DHAVE_ZSTD', language : 'c')
|
||||
tqftpserv_srcs += 'zstd-decompress.c'
|
||||
tqftpserv_deps += zstd_dep
|
||||
endif
|
||||
|
||||
# Not required to build the executable,
|
||||
# only to automatically retrieve the install dir for unit files
|
||||
systemd = dependency('systemd', required : false)
|
||||
if get_option('systemd-unit-prefix') != ''
|
||||
systemd_system_unit_dir = get_option('systemd-unit-prefix')
|
||||
elif systemd.found()
|
||||
systemd_system_unit_dir = systemd.get_variable(
|
||||
pkgconfig : 'systemdsystemunitdir',
|
||||
pkgconfig_define: ['prefix', prefix])
|
||||
else
|
||||
systemd_system_unit_dir = ''
|
||||
endif
|
||||
|
||||
qrtr_dep = dependency('qrtr', required : false)
|
||||
if not qrtr_dep.found()
|
||||
# Support old libqrtr that does not ship a qrtr.pc pkg-config file.
|
||||
cc = meson.get_compiler('c')
|
||||
qrtr_dep = cc.find_library('qrtr', has_headers : 'libqrtr.h')
|
||||
endif
|
||||
tqftpserv_deps += qrtr_dep
|
||||
|
||||
executable('tqftpserv',
|
||||
tqftpserv_srcs,
|
||||
dependencies : tqftpserv_deps,
|
||||
install : true)
|
||||
|
||||
if systemd_system_unit_dir != ''
|
||||
systemd_unit_conf = configuration_data()
|
||||
systemd_unit_conf.set('prefix', prefix)
|
||||
configure_file(
|
||||
input : 'tqftpserv.service.in',
|
||||
output : 'tqftpserv.service',
|
||||
configuration : systemd_unit_conf,
|
||||
install_dir : systemd_system_unit_dir)
|
||||
endif
|
||||
@@ -0,0 +1,4 @@
|
||||
option('systemd-unit-prefix',
|
||||
type: 'string',
|
||||
description: 'Directory for systemd system unit files'
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/sh
|
||||
# Populate tqftp readwrite data from persist partition
|
||||
|
||||
set -eu
|
||||
|
||||
PERSIST_DEV="/dev/disk/by-partlabel/persist"
|
||||
PERSIST_MOUNT="/mnt/persist"
|
||||
TQFTPSERV_TMP="/var/lib/tqftpserv"
|
||||
|
||||
if [ -f $TQFTPSERV_TMP/readwrite_ready ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p $PERSIST_MOUNT
|
||||
mount $PERSIST_DEV -o ro,noatime $PERSIST_MOUNT
|
||||
mkdir -p $TQFTPSERV_TMP
|
||||
cp -r $PERSIST_MOUNT/rfs/msm/mpss/* $TQFTPSERV_TMP/
|
||||
touch $TQFTPSERV_TMP/readwrite_ready
|
||||
umount $PERSIST_MOUNT
|
||||
rmdir $PERSIST_MOUNT
|
||||
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description= Populate tqftp readwrite data from persist partition
|
||||
Requires=dev-disk-by\x2dpartlabel-persist.device
|
||||
After=dev-disk-by\x2dpartlabel-persist.device
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=@prefix@/bin/populate-readwrite.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+610
-163
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=QRTR TFTP service
|
||||
|
||||
[Service]
|
||||
ExecStart=@prefix@/bin/tqftpserv
|
||||
Restart=always
|
||||
StateDirectory=tqftpserv
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loaded 20 of 26 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user