Replace git patch with portable shell script and parameterize OpenWrt version
- Convert enable_wcn36xx_mac80211.patch to apply_patches.sh (sed + heredoc) for cross-version compatibility (old patch moved to TBR/) - GHA workflows auto-resolve latest OpenWrt 25.12.x tag via git ls-remote - Unify build.yml and build-all.yml into single workflow with dynamic matrix - Local dev (Dockerfile/docker-compose) defaults to main (snapshot) - Remove target-specific APK feed on first boot (msm89xx not on downloads.openwrt.org) - Make LuCI odhcpd fix conditional - Update README with new build instructions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
ac475d7ab1
commit
e89f2c8bfb
9 files changed
+159
-125
No files matched your search
@@ -1,101 +0,0 @@
|
||||
name: OpenWrt Builder (All Devices)
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
UPLOAD_FIRMWARE: true
|
||||
TZ: Europe/Madrid
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
device: [uz801, uf02]
|
||||
|
||||
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: |
|
||||
df -hT $PWD
|
||||
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: Load diffconfig
|
||||
run: |
|
||||
DEVICE="${{ matrix.device }}"
|
||||
DIFFCONFIG="diffconfig_${DEVICE}"
|
||||
[ -f "$DIFFCONFIG" ] && mv "$DIFFCONFIG" openwrt/.config
|
||||
|
||||
- name: Download package
|
||||
id: package
|
||||
run: |
|
||||
cd openwrt
|
||||
make defconfig
|
||||
make download -j8
|
||||
find dl -size -1024c -exec ls -l {} \; || true
|
||||
find dl -size -1024c -exec rm -f {} \; || true
|
||||
|
||||
- name: Compile the firmware
|
||||
id: compile
|
||||
run: |
|
||||
cd openwrt
|
||||
echo -e "$(nproc) thread compile"
|
||||
make -j$(nproc) || make -j1 || make -j1 V=s
|
||||
echo "status=success" >> $GITHUB_OUTPUT
|
||||
grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME
|
||||
[ -s DEVICE_NAME ] && echo "DEVICE_NAME=$(cat DEVICE_NAME)" >> $GITHUB_ENV
|
||||
echo "FILE_DATE=$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
|
||||
|
||||
- name: Organize files
|
||||
id: organize
|
||||
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
|
||||
run: |
|
||||
cd openwrt/bin/targets/*/*
|
||||
rm -rf packages
|
||||
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
|
||||
echo "status=success" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Upload firmware
|
||||
uses: actions/upload-artifact@v4
|
||||
if: steps.organize.outputs.status == 'success' && !cancelled()
|
||||
with:
|
||||
name: openwrt_firmware_${{ env.DEVICE_NAME }}_${{ env.FILE_DATE }}
|
||||
path: |
|
||||
${{ env.FIRMWARE }}/openwrt-msm89xx-msm8916-${{ env.DEVICE_NAME }}-squashfs-gpt_both0.bin
|
||||
${{ env.FIRMWARE }}/openwrt-msm89xx-msm8916-${{ env.DEVICE_NAME }}-squashfs-boot.img
|
||||
${{ env.FIRMWARE }}/openwrt-msm89xx-msm8916-${{ env.DEVICE_NAME }}-squashfs-system.img
|
||||
${{ env.FIRMWARE }}/openwrt-msm89xx-msm8916-${{ env.DEVICE_NAME }}.manifest
|
||||
${{ env.FIRMWARE }}/openwrt-msm89xx-msm8916-${{ env.DEVICE_NAME }}-flash.sh
|
||||
${{ env.FIRMWARE }}/openwrt-msm89xx-msm8916-${{ env.DEVICE_NAME }}-firmware.zip
|
||||
@@ -18,6 +18,14 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Resolve latest OpenWrt 25.12.x tag
|
||||
id: resolve
|
||||
run: |
|
||||
VERSION=$(git ls-remote --tags https://git.openwrt.org/openwrt/openwrt.git 'v25.12.*' \
|
||||
| grep -oP 'v25\.12\.\d+$' | sort -V | tail -1)
|
||||
echo "Resolved OpenWrt version: $VERSION"
|
||||
echo "OPENWRT_VERSION=$VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Initialization environment
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
@@ -32,12 +40,13 @@ jobs:
|
||||
|
||||
- name: Clone OpenWrt source code
|
||||
run: |
|
||||
echo "Using OpenWrt ${{ env.OPENWRT_VERSION }}"
|
||||
git clone https://git.openwrt.org/openwrt/openwrt.git openwrt
|
||||
git -C openwrt checkout 00ceb1ed1763f7479df6edf92ffada948f0e7d45
|
||||
git -C openwrt checkout ${{ env.OPENWRT_VERSION }}
|
||||
|
||||
- name: Load msm89xx target and packages
|
||||
run: |
|
||||
git apply --unsafe-paths enable_wcn36xx_mac80211.patch
|
||||
chmod +x apply_patches.sh && ./apply_patches.sh openwrt
|
||||
mv msm89xx openwrt/target/linux/msm89xx
|
||||
mv packages openwrt/package/uz801
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
device:
|
||||
description: 'Target device'
|
||||
required: true
|
||||
description: 'Target device (all = build all devices)'
|
||||
required: false
|
||||
type: choice
|
||||
default: uz801
|
||||
default: all
|
||||
options:
|
||||
- all
|
||||
- uz801
|
||||
- uf02
|
||||
|
||||
@@ -18,8 +19,27 @@ env:
|
||||
TZ: Europe/Madrid
|
||||
|
||||
jobs:
|
||||
build:
|
||||
resolve-version:
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
openwrt_version: ${{ steps.resolve.outputs.version }}
|
||||
steps:
|
||||
- name: Resolve latest OpenWrt 25.12.x tag
|
||||
id: resolve
|
||||
run: |
|
||||
VERSION=$(git ls-remote --tags https://git.openwrt.org/openwrt/openwrt.git 'v25.12.*' \
|
||||
| grep -oP 'v25\.12\.\d+$' | sort -V | tail -1)
|
||||
echo "Resolved OpenWrt version: $VERSION"
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
needs: resolve-version
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
device: ${{ fromJSON(inputs.device == 'all' || inputs.device == '' && '["uz801","uf02"]' || format('["{0}"]', inputs.device)) }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -40,12 +60,13 @@ jobs:
|
||||
- name: Clone OpenWrt source code
|
||||
run: |
|
||||
df -hT $PWD
|
||||
echo "Using OpenWrt ${{ needs.resolve-version.outputs.openwrt_version }}"
|
||||
git clone https://git.openwrt.org/openwrt/openwrt.git openwrt
|
||||
git -C openwrt checkout 00ceb1ed1763f7479df6edf92ffada948f0e7d45
|
||||
git -C openwrt checkout ${{ needs.resolve-version.outputs.openwrt_version }}
|
||||
|
||||
- name: Load msm89xx target and packages
|
||||
run: |
|
||||
git apply --unsafe-paths enable_wcn36xx_mac80211.patch
|
||||
chmod +x apply_patches.sh && ./apply_patches.sh openwrt
|
||||
mv msm89xx openwrt/target/linux/msm89xx
|
||||
mv packages openwrt/package/uz801
|
||||
|
||||
@@ -58,7 +79,7 @@ jobs:
|
||||
|
||||
- name: Load diffconfig
|
||||
run: |
|
||||
DEVICE="${{ inputs.device || 'uz801' }}"
|
||||
DEVICE="${{ matrix.device }}"
|
||||
DIFFCONFIG="diffconfig_${DEVICE}"
|
||||
[ -f "$DIFFCONFIG" ] && mv "$DIFFCONFIG" openwrt/.config
|
||||
|
||||
|
||||
File renamed without changes.
Executable
+86
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
# apply_patches.sh
|
||||
# Applies wcn36xx and ath10k-sdio support patches to OpenWrt's mac80211 package.
|
||||
# Replaces the git patch approach to work across different OpenWrt versions.
|
||||
# NOTE: Requires GNU sed (Linux only - runs in Docker or GHA).
|
||||
set -e
|
||||
|
||||
OPENWRT_DIR="${1:-openwrt}"
|
||||
ATH_MK="$OPENWRT_DIR/package/kernel/mac80211/ath.mk"
|
||||
|
||||
if [ ! -f "$ATH_MK" ]; then
|
||||
echo "Error: $ATH_MK not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep -q 'wcn36xx' "$ATH_MK"; then
|
||||
echo "mac80211 patches already applied, skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Applying mac80211 wcn36xx/ath10k-sdio patches to $ATH_MK..."
|
||||
|
||||
# 1. Add ath10k-sdio and wcn36xx to PKG_DRIVERS
|
||||
sed -i 's/ath10k ath10k-smallbuffers/ath10k ath10k-sdio ath10k-smallbuffers/' "$ATH_MK"
|
||||
sed -i 's/wil6210 qcom-qmi-helpers/wil6210 wcn36xx qcom-qmi-helpers/' "$ATH_MK"
|
||||
|
||||
# 2. Add WCN36XX_DEBUGFS after WIL6210_DEBUGFS
|
||||
sed -i '/^[[:space:]]*WIL6210_DEBUGFS$/s/WIL6210_DEBUGFS/WIL6210_DEBUGFS \\\n\tWCN36XX_DEBUGFS/' "$ATH_MK"
|
||||
|
||||
# 3. Add sdio variant to ath config_package
|
||||
sed -i 's/config_package,ath,regular smallbuffers/config_package,ath,regular sdio smallbuffers/' "$ATH_MK"
|
||||
|
||||
# 4. Add WCN36XX config for msm89xx target (after ipq40xx line)
|
||||
sed -i '/config-.*CONFIG_TARGET_ipq40xx/a config-$(CONFIG_TARGET_msm89xx) += WCN36XX' "$ATH_MK"
|
||||
|
||||
# 5. Add ath10k-sdio config line (after ath10k regular line)
|
||||
sed -i '/config-.*config_package,ath10k,regular)/a config-$(call config_package,ath10k-sdio,sdio) += ATH10K ATH10K_SDIO' "$ATH_MK"
|
||||
|
||||
# 6. Extend kmod-ath DEPENDS for msm89xx
|
||||
sed -i 's/@PCI_SUPPORT||USB_SUPPORT||TARGET_ath79 +kmod-mac80211/@PCI_SUPPORT||USB_SUPPORT||TARGET_ath79||TARGET_ath25||TARGET_msm89xx +kmod-mac80211/' "$ATH_MK"
|
||||
|
||||
# 7. Add ath10k-sdio to LEDS and THERMAL depends
|
||||
sed -i 's/PACKAGE_kmod-ath10k || PACKAGE_kmod-ath10k-smallbuffers/PACKAGE_kmod-ath10k || PACKAGE_kmod-ath10k-sdio || PACKAGE_kmod-ath10k-smallbuffers/g' "$ATH_MK"
|
||||
|
||||
# 8. Add default y to ATH10K_THERMAL (insert before its depends line)
|
||||
sed -i '/config ATH10K_THERMAL/{n;n;/depends/i\ default y
|
||||
}' "$ATH_MK"
|
||||
|
||||
# 9. Append KernelPackage/ath10k-sdio and KernelPackage/wcn36xx definitions
|
||||
cat >> "$ATH_MK" << 'EOF'
|
||||
|
||||
define KernelPackage/ath10k-sdio
|
||||
$(call KernelPackage/mac80211/Default)
|
||||
TITLE:=Atheros 802.11ac SDIO wireless cards support
|
||||
URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath10k
|
||||
DEPENDS+= +kmod-ath +kmod-mmc +@DRIVER_11AC_SUPPORT \
|
||||
+ATH10K_THERMAL:kmod-hwmon-core +ATH10K_THERMAL:kmod-thermal
|
||||
FILES:= \
|
||||
$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
|
||||
$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_sdio.ko
|
||||
AUTOLOAD:=$(call AutoProbe,ath10k_core)
|
||||
MODPARAMS.ath10k_core:=frame_mode=2
|
||||
VARIANT:=sdio
|
||||
endef
|
||||
|
||||
define KernelPackage/ath10k-sdio/description
|
||||
This module adds support for wireless adapters based on
|
||||
Atheros IEEE 802.11ac family of chipsets with SDIO bus.
|
||||
endef
|
||||
|
||||
define KernelPackage/wcn36xx
|
||||
$(call KernelPackage/mac80211/Default)
|
||||
TITLE:=Qualcomm Atheros WCN3660/3680 support
|
||||
URL:=https://wireless.wiki.kernel.org/en/users/drivers/wcn36xx
|
||||
DEPENDS+= @TARGET_msm89xx +kmod-ath +kmod-qcom-rproc-wcnss
|
||||
FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/wcn36xx/wcn36xx.ko
|
||||
AUTOLOAD:=$(call AutoProbe,wcn36xx)
|
||||
endef
|
||||
|
||||
define KernelPackage/wcn36xx/description
|
||||
This module adds support for Qualcomm Atheros WCN3660/3680 Wireless
|
||||
blocks in some Qualcomm SoCs
|
||||
endef
|
||||
EOF
|
||||
|
||||
echo "mac80211 patches applied successfully"
|
||||
+10
-8
@@ -17,15 +17,15 @@ WORKDIR /home/builder
|
||||
|
||||
FROM base AS openwrt
|
||||
|
||||
ENV BRANCH=main
|
||||
ARG OPENWRT_VERSION=main
|
||||
|
||||
# Clone OpenWrt repository
|
||||
RUN git clone https://git.openwrt.org/openwrt/openwrt.git openwrt && \
|
||||
git -C openwrt checkout 00ceb1ed1763f7479df6edf92ffada948f0e7d45
|
||||
git -C openwrt checkout ${OPENWRT_VERSION}
|
||||
|
||||
# Apply patch inside openwrt directory
|
||||
COPY enable_wcn36xx_mac80211.patch .
|
||||
RUN git apply enable_wcn36xx_mac80211.patch
|
||||
# Apply mac80211 patches (wcn36xx/ath10k-sdio support)
|
||||
COPY --chmod=755 apply_patches.sh .
|
||||
RUN ./apply_patches.sh openwrt
|
||||
|
||||
# Update and install feeds
|
||||
RUN cd openwrt && \
|
||||
@@ -33,9 +33,11 @@ RUN cd openwrt && \
|
||||
./scripts/feeds install -a && \
|
||||
rm -rf tmp
|
||||
|
||||
# Fix LuCI getFeatures crash when odhcpd is present (upstream bug: ??= doesn't override false)
|
||||
RUN sed -i 's/result\.odhcpd = false;/result.odhcpd = {};/' \
|
||||
openwrt/feeds/luci/modules/luci-base/root/usr/share/rpcd/ucode/luci
|
||||
# Fix LuCI getFeatures crash when odhcpd is present (conditional - may be fixed in release)
|
||||
RUN LUCI_FILE="openwrt/feeds/luci/modules/luci-base/root/usr/share/rpcd/ucode/luci" && \
|
||||
if [ -f "$LUCI_FILE" ] && grep -q 'result\.odhcpd = false;' "$LUCI_FILE"; then \
|
||||
sed -i 's/result\.odhcpd = false;/result.odhcpd = {};/' "$LUCI_FILE"; \
|
||||
fi
|
||||
|
||||
WORKDIR /home/builder/openwrt
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ services:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: devenv/Dockerfile
|
||||
args:
|
||||
OPENWRT_VERSION: ${OPENWRT_VERSION:-main}
|
||||
container_name: openwrt-builder
|
||||
working_dir: /home/builder/openwrt
|
||||
stdin_open: true
|
||||
|
||||
@@ -16,4 +16,7 @@ uci add_list firewall.@zone[1].network='modem'
|
||||
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
|
||||
|
||||
# Remove target-specific APK feed (msm89xx is not on downloads.openwrt.org)
|
||||
sed -i '\|/targets/msm89xx/msm8916/packages|d' /etc/apk/repositories.d/distfeeds.list 2>/dev/null || true
|
||||
|
||||
uci commit
|
||||
@@ -59,23 +59,35 @@ MF68E and M9S device support has been moved to the [TBR](TBR/readme.md) director
|
||||
|
||||
## Building
|
||||
|
||||
1. Enter the build environment:
|
||||
### GitHub Actions (release builds)
|
||||
|
||||
GHA workflows automatically resolve the **latest OpenWrt 25.12.x** tag. Trigger manually from the Actions tab:
|
||||
|
||||
- **Build firmware**: `build.yml` — select a device (`uz801`, `uf02`, or `all`)
|
||||
- **Build packages**: `build-package.yml` — builds `luci-app-tailscale`, `uci-usb-gadget`, and `luci-app-usb-gadget` in APK and IPK formats
|
||||
|
||||
### Local (snapshot builds)
|
||||
|
||||
1. Build the environment (defaults to OpenWrt `main`/snapshot):
|
||||
```
|
||||
cd devenv
|
||||
docker compose run --rm builder
|
||||
docker compose build builder
|
||||
```
|
||||
|
||||
2. Configure and build:
|
||||
2. Enter and build:
|
||||
```
|
||||
docker compose run --rm builder
|
||||
cp /repo/diffconfig_uz801 .config
|
||||
echo "# CONFIG_SIGNED_PACKAGES is not set" >> .config # Optional: disable signature verification
|
||||
make defconfig
|
||||
make -j$(nproc)
|
||||
```
|
||||
|
||||
### Building standalone packages
|
||||
To build a specific version locally:
|
||||
```
|
||||
OPENWRT_VERSION=v25.12.1 docker compose build builder --no-cache
|
||||
```
|
||||
|
||||
A GitHub Actions workflow (`build-package.yml`) builds `luci-app-tailscale`, `uci-usb-gadget`, and `luci-app-usb-gadget` in both APK and IPK formats. Trigger it manually from the Actions tab.
|
||||
> **Note:** The msm89xx target requires kernel 6.12. Only OpenWrt versions that include this kernel (25.12.x, current snapshots) are supported.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -153,7 +165,7 @@ The modem requires region-specific MCFG configuration files.
|
||||
|
||||
- [ ] Custom package server for msm89xx/msm8916
|
||||
- Note: Target-specific modules may require building from source via `make menuconfig`
|
||||
- Removed feed: `https://downloads.openwrt.org/snapshots/targets/msm89xx/msm8916/packages/packages.adb`
|
||||
- The target-specific APK feed is automatically removed on first boot (msm89xx is not on downloads.openwrt.org)
|
||||
- [ ] Investigate `lpac` for eSIM support
|
||||
- [x] Memory expansion: `kmod-zram` + `zram-swap` enabled on all devices
|
||||
|
||||
|
||||
Reference in new issue
Block a user