Add support for MF68E and M9S devices with necessary patches and configurations

- Introduced device tree patches for MF68E and M9S, adding their respective .dts files and updating the Makefile to include them.
- Implemented framebuffer driver for the GC9107 LCD controller, enabling display support for the MF68E and M9S devices.
- Created UCI defaults for modem management, including network interface configurations and LED handling for modem and WiFi indicators.
- Added scripts for automatic formatting of the rootfs_data partition and generating GPT images for MSM8916 eMMC.
- Included hotplug scripts for managing LED states based on device actions.
- Updated README with instructions for re-integrating the deprecated device support into the main build.
This commit is contained in:
Miguel Fuertes committed 2026-02-24 10:46:35 +01:00
1 parent d3a42b4e4d
commit 81a703fcc4
57 files changed
+378 -652

No files matched your search

+2 -2
View File
@@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
device: [uz801, m9s, mf68e, uf02]
device: [uz801, uf02]
steps:
- name: Checkout
@@ -55,7 +55,7 @@ jobs:
- name: Load diffconfig
run: |
DEVICE="${{ matrix.device }}"
DIFFCONFIG=$([ "$DEVICE" = "uz801" ] && echo "diffconfig" || echo "diffconfig_${DEVICE}")
DIFFCONFIG="diffconfig_${DEVICE}"
[ -f "$DIFFCONFIG" ] && mv "$DIFFCONFIG" openwrt/.config
- name: Download package
+77
View File
@@ -0,0 +1,77 @@
name: Build Package
on:
workflow_dispatch:
inputs:
package:
description: 'Package to build'
required: true
type: string
default: luci-app-tailscale
env:
TZ: Europe/Madrid
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo -E apt-get -qq update
sudo -E ./devenv/dependencies.sh
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
- name: Clone OpenWrt source code
run: |
git clone https://git.openwrt.org/openwrt/openwrt.git openwrt
git -C openwrt checkout 00ceb1ed1763f7479df6edf92ffada948f0e7d45
- name: Load msm89xx target and packages
run: |
git apply --unsafe-paths enable_wcn36xx_mac80211.patch
mv msm89xx openwrt/target/linux/msm89xx
mv packages openwrt/package/uz801
- name: Update and install feeds
run: |
cd openwrt
rm -rf tmp
./scripts/feeds update -a
./scripts/feeds install -a
- name: Configure for package build
run: |
cd openwrt
mv ../diffconfig_uz801 .config
make defconfig
make download -j8
find dl -size -1024c -exec rm -f {} \; || true
- name: Build toolchain and dependencies
run: |
cd openwrt
make tools/install -j$(nproc)
make toolchain/install -j$(nproc)
- name: Build package
run: |
cd openwrt
make package/${{ inputs.package }}/compile -j$(nproc) V=s
echo "FILE_DATE=$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.package }}_${{ env.FILE_DATE }}
path: openwrt/bin/packages/**/${{ inputs.package }}*.apk
+1 -3
View File
@@ -11,8 +11,6 @@ on:
default: uz801
options:
- uz801
- m9s
- mf68e
- uf02
env:
@@ -61,7 +59,7 @@ jobs:
- name: Load diffconfig
run: |
DEVICE="${{ inputs.device || 'uz801' }}"
DIFFCONFIG=$([ "$DEVICE" = "uz801" ] && echo "diffconfig" || echo "diffconfig_${DEVICE}")
DIFFCONFIG="diffconfig_${DEVICE}"
[ -f "$DIFFCONFIG" ] && mv "$DIFFCONFIG" openwrt/.config
- name: Download package
File renamed without changes.
File renamed without changes.
+24
View File
@@ -0,0 +1,24 @@
## Deprecated device definitions - moved from msm8916.mk
define Device/generic-mf68e
$(Device/msm8916)
DEVICE_VENDOR := Generic
DEVICE_MODEL := MF68E
FILESYSTEMS := squashfs
CMDLINE := "earlycon console=ttyMSM0,115200 quiet loglevel=0 vt.global_cursor_default=0 vt.cur_default=0 root=/dev/mmcblk0p14 rootfstype=squashfs rootwait nowatchdog"
DEVICE_PACKAGES := configs-mifi wpad-basic-wolfssl rmtfs uci-usb-gadget \
block-mount f2fs-tools \
msm-firmware-dumper kmod-fbtft-gc9107 router-display
endef
TARGET_DEVICES += generic-mf68e
define Device/generic-m9s
$(Device/msm8916)
DEVICE_VENDOR := Generic
DEVICE_MODEL := M9S
FILESYSTEMS := squashfs
DEVICE_PACKAGES := configs-mifi wpad-basic-wolfssl rmtfs uci-usb-gadget \
block-mount f2fs-tools \
msm-firmware-dumper
endef
TARGET_DEVICES += generic-m9s
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,22 @@
From: hkfuertes <hkfuertes@example.com>
Date: Sat, 11 Oct 2025 11:49:00 +0200
Subject: [PATCH] arm64: dts: qcom: Add MF68E and M9S to Makefile
Add msm8916-generic-mf68e.dtb and msm8916-generic-m9s.dtb to Makefile.
Signed-off-by: hkfuertes <hkfuertes@example.com>
---
arch/arm64/boot/dts/qcom/Makefile | 2 ++
1 file changed, 2 insertions(+)
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -23,6 +23,8 @@ dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsu
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-gt58.dtb
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-j3ltetw.dtb
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-j5.dtb
+dtb-$(CONFIG_ARCH_QCOM) += msm8916-generic-mf68e.dtb
+dtb-$(CONFIG_ARCH_QCOM) += msm8916-generic-m9s.dtb
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-j5x.dtb
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-rossa.dtb
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-serranove.dtb
+52
View File
@@ -0,0 +1,52 @@
# TBR - Deprecated Device Support (MF68E, M9S)
These files were removed from the main build but are kept here for reference.
They supported MiFi-style devices (MF68E, M9S) with displays, battery monitoring
and power button handling.
## How to re-integrate
### 1. Device definitions
Add the contents of `msm8916.mk.devices` to `msm89xx/image/msm8916.mk`,
before the `endif` line.
### 2. Kernel patches
Copy the patches back into `msm89xx/patches-6.12/`:
```sh
cp patches/802-arm64-dts-qcom-add-msm8916-generic-mf68e.patch ../msm89xx/patches-6.12/
cp patches/805-arm64-dts-qcom-add-msm8916-generic-m9s.patch ../msm89xx/patches-6.12/
cp patches/901-fbtft-fb_gc9107.patch ../msm89xx/patches-6.12/
```
The `801-...patch.orig` only adds mf68e and m9s (UF02 is already handled
by the active `801` patch). Both patches touch different lines so they
apply cleanly one after another.
### 3. Packages
Move the packages back into the `packages/` directory:
```sh
cp -r packages/configs-mifi ../packages/
cp -r packages/router-display ../packages/
cp -r packages/fbtft-gc9107 ../packages/
```
These packages provide:
- **configs-mifi**: UCI defaults, LED hotplugs, battery monitoring, power button
handling, and a pre-built Tailscale APK for MiFi devices.
- **router-display**: SPI display manager (GC9107) with boot/shutdown logos and
status display for MF68E.
- **fbtft-gc9107**: Kernel module for the GC9107 framebuffer (SPI display).
### 4. Diffconfigs
Move `diffconfig_m9s` and `diffconfig_mf68e` back to the repository root.
### 5. CI/CD
Add `m9s` and `mf68e` back to the device matrix in `.github/workflows/build-all.yml`
and the choice options in `.github/workflows/build.yml`.
View File
File renamed without changes.
@@ -0,0 +1,17 @@
#!/bin/sh
LED="/sys/class/leds/blue:wlan"
[ -d "$LED" ] || exit 0
case "$ACTION" in
add)
[ "$DEVICENAME" = "phy0" ] || exit 0
echo none > "$LED/trigger"
echo 1 > "$LED/brightness"
;;
remove)
[ "$DEVICENAME" = "phy0" ] || exit 0
echo none > "$LED/trigger"
echo 0 > "$LED/brightness"
;;
esac
@@ -0,0 +1,15 @@
#!/bin/sh
LED="/sys/class/leds/green:wan"
[ -d "$LED" ] || exit 0
case "$ACTION:$INTERFACE" in
ifup:modem)
echo none > "$LED/trigger"
echo 1 > "$LED/brightness"
;;
ifdown:modem)
echo none > "$LED/trigger"
echo 0 > "$LED/brightness"
;;
esac
@@ -1,10 +1,5 @@
#!/bin/sh
# Enabling WiFi
uci set wireless.@wifi-device[0].disabled='0'
uci set wireless.@wifi-iface[0].disabled='0'
uci commit wireless
# Create modem interface
uci set network.modem=interface
uci set network.modem.proto='modemmanager'
@@ -14,17 +9,11 @@ uci set network.modem.apn='internet'
uci set network.modem.allowedmode='4g|3g'
uci set network.modem.preferredmode='4g'
uci set network.modem.ifname='wwan0'
uci commit network
uci del_list firewall.@zone[1].network='modem'
uci add_list firewall.@zone[1].network='modem'
uci commit firewall
# We don't have eth0
uci -q del_list "network.@device[0].ports=eth0" 2>/dev/null || true
sed -i 's/"device": "eth0"/"device": "br-lan"/g' /etc/board.json
# Commit all changes
uci commit
exit 0
File renamed without changes.
+69 -89
View File
@@ -1,17 +1,23 @@
#!/usr/bin/env bash
# Prerequisites: EDL mode and fastboot.
# Usage: Execute from bin/targets/XXX/YYY/ directory
# Notes:
# - Automatically detects "*-firmware.zip" in the current directory, extracts .mbn files to a temp dir, and uses them.
# - Falls back to manual directory selection if the ZIP is not found.
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only
#
# Flash OpenWrt to MSM8916 devices entirely via EDL.
# Prerequisites: edl, simg2img
# Usage: run from the build output directory (bin/targets/...)
set -euo pipefail
# Find a file by pattern at a given directory depth.
# Must match TOT_SECTORS in generate_squashfs_gpt.sh
TOT_SECTORS=7569408
# Temp files - cleaned up on exit
firmware_tmp=""
rootfs_raw=""
gpt_tmp=""
trap 'rm -rf "$firmware_tmp" "$rootfs_raw" "$gpt_tmp"' EXIT
find_image() {
local dir="$1"
local pattern="$2"
local file
local dir="$1" pattern="$2" file
file=$(find "$dir" -maxdepth 1 -type f -name "$pattern" 2>/dev/null | head -n 1 || true)
if [[ -z "${file:-}" ]]; then
echo "[-] Error: Image not found with pattern: $pattern" >&2
@@ -20,37 +26,27 @@ find_image() {
echo "$file"
}
echo "=== OpenWrt SquashFS Flash Script ==="
echo "[*] Filesystem: SquashFS"
echo
# Use current directory for images.
openwrt_dir="."
echo "[*] Using current directory: $(pwd)"
echo "=== OpenWrt MSM8916 EDL Flash Script ==="
echo
# Detect required OpenWrt images.
echo "[*] Detecting OpenWrt images..."
gpt_path=$(find_image "$openwrt_dir" "*-squashfs-gpt_both0.bin") || exit 1
boot_path=$(find_image "$openwrt_dir" "*-squashfs-boot.img") || exit 1
system_path=$(find_image "$openwrt_dir" "*-squashfs-system.img") || exit 1
gpt_path=$(find_image "." "*-squashfs-gpt_both0.bin") || exit 1
boot_path=$(find_image "." "*-squashfs-boot.img") || exit 1
rootfs_path=$(find_image "." "*-squashfs-system.img") || exit 1
echo "[+] GPT: $(basename "$gpt_path")"
echo "[+] Boot: $(basename "$boot_path")"
echo "[+] Rootfs: $(basename "$system_path")"
echo "[+] GPT: $(basename "$gpt_path")"
echo "[+] Boot: $(basename "$boot_path")"
echo "[+] Rootfs: $(basename "$rootfs_path")"
# Detect firmware ZIP and extract .mbn files.
echo
echo "=== Firmware bundle (.zip) ==="
zip_path="$(find_image "$openwrt_dir" "*-firmware.zip" || true)"
firmware_tmp=""
firmware_dir=""
zip_path="$(find_image "." "*-firmware.zip" || true)"
if [[ -n "${zip_path:-}" ]]; then
echo "[*] Found firmware ZIP: $(basename "$zip_path")"
firmware_tmp="$(mktemp -d)"
trap 'if [[ -n "$firmware_tmp" && -d "$firmware_tmp" ]]; then rm -rf "$firmware_tmp"; fi' EXIT
echo "[*] Extracting .mbn files..."
unzip -q -j -d "$firmware_tmp" "$zip_path" "*.mbn" || {
echo "[-] Error: Failed to extract .mbn files from ZIP"
@@ -61,13 +57,11 @@ else
echo "[!] No firmware ZIP found in the current directory"
echo "=== Qualcomm Firmware Directory (fallback) ==="
read -e -r -p "Drag the folder with .mbn files (aboot, hyp, rpm, sbl1, tz): " firmware_dir
# Normalize quotes and spaces (useful for drag-and-drop from GUI).
firmware_dir="${firmware_dir//\"/}"
firmware_dir="${firmware_dir//\'/}"
firmware_dir="${firmware_dir// /}"
fi
# Validate firmware directory.
if [[ -z "$firmware_dir" || ! -d "$firmware_dir" ]]; then
echo "[-] Error: Invalid firmware directory: $firmware_dir"
exit 1
@@ -77,7 +71,7 @@ echo "[*] Using firmware directory: $firmware_dir"
echo
# Verify required .mbn files.
echo "[*] Verifying Qualcomm firmware partitions..."
echo "[*] Verifying firmware partitions..."
missing_mbn=false
for part in aboot hyp rpm sbl1 tz; do
if [[ ! -f "$firmware_dir/${part}.mbn" ]]; then
@@ -89,15 +83,27 @@ for part in aboot hyp rpm sbl1 tz; do
done
if [[ "$missing_mbn" == true ]]; then
echo
echo "[-] ERROR: Missing required .mbn files for flashing."
echo "[!] Ensure ZIP extraction succeeded or provide a correct directory."
echo "[-] ERROR: Missing required .mbn files."
exit 1
fi
# Convert sparse rootfs to raw if needed (simg2img).
echo
echo "[*] Checking rootfs format..."
if file "$rootfs_path" | grep -q "Android sparse image"; then
echo "[*] Sparse image detected, converting to raw..."
rootfs_raw="$(mktemp --suffix=.img)"
simg2img "$rootfs_path" "$rootfs_raw" || { echo "[-] simg2img failed"; exit 1; }
rootfs_flash="$rootfs_raw"
echo "[+] Converted: $(du -h "$rootfs_raw" | cut -f1)"
else
rootfs_flash="$rootfs_path"
echo "[+] Raw image, no conversion needed"
fi
# Confirm before flashing.
echo
read -p "Continue with flashing? (y/N): " confirm
read -r -p "Continue with flashing? (y/N): " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
echo "[!] Cancelled"
exit 0
@@ -105,74 +111,48 @@ fi
mkdir -p saved
# Backup critical partitions via EDL.
# Backup critical partitions.
echo
echo "=== Partition Backup (EDL) ==="
for n in fsc fsg modemst1 modemst2 modem persist sec; do
echo "[*] Backing up partition $n ..."
echo "[*] Backing up $n..."
edl r "$n" "saved/$n.bin" || { echo "[-] Error backing up $n"; exit 1; }
done
# Flash aboot via EDL to get a known-good aboot.
# Flash new GPT via raw sector writes first, so all subsequent flashes
# use the correct partition offsets from the OpenWrt GPT.
# gpt_both0.bin layout: [34 sectors primary] [32 sectors backup entries] [1 sector backup header]
echo
echo "=== Flashing Partitions (EDL) ==="
echo "[*] Flashing aboot via EDL..."
echo "=== Flashing GPT (EDL) ==="
gpt_tmp="$(mktemp -d)"
dd if="$gpt_path" bs=512 count=34 of="${gpt_tmp}/primary.bin" 2>/dev/null
dd if="$gpt_path" bs=512 skip=34 count=32 of="${gpt_tmp}/backup_entries.bin" 2>/dev/null
dd if="$gpt_path" bs=512 skip=66 count=1 of="${gpt_tmp}/backup_header.bin" 2>/dev/null
edl ws 0 "${gpt_tmp}/primary.bin" || { echo "[-] Error flashing primary GPT"; exit 1; }
edl ws $((TOT_SECTORS - 33)) "${gpt_tmp}/backup_entries.bin" || { echo "[-] Error flashing GPT backup entries"; exit 1; }
edl ws $((TOT_SECTORS - 1)) "${gpt_tmp}/backup_header.bin" || { echo "[-] Error flashing GPT backup header"; exit 1; }
# Flash firmware, boot, rootfs (new GPT now active, correct offsets).
echo
echo "=== Flashing Firmware + OpenWrt images (EDL) ==="
edl w aboot "$firmware_dir/aboot.mbn" || { echo "[-] Error flashing aboot"; exit 1; }
edl w hyp "$firmware_dir/hyp.mbn" || { echo "[-] Error flashing hyp"; exit 1; }
edl w rpm "$firmware_dir/rpm.mbn" || { echo "[-] Error flashing rpm"; exit 1; }
edl w sbl1 "$firmware_dir/sbl1.mbn" || { echo "[-] Error flashing sbl1"; exit 1; }
edl w tz "$firmware_dir/tz.mbn" || { echo "[-] Error flashing tz"; exit 1; }
edl w boot "$boot_path" || { echo "[-] Error flashing boot"; exit 1; }
edl w rootfs "$rootfs_flash" || { echo "[-] Error flashing rootfs"; exit 1; }
edl e rootfs_data || { echo "[-] Error erasing rootfs_data"; exit 1; }
# Reboot to fastboot using EDL commands.
echo "[*] Rebooting to fastboot..."
edl e boot || { echo "[-] Error rebooting to fastboot"; exit 1; }
edl reset || { echo "[-] Error resetting device"; exit 1; }
# Wait for fastboot to come up.
echo "[*] Waiting for fastboot mode (up to 10s)..."
for i in {1..10}; do
if fastboot devices | grep -qE "fastboot$"; then
echo "[+] Fastboot device detected"
break
fi
sleep 1
if [[ $i -eq 10 ]]; then
echo "[-] Error: Fastboot device not detected"
exit 1
fi
done
# Flash GPT and firmware via fastboot.
echo
echo "=== Flashing partitions (fastboot) ==="
echo "[*] Flashing GPT..."
fastboot flash partition "$gpt_path" || { echo "[-] Error flashing partition"; exit 1; }
echo "[*] Flashing firmware (.mbn files)..."
fastboot flash aboot "$firmware_dir/aboot.mbn" || { echo "[-] Error flashing aboot"; exit 1; }
fastboot flash hyp "$firmware_dir/hyp.mbn" || { echo "[-] Error flashing hyp"; exit 1; }
fastboot flash rpm "$firmware_dir/rpm.mbn" || { echo "[-] Error flashing rpm"; exit 1; }
fastboot flash sbl1 "$firmware_dir/sbl1.mbn" || { echo "[-] Error flashing sbl1"; exit 1; }
fastboot flash tz "$firmware_dir/tz.mbn" || { echo "[-] Error flashing tz"; exit 1; }
echo "[*] Flashing OpenWrt images..."
fastboot flash boot "$boot_path" || { echo "[-] Error flashing boot"; exit 1; }
fastboot flash rootfs "$system_path" || { echo "[-] Error flashing rootfs"; exit 1; }
fastboot erase rootfs_data || { echo "[-] Error erasing rootfs_data"; exit 1; }
# Reboot back to EDL to restore radio-cal data partitions.
echo "[*] Rebooting to EDL mode..."
fastboot oem reboot-edl || { echo "[-] Error rebooting to EDL"; exit 1; }
# Small wait for EDL to be available.
echo "[*] Waiting for EDL mode (3 seconds)..."
sleep 3
# Restore backed-up partitions via EDL.
# Restore radio partitions.
echo
echo "=== Partition Restoration (EDL) ==="
for n in fsc fsg modemst1 modemst2 modem persist sec; do
echo "[*] Restoring partition $n ..."
echo "[*] Restoring $n..."
edl w "$n" "saved/$n.bin" || { echo "[-] Error restoring $n"; exit 1; }
done
echo
echo "[+] Process completed successfully"
echo "[*] Rebooting device..."
echo "[+] Flash completed successfully"
echo "[*] Rebooting..."
edl reset || { echo "[-] Error resetting device"; exit 1; }
+5 -3
View File
@@ -1,8 +1,10 @@
#!/bin/bash
# Build firmware bundle: compiles qhypstub (AArch64 asm) and lk2nd (ARM), signs them, and packs a ZIP.
# Works inside OpenWrt build by restoring implicit make rules only for qhypstub and using detected toolchains.
# SPDX-License-Identifier: GPL-2.0-only
#
# Build firmware bundle: compiles qhypstub (AArch64 asm) and lk2nd (ARM),
# signs them with qtestsign, and packs a ZIP.
set -e
set -euo pipefail
OUT_FILE="${1:-uz801v3-firmware.zip}"
@@ -1,11 +1,16 @@
#!/bin/sh -e
# Creates GPT table with fixed TOT_SECTORS=7569408 (512B logical sectors)
# To get TOT_SECTORS automatically from EDL:
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
#
# Generate GPT image for MSM8916 eMMC (7569408 x 512B sectors).
# To read TOT_SECTORS from a live device:
# HEX=$(edl printgpt 2>&1 | sed -n 's/.*sectors:\(0x[0-9A-Fa-f]\+\).*/\1/p' | tail -n1)
# TOT_SECTORS=$((HEX))
set -e
OUTFILE=${1:-gpt_both0.bin}
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
IMG="${TMPDIR}/gpt.img"
# Total size in 512B sectors
@@ -24,13 +29,10 @@ ROOTFS_END=$((ROOTFS_START + ROOTFS_SIZE - 1))
ROOTFSDATA_START=$((ROOTFS_END + 1))
ROOTFSDATA_SIZE=$((LAST_LBA - ROOTFSDATA_START + 1))
# Validation
[ ${ROOTFSDATA_SIZE} -gt 0 ] || { echo "ERROR: No space for rootfs_data"; exit 1; }
# Create image with exact size
truncate -s $((TOT_SECTORS * 512)) "${IMG}"
# Generate GPT table
sfdisk "${IMG}" <<EOF
label: gpt
label-id: DB708ACF-2E04-8DE2-BAFE-30C9B26444C5
@@ -56,9 +58,7 @@ gpt.img14 : start=${ROOTFS_START}, size=${ROOTFS_SIZE}, type=1B81E7E6-F50D-419B-
gpt.img15 : start=${ROOTFSDATA_START}, type=1B81E7E6-F50D-419B-A739-2AEEF8DA3335, name="rootfs_data"
EOF
# size=${ROOTFSDATA_SIZE},
# Build gpt_both0.bin (primary + entries + backup header)
# Assemble gpt_both0.bin: primary header+entries + backup header
dd if="${IMG}" of="${OUTFILE}" bs=512 count=34
dd if="${IMG}" bs=512 skip=2 count=32 >> "${OUTFILE}"
dd if="${IMG}" bs=512 skip=$((TOT_SECTORS - 1)) count=1 >> "${OUTFILE}"
+6 -30
View File
@@ -3,8 +3,8 @@
ifeq ($(SUBTARGET),msm8916)
define Build/generate-squashfs-gpt
chmod +x $(TOPDIR)/target/linux/$(BOARD)/image/generate_squahsfs_gpt.sh
$(TOPDIR)/target/linux/$(BOARD)/image/generate_squahsfs_gpt.sh $@
chmod +x $(TOPDIR)/target/linux/$(BOARD)/image/generate_squashfs_gpt.sh
$(TOPDIR)/target/linux/$(BOARD)/image/generate_squashfs_gpt.sh $@
endef
define Build/install-flasher
@@ -33,8 +33,8 @@ define Device/yiming-uz801v3
DEVICE_VENDOR := YiMing
DEVICE_MODEL := uz801v3
FILESYSTEMS := squashfs
DEVICE_PACKAGES := configs-dongle wpad-basic-wolfssl rmtfs uci-usb-gadget \
block-mount f2fs-tools prepare-rootfs-data \
DEVICE_PACKAGES := wpad-basic-wolfssl rmtfs uci-usb-gadget \
block-mount f2fs-tools \
msm-firmware-dumper
endef
TARGET_DEVICES += yiming-uz801v3
@@ -44,34 +44,10 @@ define Device/generic-uf02
DEVICE_VENDOR := Generic
DEVICE_MODEL := UF02 (250605 V0S)
FILESYSTEMS := squashfs
DEVICE_PACKAGES := configs-dongle wpad-basic-wolfssl rmtfs uci-usb-gadget \
block-mount f2fs-tools prepare-rootfs-data \
DEVICE_PACKAGES := wpad-basic-wolfssl rmtfs uci-usb-gadget \
block-mount f2fs-tools \
msm-firmware-dumper
endef
TARGET_DEVICES += generic-uf02
define Device/generic-mf68e
$(Device/msm8916)
DEVICE_VENDOR := Generic
DEVICE_MODEL := MF68E
FILESYSTEMS := squashfs
CMDLINE := "earlycon console=ttyMSM0,115200 quiet loglevel=0 vt.global_cursor_default=0 vt.cur_default=0 root=/dev/mmcblk0p14 rootfstype=squashfs rootwait nowatchdog"
DEVICE_PACKAGES := configs-mifi wpad-basic-wolfssl rmtfs uci-usb-gadget \
block-mount f2fs-tools prepare-rootfs-data \
msm-firmware-dumper kmod-fbtft-gc9107 router-display
endef
TARGET_DEVICES += generic-mf68e
define Device/generic-m9s
$(Device/msm8916)
DEVICE_VENDOR := Generic
DEVICE_MODEL := M9S
FILESYSTEMS := squashfs
DEVICE_PACKAGES := configs-mifi wpad-basic-wolfssl rmtfs uci-usb-gadget \
block-mount f2fs-tools prepare-rootfs-data \
msm-firmware-dumper
endef
TARGET_DEVICES += generic-m9s
endif
@@ -1,8 +1,8 @@
From: hkfuertes <hkfuertes@example.com>
Date: Sat, 11 Oct 2025 11:49:00 +0200
Subject: [PATCH] arm64: dts: qcom: Add MF68E to Makefile
Subject: [PATCH] arm64: dts: qcom: Add UF02 to Makefile
Add msm8916-generic-mf68e.dtb to Makefile.
Add msm8916-generic-uf02.dtb to Makefile.
Signed-off-by: hkfuertes <hkfuertes@example.com>
---
@@ -11,13 +11,11 @@ Signed-off-by: hkfuertes <hkfuertes@example.com>
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -23,6 +23,9 @@ dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsu
@@ -23,6 +23,7 @@ dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsu
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-gt58.dtb
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-j3ltetw.dtb
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-j5.dtb
+dtb-$(CONFIG_ARCH_QCOM) += msm8916-generic-mf68e.dtb
+dtb-$(CONFIG_ARCH_QCOM) += msm8916-generic-uf02.dtb
+dtb-$(CONFIG_ARCH_QCOM) += msm8916-generic-m9s.dtb
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-j5x.dtb
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-rossa.dtb
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-serranove.dtb
-172
View File
@@ -1,172 +0,0 @@
Perfecto. Aquí tienes la **checklist definitiva** para solucionar esto por software en el futuro:[1][2][3]
## Checklist: Simular batería presente por software
### 1. **Información que necesito darte**
Cuando quieras hacer esto en otro dispositivo, dame:[4][5]
**A) El device tree completo del dispositivo** (archivo `.dts`)
- Para identificar qué GPIOs y canales VADC están definidos
**B) El device tree base de msm8916** (normalmente `msm8916-ufi.dtsi`)
- Para ver qué tiene el PMIC configurado por defecto
**C) Logs del kernel con batería vs sin batería**
```bash
dmesg | grep -E "pm8916|bms|vadc|bat"
```
**D) Estado actual de los sysfs relevantes**
```bash
ls -la /sys/class/power_supply/
cat /sys/kernel/debug/iio/iio:device*/in_*_raw
cat /sys/bus/spmi/devices/0-000*/name
```
### 2. **Preguntas clave que debes hacerme**
Cuando tengas esa información, pregúntame:[2][3][1]
**"¿Cómo simular batería presente en [nombre-dispositivo]?"**
Y específicamente investigo:
**a) Identificar el canal VADC de BAT_ID**[1]
```
¿Qué canal del PM8916 VADC lee el BAT_ID?
```
Normalmente es `VADC_LR_MUX2_BAT_ID` o similar.
**b) Localizar GPIO asociado a BAT_ID**[3][2]
```
¿Hay algún GPIO del PMIC conectado a BAT_ID?
```
**c) Ver configuración actual del BMS**[1]
```
¿Qué propiedades tiene el nodo &pm8916_bms?
```
### 3. **Soluciones software que aplicaré**
Según lo que encuentre, te daré una de estas soluciones:[2][3][1]
#### Opción A: Desactivar lectura de BAT_ID en VADC
```dts
&pm8916_vadc {
/* Comentar/eliminar el canal BAT_ID */
/*
bat-id@12 {
reg = <VADC_LR_MUX2_BAT_ID>;
qcom,pre-scaling = <1 1>;
qcom,hw-settle-time = <200>;
};
*/
};
```
#### Opción B: Forzar GPIO en pull-down permanente
```dts
&pm8916_gpios {
bat_id_pulldown: bat-id-pulldown-state {
pins = "gpioX"; // X = número de GPIO
function = "normal";
input-disable;
output-low;
bias-pull-down;
power-source = <PM8916_GPIO_VPH>;
};
};
```
#### Opción C: Modificar propiedades del BMS
```dts
&pm8916_bms {
status = "okay";
monitored-battery = <&bat>;
power-supplies = <&pm8916_charger>;
/* Opciones para ignorar BAT_ID */
qcom,ignore-shutdown-soc;
qcom,force-bms-active-on-charger;
/delete-property/ io-channels; // Elimina referencia a VADC
};
```
#### Opción D: Simular resistencia con GPIO analog
```dts
&pm8916_gpios {
bat_id_sim: bat-id-simulation {
pins = "gpioX";
function = "normal";
qcom,pull-up-strength = <PMIC_GPIO_PULL_UP_30>; // 100kΩ equiv
bias-pull-down;
};
};
```
### 4. **Archivos que necesito ver**
Cuando me preguntes, adjunta estos archivos:[5][4]
```bash
# 1. DTS del dispositivo
target/linux/msm89xx/dts/qcom/msm8916-generic-TUDEVICE.dts
# 2. DTSI base si existe
target/linux/msm89xx/dts/qcom/msm8916-ufi.dtsi
# 3. Configuración del kernel (opcional pero útil)
target/linux/msm89xx/config-*
# 4. Output de debugfs con batería conectada
cat /sys/kernel/debug/pm8916-adc/channels
cat /sys/kernel/debug/gpio
```
### 5. **Comando diagnóstico rápido**
Cuando no arranque sin batería, ejecuta esto (con UART/serial):[2][1]
```bash
# Durante boot, captura:
dmesg | grep -i "bat\|bms\|vadc\|adc" > /tmp/boot_log.txt
# Y también:
cat /sys/bus/spmi/devices/*/name
cat /proc/interrupts | grep pm8916
```
Y pásame ese log completo.
### 6. **Resumen: ¿Qué te pregunto yo a ti?**
Cuando tengas un dispositivo nuevo que no arranca sin batería:[3][1][2]
> **"Tengo [dispositivo] con MSM8916/PM8916 que no arranca sin batería. Usa el mismo lk2nd que [otro dispositivo] que sí funciona sin batería. Te adjunto:**
> - **DTS de ambos dispositivos** (el que funciona y el que no)
> - **dmesg completo** del que no funciona (si arranca con batería)
> - **Esquemático** si lo tengo
>
> **¿Cómo configuro el device tree para simular BAT_ID por software?**"
Y con eso, busco las diferencias en VADC, GPIOs y configuración del BMS para darte el patch exacto.[4][5][3][1][2]
[1](https://www.kernel.org/doc/Documentation/devicetree/bindings/power/supply/qcom,pm8916-bms-vm.yaml)
[2](https://www.kernel.org/doc/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.txt)
[3](https://docs.qualcomm.com/bundle/publicresource/topics/80-88500-4/20_GPIO_registers_configuration.html)
[4](https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/71119587/2cbba375-133e-46d7-b84a-35a4b519f137/802-arm64-dts-qcom-add-msm8916-generic-mf68e.patch)
[5](https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/71119587/bb25f50b-d1d3-4c22-921c-7e22b9b185a8/805-arm64-dts-qcom-add-msm8916-generic-m9s.patch)
[6](https://docs.qualcomm.com/bundle/publicresource/topics/80-88500-1/7_Pin_control_driver.html)
[7](https://www.kernel.org/doc/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml)
[8](https://sbexr.rabexc.org/latest/sources/6d/8af0298da51217.html)
[9](https://gitlab.com/cunidev/linux-msm8996/-/blob/v3.5-rc5/Documentation/gpio.txt)
[10](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-4/pmic-developer-touchpoints.html)
[11](https://hafnium.googlesource.com/hafnium/third_party/linux/+/refs/heads/master/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.txt)
[12](https://docs.qualcomm.com/bundle/publicresource/topics/80-88500-4/19_Hardware_overview.html)
[13](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-8/pcie.html)
-57
View File
@@ -1,57 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=configs-dongle
PKG_VERSION:=1.0
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=Utilities
CATEGORY:=Utilities
TITLE:=Default Settings For Dongles
DEPENDS:=+PACKAGE_luci:luci-proto-modemmanager +ledcontrol +kmod-button-hotplug +inotifywait
endef
# Optional description
define Package/$(PKG_NAME)/description
Tweaks and defaults for Dongles, including cleanup of problematic APK feeds.
endef
define Build/Configure
endef
define Build/Compile
endef
# Install configuration files and payload you already had
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/uci_defaults $(1)/etc/uci-defaults/99-default-config
$(INSTALL_DIR) $(1)/root/
$(INSTALL_BIN) ./files/luci-app-tailscale*.apk $(1)/root/
$(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211
$(INSTALL_DATA) ./files/hotplugs/99-wifi-led $(1)/etc/hotplug.d/ieee80211/
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_DATA) ./files/hotplugs/99-modem-led $(1)/etc/hotplug.d/iface/
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
set -e
FILE="/etc/apk/repositories.d/distfeeds.list"
ROOT="$${IPKG_INSTROOT:-/}"
TARGET_FILE="$$ROOT$$FILE"
if [ -f "$$TARGET_FILE" ]; then
sed -i '\|/targets/msm89xx/msm8916/packages|d' "$$TARGET_FILE" || true
fi
exit 0
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
@@ -1,14 +0,0 @@
#!/bin/sh
# /etc/hotplug.d/iface/99-modem-led
# Modem LED control based on interface status
case "$ACTION:$INTERFACE" in
ifup:modem)
ledcontrol green:wan on
logger -t modem-led "Modem UP - Green LED ON"
;;
ifdown:modem)
ledcontrol green:wan off
logger -t modem-led "Modem DOWN - Green LED OFF"
;;
esac
@@ -1,29 +0,0 @@
#!/bin/sh
# /etc/hotplug.d/ieee80211/99-wifi-led
# WiFi LED control based on phy0 status
case "$ACTION" in
add)
if [ "$DEVICENAME" = "phy0" ]; then
sleep 5
# Check interface status
ap_status=$(ip link show phy0-ap0 2>/dev/null | grep -c "state UP")
sta_status=$(ip link show phy0-sta0 2>/dev/null | grep -c "state UP")
if [ "$ap_status" -gt 0 ] || [ "$sta_status" -gt 0 ]; then
ledcontrol blue:wlan on
logger -t wifi-led "phy0 interface UP, blue LED ON"
else
ledcontrol blue:wlan off
logger -t wifi-led "No phy0 interface UP, blue LED OFF"
fi
fi
;;
remove)
if [ "$DEVICENAME" = "phy0" ]; then
ledcontrol blue:wlan off
logger -t wifi-led "phy0 removed, blue LED OFF"
fi
;;
esac
-31
View File
@@ -1,31 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ledcontrol
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
define Package/ledcontrol
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Simple LED control utility
DEPENDS:=
endef
define Package/ledcontrol/description
Simple utility to control device LEDs via sysfs
Usage: ledcontrol <color:function> <on|off|blink|blink_fast>
Includes hotplug scripts for WiFi and modem LED management
endef
define Build/Compile
endef
define Package/ledcontrol/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) ./ledcontrol.sh $(1)/usr/bin/ledcontrol
endef
$(eval $(call BuildPackage,ledcontrol))
-75
View File
@@ -1,75 +0,0 @@
#!/bin/sh
# LED Control Utility for OpenWrt
# Usage: ledcontrol <color:function> <on|off|blink|blink_fast>
# Examples:
# ledcontrol green:wan on
# ledcontrol blue:wlan blink
# ledcontrol red:charging off
set -e
# Parse arguments
if [ $# -ne 2 ]; then
echo "Usage: ledcontrol <color:function> <on|off|blink|blink_fast>" >&2
echo "" >&2
echo "Examples:" >&2
echo " ledcontrol green:wan on" >&2
echo " ledcontrol blue:wlan blink" >&2
echo " ledcontrol red:charging off" >&2
echo "" >&2
echo "Available LEDs:" >&2
ls -1 /sys/class/leds 2>/dev/null | grep -v "^mmc" | sed 's/^/ /' >&2
exit 1
fi
LED_NAME="$1"
ACTION="$2"
LED_PATH="/sys/class/leds/$LED_NAME"
# Check if LED exists
if [ ! -d "$LED_PATH" ]; then
echo "[!] LED '$LED_NAME' not found" >&2
echo "[*] Available LEDs:" >&2
ls -1 /sys/class/leds 2>/dev/null | grep -v "^mmc" | sed 's/^/ /' >&2
exit 1
fi
# Set LED state
case "$ACTION" in
on)
echo none > "$LED_PATH/trigger" 2>/dev/null || true
echo 1 > "$LED_PATH/brightness"
;;
off)
echo none > "$LED_PATH/trigger" 2>/dev/null || true
echo 0 > "$LED_PATH/brightness"
;;
blink)
echo timer > "$LED_PATH/trigger" 2>/dev/null || {
echo "[!] Blink not supported, setting ON" >&2
echo 1 > "$LED_PATH/brightness"
exit 0
}
echo 500 > "$LED_PATH/delay_on" 2>/dev/null || true
echo 500 > "$LED_PATH/delay_off" 2>/dev/null || true
;;
blink_fast)
echo timer > "$LED_PATH/trigger" 2>/dev/null || {
echo "[!] Blink not supported, setting ON" >&2
echo 1 > "$LED_PATH/brightness"
exit 0
}
echo 100 > "$LED_PATH/delay_on" 2>/dev/null || true
echo 100 > "$LED_PATH/delay_off" 2>/dev/null || true
;;
*)
echo "[!] Invalid action: $ACTION" >&2
echo "[*] Valid actions: on, off, blink, blink_fast" >&2
exit 1
;;
esac
logger -t ledcontrol "LED '$LED_NAME' set to '$ACTION'"
# Only print to stdout if running interactively (not from a script/service)
[ -t 1 ] && echo "[+] LED '$LED_NAME' set to '$ACTION'"
+17 -9
View File
@@ -1,29 +1,37 @@
# SPDX-License-Identifier: BSD-3-Clause
include $(TOPDIR)/rules.mk
PKG_NAME:=msm-firmware-dumper
PKG_VERSION:=1.1
PKG_RELEASE:=1
PKG_LICENSE:=BSD-3-Clause
PKG_MAINTAINER:=Miguel Fuertes <hkfuertes@gmail.com>
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
TITLE:=One-shot dump of Qualcomm firmware partitions into /lib/firmware
DEPENDS:=+kmod-fs-vfat +kmod-fs-ext4 +kmod-nls-cp437 +kmod-nls-iso8859-1
endef
define Build/Configure
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Compile
endef
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Qualcomm firmware partition dump utility
DEPENDS:=+kmod-fs-vfat +kmod-fs-ext4 +kmod-nls-cp437 +kmod-nls-iso8859-1
endef
define Package/$(PKG_NAME)/description
Dumps Qualcomm firmware partitions into /lib/firmware on first boot.
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) ./files/msm-firmware-dumper.sh $(1)/usr/bin/msm-firmware-dumper
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/msm-firmware-dumper.init $(1)/etc/init.d/msm-firmware-dumper
endef
-33
View File
@@ -1,33 +0,0 @@
# package/system/prepare-rootfs-data/Makefile
include $(TOPDIR)/rules.mk
PKG_NAME:=prepare-rootfs-data
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
define Package/prepare-rootfs-data
SECTION:=base
CATEGORY:=Base system
TITLE:=Automatically format rootfs_data on first boot
DEPENDS:=@TARGET_ROOTFS_SQUASHFS +e2fsprogs +blkid
PKGARCH:=all
endef
define Package/prepare-rootfs-data/description
Preinit script that automatically formats the rootfs_data partition
with ext4 filesystem if it is empty or unformatted, enabling overlay
filesystem to work without manual intervention.
endef
define Build/Compile
endef
define Package/prepare-rootfs-data/install
$(INSTALL_DIR) $(1)/lib/preinit
$(INSTALL_BIN) ./files/79-format-rootfs-data $(1)/lib/preinit/79-format-rootfs-data
endef
$(eval $(call BuildPackage,prepare-rootfs-data))
+14 -20
View File
@@ -1,4 +1,3 @@
# Copyright (C) 2025
# SPDX-License-Identifier: BSD-3-Clause
include $(TOPDIR)/rules.mk
@@ -8,12 +7,13 @@ PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/linux-msm/qrtr.git
# Commit que estás usando
PKG_SOURCE_VERSION:=5923eea97377f4a3ed9121b358fd919e3659db7b
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Miguel Fuertes <hkfuertes@gmail.com>
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
@@ -25,41 +25,35 @@ MESON_ARGS += \
-Dsystemd-service=disabled
define Package/libqrtr
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Userspace library for Linux kernel QRTR
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Qualcomm IPC Router userspace library
endef
define Package/qrtr-utils
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libqrtr
TITLE:=QRTR tools and daemon (qrtr-ns, lookup, etc.)
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libqrtr
TITLE:=Qualcomm IPC Router tools and nameservice daemon
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/ || true
$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libqrtr*.so* $(1)/usr/lib/ || true
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libqrtr*.so* $(1)/usr/lib/
endef
define Package/libqrtr/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libqrtr*.so* $(1)/usr/lib/ || true
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libqrtr*.so* $(1)/usr/lib/
endef
define Package/qrtr-utils/install
# Binarios en /usr/bin
$(INSTALL_DIR) $(1)/usr/bin
-$(CP) $(PKG_INSTALL_DIR)/usr/bin/qrtr* $(1)/usr/bin/ 2>/dev/null || true
# Daemon en /usr/sbin
-$(CP) $(PKG_INSTALL_DIR)/usr/bin/qrtr* $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/sbin
-$(CP) $(PKG_INSTALL_DIR)/usr/sbin/qrtr-ns $(1)/usr/sbin/ 2>/dev/null || true
# Init script (opcional): coloca files/qrtrns.init para procd
-$(CP) $(PKG_INSTALL_DIR)/usr/sbin/qrtr-ns $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/qrtrns.init $(1)/etc/init.d/qrtrns
endef
+11 -14
View File
@@ -1,9 +1,4 @@
#
# Copyright (C) 2020-2021 HandsomeMod Project
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# SPDX-License-Identifier: BSD-3-Clause
include $(TOPDIR)/rules.mk
@@ -11,20 +6,23 @@ PKG_NAME:=rmtfs
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/rmtfs-$(PKG_VERSION)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/linux-msm/rmtfs
PKG_SOURCE_VERSION:=586372e575f5cc1a7cbb170219ab6df98f394cae
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Miguel Fuertes <hkfuertes@gmail.com>
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/rmtfs
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Qualcomm Remote Filesystem Service Implementation
DEPENDS:=+libudev-zero +libqrtr +qrtr-utils
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Qualcomm Remote Filesystem service daemon
DEPENDS:=+libudev-zero +libqrtr +qrtr-utils
endef
define Build/Compile
@@ -32,11 +30,10 @@ define Build/Compile
endef
define Package/rmtfs/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/rmtfs.init $(1)/etc/init.d/rmtfs
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rmtfs $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/rmtfs.init $(1)/etc/init.d/rmtfs
endef
$(eval $(call BuildPackage,rmtfs))
+34 -46
View File
@@ -1,65 +1,57 @@
# SPDX-License-Identifier: GPL-2.0-only
include $(TOPDIR)/rules.mk
PKG_NAME:=uci-usb-gadget
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_MAINTAINER:=Miguel Fuertes <hkfuertes@gmail.com>
PKG_LICENSE:=GPL-2.0-only
PKG_MAINTAINER:=Miguel Fuertes <hkfuertes@gmail.com>
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
TITLE:=UCI-based USB Gadget Manager for OpenWrt
DEPENDS:=@USB_GADGET_SUPPORT +kmod-fs-configfs +kmod-usb-gadget +kmod-usb-lib-composite +kmod-usb-gadget-serial +kmod-usb-gadget-mass-storage +kmod-usb-gadget-ncm +coreutils-truncate +coreutils-shuf +coreutils-dd
PKGARCH:=all
endef
define Package/$(PKG_NAME)/description
UCI-based USB Gadget Manager for OpenWrt using the kernel configfs interface.
Provides easy configuration and management of USB gadget functions through UCI,
making OpenWrt devices appear as various USB peripherals when connected to a host.
Supported functions:
- RNDIS: Windows-compatible USB ethernet (plug-and-play)
- ECM: CDC Ethernet for macOS and Linux
- NCM: Modern high-performance USB ethernet
- ACM: Serial console (with optional login shell)
- Mass Storage: Expose storage image as USB drive
Features:
- Hardware-agnostic: auto-detects UDC controller (works on Raspberry Pi, MSM8916,
Orange Pi, and any device with USB gadget support)
- Network integration: automatically adds USB ethernet interfaces to LAN bridge
- Configurable via UCI: /etc/config/usbgadget
- Persistent serial numbers based on machine-id
- Deterministic MAC address generation
Perfect for creating USB-based network access, serial consoles, or mass storage
devices from OpenWrt routers and embedded devices.
endef
define Package/$(PKG_NAME)/conffiles
/etc/config/usbgadget
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Compile
endef
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
TITLE:=UCI-based USB gadget manager
DEPENDS:=@USB_GADGET_SUPPORT \
+kmod-fs-configfs \
+kmod-usb-gadget \
+kmod-usb-lib-composite \
+kmod-usb-gadget-serial \
+kmod-usb-gadget-mass-storage \
+kmod-usb-gadget-ncm \
+coreutils-truncate \
+coreutils-shuf \
+coreutils-dd
PKGARCH:=all
endef
define Package/$(PKG_NAME)/description
UCI-based USB gadget manager using the kernel configfs interface.
Configures OpenWrt devices as USB peripherals (RNDIS, ECM, NCM, ACM,
Mass Storage) when connected to a host. Hardware-agnostic: auto-detects
the UDC controller and integrates USB ethernet interfaces into the LAN bridge.
endef
define Package/$(PKG_NAME)/conffiles
/etc/config/usbgadget
endef
define Package/$(PKG_NAME)/install
# Install main script
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./files/usb-gadget.sh $(1)/usr/sbin/usb-gadget
# Install init script
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/usb-gadget.init $(1)/etc/init.d/usb-gadget
# Install UCI config
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/usbgadget.config $(1)/etc/config/usbgadget
endef
@@ -67,10 +59,7 @@ endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || {
# Enable service on first install
/etc/init.d/usb-gadget enable
echo "USB Gadget service installed. Configure in /etc/config/usbgadget"
echo "Start with: /etc/init.d/usb-gadget start"
}
exit 0
endef
@@ -78,7 +67,6 @@ endef
define Package/$(PKG_NAME)/prerm
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || {
# Stop and disable service before removal
/etc/init.d/usb-gadget stop
/etc/init.d/usb-gadget disable
}