mirror of
https://github.com/dikeckaan/mu300-linux.git
synced 2026-12-06 08:03:36 +00:00
OpenWrt: nftables sets in kernel (fw4 NAT), signed regdb and country before hostapd, PATH fixes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Z17MBkdHmZPvNPNSLxcHk
This commit is contained in:
1 parent
f24b59da1a
commit
ea6344301b
9 files changed
+51
-2
No files matched your search
@@ -33,7 +33,7 @@ Wi-Fi on the ZTE F50 5G mobile hotspot (hardware MU300, Unisoc T760 / UMS9620).
|
||||
| Thermal throttling, status LEDs, SIM tray, DVFS drivers | ✅ `mu300-extra-modules` (blue LED = mobile data up) |
|
||||
| Default boot to Linux with automatic fallback | ✅ `mu300-next-boot linux\|android`; a Linux boot that never completes rolls back to Android |
|
||||
| RAM | ✅ 1473 MiB usable (464 MiB is the modem firmware's, unavoidable); unused logo/sysdump reservations freed, zram swap |
|
||||
| OpenWrt 25.12 (selectable next to Ubuntu, `mu300-os`) | 🔧 boots; modem, cellular WAN (`proto mu300cell`), LuCI and SSH work; Wi-Fi bring-up in progress |
|
||||
| OpenWrt 25.12 (selectable next to Ubuntu, `mu300-os`) | ✅ procd boot, modem, cellular WAN (`proto mu300cell`, APN in LuCI), firewall4 NAT, 5 GHz Wi-Fi (UCI/LuCI), USB LAN, SSH; ~140 MiB RAM used |
|
||||
| Internal audio | ✗ no speaker/mic path; the AW883xx amplifier does not answer on I2C. The AGDSP can be booted with firmware from another device (Android community modules), Linux port pending |
|
||||
| Bluetooth (SC2355) | ✅ BlueZ `hci0` powered, scanning works: `sprdbt_tty` (PCIe H4) + `mu300-bt-init` vendor PSKey/RF upload + link-policy kernel patch |
|
||||
| GPU (Mali-G57) | ✅ OpenCL 3.0 (headless): `mali_kbase` r40p0 built from source + Android's Mali userspace in the vendor chroot (`android-gpu-run`) |
|
||||
|
||||
@@ -307,6 +307,12 @@ average. `top` shows about 98 % idle.
|
||||
* `wifi`/netifd wireless handlers are in `wifi-scripts` (with `iwinfo`, `wireless-regdb`), not pulled in by `wpad`.
|
||||
* macOS keeps the ECM link inactive after netifd reconfigures `usb0`; a hotplug hook re-enumerates the gadget on every
|
||||
LAN ifup.
|
||||
* The kernel had no nftables sets (`CONFIG_NF_TABLES_SET`), so fw4's ruleset (`ct state vmap {...}`) was rejected as a
|
||||
whole and there was no NAT; the fragment now enables sets, objref, flow offload, redirect, quota and friends.
|
||||
* OpenWrt's `regulatory.db` is unsigned; this kernel wants the signed one (Debian's `wireless-regdb`). `iw reg reload`
|
||||
fails with ENOENT early in boot and is retried, and the country is applied before netifd starts hostapd.
|
||||
* Verified after reboots: 5 GHz AP (channel 36), cellular WAN, a USB client's traffic leaves with the modem's public IP;
|
||||
memory use about 140 MiB.
|
||||
* The early recorder runs from preinit, so a failed OpenWrt boot leaves dmesg, `ps`, `logread` and the Android logcat in
|
||||
boot_b for `tools/collect-logs.sh`.
|
||||
|
||||
|
||||
@@ -135,3 +135,21 @@ CONFIG_ZTE_AW883XX_SMART_PA=m
|
||||
|
||||
# --- give unused reserved-memory back to Linux (no display, no bootloader sysdump)
|
||||
CONFIG_OF_RESERVED_MEM_SKIP="logobuffer,sysdump-uboot"
|
||||
|
||||
# --- nftables features firewall4 (OpenWrt) and common tools need: sets/maps, flow offload, redirect, quota
|
||||
CONFIG_NF_TABLES_SET=y
|
||||
CONFIG_NFT_OBJREF=y
|
||||
CONFIG_NFT_REDIR=y
|
||||
CONFIG_NFT_QUOTA=y
|
||||
CONFIG_NFT_NUMGEN=y
|
||||
CONFIG_NFT_HASH=y
|
||||
CONFIG_NFT_CONNLIMIT=y
|
||||
CONFIG_NFT_SOCKET=y
|
||||
CONFIG_NFT_TPROXY=y
|
||||
CONFIG_NF_FLOW_TABLE=y
|
||||
CONFIG_NF_FLOW_TABLE_INET=y
|
||||
CONFIG_NFT_FLOW_OFFLOAD=y
|
||||
CONFIG_NFT_FIB_NETDEV=y
|
||||
CONFIG_NFT_FWD_NETDEV=y
|
||||
CONFIG_NFT_BRIDGE_META=y
|
||||
CONFIG_NFT_BRIDGE_REJECT=y
|
||||
@@ -22,6 +22,10 @@ want=$(curl -fsL "$URL/sha256sums" | sed -n "s/^\([0-9a-f]*\) \*$TARBALL$/\1/p")
|
||||
have=$(shasum -a 256 "openwrt/$TARBALL" 2>/dev/null || sha256sum "openwrt/$TARBALL")
|
||||
[ "${have%% *}" = "$want" ] || { echo "checksum mismatch for $TARBALL" >&2; exit 1; }
|
||||
docker import --platform linux/arm64 "openwrt/$TARBALL" mu300-openwrt-base:$VER >/dev/null
|
||||
# OpenWrt ships an unsigned regulatory.db; this kernel requires the signed database (wens key), so take Debian/Ubuntu's
|
||||
REGDB=$(mktemp -d)
|
||||
docker run --rm --platform linux/arm64 -v "$REGDB":/o ubuntu:26.04 sh -c \
|
||||
"apt-get update -qq >/dev/null && apt-get install -y -qq wireless-regdb >/dev/null && cp /usr/lib/firmware/regulatory.db /usr/lib/firmware/regulatory.db.p7s /o/"
|
||||
|
||||
opt() { [ -e "$IN/$1" ] && echo "-v $IN/$1:/in/$2:ro" || true; }
|
||||
# shellcheck disable=SC2046
|
||||
@@ -31,7 +35,7 @@ docker run --rm --platform linux/arm64 \
|
||||
$(opt out/modules.builtin modules.builtin) $(opt out/modules.builtin.modinfo modules.builtin.modinfo) \
|
||||
$(opt firmware firmware) $(opt android-subset android-subset) $(opt android-gpu-subset android-gpu-subset) \
|
||||
$(opt tools/logdw/logdw logdw) $(opt tools/bt-init/mu300-bt-init bt-init) $(opt tools/gpu/cltest cltest) \
|
||||
$(opt busybox busybox) -v "$TOP/openwrt":/out \
|
||||
$(opt busybox busybox) -v "$TOP/openwrt":/out -v "$REGDB":/in/regdb:ro \
|
||||
-e KREL=$KREL -e OUT="$(basename "$OUT")" mu300-openwrt-base:$VER /bin/sh -eu -c '
|
||||
mkdir -p /var/lock /var/run /tmp
|
||||
apk update >/dev/null
|
||||
@@ -51,6 +55,7 @@ M=$R/lib/modules/$KREL; mkdir -p $M
|
||||
cp /in/modules/*.ko $M/ # ubox kmodloader expects the modules flat in /lib/modules/<release>/
|
||||
for f in modules.builtin modules.builtin.modinfo; do [ -e /in/$f ] && cp /in/$f $M/; done
|
||||
[ -d /in/firmware ] && { mkdir -p $R/lib/firmware; cp -a /in/firmware/. $R/lib/firmware/; }
|
||||
cp /in/regdb/regulatory.db /in/regdb/regulatory.db.p7s $R/lib/firmware/
|
||||
if [ -d /in/android-subset ]; then
|
||||
mkdir -p $R/opt/mu300/android && cp -a /in/android-subset/. $R/opt/mu300/android/
|
||||
mv $R/opt/mu300/android/dev/__properties__ $R/opt/mu300/android/dev-properties && rmdir $R/opt/mu300/android/dev
|
||||
@@ -78,3 +83,4 @@ done
|
||||
rm -rf $R/lib/modules/6.* $R/boot
|
||||
cd $R && tar -czf /out/$OUT .
|
||||
ls -la /out/$OUT'
|
||||
rm -rf "$REGDB"
|
||||
@@ -7,7 +7,18 @@ boot() {
|
||||
/opt/mu300/bin/extra-modules >/tmp/mu300-extra-modules.log 2>&1
|
||||
/opt/mu300/bin/zram-start >/dev/null 2>&1
|
||||
/opt/mu300/bin/wifi-start >/tmp/mu300-wifi-start.log 2>&1
|
||||
# cfg80211 looked for regulatory.db before the rootfs was mounted; load it now so hostapd sees the country rules
|
||||
for n in $(seq 1 15); do
|
||||
iw reg reload >>/tmp/mu300-wifi-start.log 2>&1 && break
|
||||
sleep 1
|
||||
done
|
||||
/opt/mu300/bin/openwrt-wifi-config >>/tmp/mu300-wifi-start.log 2>&1
|
||||
# apply the country before netifd starts hostapd, otherwise 5 GHz channels are still NO-IR under world rules
|
||||
country=$(uci -q get wireless.radio0.country)
|
||||
if [ -n "$country" ]; then
|
||||
iw reg set "$country"
|
||||
for n in $(seq 1 10); do iw reg get | grep -q "country $country:" && break; sleep 1; done
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
# Early boot recorder: for the first minutes after switch_root, copy dmesg + unit states into the persistent
|
||||
# log area inside boot_b (48 MiB, 8 MiB) every few seconds, so a power cut before journald flushes still
|
||||
# leaves evidence that tools/collect-logs.sh can read from Android.
|
||||
# OpenWrt: od/timeout come from the static busybox in /opt/mu300/busybox-bin
|
||||
export PATH="$PATH:/opt/mu300/busybox-bin"
|
||||
BOOTB=$(readlink -f /dev/block/by-name/boot_b 2>/dev/null)
|
||||
[ -b "$BOOTB" ] || for u in /sys/class/block/mmcblk0p*/uevent; do grep -qx PARTNAME=boot_b "$u" && BOOTB=/dev/$(basename "$(dirname "$u")"); done
|
||||
[ -b "$BOOTB" ] || exit 0
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
# Mobile data on the MU300 modem without Android RIL: AT commands on /dev/stty_nr1, data over sipa_eth<cid-1>.
|
||||
# usage: mobile-data up [APN] | down | status | sim-reset | watch
|
||||
# MU300_NETIFD=1 mobile-data up [APN]: only attach and print IFACE/IP/PREFIX/DNS1/DNS2 (OpenWrt netifd protocol)
|
||||
# OpenWrt: od/timeout come from the static busybox in /opt/mu300/busybox-bin
|
||||
export PATH="$PATH:/opt/mu300/busybox-bin"
|
||||
set -euo pipefail
|
||||
DEV=${MU300_AT_DEV:-/dev/stty_nr1}
|
||||
CID=1
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
# mu300-next-boot status
|
||||
# Slot b is armed with tries=2 and successful=0. LK decrements tries on boot; if Linux never reaches
|
||||
# mu300-boot-ok, the next boot sees tries=1 and rolls back to slot a (Android) by itself.
|
||||
# OpenWrt: od/timeout come from the static busybox in /opt/mu300/busybox-bin
|
||||
export PATH="$PATH:/opt/mu300/busybox-bin"
|
||||
set -eu
|
||||
CONF=/etc/mu300/default-boot
|
||||
BC_A=/run/mu300/misc-bc-slot-a.bin
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
# mu300-os show installed systems and the current choice
|
||||
# mu300-os openwrt boot OpenWrt from now on (reboot to apply)
|
||||
# mu300-os ubuntu
|
||||
# OpenWrt: od/timeout come from the static busybox in /opt/mu300/busybox-bin
|
||||
export PATH="$PATH:/opt/mu300/busybox-bin"
|
||||
set -e
|
||||
if mountpoint -q /mnt/mu300-disk 2>/dev/null; then
|
||||
DISK=/mnt/mu300-disk
|
||||
|
||||
Reference in new issue
Block a user