diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml
index e40580cf8..b4863503c 100644
--- a/.github/workflows/build-release.yml
+++ b/.github/workflows/build-release.yml
@@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
device:
- description: 'Select device to build'
+ description: 'Select the build device'
required: true
default: 'x86_64'
type: choice
@@ -12,12 +12,34 @@ on:
- 'armv8'
- 'nanopi-r4s'
- 'nanopi-r5s'
- - 'netgear_r8500'
+ - 'nanopi-r76s'
- 'x86_64'
+ version:
+ description: 'Select the build version'
+ required: true
+ default: 'release'
+ type: choice
+ options:
+ - 'release'
+ - 'snapshot-25.12'
+ ccache:
+ description: 'Enable ccache (Use Cache to speed up next build)'
+ type: boolean
+ default: false
+ lan_addr:
+ description: 'Setting default LAN address'
+ required: true
+ default: '10.0.0.1'
+ type: string
+ root_password:
+ description: 'Setting default root password (Optional, No password by default)'
+ required: false
+ default: ''
+ type: string
build_options:
description: 'Build options (separate multiple options with spaces)'
required: false
- default: 'BUILD_FAST=y ENABLE_LTO=y ENABLE_MOLD=y ENABLE_LRNG=y ENABLE_BPF=y USE_GCC14=y'
+ default: 'BUILD_FAST=y ENABLE_BPF=y ENABLE_LTO=y ENABLE_LRNG=y ENABLE_MOLD=y KERNEL_CLANG_LTO=y'
type: string
jobs:
@@ -29,12 +51,19 @@ jobs:
shell: bash
steps:
+ - name: Checkout
+ continue-on-error: true
+ uses: actions/checkout@main
+ with:
+ path: r4s_build_script
+
- name: Setup variables
run: |
sudo timedatectl set-timezone 'Asia/Shanghai'
git config --global user.name 'actions'
git config --global user.email 'action@github.com'
- echo WORKDIR="/builder" >> "$GITHUB_ENV"
+ echo build_dir="/builder" >> "$GITHUB_ENV"
+ [ "${{ github.event.inputs.version }}" = release ] && echo build_version="rc2" >> "$GITHUB_ENV" || echo build_version="dev" >> "$GITHUB_ENV"
- name: Show system
run: |
@@ -50,6 +79,16 @@ jobs:
uname -a
echo
+ - name: Install Caddy Server
+ run: |
+ sudo curl -sL -o /usr/bin/caddy https://github.com/sbwml/r4s_build_script/releases/download/caddy/caddy
+ sudo chmod 755 /usr/bin/caddy
+ echo ":8080 {" > caddyfile
+ echo " root * $(pwd)/r4s_build_script" >> caddyfile
+ echo " file_server browse" >> caddyfile
+ echo "}" >> caddyfile
+ sudo /usr/bin/caddy start --config caddyfile --adapter caddyfile
+
- name: Free disk space
uses: sbwml/actions@free-disk
with:
@@ -61,16 +100,45 @@ jobs:
- name: Install LLVM
uses: sbwml/actions@install-llvm
+ - name: Restore Cached
+ if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device != 'armv8' && github.event.inputs.device != 'nanopi-r4s' }}
+ uses: actions/cache/restore@main
+ with:
+ path: /builder/.ccache
+ key: openwrt-25.12-${{ github.event.inputs.device }}-ccache
+
+ - name: Restore Cached (releases)
+ if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device == 'armv8' || github.event.inputs.device == 'nanopi-r4s' }}
+ continue-on-error: true
+ working-directory: /builder
+ run: |
+ curl -s https://api.github.com/repos/${{ github.repository }}/releases | grep 'browser_download_url' | grep ccache | grep ${{ github.event.inputs.device }} | awk -F '"' '{print $4}' | grep -v '^$' | xargs -n 1 wget -q
+ cat ${{ github.event.inputs.device }}.tar.* | tar -xf - || true
+ rm -rf ${{ github.event.inputs.device }}.tar.* || true
+ [ -d .ccache ] && cache_size=$(du -sb .ccache | awk '{print $1}') || cache_size=0
+ cache_size_mb=$(echo "scale=0; ${cache_size} / (1024 * 1024)" | bc)
+ echo "Cache Size: ~${cache_size_mb} MB (${cache_size} B)"
+ echo "Cache restored successfully"
+ echo "Cache restored from key: ${{ github.event.inputs.device }}"
+
- name: Compile OpenWrt
working-directory: /builder
id: compile
continue-on-error: true
+ env:
+ git_name: ${{ secrets.username }}
+ git_password: ${{ secrets.password }}
run: |
- export GITHUB_REPO=${{ github.repository }}
- export ${{ github.event.inputs.build_options }}
- bash <(curl -sS https://raw.githubusercontent.com/${{ github.repository }}/master/openwrt/build.sh) rc2 ${{ github.event.inputs.device }}
+ export ${{ github.event.inputs.build_options }} LAN=${{ github.event.inputs.lan_addr }} USE_GCC15=y
+ [ ${{ github.event.inputs.ccache }} = 'true' ] && export ENABLE_CCACHE=y
+ [ -n ${{ github.event.inputs.root_password }} ] && export ROOT_PASSWORD="${{ github.event.inputs.root_password }}"
+ bash <(curl -sS http://127.0.0.1:8080/build.sh) ${{ env.build_version }} ${{ github.event.inputs.device }}
cd openwrt
- tags=$(git describe --abbrev=0 --tags)
+ if [ "${{ github.event.inputs.version }}" = release ]; then
+ tags=OpenWrt-$(git describe --abbrev=0 --tags)
+ else
+ tags=snapshot-25.12-$(git log -n 1 --date=format:"%Y%m%d" --format="%cd")-$(git log --pretty=format:"%h" -1)
+ fi
echo "latest_release=$tags" >>$GITHUB_ENV
- name: Extensive logs after a failed compilation
@@ -80,16 +148,52 @@ jobs:
cd openwrt
make V=s
+ - name: Delete Cached
+ if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device != 'armv8' && github.event.inputs.device != 'nanopi-r4s' }}
+ continue-on-error: true
+ working-directory: /builder
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GH_REPO: ${{ github.repository }}
+ run: |
+ gh cache delete openwrt-25.12-${{ github.event.inputs.device }}-ccache || true
+
+ - name: Save Cached
+ if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device != 'armv8' && github.event.inputs.device != 'nanopi-r4s' }}
+ continue-on-error: true
+ uses: actions/cache/save@main
+ with:
+ path: /builder/.ccache
+ key: openwrt-25.12-${{ github.event.inputs.device }}-ccache
+
+ - name: Create ccache tar files
+ if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device == 'armv8' || github.event.inputs.device == 'nanopi-r4s' }}
+ continue-on-error: true
+ working-directory: /builder
+ run: |
+ mkdir -p ccache
+ tar cf - .ccache | split -d -b 1800m - ccache/${{ github.event.inputs.device }}.tar.
+
+ - name: Upload Cached (releases - ccache)
+ if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device == 'armv8' || github.event.inputs.device == 'nanopi-r4s' }}
+ continue-on-error: true
+ uses: ncipollo/release-action@main
+ with:
+ name: ccache
+ allowUpdates: true
+ tag: ccache
+ commit: master
+ replacesArtifacts: true
+ prerelease: true
+ token: ${{ secrets.GITHUB_TOKEN }}
+ artifacts: |
+ ${{ env.build_dir }}/ccache/*
+
- name: Prepare Firmware Files
working-directory: /builder
run: |
mkdir -p rom info
- if [ "${{ github.event.inputs.device }}" = "nanopi-r4s" ]; then
- cp -a openwrt/bin/targets/rockchip/*/*.img.gz rom/
- cp -a openwrt/bin/targets/rockchip/*/*-r4s.manifest info/manifest.txt
- cp -a openwrt/bin/targets/rockchip/*/config.buildinfo info/config.buildinfo
- cd rom && sha256sum *gz > ../info/sha256sums.txt
- elif [ "${{ github.event.inputs.device }}" = "nanopi-r5s" ]; then
+ if [[ "${{ github.event.inputs.device }}" == nanopi-* ]]; then
cp -a openwrt/bin/targets/rockchip/*/*.img.gz rom/
cp -a openwrt/bin/targets/rockchip/*/*.manifest info/manifest.txt
cp -a openwrt/bin/targets/rockchip/*/config.buildinfo info/config.buildinfo
@@ -114,19 +218,19 @@ jobs:
fi
- name: Upload artifacts
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@main
with:
name: ${{ github.event.inputs.device }}-openwrt-${{ env.latest_release }}
- path: ${{ env.WORKDIR }}/rom/*
+ path: ${{ env.build_dir }}/rom/*
- name: Create release
continue-on-error: true
- uses: sbwml/release-action@main
+ uses: ncipollo/release-action@main
with:
- name: OpenWrt-${{ env.latest_release }}
+ name: ${{ env.latest_release }}
allowUpdates: true
tag: ${{ env.latest_release }}
commit: master
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
- artifacts: ${{ env.WORKDIR }}/rom/*
+ artifacts: ${{ env.build_dir }}/rom/*
diff --git a/README.md b/README.md
index 2f447b4c0..52c352c0c 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,21 @@
-# NanoPi R4S/R5S/R5C & X86_64 OpenWrt 简易构建脚本存档
+# NanoPi R4S/R5S/R5C/R76S & X86_64 OpenWrt 简易构建脚本存档
### 存档来自:https://init2.cooluc.com
---------------
-## 基于 Linux 6.6 LTS 固件下载:
+## 基于 Linux 6.18 LTS 固件下载:
#### NanoPi R4S: https://r4s.cooluc.com
#### NanoPi R5S/R5C: https://r5s.cooluc.com
+#### NanoPi R76S: https://r76s.cooluc.com
+
#### X86_64: https://x86.cooluc.com
+#### Snapshot 25.12: https://snapshot.cooluc.com
+
#### 构建来源: https://github.com/sbwml/builder
---------------
@@ -22,40 +26,28 @@ sudo apt-get update
sudo apt-get install -y build-essential flex bison g++ gawk gcc-multilib g++-multilib gettext git libfuse-dev libncurses5-dev libssl-dev python3 python3-pip python3-ply python3-distutils python3-pyelftools rsync unzip zlib1g-dev file wget subversion patch upx-ucl autoconf automake curl asciidoc binutils bzip2 lib32gcc-s1 libc6-dev-i386 uglifyjs msmtp texinfo libreadline-dev libglib2.0-dev xmlto libelf-dev libtool autopoint antlr3 gperf ccache swig coreutils haveged scons libpython3-dev jq
```
-##### 安装 [LLVM/CLANG](https://github.com/sbwml/redhat-llvm-project) - 启用 `ENABLE_BPF` / `KERNEL_CLANG_LTO` 时需要
-
-```shell
-# 下载并解压
-sudo mkdir -p /opt/clang
-curl -LO https://github.com/sbwml/redhat-llvm-project/releases/download/18.1.8/clang-18.1.8-x86_64-redhat-linux.tar.xz
-sudo tar --strip-components=1 -C /opt/clang -xf clang-18.1.8-x86_64-redhat-linux.tar.xz
-rm -rf clang-18.1.8-x86_64-redhat-linux.tar.xz
-
-# 添加 BIN 到系统变量
-export PATH="/opt/clang/bin:$PATH"
+---------------
-# clang 版本验证
-clang --version
+## 授权构建
+#### 由于本源码具备后门被证实 [#92](https://github.com/sbwml/r4s_build_script/issues/92),良心发现后,防止毒害社会不再允许任何人~~与狗~~直接构建😏
+#### 如果你得到授权,请在构建前执行以下命令
- clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
- Target: x86_64-redhat-linux-gnu
- Thread model: posix
- InstalledDir: /opt/clang/bin
+```
+export git_name=账户名 git_password=密码
```
---------------
### 启用 [Clang/LLVM](https://docs.kernel.org/kbuild/llvm.html) 构建内核
##### 脚本支持使用 Clang/LLVM 构建内核,NanoPi & X86_64 设备将同时启用 LLVM LTO 链接时优化,这会增加编译的时间,但会获得更优的性能
-##### 编译环境需要安装 Clang/LLVM 工具链,推荐使用 clang 16~18 版本
##### 只需在构建固件前执行以下命令即可启用 Clang/LLVM 构建内核与内核模块
```
export KERNEL_CLANG_LTO=y
```
-### 启用 [GCC13](https://gcc.gnu.org/gcc-13/)/[GCC14](https://gcc.gnu.org/gcc-14/)/[GCC15](https://gcc.gnu.org/gcc-15/) 工具链编译
-##### 只需在构建固件前执行以下命令即可启用 GCC13/GCC14/GCC15 交叉工具链
+### 启用 [GCC13](https://gcc.gnu.org/gcc-13/)/[GCC14](https://gcc.gnu.org/gcc-14/)/[GCC15](https://gcc.gnu.org/gcc-15/)/[GCC16](https://gcc.gnu.org/gcc-16/) 工具链编译
+##### 只需在构建固件前执行以下命令即可启用对应交叉工具链版本
```
# GCC13
@@ -72,6 +64,11 @@ export USE_GCC14=y
export USE_GCC15=y
```
+```
+# GCC16
+export USE_GCC16=y
+```
+
### 启用 [LTO](https://gcc.gnu.org/onlinedocs/gccint/LTO-Overview.html) 优化
##### 只需在构建固件前执行以下命令即可启用编译器 LTO 优化
@@ -79,7 +76,7 @@ export USE_GCC15=y
export ENABLE_LTO=y
```
-### 启用 [MOLD](https://github.com/rui314/mold) 现代链接器(需要启用 `USE_GCC13=y` 或 `USE_GCC14=y` 或 `USE_GCC15=y`)
+### 启用 [MOLD](https://github.com/rui314/mold) 现代链接器
##### 只需在构建固件前执行以下命令即可启用 MOLD 链接,如果使用它建议同时启用 LTO 优化
```
@@ -100,9 +97,9 @@ export ENABLE_BPF=y
export ENABLE_LRNG=y
```
-### 启用 [Glibc](https://www.gnu.org/software/libc/) 库构建 (实验性)
-##### 启用 glibc 库进行构建时,构建的固件将会同时兼容 musl/glibc 的预构建二进制程序,但缺失 `opkg install` 安装源支持
-##### 只需在构建固件前执行以下命令即可启用 glibc 构建
+### ~~启用 [Glibc](https://www.gnu.org/software/libc/) 库构建 (实验性)~~
+##### ~~启用 glibc 库进行构建时,构建的固件将会同时兼容 musl/glibc 的预构建二进制程序,但缺失 `apk install` 安装源支持~~
+##### ~~只需在构建固件前执行以下命令即可启用 glibc 构建~~
```
export ENABLE_GLIBC=y
@@ -141,6 +138,14 @@ export BUILD_FAST=y
export MINIMAL_BUILD=y
```
+### 构建 iStoreOS 样式
+##### 包含 iStoreOS 的商店、状态页
+##### 只需在构建固件前执行以下命令即可构建 iStoreOS 样式
+
+```
+export ENABLE_ISTORE=y
+```
+
### 更改 LAN IP 地址
##### 自定义默认 LAN IP 地址
##### 只需在构建固件前执行以下命令即可覆盖默认 LAN 地址(默认:10.0.0.1)
@@ -149,45 +154,80 @@ export MINIMAL_BUILD=y
export LAN=10.0.0.1
```
+### 更改默认 ROOT 密码
+##### 只需在构建固件前执行以下命令即可设置默认 ROOT 密码(默认:无密码)
+
+```
+export ROOT_PASSWORD=12345678
+```
+
+### 使用 uhttpd 轻量 web 引擎
+##### 固件默认使用 Nginx(quic) 作为页面引擎,只需在构建固件前执行以下命令即可使用 uhttpd 取代 nginx
+##### Nginx 在具备公网的环境下可以提供更丰富的功能支持
+
+```
+export ENABLE_UHTTPD=y
+```
+
+### 禁用全模块编译(For developers)
+##### 启用该标志时,固件仅编译 config 指定的软件包和内核模块,但固件不再支持安装内核模块(opkg install kmod-xxx),强制安装模块将会导致内核崩溃
+##### 最大的可能性降低 OpenWrt 的编译耗时,适用于开发者调试构建
+
+```
+export NO_KMOD=y
+```
+
---------------
-## 构建 OpenWrt 23.05 最新 Releases
+## 构建 OpenWrt 25.12 最新 Releases
### nanopi-r4s
```shell
-# linux-6.6
+# linux-6.12
bash <(curl -sS https://init2.cooluc.com/build.sh) rc2 nanopi-r4s
```
### nanopi-r5s/r5c
```shell
-# linux-6.6
+# linux-6.18
bash <(curl -sS https://init2.cooluc.com/build.sh) rc2 nanopi-r5s
```
+### nanopi-r76s
+```shell
+# linux-6.18
+bash <(curl -sS https://init2.cooluc.com/build.sh) rc2 nanopi-r76s
+```
+
### x86_64
```shell
-# linux-6.6
+# linux-6.18
bash <(curl -sS https://init2.cooluc.com/build.sh) rc2 x86_64
```
-## 构建 OpenWrt 23.05 开发版(23.05-SNAPSHOT)
+## 构建 OpenWrt 25.12 开发版(25.12-SNAPSHOT)
### nanopi-r4s
```shell
-# linux-6.6
+# linux-6.18
bash <(curl -sS https://init2.cooluc.com/build.sh) dev nanopi-r4s
```
### nanopi-r5s/r5c
```shell
-# linux-6.6
+# linux-6.18
bash <(curl -sS https://init2.cooluc.com/build.sh) dev nanopi-r5s
```
+### nanopi-r76s
+```shell
+# linux-6.18
+bash <(curl -sS https://init2.cooluc.com/build.sh) dev nanopi-r76s
+```
+
### x86_64
```shell
-# linux-6.6
+# linux-6.18
bash <(curl -sS https://init2.cooluc.com/build.sh) dev x86_64
```
@@ -201,37 +241,32 @@ bash <(curl -sS https://init2.cooluc.com/build.sh) dev x86_64
### 二、修改构建脚本文件:`openwrt/build.sh`(使用 Github Actions 构建时无需更改)
-将 init.cooluc.com 脚本默认连接替换为你的 github raw 连接(不带 https://),像这样 `raw.githubusercontent.com/你的用户名/r4s_build_script/master`
+将 init.cooluc.com 脚本默认连接替换为你的 github raw 连接,像这样 `https://raw.githubusercontent.com/你的用户名/r4s_build_script/refs/heads/master`
```diff
# script url
- if [ "$isCN" = "CN" ]; then
-- export mirror=init.cooluc.com
-+ export mirror=raw.githubusercontent.com/你的用户名/r4s_build_script/master
- else
-- export mirror=init2.cooluc.com
-+ export mirror=raw.githubusercontent.com/你的用户名/r4s_build_script/master
- fi
+-export mirror=https://init.cooluc.com
++export mirror=https://raw.githubusercontent.com/你的用户名/r4s_build_script/refs/heads/master
```
### 三、在本地 Linux 执行基于你自己仓库的构建脚本,即可编译所需固件
-#### nanopi-r4s openwrt-23.05
+#### nanopi-r4s openwrt-25.12
```shell
-# linux-6.6
-bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/master/openwrt/build.sh) rc2 nanopi-r4s
+# linux-6.18
+bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/refs/heads/master/openwrt/build.sh) rc2 nanopi-r4s
```
-#### nanopi-r5s/r5c openwrt-23.05
+#### nanopi-r5s/r5c openwrt-25.12
```shell
-# linux-6.6
-bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/master/openwrt/build.sh) rc2 nanopi-r5s
+# linux-6.18
+bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/refs/heads/master/openwrt/build.sh) rc2 nanopi-r5s
```
-#### x86_64 openwrt-23.05
+#### x86_64 openwrt-25.12
```shell
-# linux-6.6
-bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/master/openwrt/build.sh) rc2 x86_64
+# linux-6.18
+bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/refs/heads/master/openwrt/build.sh) rc2 x86_64
```
-----------------
@@ -241,10 +276,11 @@ bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_scri
### 一、Fork 本仓库到自己 GitHub 存储库
### 二、构建固件
-- 在存储库名称下,单击(
Actions)。
+
+- 在存储库名称下,单击(
Actions)。
- 在左侧边栏中,单击要运行的工作流的名称:**Build releases**。
- 在工作流运行的列表上方,单击“**Run workflow**”按钮,选择要构建的设备固件并运行工作流。
- 
+ 
diff --git a/openwrt/23-config-musl-r8500-minimal b/openwrt/23-config-musl-r8500-minimal
deleted file mode 100644
index 3b438ea2b..000000000
--- a/openwrt/23-config-musl-r8500-minimal
+++ /dev/null
@@ -1,150 +0,0 @@
-### Init
-CONFIG_TARGET_bcm53xx=y
-CONFIG_TARGET_bcm53xx_generic=y
-CONFIG_TARGET_bcm53xx_generic_DEVICE_netgear_r8500=y
-
-### Basic
-CONFIG_ALL_KMODS=y
-CONFIG_ALL_NONSHARED=y
-CONFIG_KERNEL_BUILD_DOMAIN="cooluc.com"
-CONFIG_KERNEL_BUILD_USER="admin"
-CONFIG_PACKAGE_autocore-arm=y
-CONFIG_PACKAGE_bind-host=y
-CONFIG_PACKAGE_block-mount=y
-CONFIG_PACKAGE_default-settings=y
-# CONFIG_KERNEL_KALLSYMS is not set
-
-### Curl
-CONFIG_PACKAGE_curl=y
-CONFIG_PACKAGE_libcurl=y
-CONFIG_LIBCURL_NGHTTP3=y
-CONFIG_LIBCURL_NGTCP2=y
-CONFIG_LIBCURL_OPENSSL=y
-# CONFIG_LIBCURL_GNUTLS is not set
-# CONFIG_LIBCURL_MBEDTLS is not set
-# CONFIG_LIBCURL_NOSSL is not set
-# CONFIG_LIBCURL_WOLFSSL is not set
-
-### Firewall
-CONFIG_PACKAGE_nat6=y
-CONFIG_PACKAGE_ip6tables-nft=y
-CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
-CONFIG_PACKAGE_iptables-mod-iprange=y
-CONFIG_PACKAGE_iptables-mod-nat-extra=y
-CONFIG_PACKAGE_iptables-mod-socket=y
-CONFIG_PACKAGE_iptables-mod-tproxy=y
-CONFIG_PACKAGE_iptables-nft=y
-CONFIG_PACKAGE_xtables-nft=y
-# CONFIG_PACKAGE_iptables-legacy is not set
-
-# SFE
-CONFIG_PACKAGE_kmod-fast-classifier=y
-CONFIG_PACKAGE_kmod-shortcut-fe-cm=y
-
-### Zram
-CONFIG_PACKAGE_zram-swap=y
-CONFIG_PACKAGE_kmod-lib-lz4=y
-CONFIG_PACKAGE_kmod-lib-lzo=y
-CONFIG_PACKAGE_kmod-lib-zstd=y
-
-### Busybox
-CONFIG_BUSYBOX_CUSTOM=y
-CONFIG_BUSYBOX_CONFIG_ASH_HELP=y
-CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_HISTORY=1024
-CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_SAVEHISTORY=y
-CONFIG_BUSYBOX_CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
-CONFIG_BUSYBOX_CONFIG_FEATURE_SH_HISTFILESIZE=y
-CONFIG_BUSYBOX_CONFIG_FEATURE_SYSLOG_INFO=y
-
-### Dnsmasq
-CONFIG_PACKAGE_dnsmasq-full=y
-CONFIG_PACKAGE_dnsmasq_full_ipset=y
-# CONFIG_PACKAGE_dnsmasq_full_broken_rtc is not set
-# CONFIG_PACKAGE_dnsmasq is not set
-
-### Luci
-CONFIG_PACKAGE_luci=y
-CONFIG_PACKAGE_luci-lib-base=y
-CONFIG_PACKAGE_luci-lib-ip=y
-CONFIG_PACKAGE_luci-lib-ipkg=y
-CONFIG_PACKAGE_luci-lib-jsonc=y
-CONFIG_PACKAGE_luci-lib-nixio=y
-CONFIG_PACKAGE_luci-nginx=y
-CONFIG_PACKAGE_nginx-all-module=y
-CONFIG_LUCI_LANG_zh_Hans=y
-
-### APPS
-CONFIG_PACKAGE_luci-app-autoreboot=y
-CONFIG_PACKAGE_luci-app-ddns=y
-CONFIG_PACKAGE_luci-app-ramfree=y
-CONFIG_PACKAGE_luci-app-ttyd=y
-CONFIG_PACKAGE_luci-app-upnp=y
-
-### DDNS Scripts
-CONFIG_PACKAGE_ddns-scripts=y
-CONFIG_PACKAGE_ddns-scripts-aliyun=y
-CONFIG_PACKAGE_ddns-scripts-dnspod=y
-
-### OpenSSL
-CONFIG_OPENSSL_ENGINE=y
-CONFIG_OPENSSL_OPTIMIZE_SPEED=y
-CONFIG_OPENSSL_WITH_ASM=y
-CONFIG_PACKAGE_libopenssl-afalg=y
-CONFIG_PACKAGE_libopenssl-conf=y
-CONFIG_PACKAGE_libopenssl-devcrypto=y
-CONFIG_PACKAGE_libopenssl-legacy=y
-CONFIG_PACKAGE_openssl-util=y
-# CONFIG_OPENSSL_WITH_ERROR_MESSAGES is not set
-
-### Share Network
-CONFIG_PACKAGE_usbmuxd=y
-CONFIG_PACKAGE_kmod-usb-net-rndis=y
-CONFIG_PACKAGE_kmod-usb-net-ipheth=y
-
-### Kernel Modules
-CONFIG_PACKAGE_kmod-button-hotplug=y
-CONFIG_PACKAGE_kmod-crypto-chacha20poly1305=y
-CONFIG_PACKAGE_kmod-crypto-sha256=y
-CONFIG_PACKAGE_kmod-fs-exfat=y
-CONFIG_PACKAGE_kmod-fs-f2fs=y
-CONFIG_PACKAGE_kmod-fs-ntfs3=y
-CONFIG_PACKAGE_kmod-fs-vfat=y
-CONFIG_PACKAGE_kmod-fs-xfs=y
-CONFIG_PACKAGE_kmod-ikconfig=y
-CONFIG_PACKAGE_kmod-inet-diag=y
-CONFIG_PACKAGE_kmod-ipsec4=y
-CONFIG_PACKAGE_kmod-ipsec6=y
-CONFIG_PACKAGE_kmod-ipt-nat6=y
-CONFIG_PACKAGE_kmod-ipt-tproxy=y
-CONFIG_PACKAGE_kmod-iptunnel6=y
-CONFIG_PACKAGE_kmod-nf-socket=y
-CONFIG_PACKAGE_kmod-nft-fullcone=y
-CONFIG_PACKAGE_kmod-nft-offload=y
-CONFIG_PACKAGE_kmod-nft-socket=y
-CONFIG_PACKAGE_kmod-nft-tproxy=y
-CONFIG_PACKAGE_kmod-sched=y
-CONFIG_PACKAGE_kmod-tcp-bbr=y
-CONFIG_PACKAGE_kmod-tls=y
-CONFIG_PACKAGE_kmod-tun=y
-CONFIG_PACKAGE_kmod-usb-storage=y
-
-### Utilities
-CONFIG_PACKAGE_bash=y
-CONFIG_PACKAGE_dmesg=y
-CONFIG_PACKAGE_ftp=y
-CONFIG_PACKAGE_telnet-bsd=y
-CONFIG_PACKAGE_wget-ssl=y
-CONFIG_PACKAGE_wpad-openssl=y
-
-### GNU Core Utilities
-CONFIG_PACKAGE_coreutils=y
-CONFIG_PACKAGE_coreutils-dircolors=y
-CONFIG_PACKAGE_coreutils-ls=y
-
-### Version
-CONFIG_IMAGEOPT=y
-CONFIG_VERSIONOPT=y
-CONFIG_VERSION_FILENAMES=y
-
-### ZLIB
-CONFIG_ZLIB_OPTIMIZE_SPEED=y
diff --git a/openwrt/23-config-common b/openwrt/25-config-common
similarity index 62%
rename from openwrt/23-config-common
rename to openwrt/25-config-common
index 76fda3a5a..6b48104e2 100644
--- a/openwrt/23-config-common
+++ b/openwrt/25-config-common
@@ -1,3 +1,4 @@
+
### Curl
CONFIG_PACKAGE_curl=y
CONFIG_PACKAGE_libcurl=y
@@ -11,25 +12,10 @@ CONFIG_LIBCURL_OPENSSL=y
### Firewall
CONFIG_PACKAGE_nat6=y
-CONFIG_PACKAGE_ip6tables-nft=y
-CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
-CONFIG_PACKAGE_iptables-mod-iprange=y
-CONFIG_PACKAGE_iptables-mod-nat-extra=y
-CONFIG_PACKAGE_iptables-mod-socket=y
-CONFIG_PACKAGE_iptables-mod-tproxy=y
-CONFIG_PACKAGE_iptables-nft=y
-CONFIG_PACKAGE_xtables-nft=y
-# CONFIG_PACKAGE_iptables-legacy is not set
-
-# SFE
-CONFIG_PACKAGE_kmod-fast-classifier=y
-CONFIG_PACKAGE_kmod-shortcut-fe-cm=y
### Zram
CONFIG_PACKAGE_zram-swap=y
-CONFIG_PACKAGE_kmod-lib-lz4=y
-CONFIG_PACKAGE_kmod-lib-lzo=y
-CONFIG_PACKAGE_kmod-lib-zstd=y
+CONFIG_ZRAM_DEF_COMP_LZ4=y
### Busybox
CONFIG_BUSYBOX_CUSTOM=y
@@ -42,8 +28,6 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_SYSLOG_INFO=y
### Dnsmasq
CONFIG_PACKAGE_dnsmasq-full=y
-CONFIG_PACKAGE_dnsmasq_full_ipset=y
-# CONFIG_PACKAGE_dnsmasq_full_broken_rtc is not set
# CONFIG_PACKAGE_dnsmasq is not set
### Docker
@@ -56,96 +40,72 @@ CONFIG_DOCKER_OPTIONAL_FEATURES=y
CONFIG_DOCKER_STO_BTRFS=y
CONFIG_DOCKER_STO_EXT4=y
CONFIG_PACKAGE_luci-app-dockerman=y
-CONFIG_PACKAGE_luci-lib-docker=y
### Luci
CONFIG_PACKAGE_luci=y
-CONFIG_PACKAGE_luci-lib-base=y
-CONFIG_PACKAGE_luci-lib-ip=y
-CONFIG_PACKAGE_luci-lib-ipkg=y
-CONFIG_PACKAGE_luci-lib-jsonc=y
-CONFIG_PACKAGE_luci-lib-nixio=y
CONFIG_PACKAGE_luci-nginx=y
CONFIG_PACKAGE_luci-proto-wireguard=y
CONFIG_PACKAGE_luci-theme-argon=y
-CONFIG_PACKAGE_luci-theme-material=y
-CONFIG_PACKAGE_luci-theme-openwrt-2020=y
-CONFIG_PACKAGE_nginx-all-module=y
+CONFIG_PACKAGE_luci-theme-aurora=y
CONFIG_LUCI_LANG_zh_Hans=y
# CONFIG_LUCI_CSSTIDY is not set
# CONFIG_LUCI_JSMIN is not set
+### Nginx
+CONFIG_PACKAGE_nginx-ssl=y
+CONFIG_PACKAGE_nginx-mod-brotli=y
+CONFIG_PACKAGE_nginx-mod-luci=y
+CONFIG_PACKAGE_nginx-mod-rtmp=y
+CONFIG_PACKAGE_nginx-mod-stream=y
+CONFIG_PACKAGE_nginx-mod-ubus=y
+CONFIG_PACKAGE_nginx-mod-zstd=y
+CONFIG_PACKAGE_nginx-ssl-util=y
+CONFIG_NGINX_DAV=y
+CONFIG_NGINX_HTTP_AUTH_BASIC=y
+CONFIG_NGINX_HTTP_QUIC=y
+CONFIG_NGINX_HTTP_REAL_IP=y
+CONFIG_NGINX_HTTP_SUB=y
+CONFIG_NGINX_STREAM_REAL_IP=y
+
### APPS
-CONFIG_PACKAGE_luci-app-accesscontrol=y
CONFIG_PACKAGE_luci-app-airconnect=y
CONFIG_PACKAGE_luci-app-airplay2=y
-CONFIG_PACKAGE_luci-app-alist=y
CONFIG_PACKAGE_luci-app-argon-config=y
-CONFIG_PACKAGE_luci-app-aria2=y
+CONFIG_PACKAGE_luci-app-aurora-config=y
CONFIG_PACKAGE_luci-app-autoreboot=y
CONFIG_PACKAGE_luci-app-commands=y
CONFIG_PACKAGE_luci-app-cpufreq=y
-# CONFIG_PACKAGE_luci-app-daed is not set
CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_luci-app-diskman=y
CONFIG_PACKAGE_luci-app-eqos=y
-CONFIG_PACKAGE_luci-app-filebrowser=y
CONFIG_PACKAGE_luci-app-frpc=y
-CONFIG_PACKAGE_luci-app-gowebdav=y
CONFIG_PACKAGE_luci-app-mentohust=y
CONFIG_PACKAGE_luci-app-mosdns=y
CONFIG_PACKAGE_luci-app-natmap=y
CONFIG_PACKAGE_luci-app-netspeedtest=y
CONFIG_PACKAGE_luci-app-nlbwmon=y
CONFIG_PACKAGE_luci-app-oaf=y
+CONFIG_PACKAGE_luci-app-openlist2=y
CONFIG_PACKAGE_luci-app-qbittorrent=y
+CONFIG_PACKAGE_luci-app-quickfile=y
CONFIG_PACKAGE_luci-app-ramfree=y
+CONFIG_PACKAGE_luci-app-rtp2httpd=y
CONFIG_PACKAGE_luci-app-samba4=y
CONFIG_PACKAGE_luci-app-socat=y
CONFIG_PACKAGE_luci-app-sqm=y
CONFIG_PACKAGE_luci-app-ttyd=y
# CONFIG_PACKAGE_luci-app-unblockneteasemusic is not set
CONFIG_PACKAGE_luci-app-upnp=y
-CONFIG_PACKAGE_luci-app-usb-printer=y
CONFIG_PACKAGE_luci-app-vlmcsd=y
CONFIG_PACKAGE_luci-app-watchcat=y
-CONFIG_PACKAGE_luci-app-wireguard=y
-CONFIG_PACKAGE_luci-app-wolplus=y
+CONFIG_PACKAGE_luci-app-webdav=y
+CONFIG_PACKAGE_luci-app-wol=y
CONFIG_PACKAGE_luci-app-zerotier=y
-CONFIG_PACKAGE_ariang-nginx=y
-### ImmortalWrt Proxy - nft
+### Proxy
CONFIG_PACKAGE_luci-app-homeproxy=y
-
-### Passwall
-CONFIG_PACKAGE_luci-app-passwall=y
-CONFIG_PACKAGE_luci-app-passwall_INCLUDE_NaiveProxy=y
-CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Client=y
-CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Rust_Client=y
-CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Rust_Server=y
-CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client=y
-CONFIG_PACKAGE_luci-app-passwall_INCLUDE_SingBox=y
-CONFIG_PACKAGE_luci-app-passwall_INCLUDE_V2ray_Geodata=y
-CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Xray_Plugin=y
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Brook is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Hysteria is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Server is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_tuic_client is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Trojan_GO is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Trojan_Plus is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_V2ray_Plugin is not set
-
-### SSR Plus
-# CONFIG_PACKAGE_luci-app-ssr-plus is not set
-# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_IPT2Socks=y
-# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Kcptun=y
-# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Redsocks2=y
-# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Simple_Obfs=y
-# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Xray=y
-# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Xray_Plugin=y
-# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_ShadowsocksR_Libev_Client=y
-# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Hysteria is not set
-# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Trojan is not set
+CONFIG_PACKAGE_luci-app-nikki=y
+CONFIG_PACKAGE_mihomo-meta=y
### DDNS Scripts
CONFIG_PACKAGE_ddns-scripts=y
@@ -180,9 +140,11 @@ CONFIG_PACKAGE_kmod-usb-net-rndis=y
CONFIG_PACKAGE_kmod-usb-net-ipheth=y
### Kernel Modules
-CONFIG_PACKAGE_kmod-button-hotplug=y
+CONFIG_PACKAGE_kmod-bonding=y
+CONFIG_PACKAGE_kmod-br-netfilter=y
CONFIG_PACKAGE_kmod-crypto-chacha20poly1305=y
CONFIG_PACKAGE_kmod-crypto-sha256=y
+CONFIG_PACKAGE_kmod-tun=y
CONFIG_PACKAGE_kmod-fs-exfat=y
CONFIG_PACKAGE_kmod-fs-f2fs=y
CONFIG_PACKAGE_kmod-fs-ntfs3=y
@@ -191,11 +153,6 @@ CONFIG_PACKAGE_kmod-fs-xfs=y
CONFIG_PACKAGE_kmod-hwmon-pwmfan=y
CONFIG_PACKAGE_kmod-ikconfig=y
CONFIG_PACKAGE_kmod-inet-diag=y
-CONFIG_PACKAGE_kmod-ipsec4=y
-CONFIG_PACKAGE_kmod-ipsec6=y
-CONFIG_PACKAGE_kmod-ipt-nat6=y
-CONFIG_PACKAGE_kmod-ipt-tproxy=y
-CONFIG_PACKAGE_kmod-iptunnel6=y
CONFIG_PACKAGE_kmod-mac80211=y
CONFIG_PACKAGE_kmod-nf-socket=y
CONFIG_PACKAGE_kmod-nft-fullcone=y
@@ -204,6 +161,9 @@ CONFIG_PACKAGE_kmod-nft-socket=y
CONFIG_PACKAGE_kmod-nft-tproxy=y
CONFIG_PACKAGE_kmod-nls-cp936=y
CONFIG_PACKAGE_kmod-nls-cp950=y
+CONFIG_PACKAGE_kmod-sched-bpf=y
+CONFIG_PACKAGE_kmod-sched-cake=y
+CONFIG_PACKAGE_kmod-sched-core=y
CONFIG_PACKAGE_kmod-sched=y
CONFIG_PACKAGE_kmod-tcp-bbr3=y
CONFIG_PACKAGE_kmod-tcp-brutal=y
@@ -215,6 +175,7 @@ CONFIG_PACKAGE_kmod-usb-storage-uas=y
CONFIG_PACKAGE_kmod-usb2-pci=y
CONFIG_PACKAGE_kmod-usb2=y
CONFIG_PACKAGE_kmod-usb3=y
+CONFIG_PACKAGE_kmod-veth=y
### Kernel Modules - out-of-tree driver
CONFIG_PACKAGE_kmod-usb-net-rtl8152-vendor=y
@@ -224,6 +185,7 @@ CONFIG_PACKAGE_kmod-mt7921u=y
### Utilities
CONFIG_PACKAGE_bash=y
+CONFIG_PACKAGE_bash-completion=y
CONFIG_PACKAGE_dmesg=y
CONFIG_PACKAGE_dosfstools=y
CONFIG_PACKAGE_exfat-fsck=y
@@ -236,13 +198,13 @@ CONFIG_PACKAGE_ftp=y
CONFIG_PACKAGE_gdisk=y
CONFIG_PACKAGE_htop=y
CONFIG_PACKAGE_iperf3=y
+CONFIG_PACKAGE_ip-full=y
CONFIG_PACKAGE_iputils-ping=y
-CONFIG_PACKAGE_less=y
CONFIG_PACKAGE_lrzsz=y
CONFIG_PACKAGE_lsblk=y
CONFIG_PACKAGE_lscpu=y
CONFIG_PACKAGE_lsof=y
-CONFIG_PACKAGE_nethogs=y
+# CONFIG_PACKAGE_nethogs is not set
CONFIG_PACKAGE_openssh-sftp-server=y
CONFIG_PACKAGE_pciutils=y
CONFIG_PACKAGE_qrencode=y
@@ -252,7 +214,6 @@ CONFIG_PACKAGE_rsync=y
CONFIG_PACKAGE_screen=y
CONFIG_PACKAGE_sed=y
CONFIG_PACKAGE_sshpass=y
-CONFIG_PACKAGE_sudo=y
CONFIG_PACKAGE_tar=y
CONFIG_PACKAGE_taskset=y
CONFIG_PACKAGE_telnet-bsd=y
@@ -271,24 +232,6 @@ CONFIG_PACKAGE_xz=y
CONFIG_PACKAGE_zip=y
CONFIG_PACKAGE_zoneinfo-asia=y
-### Shadow Utilities
-CONFIG_PACKAGE_shadow-chgpasswd=y
-CONFIG_PACKAGE_shadow-chpasswd=y
-CONFIG_PACKAGE_shadow-gpasswd=y
-CONFIG_PACKAGE_shadow-groupadd=y
-CONFIG_PACKAGE_shadow-groupdel=y
-CONFIG_PACKAGE_shadow-groupmod=y
-CONFIG_PACKAGE_shadow-groups=y
-CONFIG_PACKAGE_shadow-login=y
-CONFIG_PACKAGE_shadow-nologin=y
-CONFIG_PACKAGE_shadow-passwd=y
-CONFIG_PACKAGE_shadow-su=y
-CONFIG_PACKAGE_shadow-useradd=y
-CONFIG_PACKAGE_shadow-userdel=y
-CONFIG_PACKAGE_shadow-usermod=y
-CONFIG_PACKAGE_shadow-utils=y
-# CONFIG_shadow-all is not set
-
### GNU Core Utilities
CONFIG_PACKAGE_coreutils=y
CONFIG_PACKAGE_coreutils-cat=y
@@ -304,8 +247,6 @@ CONFIG_PACKAGE_coreutils-mkdir=y
CONFIG_PACKAGE_coreutils-mv=y
CONFIG_PACKAGE_coreutils-nproc=y
CONFIG_PACKAGE_coreutils-rm=y
-CONFIG_PACKAGE_coreutils-sha1sum=y
-CONFIG_PACKAGE_coreutils-sha512sum=y
CONFIG_PACKAGE_coreutils-sleep=y
CONFIG_PACKAGE_coreutils-timeout=y
CONFIG_PACKAGE_coreutils-truncate=y
diff --git a/openwrt/23-config-minimal-common b/openwrt/25-config-minimal-common
similarity index 69%
rename from openwrt/23-config-minimal-common
rename to openwrt/25-config-minimal-common
index 1141a46e1..1f50dc619 100644
--- a/openwrt/23-config-minimal-common
+++ b/openwrt/25-config-minimal-common
@@ -12,25 +12,10 @@ CONFIG_LIBCURL_OPENSSL=y
### Firewall
CONFIG_PACKAGE_nat6=y
-CONFIG_PACKAGE_ip6tables-nft=y
-CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
-CONFIG_PACKAGE_iptables-mod-iprange=y
-CONFIG_PACKAGE_iptables-mod-nat-extra=y
-CONFIG_PACKAGE_iptables-mod-socket=y
-CONFIG_PACKAGE_iptables-mod-tproxy=y
-CONFIG_PACKAGE_iptables-nft=y
-CONFIG_PACKAGE_xtables-nft=y
-# CONFIG_PACKAGE_iptables-legacy is not set
-
-# SFE
-CONFIG_PACKAGE_kmod-fast-classifier=y
-CONFIG_PACKAGE_kmod-shortcut-fe-cm=y
### Zram
CONFIG_PACKAGE_zram-swap=y
-CONFIG_PACKAGE_kmod-lib-lz4=y
-CONFIG_PACKAGE_kmod-lib-lzo=y
-CONFIG_PACKAGE_kmod-lib-zstd=y
+CONFIG_ZRAM_DEF_COMP_LZ4=y
### Busybox
CONFIG_BUSYBOX_CUSTOM=y
@@ -43,38 +28,40 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_SYSLOG_INFO=y
### Dnsmasq
CONFIG_PACKAGE_dnsmasq-full=y
-CONFIG_PACKAGE_dnsmasq_full_ipset=y
-# CONFIG_PACKAGE_dnsmasq_full_broken_rtc is not set
# CONFIG_PACKAGE_dnsmasq is not set
### Luci
CONFIG_PACKAGE_luci=y
-CONFIG_PACKAGE_luci-lib-base=y
-CONFIG_PACKAGE_luci-lib-ip=y
-CONFIG_PACKAGE_luci-lib-ipkg=y
-CONFIG_PACKAGE_luci-lib-jsonc=y
-CONFIG_PACKAGE_luci-lib-nixio=y
CONFIG_PACKAGE_luci-nginx=y
-CONFIG_PACKAGE_nginx-all-module=y
CONFIG_LUCI_LANG_zh_Hans=y
# CONFIG_LUCI_CSSTIDY is not set
# CONFIG_LUCI_JSMIN is not set
+### Nginx
+CONFIG_PACKAGE_nginx-ssl=y
+CONFIG_PACKAGE_nginx-mod-brotli=y
+CONFIG_PACKAGE_nginx-mod-luci=y
+CONFIG_PACKAGE_nginx-mod-rtmp=y
+CONFIG_PACKAGE_nginx-mod-stream=y
+CONFIG_PACKAGE_nginx-mod-ubus=y
+CONFIG_PACKAGE_nginx-mod-zstd=y
+CONFIG_PACKAGE_nginx-ssl-util=y
+CONFIG_NGINX_DAV=y
+CONFIG_NGINX_HTTP_AUTH_BASIC=y
+CONFIG_NGINX_HTTP_QUIC=y
+CONFIG_NGINX_HTTP_REAL_IP=y
+CONFIG_NGINX_HTTP_SUB=y
+CONFIG_NGINX_STREAM_REAL_IP=y
+
### APPS
CONFIG_PACKAGE_luci-app-autoreboot=y
CONFIG_PACKAGE_luci-app-cpufreq=y
-CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_luci-app-diskman=y
-CONFIG_PACKAGE_luci-app-oaf=y
+CONFIG_PACKAGE_luci-app-filemanager=y
CONFIG_PACKAGE_luci-app-ramfree=y
CONFIG_PACKAGE_luci-app-ttyd=y
CONFIG_PACKAGE_luci-app-upnp=y
-### DDNS Scripts
-CONFIG_PACKAGE_ddns-scripts=y
-CONFIG_PACKAGE_ddns-scripts-aliyun=y
-CONFIG_PACKAGE_ddns-scripts-dnspod=y
-
### OpenSSL
CONFIG_OPENSSL_ENGINE=y
CONFIG_OPENSSL_OPTIMIZE_SPEED=y
@@ -93,7 +80,8 @@ CONFIG_PACKAGE_kmod-usb-net-rndis=y
CONFIG_PACKAGE_kmod-usb-net-ipheth=y
### Kernel Modules
-CONFIG_PACKAGE_kmod-button-hotplug=y
+CONFIG_PACKAGE_kmod-bonding=y
+CONFIG_PACKAGE_kmod-br-netfilter=y
CONFIG_PACKAGE_kmod-crypto-chacha20poly1305=y
CONFIG_PACKAGE_kmod-crypto-sha256=y
CONFIG_PACKAGE_kmod-fs-exfat=y
@@ -104,31 +92,26 @@ CONFIG_PACKAGE_kmod-fs-xfs=y
CONFIG_PACKAGE_kmod-hwmon-pwmfan=y
CONFIG_PACKAGE_kmod-ikconfig=y
CONFIG_PACKAGE_kmod-inet-diag=y
-CONFIG_PACKAGE_kmod-ipsec4=y
-CONFIG_PACKAGE_kmod-ipsec6=y
-CONFIG_PACKAGE_kmod-ipt-nat6=y
-CONFIG_PACKAGE_kmod-ipt-tproxy=y
-CONFIG_PACKAGE_kmod-iptunnel6=y
CONFIG_PACKAGE_kmod-mac80211=y
CONFIG_PACKAGE_kmod-nf-socket=y
CONFIG_PACKAGE_kmod-nft-fullcone=y
CONFIG_PACKAGE_kmod-nft-offload=y
CONFIG_PACKAGE_kmod-nft-socket=y
CONFIG_PACKAGE_kmod-nft-tproxy=y
+CONFIG_PACKAGE_kmod-sched-bpf=y
+CONFIG_PACKAGE_kmod-sched-cake=y
+CONFIG_PACKAGE_kmod-sched-core=y
CONFIG_PACKAGE_kmod-sched=y
CONFIG_PACKAGE_kmod-tcp-bbr3=y
CONFIG_PACKAGE_kmod-tcp-brutal=y
CONFIG_PACKAGE_kmod-tls=y
CONFIG_PACKAGE_kmod-tun=y
-CONFIG_PACKAGE_kmod-usb-audio=y
CONFIG_PACKAGE_kmod-usb-hid=y
CONFIG_PACKAGE_kmod-usb-storage-uas=y
CONFIG_PACKAGE_kmod-usb2-pci=y
CONFIG_PACKAGE_kmod-usb2=y
CONFIG_PACKAGE_kmod-usb3=y
-
-### Kernel Modules - out-of-tree driver
-CONFIG_PACKAGE_kmod-usb-net-rtl8152-vendor=y
+CONFIG_PACKAGE_kmod-veth=y
### Kernel Modules - USB WiFi Adapter
CONFIG_PACKAGE_kmod-mt7921u=y
@@ -136,6 +119,7 @@ CONFIG_PACKAGE_kmod-mt7921u=y
### Utilities
CONFIG_PACKAGE_bash=y
CONFIG_PACKAGE_dmesg=y
+CONFIG_PACKAGE_openssh-sftp-server=y
CONFIG_PACKAGE_taskset=y
CONFIG_PACKAGE_wget-ssl=y
CONFIG_PACKAGE_wpad-openssl=y
diff --git a/openwrt/23-config-musl-armsr-armv8 b/openwrt/25-config-musl-armsr-armv8
similarity index 63%
rename from openwrt/23-config-musl-armsr-armv8
rename to openwrt/25-config-musl-armsr-armv8
index 663c30b53..c4da496ef 100644
--- a/openwrt/23-config-musl-armsr-armv8
+++ b/openwrt/25-config-musl-armsr-armv8
@@ -8,6 +8,10 @@ CONFIG_ALL_KMODS=y
CONFIG_ALL_NONSHARED=y
CONFIG_KERNEL_BUILD_DOMAIN="cooluc.com"
CONFIG_KERNEL_BUILD_USER="admin"
+CONFIG_KERNEL_MEMCG_V1=y
+CONFIG_KERNEL_MPTCP=y
+CONFIG_KERNEL_MPTCP_IPV6=y
+# CONFIG_KERNEL_PREEMPT_RT is not set
CONFIG_PACKAGE_autocore-arm=y
CONFIG_PACKAGE_bind-host=y
CONFIG_PACKAGE_block-mount=y
@@ -17,14 +21,3 @@ CONFIG_TARGET_KERNEL_PARTSIZE=64
CONFIG_TARGET_ROOTFS_PARTSIZE=944
CONFIG_COREMARK_NUMBER_OF_THREADS=16
# CONFIG_KERNEL_KALLSYMS is not set
-
-### Utilities
-CONFIG_PACKAGE_qemu-ga=y
-
-### RTL8723D / RTL8821C / RTW89 firmware
-CONFIG_PACKAGE_rtl8723de-firmware=m
-CONFIG_PACKAGE_rtl8821ce-firmware=m
-CONFIG_PACKAGE_rtl8851be-firmware=m
-CONFIG_PACKAGE_rtl8852ae-firmware=m
-CONFIG_PACKAGE_rtl8852be-firmware=m
-CONFIG_PACKAGE_rtl8852ce-firmware=m
diff --git a/openwrt/23-config-musl-r4s b/openwrt/25-config-musl-r4s
similarity index 69%
rename from openwrt/23-config-musl-r4s
rename to openwrt/25-config-musl-r4s
index 42da9b4ef..51d6d95cd 100644
--- a/openwrt/23-config-musl-r4s
+++ b/openwrt/25-config-musl-r4s
@@ -8,12 +8,18 @@ CONFIG_ALL_KMODS=y
CONFIG_ALL_NONSHARED=y
CONFIG_KERNEL_BUILD_DOMAIN="cooluc.com"
CONFIG_KERNEL_BUILD_USER="admin"
+CONFIG_KERNEL_CFLAGS="-march=armv8-a+crypto+crc -mcpu=cortex-a72+crypto+crc -mtune=cortex-a72"
+CONFIG_KERNEL_MEMCG_V1=y
+CONFIG_KERNEL_MPTCP=y
+CONFIG_KERNEL_MPTCP_IPV6=y
+# CONFIG_KERNEL_PREEMPT_RT is not set
+CONFIG_KERNEL_PSI=y
CONFIG_PACKAGE_autocore-arm=y
CONFIG_PACKAGE_bind-host=y
CONFIG_PACKAGE_block-mount=y
CONFIG_PACKAGE_coremark=y
CONFIG_PACKAGE_default-settings=y
-CONFIG_TARGET_KERNEL_PARTSIZE=16
+CONFIG_TARGET_KERNEL_PARTSIZE=32
CONFIG_TARGET_ROOTFS_PARTSIZE=944
CONFIG_COREMARK_NUMBER_OF_THREADS=8
# CONFIG_KERNEL_KALLSYMS is not set
diff --git a/openwrt/23-config-musl-r5s b/openwrt/25-config-musl-r5s
similarity index 69%
rename from openwrt/23-config-musl-r5s
rename to openwrt/25-config-musl-r5s
index ca5e9b674..59bf69938 100644
--- a/openwrt/23-config-musl-r5s
+++ b/openwrt/25-config-musl-r5s
@@ -11,12 +11,17 @@ CONFIG_ALL_NONSHARED=y
CONFIG_KERNEL_BUILD_DOMAIN="cooluc.com"
CONFIG_KERNEL_BUILD_USER="admin"
CONFIG_KERNEL_CFLAGS="-march=armv8.2-a+crypto+crc -mcpu=cortex-a55+crypto+crc -mtune=cortex-a55"
+CONFIG_KERNEL_MEMCG_V1=y
+CONFIG_KERNEL_MPTCP=y
+CONFIG_KERNEL_MPTCP_IPV6=y
+# CONFIG_KERNEL_PREEMPT_RT is not set
+CONFIG_KERNEL_PSI=y
CONFIG_PACKAGE_autocore-arm=y
CONFIG_PACKAGE_bind-host=y
CONFIG_PACKAGE_block-mount=y
CONFIG_PACKAGE_coremark=y
CONFIG_PACKAGE_default-settings=y
-CONFIG_TARGET_KERNEL_PARTSIZE=16
+CONFIG_TARGET_KERNEL_PARTSIZE=32
CONFIG_TARGET_ROOTFS_PARTSIZE=944
CONFIG_COREMARK_NUMBER_OF_THREADS=6
# CONFIG_KERNEL_KALLSYMS is not set
@@ -24,14 +29,3 @@ CONFIG_COREMARK_NUMBER_OF_THREADS=6
### Video Support
CONFIG_PACKAGE_kmod-drm-rockchip=y
CONFIG_PACKAGE_kmod-drm-panfrost=y
-
-### RTL8723D / RTL8821C / RTW89 firmware
-CONFIG_PACKAGE_rtl8723de-firmware=m
-CONFIG_PACKAGE_rtl8821ce-firmware=m
-CONFIG_PACKAGE_rtl8851be-firmware=m
-CONFIG_PACKAGE_rtl8852ae-firmware=m
-CONFIG_PACKAGE_rtl8852be-firmware=m
-CONFIG_PACKAGE_rtl8852ce-firmware=m
-
-### MT76 firmware
-CONFIG_PACKAGE_mt7925-firmware=m
diff --git a/openwrt/25-config-musl-r76s b/openwrt/25-config-musl-r76s
new file mode 100644
index 000000000..bdb09f2b7
--- /dev/null
+++ b/openwrt/25-config-musl-r76s
@@ -0,0 +1,43 @@
+### Init
+CONFIG_TARGET_rockchip=y
+CONFIG_TARGET_rockchip_armv8=y
+CONFIG_TARGET_rockchip_armv8_DEVICE_friendlyarm_nanopi-r76s=y
+
+### Basic
+CONFIG_ALL_KMODS=y
+CONFIG_ALL_NONSHARED=y
+CONFIG_KERNEL_BUILD_DOMAIN="cooluc.com"
+CONFIG_KERNEL_BUILD_USER="admin"
+CONFIG_KERNEL_CFLAGS="-march=armv8-a+crypto+crc -mcpu=cortex-a72+crypto+crc -mtune=cortex-a72"
+CONFIG_KERNEL_MEMCG_V1=y
+CONFIG_KERNEL_MPTCP=y
+CONFIG_KERNEL_MPTCP_IPV6=y
+# CONFIG_KERNEL_PREEMPT_RT is not set
+CONFIG_KERNEL_PSI=y
+CONFIG_PACKAGE_autocore-arm=y
+CONFIG_PACKAGE_bind-host=y
+CONFIG_PACKAGE_block-mount=y
+CONFIG_PACKAGE_coremark=y
+CONFIG_PACKAGE_default-settings=y
+CONFIG_TARGET_KERNEL_PARTSIZE=64
+CONFIG_TARGET_ROOTFS_PARTSIZE=944
+CONFIG_COREMARK_NUMBER_OF_THREADS=8
+# CONFIG_KERNEL_KALLSYMS is not set
+
+### SDIO Wireles
+CONFIG_PACKAGE_kmod-rtl8822cs=y
+
+### UART Bluetooth
+CONFIG_PACKAGE_kmod-hci-uart=y
+CONFIG_PACKAGE_rtl8822cs-firmware=y
+CONFIG_PACKAGE_luci-app-bluetooth=y
+
+### HDMI
+CONFIG_PACKAGE_kmod-drm-rockchip=y
+CONFIG_PACKAGE_kmod-drm-panfrost=y
+
+### Video Decoder
+CONFIG_PACKAGE_kmod-rkvdec=y
+
+### Rocket NPU
+CONFIG_PACKAGE_kmod-rocket-rockchip=y
diff --git a/openwrt/23-config-musl-x86 b/openwrt/25-config-musl-x86
similarity index 52%
rename from openwrt/23-config-musl-x86
rename to openwrt/25-config-musl-x86
index 7d55f8367..387e8c6f5 100644
--- a/openwrt/23-config-musl-x86
+++ b/openwrt/25-config-musl-x86
@@ -2,14 +2,17 @@
CONFIG_TARGET_x86=y
CONFIG_TARGET_x86_64=y
CONFIG_TARGET_x86_64_DEVICE_generic=y
-CONFIG_GRUB_TIMEOUT="1"
-CONFIG_TESTING_KERNEL=y
+CONFIG_GRUB_TIMEOUT="3"
### Basic
CONFIG_ALL_KMODS=y
CONFIG_ALL_NONSHARED=y
CONFIG_KERNEL_BUILD_DOMAIN="cooluc.com"
CONFIG_KERNEL_BUILD_USER="admin"
+CONFIG_KERNEL_MEMCG_V1=y
+CONFIG_KERNEL_MPTCP=y
+CONFIG_KERNEL_MPTCP_IPV6=y
+# CONFIG_KERNEL_PREEMPT_RT is not set
CONFIG_PACKAGE_autocore-x86=y
CONFIG_PACKAGE_bind-host=y
CONFIG_PACKAGE_block-mount=y
@@ -20,58 +23,30 @@ CONFIG_TARGET_ROOTFS_PARTSIZE=944
# CONFIG_KERNEL_KALLSYMS is not set
### Kernel driver
+CONFIG_PACKAGE_kmod-i40e=y
CONFIG_PACKAGE_kmod-igb=y
CONFIG_PACKAGE_kmod-igc=y
+CONFIG_PACKAGE_kmod-ixgbe=y
CONFIG_PACKAGE_kmod-mlx4-core=y
CONFIG_PACKAGE_kmod-mlx5-core=y
CONFIG_PACKAGE_kmod-mt76x2=y
CONFIG_PACKAGE_kmod-mt7921e=y
CONFIG_PACKAGE_kmod-mt7921u=y
CONFIG_PACKAGE_kmod-mt7922-firmware=y
+CONFIG_PACKAGE_kmod-mt7925-firmware=y
+CONFIG_PACKAGE_kmod-mt7927-firmware=y
CONFIG_PACKAGE_kmod-ngbe=y
+CONFIG_PACKAGE_kmod-nvme=y
CONFIG_PACKAGE_kmod-r8101=y
CONFIG_PACKAGE_kmod-r8125=y
CONFIG_PACKAGE_kmod-r8126=y
+CONFIG_PACKAGE_kmod-r8127=y
CONFIG_PACKAGE_kmod-r8168=y
-CONFIG_PACKAGE_kmod-txgbe=y
# CONFIG_PACKAGE_kmod-r8169 is not set
-CONFIG_PACKAGE_kmod-nvme=y
+CONFIG_PACKAGE_kmod-txgbe=y
### Display & Extra Drivers
-CONFIG_PACKAGE_kmod-backlight-pwm=y
-CONFIG_PACKAGE_kmod-backlight=y
-CONFIG_PACKAGE_kmod-drm-amdgpu=y
+CONFIG_PACKAGE_i915-firmware-huc=y
CONFIG_PACKAGE_kmod-drm-i915=y
-CONFIG_PACKAGE_kmod-drm-kms-helper=y
-CONFIG_PACKAGE_kmod-drm-radeon=y
-CONFIG_PACKAGE_kmod-drm-ttm=y
-CONFIG_PACKAGE_kmod-drm=y
-CONFIG_PACKAGE_kmod-fb-cfb-copyarea=y
-CONFIG_PACKAGE_kmod-fb-cfb-fillrect=y
-CONFIG_PACKAGE_kmod-fb-cfb-imgblt=y
-CONFIG_PACKAGE_kmod-fb-sys-fops=y
-CONFIG_PACKAGE_kmod-fb-sys-ram=y
-CONFIG_PACKAGE_kmod-fb=y
CONFIG_PACKAGE_kmod-sound-hda-codec-realtek=y
CONFIG_PACKAGE_kmod-sound-hda-intel=y
-CONFIG_PACKAGE_kmod-video-pwc=y
-CONFIG_PACKAGE_kmod-video-uvc=y
-CONFIG_PACKAGE_kmod-video-videobuf2=y
-
-### Utilities
-CONFIG_PACKAGE_qemu-ga=y
-
-### Virtualization
-CONFIG_PACKAGE_kmod-kvm-intel=y
-CONFIG_PACKAGE_kmod-kvm-x86=y
-
-### RTL8723D / RTL8821C / RTW89 firmware
-CONFIG_PACKAGE_rtl8723de-firmware=m
-CONFIG_PACKAGE_rtl8821ce-firmware=m
-CONFIG_PACKAGE_rtl8851be-firmware=m
-CONFIG_PACKAGE_rtl8852ae-firmware=m
-CONFIG_PACKAGE_rtl8852be-firmware=m
-CONFIG_PACKAGE_rtl8852ce-firmware=m
-
-### MT76 firmware
-CONFIG_PACKAGE_mt7925-firmware=m
diff --git a/openwrt/23-config-musl-r8500 b/openwrt/25-config-std-common
similarity index 57%
rename from openwrt/23-config-musl-r8500
rename to openwrt/25-config-std-common
index e36ad1fd9..92fab0ac7 100644
--- a/openwrt/23-config-musl-r8500
+++ b/openwrt/25-config-std-common
@@ -1,18 +1,3 @@
-### Init
-CONFIG_TARGET_bcm53xx=y
-CONFIG_TARGET_bcm53xx_generic=y
-CONFIG_TARGET_bcm53xx_generic_DEVICE_netgear_r8500=y
-
-### Basic
-CONFIG_ALL_KMODS=y
-CONFIG_ALL_NONSHARED=y
-CONFIG_KERNEL_BUILD_DOMAIN="cooluc.com"
-CONFIG_KERNEL_BUILD_USER="admin"
-CONFIG_PACKAGE_autocore-arm=y
-CONFIG_PACKAGE_bind-host=y
-CONFIG_PACKAGE_block-mount=y
-CONFIG_PACKAGE_default-settings=y
-# CONFIG_KERNEL_KALLSYMS is not set
### Curl
CONFIG_PACKAGE_curl=y
@@ -27,25 +12,10 @@ CONFIG_LIBCURL_OPENSSL=y
### Firewall
CONFIG_PACKAGE_nat6=y
-CONFIG_PACKAGE_ip6tables-nft=y
-CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
-CONFIG_PACKAGE_iptables-mod-iprange=y
-CONFIG_PACKAGE_iptables-mod-nat-extra=y
-CONFIG_PACKAGE_iptables-mod-socket=y
-CONFIG_PACKAGE_iptables-mod-tproxy=y
-CONFIG_PACKAGE_iptables-nft=y
-CONFIG_PACKAGE_xtables-nft=y
-# CONFIG_PACKAGE_iptables-legacy is not set
-
-# SFE
-CONFIG_PACKAGE_kmod-fast-classifier=y
-CONFIG_PACKAGE_kmod-shortcut-fe-cm=y
### Zram
CONFIG_PACKAGE_zram-swap=y
-CONFIG_PACKAGE_kmod-lib-lz4=y
-CONFIG_PACKAGE_kmod-lib-lzo=y
-CONFIG_PACKAGE_kmod-lib-zstd=y
+CONFIG_ZRAM_DEF_COMP_LZ4=y
### Busybox
CONFIG_BUSYBOX_CUSTOM=y
@@ -58,74 +28,76 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_SYSLOG_INFO=y
### Dnsmasq
CONFIG_PACKAGE_dnsmasq-full=y
-CONFIG_PACKAGE_dnsmasq_full_ipset=y
-# CONFIG_PACKAGE_dnsmasq_full_broken_rtc is not set
# CONFIG_PACKAGE_dnsmasq is not set
### Luci
CONFIG_PACKAGE_luci=y
-CONFIG_PACKAGE_luci-lib-base=y
-CONFIG_PACKAGE_luci-lib-ip=y
-CONFIG_PACKAGE_luci-lib-ipkg=y
-CONFIG_PACKAGE_luci-lib-jsonc=y
-CONFIG_PACKAGE_luci-lib-nixio=y
CONFIG_PACKAGE_luci-nginx=y
+CONFIG_PACKAGE_luci-proto-wireguard=y
CONFIG_PACKAGE_luci-theme-argon=y
-CONFIG_PACKAGE_nginx-all-module=y
CONFIG_LUCI_LANG_zh_Hans=y
# CONFIG_LUCI_CSSTIDY is not set
# CONFIG_LUCI_JSMIN is not set
+### Nginx
+CONFIG_PACKAGE_nginx-ssl=y
+CONFIG_PACKAGE_nginx-mod-brotli=y
+CONFIG_PACKAGE_nginx-mod-luci=y
+CONFIG_PACKAGE_nginx-mod-rtmp=y
+CONFIG_PACKAGE_nginx-mod-stream=y
+CONFIG_PACKAGE_nginx-mod-ubus=y
+CONFIG_PACKAGE_nginx-mod-zstd=y
+CONFIG_PACKAGE_nginx-ssl-util=y
+CONFIG_NGINX_DAV=y
+CONFIG_NGINX_HTTP_AUTH_BASIC=y
+CONFIG_NGINX_HTTP_QUIC=y
+CONFIG_NGINX_HTTP_REAL_IP=y
+CONFIG_NGINX_HTTP_SUB=y
+CONFIG_NGINX_STREAM_REAL_IP=y
+
### APPS
-CONFIG_PACKAGE_luci-app-accesscontrol=y
CONFIG_PACKAGE_luci-app-airconnect=y
CONFIG_PACKAGE_luci-app-airplay2=y
CONFIG_PACKAGE_luci-app-argon-config=y
CONFIG_PACKAGE_luci-app-autoreboot=y
CONFIG_PACKAGE_luci-app-commands=y
+CONFIG_PACKAGE_luci-app-cpufreq=y
CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_luci-app-diskman=y
-CONFIG_PACKAGE_luci-app-eqos=y
CONFIG_PACKAGE_luci-app-frpc=y
-CONFIG_PACKAGE_luci-app-mentohust=y
CONFIG_PACKAGE_luci-app-mosdns=y
+CONFIG_PACKAGE_luci-app-natmap=y
CONFIG_PACKAGE_luci-app-netspeedtest=y
CONFIG_PACKAGE_luci-app-nlbwmon=y
CONFIG_PACKAGE_luci-app-oaf=y
+CONFIG_PACKAGE_luci-app-quickfile=y
CONFIG_PACKAGE_luci-app-ramfree=y
-CONFIG_PACKAGE_luci-app-samba4=y
CONFIG_PACKAGE_luci-app-socat=y
+CONFIG_PACKAGE_luci-app-sqm=y
CONFIG_PACKAGE_luci-app-ttyd=y
CONFIG_PACKAGE_luci-app-upnp=y
-CONFIG_PACKAGE_luci-app-usb-printer=y
CONFIG_PACKAGE_luci-app-vlmcsd=y
-CONFIG_PACKAGE_luci-app-watchcat=y
-CONFIG_PACKAGE_luci-app-wireguard=y
-CONFIG_PACKAGE_luci-app-wolplus=y
+CONFIG_PACKAGE_luci-app-webdav=y
+CONFIG_PACKAGE_luci-app-wol=y
CONFIG_PACKAGE_luci-app-zerotier=y
-### Passwall
-CONFIG_PACKAGE_luci-app-passwall=y
-CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Client=y
-CONFIG_PACKAGE_luci-app-passwall_INCLUDE_V2ray_Geodata=y
-CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Xray_Plugin=y
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Brook is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Hysteria is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_NaiveProxy is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Server is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Rust_Client is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Rust_Server is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_SingBox is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Trojan_GO is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Trojan_Plus is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_tuic_client is not set
-# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_V2ray_Plugin is not set
+### ImmortalWrt Proxy - nft
+CONFIG_PACKAGE_luci-app-homeproxy=y
### DDNS Scripts
CONFIG_PACKAGE_ddns-scripts=y
CONFIG_PACKAGE_ddns-scripts-aliyun=y
+CONFIG_PACKAGE_ddns-scripts-cloudflare=y
CONFIG_PACKAGE_ddns-scripts-dnspod=y
+CONFIG_PACKAGE_ddns-scripts-freedns=y
+CONFIG_PACKAGE_ddns-scripts-godaddy=y
+CONFIG_PACKAGE_ddns-scripts-services=y
+
+### L2TP
+CONFIG_PACKAGE_kmod-l2tp=y
+CONFIG_PACKAGE_kmod-pppol2tp=y
+CONFIG_PACKAGE_ppp-mod-pppol2tp=y
+CONFIG_PACKAGE_xl2tpd=y
### OpenSSL
CONFIG_OPENSSL_ENGINE=y
@@ -136,21 +108,17 @@ CONFIG_PACKAGE_libopenssl-conf=y
CONFIG_PACKAGE_libopenssl-devcrypto=y
CONFIG_PACKAGE_libopenssl-legacy=y
CONFIG_PACKAGE_openssl-util=y
+# CONFIG_PACKAGE_libopenssl-padlock is not set
# CONFIG_OPENSSL_WITH_ERROR_MESSAGES is not set
-### L2TP
-CONFIG_PACKAGE_kmod-l2tp=y
-CONFIG_PACKAGE_kmod-pppol2tp=y
-CONFIG_PACKAGE_ppp-mod-pppol2tp=y
-CONFIG_PACKAGE_xl2tpd=y
-
### Share Network
CONFIG_PACKAGE_usbmuxd=y
CONFIG_PACKAGE_kmod-usb-net-rndis=y
CONFIG_PACKAGE_kmod-usb-net-ipheth=y
### Kernel Modules
-CONFIG_PACKAGE_kmod-button-hotplug=y
+CONFIG_PACKAGE_kmod-bonding=y
+CONFIG_PACKAGE_kmod-br-netfilter=y
CONFIG_PACKAGE_kmod-crypto-chacha20poly1305=y
CONFIG_PACKAGE_kmod-crypto-sha256=y
CONFIG_PACKAGE_kmod-fs-exfat=y
@@ -158,27 +126,42 @@ CONFIG_PACKAGE_kmod-fs-f2fs=y
CONFIG_PACKAGE_kmod-fs-ntfs3=y
CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_kmod-fs-xfs=y
+CONFIG_PACKAGE_kmod-hwmon-pwmfan=y
CONFIG_PACKAGE_kmod-ikconfig=y
CONFIG_PACKAGE_kmod-inet-diag=y
-CONFIG_PACKAGE_kmod-ipsec4=y
-CONFIG_PACKAGE_kmod-ipsec6=y
-CONFIG_PACKAGE_kmod-ipt-nat6=y
-CONFIG_PACKAGE_kmod-ipt-tproxy=y
-CONFIG_PACKAGE_kmod-iptunnel6=y
+CONFIG_PACKAGE_kmod-mac80211=y
CONFIG_PACKAGE_kmod-nf-socket=y
CONFIG_PACKAGE_kmod-nft-fullcone=y
CONFIG_PACKAGE_kmod-nft-offload=y
CONFIG_PACKAGE_kmod-nft-socket=y
CONFIG_PACKAGE_kmod-nft-tproxy=y
+CONFIG_PACKAGE_kmod-nls-cp936=y
+CONFIG_PACKAGE_kmod-nls-cp950=y
+CONFIG_PACKAGE_kmod-sched-bpf=y
+CONFIG_PACKAGE_kmod-sched-cake=y
+CONFIG_PACKAGE_kmod-sched-core=y
CONFIG_PACKAGE_kmod-sched=y
-CONFIG_PACKAGE_kmod-tcp-bbr=y
+CONFIG_PACKAGE_kmod-tcp-bbr3=y
+CONFIG_PACKAGE_kmod-tcp-brutal=y
CONFIG_PACKAGE_kmod-tls=y
CONFIG_PACKAGE_kmod-tun=y
CONFIG_PACKAGE_kmod-usb-audio=y
-CONFIG_PACKAGE_kmod-usb-storage=y
+CONFIG_PACKAGE_kmod-usb-hid=y
+CONFIG_PACKAGE_kmod-usb-storage-uas=y
+CONFIG_PACKAGE_kmod-usb2-pci=y
+CONFIG_PACKAGE_kmod-usb2=y
+CONFIG_PACKAGE_kmod-usb3=y
+CONFIG_PACKAGE_kmod-veth=y
+
+### Kernel Modules - out-of-tree driver
+CONFIG_PACKAGE_kmod-usb-net-rtl8152-vendor=y
+
+### Kernel Modules - USB WiFi Adapter
+CONFIG_PACKAGE_kmod-mt7921u=y
### Utilities
CONFIG_PACKAGE_bash=y
+CONFIG_PACKAGE_bash-completion=y
CONFIG_PACKAGE_dmesg=y
CONFIG_PACKAGE_dosfstools=y
CONFIG_PACKAGE_exfat-fsck=y
@@ -186,18 +169,31 @@ CONFIG_PACKAGE_exfat-mkfs=y
CONFIG_PACKAGE_f2fs-tools=y
CONFIG_PACKAGE_fdisk=y
CONFIG_PACKAGE_file=y
+CONFIG_PACKAGE_fstrim=y
CONFIG_PACKAGE_ftp=y
-CONFIG_PACKAGE_less=y
+CONFIG_PACKAGE_gdisk=y
+CONFIG_PACKAGE_htop=y
+CONFIG_PACKAGE_iperf3=y
+CONFIG_PACKAGE_ip-full=y
+CONFIG_PACKAGE_iputils-ping=y
CONFIG_PACKAGE_lrzsz=y
CONFIG_PACKAGE_lsblk=y
CONFIG_PACKAGE_lscpu=y
CONFIG_PACKAGE_lsof=y
-CONFIG_PACKAGE_nethogs=y
+# CONFIG_PACKAGE_nethogs is not set
CONFIG_PACKAGE_openssh-sftp-server=y
CONFIG_PACKAGE_pciutils=y
CONFIG_PACKAGE_qrencode=y
+CONFIG_PACKAGE_rename=y
+CONFIG_PACKAGE_resize2fs=y
+CONFIG_PACKAGE_rsync=y
CONFIG_PACKAGE_screen=y
+CONFIG_PACKAGE_sshpass=y
+CONFIG_PACKAGE_tar=y
+CONFIG_PACKAGE_taskset=y
CONFIG_PACKAGE_telnet-bsd=y
+CONFIG_PACKAGE_tree=y
+CONFIG_PACKAGE_unzip=y
CONFIG_PACKAGE_usbutils=y
CONFIG_PACKAGE_wget-ssl=y
CONFIG_PACKAGE_wpad-openssl=y
@@ -205,12 +201,29 @@ CONFIG_PACKAGE_xfs-admin=y
CONFIG_PACKAGE_xfs-fsck=y
CONFIG_PACKAGE_xfs-growfs=y
CONFIG_PACKAGE_xfs-mkfs=y
+CONFIG_PACKAGE_xz-utils=y
+CONFIG_PACKAGE_xz=y
+CONFIG_PACKAGE_zip=y
CONFIG_PACKAGE_zoneinfo-asia=y
### GNU Core Utilities
CONFIG_PACKAGE_coreutils=y
+CONFIG_PACKAGE_coreutils-cat=y
+CONFIG_PACKAGE_coreutils-chmod=y
+CONFIG_PACKAGE_coreutils-chown=y
+CONFIG_PACKAGE_coreutils-chroot=y
+CONFIG_PACKAGE_coreutils-cp=y
+CONFIG_PACKAGE_coreutils-date=y
+CONFIG_PACKAGE_coreutils-dd=y
CONFIG_PACKAGE_coreutils-dircolors=y
CONFIG_PACKAGE_coreutils-ls=y
+CONFIG_PACKAGE_coreutils-mkdir=y
+CONFIG_PACKAGE_coreutils-mv=y
+CONFIG_PACKAGE_coreutils-nproc=y
+CONFIG_PACKAGE_coreutils-rm=y
+CONFIG_PACKAGE_coreutils-sleep=y
+CONFIG_PACKAGE_coreutils-timeout=y
+CONFIG_PACKAGE_coreutils-truncate=y
### procps-ng Utilities
CONFIG_PACKAGE_procps-ng=y
diff --git a/openwrt/build.sh b/openwrt/build.sh
index 31054a08f..dcd655531 100644
--- a/openwrt/build.sh
+++ b/openwrt/build.sh
@@ -20,40 +20,45 @@ endgroup() {
GROUP=
}
+# check
+if [ "$(whoami)" != "sbwml" ] && [ -z "$git_name" ] && [ -z "$git_password" ]; then
+ echo -e "\n${RED_COLOR} Not authorized. Execute the following command to provide authorization information:${RES}\n"
+ echo -e "${BLUE_COLOR} export git_name=your_username git_password=your_password${RES}\n"
+ exit 1
+fi
+
#####################################
# NanoPi R4S OpenWrt Build Script #
#####################################
# IP Location
-ip_info=`curl -s https://ip.cooluc.com`;
-export isCN=`echo $ip_info | grep -Po 'country_code\":"\K[^"]+'`;
+ip_info=`curl -sk https://ip.cooluc.com`;
+[ -n "$ip_info" ] && export isCN=`echo $ip_info | grep -Po 'country_code\":"\K[^"]+'` || export isCN=US
# script url
-if [ "$isCN" = "CN" ]; then
- export mirror=init.cooluc.com
-else
- export mirror=init2.cooluc.com
-fi
+export mirror=https://init.cooluc.com
-# github actions - automatically retrieve `github raw` links
-if [ "$(whoami)" = "runner" ] && [ -n "$GITHUB_REPO" ]; then
- export mirror=raw.githubusercontent.com/$GITHUB_REPO/master
+# github actions - caddy server
+if [ "$(whoami)" = "runner" ] && [ "$git_name" != "private" ]; then
+ export mirror=http://127.0.0.1:8080
fi
# private gitea
-export gitea=git.cooluc.com
+export gitea="git.cooluc.com"
# github mirror
if [ "$isCN" = "CN" ]; then
+ # There is currently no stable gh proxy
export github="github.com"
+ code_mirror="git.cooluc.com"
else
export github="github.com"
+ code_mirror="github.com"
fi
# Check root
if [ "$(id -u)" = "0" ]; then
- echo -e "${RED_COLOR}Building with root user is not supported.${RES}"
- exit 1
+ export FORCE_UNSAFE_CONFIGURE=1 FORCE=1
fi
# Start time
@@ -61,65 +66,77 @@ starttime=`date +'%Y-%m-%d %H:%M:%S'`
CURRENT_DATE=$(date +%s)
# Cpus
-cores=`expr $(nproc --all) + 1`
+cores=`expr $(nproc) + 1`
# $CURL_BAR
if curl --help | grep progress-bar >/dev/null 2>&1; then
CURL_BAR="--progress-bar";
fi
-if [ -z "$1" ] || [ "$2" != "nanopi-r4s" -a "$2" != "nanopi-r5s" -a "$2" != "x86_64" -a "$2" != "netgear_r8500" -a "$2" != "armv8" ]; then
- echo -e "\n${RED_COLOR}Building type not specified.${RES}\n"
+SUPPORTED_BOARDS="nanopi-r4s nanopi-r5s nanopi-r76s x86_64 armv8"
+if [ -z "$1" ] || ! echo "$SUPPORTED_BOARDS" | grep -qw "$2"; then
+ echo -e "\n${RED_COLOR}Building type not specified or unsupported board: '$2'.${RES}\n"
echo -e "Usage:\n"
- echo -e "nanopi-r4s releases: ${GREEN_COLOR}bash build.sh rc2 nanopi-r4s${RES}"
- echo -e "nanopi-r4s snapshots: ${GREEN_COLOR}bash build.sh dev nanopi-r4s${RES}"
- echo -e "nanopi-r5s releases: ${GREEN_COLOR}bash build.sh rc2 nanopi-r5s${RES}"
- echo -e "nanopi-r5s snapshots: ${GREEN_COLOR}bash build.sh dev nanopi-r5s${RES}"
- echo -e "x86_64 releases: ${GREEN_COLOR}bash build.sh rc2 x86_64${RES}"
- echo -e "x86_64 snapshots: ${GREEN_COLOR}bash build.sh dev x86_64${RES}"
- echo -e "netgear-r8500 releases: ${GREEN_COLOR}bash build.sh rc2 netgear_r8500${RES}"
- echo -e "netgear-r8500 snapshots: ${GREEN_COLOR}bash build.sh dev netgear_r8500${RES}"
- echo -e "armsr-armv8 releases: ${GREEN_COLOR}bash build.sh rc2 armv8${RES}"
- echo -e "armsr-armv8 snapshots: ${GREEN_COLOR}bash build.sh dev armv8${RES}\n"
+
+ for board in $SUPPORTED_BOARDS; do
+ echo -e "$board releases: ${GREEN_COLOR}bash build.sh rc2 $board${RES}"
+ echo -e "$board snapshots: ${GREEN_COLOR}bash build.sh dev $board${RES}"
+ done
+ echo
exit 1
fi
# Source branch
if [ "$1" = "dev" ]; then
- export branch=openwrt-23.05
- export version=snapshots-23.05
- export toolchain_version=openwrt-23.05
+ export branch=openwrt-25.12
+ export version=dev
elif [ "$1" = "rc2" ]; then
- latest_release="v$(curl -s https://$mirror/tags/v23)"
+ latest_release="v$(curl -s $mirror/tags/v25)"
export branch=$latest_release
export version=rc2
- export toolchain_version=openwrt-23.05
fi
# lan
[ -n "$LAN" ] && export LAN=$LAN || export LAN=10.0.0.1
# platform
-[ "$2" = "nanopi-r4s" ] && export platform="rk3399" toolchain_arch="nanopi-r4s"
-[ "$2" = "nanopi-r5s" ] && export platform="rk3568" toolchain_arch="nanopi-r5s"
-[ "$2" = "x86_64" ] && export platform="x86_64" toolchain_arch="x86_64"
-[ "$2" = "netgear_r8500" ] && export platform="bcm53xx" toolchain_arch="bcm53xx"
-[ "$2" = "armv8" ] && export platform="armv8" toolchain_arch="armsr-armv8"
-
-# gcc13 & 14 & 15
+case "$2" in
+ armv8)
+ platform="armv8"
+ toolchain_arch="aarch64_generic"
+ ;;
+ nanopi-r4s)
+ platform="rk3399"
+ toolchain_arch="aarch64_generic"
+ ;;
+ nanopi-r5s)
+ platform="rk3568"
+ toolchain_arch="aarch64_generic"
+ ;;
+ nanopi-r76s)
+ platform="rk3576"
+ toolchain_arch="aarch64_generic"
+ ;;
+ x86_64)
+ platform="x86_64"
+ toolchain_arch="x86_64"
+ ;;
+esac
+export platform toolchain_arch
+
+# gcc14 & 15
if [ "$USE_GCC13" = y ]; then
- export USE_GCC13=y
- # use mold
- [ "$ENABLE_MOLD" = y ] && export ENABLE_MOLD=y
+ export USE_GCC13=y gcc_version=13
elif [ "$USE_GCC14" = y ]; then
- export USE_GCC14=y
- # use mold
- [ "$ENABLE_MOLD" = y ] && export ENABLE_MOLD=y
+ export USE_GCC14=y gcc_version=14
elif [ "$USE_GCC15" = y ]; then
- export USE_GCC15=y
- # use mold
- [ "$ENABLE_MOLD" = y ] && export ENABLE_MOLD=y
+ export USE_GCC15=y gcc_version=15
+elif [ "$USE_GCC16" = y ]; then
+ export USE_GCC16=y gcc_version=16
+else
+ export USE_GCC15=y gcc_version=15
fi
+[ "$ENABLE_MOLD" = y ] && export ENABLE_MOLD=y
# build.sh flags
export \
@@ -128,78 +145,82 @@ export \
ENABLE_GLIBC=$ENABLE_GLIBC \
ENABLE_LRNG=$ENABLE_LRNG \
KERNEL_CLANG_LTO=$KERNEL_CLANG_LTO \
+ ROOT_PASSWORD=$ROOT_PASSWORD
# print version
echo -e "\r\n${GREEN_COLOR}Building $branch${RES}\r\n"
-if [ "$platform" = "x86_64" ]; then
- echo -e "${GREEN_COLOR}Model: x86_64${RES}"
-elif [ "$platform" = "armv8" ]; then
- echo -e "${GREEN_COLOR}Model: armsr/armv8${RES}"
- [ "$1" = "rc2" ] && model="armv8"
-elif [ "$platform" = "bcm53xx" ]; then
- echo -e "${GREEN_COLOR}Model: netgear_r8500${RES}"
- [ "$LAN" = "10.0.0.1" ] && export LAN="192.168.1.1"
-elif [ "$platform" = "rk3568" ]; then
- echo -e "${GREEN_COLOR}Model: nanopi-r5s/r5c${RES}"
- [ "$1" = "rc2" ] && model="nanopi-r5s"
-else
- echo -e "${GREEN_COLOR}Model: nanopi-r4s${RES}"
- [ "$1" = "rc2" ] && model="nanopi-r4s"
-fi
-curl -s https://$mirror/tags/kernel-6.6 > kernel.txt
-kmod_hash=$(grep HASH kernel.txt | awk -F'HASH-' '{print $2}' | awk '{print $1}' | md5sum | awk '{print $1}')
-kmodpkg_name=$(echo $(grep HASH kernel.txt | awk -F'HASH-' '{print $2}' | awk '{print $1}')-1-$(echo $kmod_hash))
+case "$platform" in
+ x86_64)
+ echo -e "${GREEN_COLOR}Model: x86_64${RES}"
+ ;;
+ armv8)
+ echo -e "${GREEN_COLOR}Model: armsr/armv8${RES}"
+ [ "$1" = "rc2" ] && model="armv8"
+ ;;
+ rk3568)
+ echo -e "${GREEN_COLOR}Model: nanopi-r5s/r5c${RES}"
+ [ "$1" = "rc2" ] && model="nanopi-r5s"
+ ;;
+ rk3576)
+ echo -e "${GREEN_COLOR}Model: nanopi-r76s${RES}"
+ [ "$1" = "rc2" ] && model="nanopi-r76s"
+ ;;
+ rk3399|*)
+ echo -e "${GREEN_COLOR}Model: nanopi-r4s${RES}"
+ [ "$1" = "rc2" ] && model="nanopi-r4s"
+ ;;
+esac
+
+# print build opt
+get_kernel_version=$(curl -s $mirror/tags/kernel-6.18)
+kmod_hash=$(echo -e "$get_kernel_version" | awk -F'HASH-' '{print $2}' | awk '{print $1}' | tail -1 | md5sum | awk '{print $1}')
+kmodpkg_name=$(echo $(echo -e "$get_kernel_version" | awk -F'HASH-' '{print $2}' | awk '{print $1}')~$(echo $kmod_hash)-r1)
echo -e "${GREEN_COLOR}Kernel: $kmodpkg_name ${RES}"
-rm -f kernel.txt
-
echo -e "${GREEN_COLOR}Date: $CURRENT_DATE${RES}\r\n"
-
-if [ "$USE_GCC13" = "y" ]; then
- echo -e "${GREEN_COLOR}GCC VERSION: 13${RES}"
-elif [ "$USE_GCC14" = "y" ]; then
- echo -e "${GREEN_COLOR}GCC VERSION: 14${RES}"
-elif [ "$USE_GCC15" = "y" ]; then
- echo -e "${GREEN_COLOR}GCC VERSION: 15${RES}"
-else
- echo -e "${GREEN_COLOR}GCC VERSION: 11${RES}"
-fi
-[ -n "$LAN" ] && echo -e "${GREEN_COLOR}LAN: $LAN${RES}" || echo -e "${GREEN_COLOR}LAN: 10.0.0.1${RES}"
+echo -e "${GREEN_COLOR}SCRIPT_URL:${RES} ${BLUE_COLOR}$mirror${RES}\r\n"
+echo -e "${GREEN_COLOR}GCC VERSION: $gcc_version${RES}"
+print_status() {
+ local name="$1"
+ local value="$2"
+ local true_color="${3:-$GREEN_COLOR}"
+ local false_color="${4:-$YELLOW_COLOR}"
+ local newline="${5:-}"
+ if [ "$value" = "y" ]; then
+ echo -e "${GREEN_COLOR}${name}:${RES} ${true_color}true${RES}${newline}"
+ else
+ echo -e "${GREEN_COLOR}${name}:${RES} ${false_color}false${RES}${newline}"
+ fi
+}
+[ -n "$LAN" ] && echo -e "${GREEN_COLOR}LAN:${RES} $LAN" || echo -e "${GREEN_COLOR}LAN:${RES} 10.0.0.1"
+[ -n "$ROOT_PASSWORD" ] \
+ && echo -e "${GREEN_COLOR}Default Password:${RES} ${BLUE_COLOR}$ROOT_PASSWORD${RES}" \
+ || echo -e "${GREEN_COLOR}Default Password:${RES} (${YELLOW_COLOR}No password${RES})"
[ "$ENABLE_GLIBC" = "y" ] && echo -e "${GREEN_COLOR}Standard C Library:${RES} ${BLUE_COLOR}glibc${RES}" || echo -e "${GREEN_COLOR}Standard C Library:${RES} ${BLUE_COLOR}musl${RES}"
-[ "$ENABLE_OTA" = "y" ] && echo -e "${GREEN_COLOR}ENABLE_OTA: true${RES}" || echo -e "${GREEN_COLOR}ENABLE_OTA:${RES} ${YELLOW_COLOR}false${RES}"
-[ "$ENABLE_DPDK" = "y" ] && echo -e "${GREEN_COLOR}ENABLE_DPDK: true${RES}" || echo -e "${GREEN_COLOR}ENABLE_DPDK:${RES} ${YELLOW_COLOR}false${RES}"
-[ "$ENABLE_MOLD" = "y" ] && echo -e "${GREEN_COLOR}ENABLE_MOLD: true${RES}" || echo -e "${GREEN_COLOR}ENABLE_MOLD:${RES} ${YELLOW_COLOR}false${RES}"
-[ "$ENABLE_BPF" = "y" ] && echo -e "${GREEN_COLOR}ENABLE_BPF: true${RES}" || echo -e "${GREEN_COLOR}ENABLE_BPF:${RES} ${RED_COLOR}false${RES}"
-[ "$ENABLE_LTO" = "y" ] && echo -e "${GREEN_COLOR}ENABLE_LTO: true${RES}" || echo -e "${GREEN_COLOR}ENABLE_LTO:${RES} ${RED_COLOR}false${RES}"
-[ "$ENABLE_LRNG" = "y" ] && echo -e "${GREEN_COLOR}ENABLE_LRNG: true${RES}" || echo -e "${GREEN_COLOR}ENABLE_LRNG:${RES} ${RED_COLOR}false${RES}"
-[ "$ENABLE_LOCAL_KMOD" = "y" ] && echo -e "${GREEN_COLOR}ENABLE_LOCAL_KMOD: true${RES}" || echo -e "${GREEN_COLOR}ENABLE_LOCAL_KMOD: false${RES}"
-[ "$BUILD_FAST" = "y" ] && echo -e "${GREEN_COLOR}BUILD_FAST: true${RES}" || echo -e "${GREEN_COLOR}BUILD_FAST:${RES} ${YELLOW_COLOR}false${RES}"
-[ "$MINIMAL_BUILD" = "y" ] && echo -e "${GREEN_COLOR}MINIMAL_BUILD: true${RES}" || echo -e "${GREEN_COLOR}MINIMAL_BUILD: false${RES}"
-[ "$KERNEL_CLANG_LTO" = "y" ] && echo -e "${GREEN_COLOR}KERNEL_CLANG_LTO: true${RES}\r\n" || echo -e "${GREEN_COLOR}KERNEL_CLANG_LTO:${RES} ${YELLOW_COLOR}false${RES}\r\n"
+print_status "ENABLE_OTA" "$ENABLE_OTA"
+print_status "ENABLE_DPDK" "$ENABLE_DPDK"
+print_status "ENABLE_MOLD" "$ENABLE_MOLD"
+print_status "ENABLE_BPF" "$ENABLE_BPF" "$GREEN_COLOR" "$RED_COLOR"
+print_status "ENABLE_LTO" "$ENABLE_LTO" "$GREEN_COLOR" "$RED_COLOR"
+print_status "ENABLE_LRNG" "$ENABLE_LRNG" "$GREEN_COLOR" "$RED_COLOR"
+print_status "ENABLE_LOCAL_KMOD" "$ENABLE_LOCAL_KMOD"
+print_status "BUILD_FAST" "$BUILD_FAST"
+print_status "ENABLE_CCACHE" "$ENABLE_CCACHE"
+print_status "MINIMAL_BUILD" "$MINIMAL_BUILD"
+print_status "STD_BUILD" "$STD_BUILD"
+print_status "ENABLE_ISTORE" "$ENABLE_ISTORE"
+print_status "KERNEL_CLANG_LTO" "$KERNEL_CLANG_LTO" "$GREEN_COLOR" "$YELLOW_COLOR" "\n"
# clean old files
-rm -rf openwrt master && mkdir master
+rm -rf openwrt
# openwrt - releases
[ "$(whoami)" = "runner" ] && group "source code"
-git clone --depth=1 https://$github/openwrt/openwrt -b $branch
-
-# openwrt master
-git clone https://$github/openwrt/openwrt master/openwrt --depth=1
-git clone https://$github/openwrt/packages master/packages --depth=1
-git clone https://$github/openwrt/luci master/luci --depth=1
-git clone https://$github/openwrt/routing master/routing --depth=1
-
-# openwrt-23.05
-[ "$1" = "rc2" ] && git clone https://$github/openwrt/openwrt -b openwrt-23.05 master/openwrt-23.05 --depth=1
-
-# immortalwrt master
-git clone https://$github/immortalwrt/packages master/immortalwrt_packages --depth=1
+git clone --depth=1 https://$code_mirror/openwrt/openwrt -b $branch
[ "$(whoami)" = "runner" ] && endgroup
if [ -d openwrt ]; then
cd openwrt
- [ "$1" = "rc2" ] && echo "$CURRENT_DATE" > version.date
- curl -Os https://$mirror/openwrt/patch/key.tar.gz && tar zxf key.tar.gz && rm -f key.tar.gz
+ curl -Os $mirror/openwrt/patch/key2.tar.gz && tar zxf key2.tar.gz && rm -f key2.tar.gz
else
echo -e "${RED_COLOR}Failed to download source code${RES}"
exit 1
@@ -225,10 +246,10 @@ else
telephony=";$branch"
fi
cat > feeds.conf < .config
- ALL_KMODS=y
-elif [ "$platform" = "bcm53xx" ]; then
- if [ "$MINIMAL_BUILD" = "y" ]; then
- curl -s https://$mirror/openwrt/23-config-musl-r8500-minimal > .config
- else
- curl -s https://$mirror/openwrt/23-config-musl-r8500 > .config
- fi
- ALL_KMODS=y
+ curl -s $mirror/openwrt/25-config-musl-x86 > .config
elif [ "$platform" = "rk3568" ]; then
- curl -s https://$mirror/openwrt/23-config-musl-r5s > .config
- ALL_KMODS=y
+ curl -s $mirror/openwrt/25-config-musl-r5s > .config
+elif [ "$platform" = "rk3576" ]; then
+ curl -s $mirror/openwrt/25-config-musl-r76s > .config
elif [ "$platform" = "armv8" ]; then
- curl -s https://$mirror/openwrt/23-config-musl-armsr-armv8 > .config
- ALL_KMODS=y
+ curl -s $mirror/openwrt/25-config-musl-armsr-armv8 > .config
else
- curl -s https://$mirror/openwrt/23-config-musl-r4s > .config
+ curl -s $mirror/openwrt/25-config-musl-r4s > .config
fi
# config-common
if [ "$MINIMAL_BUILD" = "y" ]; then
- [ "$platform" != "bcm53xx" ] && curl -s https://$mirror/openwrt/23-config-minimal-common >> .config
+ curl -s $mirror/openwrt/25-config-minimal-common >> .config
echo 'VERSION_TYPE="minimal"' >> package/base-files/files/usr/lib/os-release
+elif [ "$STD_BUILD" = "y" ]; then
+ curl -s $mirror/openwrt/25-config-std-common >> .config
+ echo 'VERSION_TYPE="standard"' >> package/base-files/files/usr/lib/os-release
else
- [ "$platform" != "bcm53xx" ] && curl -s https://$mirror/openwrt/23-config-common >> .config
+ curl -s $mirror/openwrt/25-config-common >> .config
[ "$platform" = "armv8" ] && sed -i '/DOCKER/Id' .config
fi
@@ -308,15 +329,16 @@ fi
[ "$ENABLE_OTA" = "y" ] && [ "$version" = "rc2" ] && echo 'CONFIG_PACKAGE_luci-app-ota=y' >> .config
# bpf
-[ "$ENABLE_BPF" = "y" ] && curl -s https://$mirror/openwrt/generic/config-bpf >> .config
+curl -s $mirror/openwrt/generic/config-bpf >> .config
+[ "$ENABLE_BPF" != "y" ] && sed -i '/KERNEL_DEBUG_INFO\|KERNEL_MODULE_ALLOW_BTF/d' .config
# LTO
export ENABLE_LTO=$ENABLE_LTO
-[ "$ENABLE_LTO" = "y" ] && curl -s https://$mirror/openwrt/generic/config-lto >> .config
+[ "$ENABLE_LTO" = "y" ] && curl -s $mirror/openwrt/generic/config-lto >> .config
# glibc
[ "$ENABLE_GLIBC" = "y" ] && {
- curl -s https://$mirror/openwrt/generic/config-glibc >> .config
+ curl -s $mirror/openwrt/generic/config-glibc >> .config
sed -i '/NaiveProxy/d' .config
}
@@ -326,13 +348,23 @@ export ENABLE_LTO=$ENABLE_LTO
echo 'CONFIG_PACKAGE_numactl=y' >> .config
}
+# istore
+[ "$ENABLE_ISTORE" = "y" ] && {
+ echo 'CONFIG_PACKAGE_luci-app-store=y' >> .config
+ echo 'CONFIG_PACKAGE_luci-app-quickstart=y' >> .config
+}
+
# mold
[ "$ENABLE_MOLD" = "y" ] && echo 'CONFIG_USE_MOLD=y' >> .config
# kernel - CLANG + LTO; Allow CONFIG_KERNEL_CC=clang / clang-18 / clang-xx
if [ "$KERNEL_CLANG_LTO" = "y" ]; then
echo '# Kernel - CLANG LTO' >> .config
- echo 'CONFIG_KERNEL_CC="clang"' >> .config
+ if [ "$USE_GCC15" = "y" ] || [ "$USE_GCC16" = "y" ] && [ "$ENABLE_CCACHE" = "y" ]; then
+ echo 'CONFIG_KERNEL_CC="ccache clang"' >> .config
+ else
+ echo 'CONFIG_KERNEL_CC="clang"' >> .config
+ fi
echo 'CONFIG_EXTRA_OPTIMIZATION=""' >> .config
echo '# CONFIG_PACKAGE_kselftests-bpf is not set' >> .config
fi
@@ -341,6 +373,8 @@ fi
if [ "$ENABLE_LRNG" = "y" ]; then
echo -e "\n# Kernel - LRNG" >> .config
echo "CONFIG_KERNEL_LRNG=y" >> .config
+ echo "# CONFIG_PACKAGE_urandom-seed is not set" >> .config
+ echo "# CONFIG_PACKAGE_urngd is not set" >> .config
fi
# local kmod
@@ -349,57 +383,56 @@ if [ "$ENABLE_LOCAL_KMOD" = "y" ]; then
echo "CONFIG_TARGET_ROOTFS_LOCAL_PACKAGES=y" >> .config
fi
-# openwrt-23.05 gcc11/13/14/15
-[ "$(whoami)" = "runner" ] && group "patching toolchain"
-if [ "$USE_GCC13" = "y" ] || [ "$USE_GCC14" = "y" ] || [ "$USE_GCC15" = "y" ]; then
- [ "$USE_GCC13" = "y" ] && curl -s https://$mirror/openwrt/generic/config-gcc13 >> .config
- [ "$USE_GCC14" = "y" ] && curl -s https://$mirror/openwrt/generic/config-gcc14 >> .config
- [ "$USE_GCC15" = "y" ] && curl -s https://$mirror/openwrt/generic/config-gcc15 >> .config
- curl -s https://$mirror/openwrt/patch/generic/200-toolchain-gcc-update-to-13.2.patch | patch -p1
- curl -s https://$mirror/openwrt/patch/generic/201-toolchain-gcc-add-support-for-GCC-14.patch | patch -p1
- curl -s https://$mirror/openwrt/patch/generic/202-toolchain-gcc-add-support-for-GCC-15.patch | patch -p1
- # gcc14/15 init
- cp -a toolchain/gcc/patches-13.x toolchain/gcc/patches-14.x
- curl -s https://$mirror/openwrt/patch/generic/gcc-14/910-mbsd_multi.patch > toolchain/gcc/patches-14.x/910-mbsd_multi.patch
- cp -a toolchain/gcc/patches-14.x toolchain/gcc/patches-15.x
- curl -s https://$mirror/openwrt/patch/generic/gcc-15/970-macos_arm64-building-fix.patch > toolchain/gcc/patches-15.x/970-macos_arm64-building-fix.patch
-elif [ ! "$ENABLE_GLIBC" = "y" ]; then
- curl -s https://$mirror/openwrt/generic/config-gcc11 >> .config
-fi
-[ "$(whoami)" = "runner" ] && endgroup
-
-# clean directory - github actions
-[ "$(whoami)" = "runner" ] && echo 'CONFIG_AUTOREMOVE=y' >> .config
+# gcc config
+echo -e "\n# gcc ${gcc_version}" >> .config
+echo -e "CONFIG_DEVEL=y" >> .config
+echo -e "CONFIG_TOOLCHAINOPTS=y" >> .config
+echo -e "CONFIG_GCC_USE_VERSION_${gcc_version}=y\n" >> .config
# uhttpd
[ "$ENABLE_UHTTPD" = "y" ] && sed -i '/nginx/d' .config && echo 'CONFIG_PACKAGE_ariang=y' >> .config
-# bcm53xx: upx_list.txt
-# [ "$platform" = "bcm53xx" ] && curl -s https://$mirror/openwrt/generic/upx_list.txt > upx_list.txt
+# not all kmod
+[ "$NO_KMOD" = "y" ] && sed -i '/CONFIG_ALL_KMODS=y/d; /CONFIG_ALL_NONSHARED=y/d' .config
+
+# build wwan pkgs for openwrt_core
+[ "$OPENWRT_CORE" = "y" ] && curl -s $mirror/openwrt/generic/config-wwan >> .config
+
+# build mt7927-firmware pkgs for openwrt_core
+[ "$OPENWRT_CORE" = "y" ] && echo 'CONFIG_PACKAGE_kmod-mt7927-firmware=m' >> .config
+
+# ccache
+if [ "$ENABLE_CCACHE" = "y" ]; then
+ echo "CONFIG_CCACHE=y" >> .config
+ [ "$(whoami)" = "runner" ] && echo "CONFIG_CCACHE_DIR=\"/builder/.ccache\"" >> .config
+ [ "$(whoami)" = "sbwml" ] && echo "CONFIG_CCACHE_DIR=\"/home/sbwml/.ccache\"" >> .config
+ tools_suffix="_ccache"
+fi
+
+# nanopi-r76s
+[ "$platform" = "rk3576" ] && {
+ sed -i '/samba4/d' .config
+ sed -i '/qbittorrent/d' .config
+}
+
+# add to core
+[ "$OPENWRT_CORE" = "y" ] && curl -s $mirror/openwrt/generic/config-build-only >> .config
# Toolchain Cache
if [ "$BUILD_FAST" = "y" ]; then
[ "$ENABLE_GLIBC" = "y" ] && LIBC=glibc || LIBC=musl
- [ "$isCN" = "CN" ] && github_proxy="http://gh.cooluc.com/" || github_proxy=""
echo -e "\n${GREEN_COLOR}Download Toolchain ...${RES}"
PLATFORM_ID=""
[ -f /etc/os-release ] && source /etc/os-release
- if [ "$PLATFORM_ID" = "platform:el9" ]; then
+ if [ "$PLATFORM_ID" = "platform:el10" ]; then
TOOLCHAIN_URL="http://127.0.0.1:8080"
else
- TOOLCHAIN_URL="$github_proxy"https://github.com/sbwml/toolchain-cache/releases/latest/download
- fi
- if [ "$USE_GCC13" = "y" ]; then
- curl -L "$TOOLCHAIN_URL"/toolchain_"$LIBC"_"$toolchain_arch"_13.tar.gz -o toolchain.tar.gz $CURL_BAR
- elif [ "$USE_GCC14" = "y" ]; then
- curl -L "$TOOLCHAIN_URL"/toolchain_"$LIBC"_"$toolchain_arch"_14.tar.gz -o toolchain.tar.gz $CURL_BAR
- elif [ "$USE_GCC15" = "y" ]; then
- curl -L "$TOOLCHAIN_URL"/toolchain_"$LIBC"_"$toolchain_arch"_15.tar.gz -o toolchain.tar.gz $CURL_BAR
- else
- curl -L "$TOOLCHAIN_URL"/toolchain_"$LIBC"_"$toolchain_arch"_11.tar.gz -o toolchain.tar.gz $CURL_BAR
+ TOOLCHAIN_URL=https://"$github_proxy"github.com/sbwml/openwrt_caches/releases/download/openwrt-25.12
fi
+ curl -L ${TOOLCHAIN_URL}/toolchain_${LIBC}_${toolchain_arch}_gcc-${gcc_version}${tools_suffix}.tar.zst -o toolchain.tar.zst $CURL_BAR
echo -e "\n${GREEN_COLOR}Process Toolchain ...${RES}"
- tar -zxf toolchain.tar.gz && rm -f toolchain.tar.gz
+ tar -I "zstd" -xf toolchain.tar.zst
+ rm -f toolchain.tar.zst
mkdir bin
find ./staging_dir/ -name '*' -exec touch {} \; >/dev/null 2>&1
find ./tmp/ -name '*' -exec touch {} \; >/dev/null 2>&1
@@ -419,15 +452,8 @@ if [ "$BUILD_TOOLCHAIN" = "y" ]; then
make -j$cores toolchain/compile || make -j$cores toolchain/compile V=s || exit 1
mkdir -p toolchain-cache
[ "$ENABLE_GLIBC" = "y" ] && LIBC=glibc || LIBC=musl
- if [ "$USE_GCC13" = "y" ]; then
- tar -zcf toolchain-cache/toolchain_"$LIBC"_"$toolchain_arch"_13.tar.gz ./{build_dir,dl,staging_dir,tmp} && echo -e "${GREEN_COLOR} Build success! ${RES}"
- elif [ "$USE_GCC14" = "y" ]; then
- tar -zcf toolchain-cache/toolchain_"$LIBC"_"$toolchain_arch"_14.tar.gz ./{build_dir,dl,staging_dir,tmp} && echo -e "${GREEN_COLOR} Build success! ${RES}"
- elif [ "$USE_GCC15" = "y" ]; then
- tar -zcf toolchain-cache/toolchain_"$LIBC"_"$toolchain_arch"_15.tar.gz ./{build_dir,dl,staging_dir,tmp} && echo -e "${GREEN_COLOR} Build success! ${RES}"
- else
- tar -zcf toolchain-cache/toolchain_"$LIBC"_"$toolchain_arch"_11.tar.gz ./{build_dir,dl,staging_dir,tmp} && echo -e "${GREEN_COLOR} Build success! ${RES}"
- fi
+ tar -I "zstd -19 -T$(nproc --all)" -cf toolchain-cache/toolchain_${LIBC}_${toolchain_arch}_gcc-${gcc_version}${tools_suffix}.tar.zst ./{build_dir,dl,staging_dir,tmp}
+ echo -e "\n${GREEN_COLOR} Build success! ${RES}"
exit 0
else
echo -e "\r\n${GREEN_COLOR}Building OpenWrt ...${RES}\r\n"
@@ -453,11 +479,24 @@ else
fi
if [ "$platform" = "x86_64" ]; then
- if [ "$ALL_KMODS" = y ]; then
+ if [ "$NO_KMOD" != "y" ]; then
cp -a bin/targets/x86/*/packages $kmodpkg_name
rm -f $kmodpkg_name/Packages*
- # driver firmware
- cp -a bin/packages/x86_64/base/*firmware*.ipk $kmodpkg_name/
+ cp -a bin/packages/x86_64/base/rtl88*a-firmware*.apk $kmodpkg_name/ || true
+ [ "$OPENWRT_CORE" = "y" ] && {
+ cp -a bin/packages/x86_64/base/*3ginfo*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/x86_64/base/*modemband*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/x86_64/base/*sms-tool*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/x86_64/base/*quectel*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/natflow*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/appfilter*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/luci-app-oaf*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/luci-i18n-oaf*.apk $kmodpkg_name/ || true
+ }
+ [ "$ENABLE_DPDK" = "y" ] && {
+ cp -a bin/packages/x86_64/base/*dpdk*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/x86_64/base/*numa*.apk $kmodpkg_name/ || true
+ }
bash kmod-sign $kmodpkg_name
tar zcf x86_64-$kmodpkg_name.tar.gz $kmodpkg_name
rm -rf $kmodpkg_name
@@ -466,9 +505,11 @@ if [ "$platform" = "x86_64" ]; then
if [ "$1" = "rc2" ]; then
mkdir -p ota
if [ "$MINIMAL_BUILD" = "y" ]; then
- OTA_URL="https://x86.cooluc.com/d/minimal/openwrt-23.05"
+ OTA_URL="https://dev.cooluc.com/minimal/x86_64"
+ elif [ "$STD_BUILD" = "y" ]; then
+ OTA_URL="https://dev.cooluc.com/standard/x86_64"
else
- OTA_URL="https://github.com/sbwml/builder/releases/download"
+ OTA_URL="https://dev.cooluc.com/release/x86_64"
fi
VERSION=$(sed 's/v//g' version.txt)
SHA256=$(sha256sum bin/targets/x86/64*/*-generic-squashfs-combined-efi.img.gz | awk '{print $1}')
@@ -478,7 +519,7 @@ if [ "$platform" = "x86_64" ]; then
{
"build_date": "$CURRENT_DATE",
"sha256sum": "$SHA256",
- "url": "$OTA_URL/v$VERSION/openwrt-$VERSION-x86-64-generic-squashfs-combined-efi.img.gz"
+ "url": "$OTA_URL/openwrt-$VERSION-x86-64-generic-squashfs-combined-efi.img.gz"
}
]
}
@@ -491,60 +532,47 @@ EOF
fi
exit 0
elif [ "$platform" = "armv8" ]; then
- if [ "$ALL_KMODS" = y ]; then
+ if [ "$NO_KMOD" != "y" ]; then
cp -a bin/targets/armsr/armv8*/packages $kmodpkg_name
rm -f $kmodpkg_name/Packages*
- # driver firmware
- cp -a bin/packages/aarch64_generic/base/*firmware*.ipk $kmodpkg_name/
+ cp -a bin/packages/aarch64_generic/base/rtl88*a-firmware*.apk $kmodpkg_name/ || true
+ [ "$OPENWRT_CORE" = "y" ] && {
+ cp -a bin/packages/aarch64_generic/base/*3ginfo*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/*modemband*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/*sms-tool*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/*quectel*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/natflow*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/appfilter*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/luci-app-oaf*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/luci-i18n-oaf*.apk $kmodpkg_name/ || true
+ }
+ [ "$ENABLE_DPDK" = "y" ] && {
+ cp -a bin/packages/aarch64_generic/base/*dpdk*.apk $kmodpkg_name/ || true
+ cp -a bin/packages/aarch64_generic/base/*numa*.apk $kmodpkg_name/ || true
+ }
bash kmod-sign $kmodpkg_name
tar zcf armv8-$kmodpkg_name.tar.gz $kmodpkg_name
rm -rf $kmodpkg_name
fi
# OTA json
- if [ "$1" = "rc2" ]; then
- mkdir -p ota
- VERSION=$(sed 's/v//g' version.txt)
- SHA256=$(sha256sum bin/targets/armsr/armv8*/*-generic-squashfs-combined-efi.img.gz | awk '{print $1}')
- cat > ota/fw.json < ota/fw.json < ota/fw.json < ota/fw.json < ota/fw.json </dev/null 2>&1; then
- rm -rf /var/emmc-install
- mkdir -p /var/emmc-install/{bin,lib}
- cp $(which fdisk) /var/emmc-install/bin
- cp /lib/{libc.so,libgcc_s.so.1} /var/emmc-install/lib
- ln -sf /var/emmc-install/lib/libc.so /var/emmc-install/lib/ld-musl-aarch64.so.1
- cp /usr/lib/{libfdisk.so.*,libsmartcols.so.*,libncursesw.so.*,libblkid.so.*,libuuid.so.*} /var/emmc-install/lib
- export PATH="/var/emmc-install/bin:$PATH"
- export LD_LIBRARY_PATH="/var/emmc-install/lib:$LD_LIBRARY_PATH"
- else
- echo "Command $cmd does not exist."
- exit 1
- fi
+ if ! which "$cmd" >/dev/null 2>&1; then
+ echo "Command $cmd does not exist."
+ exit 1
+ fi
done
if [ -z "$1" ]; then
echo "Firmware file does not specified."
echo "Usage: $0 "
- exit 1
+ exit 0
fi
echo " "
@@ -32,9 +23,9 @@ echo "Starting eMMC Flashing ..."
# eMMC device
echo " "
-echo "eMMC:"
-emmc_device=$(parted -l 2>/dev/null | grep -A 1 -E 'Model: MMC .*sd/mmc' | tail -n1 | awk '{print $2}' | sed 's/://g')
-emmc_size=$(parted -l 2>/dev/null | grep -A 1 -E 'Model: MMC .*sd/mmc' | tail -n1 | awk '{print $3}')
+echo "eMMC info"
+emmc_device=$(parted -s -l 2>/dev/null | grep -A 1 -E 'Model: MMC .*sd/mmc' | tail -n1 | awk '{print $2}' | sed 's/://g')
+emmc_size=$(parted -s -l 2>/dev/null | grep -A 1 -E 'Model: MMC .*sd/mmc' | tail -n1 | awk '{print $3}')
emmc_device_name=$(echo $emmc_device | awk -F/ '{print $3}')
emmc_partition=$(fdisk -l 2>/dev/null | grep "$emmc_device_name"p | wc -l)
if [ "$emmc_partition" -eq 3 ]; then
@@ -54,8 +45,7 @@ echo " "
read -p "This script will erase your eMMC. Continue [y/n]? " -n 1 -r
echo " "
if [[ $REPLY =~ ^[Nn]$ ]]; then
- rm -rf /var/emmc-install
- echo "Exiting script"
+ echo "Exiting script."
exit 1
fi
@@ -65,8 +55,8 @@ if [ -e "$firmware_file" ]; then
if [ "$extension" = "gz" ]; then
echo " "
echo "Gzip decompression $firmware_file ..."
- zcat "$firmware_file" > /var/emmc-install/firmware.img
- firmware_file_path="/var/emmc-install/firmware.img"
+ zcat "$firmware_file" > /var/firmware.img
+ firmware_file_path="/var/firmware.img"
elif [ "$extension" = "img" ]; then
firmware_file_path="$firmware_file"
else
@@ -94,5 +84,5 @@ EOM
fi
echo " "
echo "Done!"
-echo "Please remove the TF card and power off and restart device."
+echo "Please remove the TF card and Power off and restart device."
echo " "
diff --git a/openwrt/generic/config-build-only b/openwrt/generic/config-build-only
new file mode 100644
index 000000000..c2586d6a8
--- /dev/null
+++ b/openwrt/generic/config-build-only
@@ -0,0 +1,7 @@
+
+# Natflow
+CONFIG_PACKAGE_natflow=m
+
+# OAF
+CONFIG_PACKAGE_luci-app-oaf=m
+CONFIG_PACKAGE_appfilter=m
diff --git a/openwrt/generic/config-dpdk b/openwrt/generic/config-dpdk
new file mode 100644
index 000000000..21f3d34d6
--- /dev/null
+++ b/openwrt/generic/config-dpdk
@@ -0,0 +1,4 @@
+
+# DPDK
+CONFIG_PACKAGE_dpdk-tools=y
+CONFIG_PACKAGE_numactl=m
diff --git a/openwrt/generic/config-gcc11 b/openwrt/generic/config-gcc11
deleted file mode 100644
index e62b54353..000000000
--- a/openwrt/generic/config-gcc11
+++ /dev/null
@@ -1,5 +0,0 @@
-
-# gcc 11 - better performance
-CONFIG_DEVEL=y
-CONFIG_TOOLCHAINOPTS=y
-CONFIG_GCC_USE_VERSION_11=y
diff --git a/openwrt/generic/config-gcc13 b/openwrt/generic/config-gcc13
deleted file mode 100644
index 6e1fa77cb..000000000
--- a/openwrt/generic/config-gcc13
+++ /dev/null
@@ -1,5 +0,0 @@
-
-# gcc 13
-CONFIG_DEVEL=y
-CONFIG_TOOLCHAINOPTS=y
-CONFIG_GCC_USE_VERSION_13=y
diff --git a/openwrt/generic/config-gcc14 b/openwrt/generic/config-gcc14
deleted file mode 100644
index ca6bc7adb..000000000
--- a/openwrt/generic/config-gcc14
+++ /dev/null
@@ -1,6 +0,0 @@
-
-# gcc 14
-CONFIG_DEVEL=y
-CONFIG_TOOLCHAINOPTS=y
-CONFIG_GCC_USE_VERSION_14=y
-CONFIG_BINUTILS_USE_VERSION_2_42=y
diff --git a/openwrt/generic/config-gcc15 b/openwrt/generic/config-gcc15
deleted file mode 100644
index 24988f03d..000000000
--- a/openwrt/generic/config-gcc15
+++ /dev/null
@@ -1,6 +0,0 @@
-
-# gcc 15
-CONFIG_DEVEL=y
-CONFIG_TOOLCHAINOPTS=y
-CONFIG_GCC_USE_VERSION_15=y
-CONFIG_BINUTILS_USE_VERSION_2_42=y
diff --git a/openwrt/generic/config-wwan b/openwrt/generic/config-wwan
new file mode 100644
index 000000000..2e9bfbbf5
--- /dev/null
+++ b/openwrt/generic/config-wwan
@@ -0,0 +1,9 @@
+
+# wwan
+CONFIG_PACKAGE_luci-app-3ginfo-lite=m
+CONFIG_PACKAGE_luci-app-modemband=m
+CONFIG_PACKAGE_luci-app-sms-tool-js=m
+CONFIG_PACKAGE_luci-proto-quectel=m
+# CONFIG_PACKAGE_fibocom-dial is not set
+CONFIG_PACKAGE_modemband=m
+CONFIG_PACKAGE_quectel-cm=m
diff --git a/openwrt/nginx/luci.locations b/openwrt/nginx/luci.locations
index eab593d53..df639bbfe 100644
--- a/openwrt/nginx/luci.locations
+++ b/openwrt/nginx/luci.locations
@@ -3,18 +3,18 @@ location /cgi-bin/luci {
include uwsgi_params;
uwsgi_param SERVER_ADDR $server_addr;
uwsgi_modifier1 9;
- uwsgi_send_timeout 600;
- uwsgi_connect_timeout 600;
- uwsgi_read_timeout 600;
+ uwsgi_send_timeout 300;
+ uwsgi_connect_timeout 300;
+ uwsgi_read_timeout 300;
uwsgi_pass unix:////var/run/luci-webui.socket;
}
location ~ /cgi-bin/cgi-(backup|download|upload|exec) {
include uwsgi_params;
uwsgi_param SERVER_ADDR $server_addr;
uwsgi_modifier1 9;
- uwsgi_send_timeout 600;
- uwsgi_connect_timeout 600;
- uwsgi_read_timeout 600;
+ uwsgi_send_timeout 300;
+ uwsgi_connect_timeout 300;
+ uwsgi_read_timeout 300;
uwsgi_pass unix:////var/run/luci-cgi_io.socket;
}
diff --git a/openwrt/nginx/nginx-util/0001-nginx-util-fix-compilation-with-GCC13.patch b/openwrt/nginx/nginx-util/0001-nginx-util-fix-compilation-with-GCC13.patch
deleted file mode 100644
index c7b4c1000..000000000
--- a/openwrt/nginx/nginx-util/0001-nginx-util-fix-compilation-with-GCC13.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 969e27426dcf838f80e1a04a1203b6a7c7de7964 Mon Sep 17 00:00:00 2001
-From: Rosen Penev
-Date: Sat, 1 Jul 2023 16:44:54 -0700
-Subject: [PATCH 1/2] nginx-util: fix compilation with GCC13
-
-Signed-off-by: Rosen Penev
----
- net/nginx-util/Makefile | 2 +-
- net/nginx-util/src/ubus-cxx.hpp | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/net/nginx-util/Makefile b/net/nginx-util/Makefile
-index 5d7070eb9..4a77e2f20 100644
---- a/net/nginx-util/Makefile
-+++ b/net/nginx-util/Makefile
-@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
-
- PKG_NAME:=nginx-util
- PKG_VERSION:=1.6
--PKG_RELEASE:=18
-+PKG_RELEASE:=19
- PKG_MAINTAINER:=Peter Stadler
-
- include $(INCLUDE_DIR)/package.mk
-diff --git a/net/nginx-util/src/ubus-cxx.hpp b/net/nginx-util/src/ubus-cxx.hpp
-index 6c193cfc3..42d2d21aa 100644
---- a/net/nginx-util/src/ubus-cxx.hpp
-+++ b/net/nginx-util/src/ubus-cxx.hpp
-@@ -159,7 +159,7 @@ class message {
- both = keys;
- }
- both = concat(std::move(both), std::move(key_filter)...);
-- return std::move(message{msg, std::move(both)});
-+ return message{msg, std::move(both)};
- }
-
- inline ~message() = default;
---
-2.39.3
-
diff --git a/openwrt/nginx/nginx-util/0002-nginx-util-move-to-pcre2.patch b/openwrt/nginx/nginx-util/0002-nginx-util-move-to-pcre2.patch
deleted file mode 100644
index e3fb152b8..000000000
--- a/openwrt/nginx/nginx-util/0002-nginx-util-move-to-pcre2.patch
+++ /dev/null
@@ -1,166 +0,0 @@
-From e517ab7c73c93af83b62a317b943218908e04405 Mon Sep 17 00:00:00 2001
-From: Christian Marangi
-Date: Fri, 22 Sep 2023 18:15:01 +0200
-Subject: [PATCH 2/2] nginx-util: move to pcre2
-
-Convert to pcre2 library as pcre is EOL. No functional change intended.
-
-Signed-off-by: Christian Marangi
----
- net/nginx-util/Makefile | 4 +--
- net/nginx-util/src/CMakeLists.txt | 4 +--
- net/nginx-util/src/regex-pcre.hpp | 42 ++++++++++++++++++++++---------
- 3 files changed, 34 insertions(+), 16 deletions(-)
-
-diff --git a/net/nginx-util/Makefile b/net/nginx-util/Makefile
-index 4a77e2f20..b4f06aaae 100644
---- a/net/nginx-util/Makefile
-+++ b/net/nginx-util/Makefile
-@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
-
- PKG_NAME:=nginx-util
- PKG_VERSION:=1.6
--PKG_RELEASE:=19
-+PKG_RELEASE:=20
- PKG_MAINTAINER:=Peter Stadler
-
- include $(INCLUDE_DIR)/package.mk
-@@ -30,7 +30,7 @@ endef
- define Package/nginx-ssl-util
- $(Package/nginx-ssl-util/default)
- TITLE+= (using PCRE)
-- DEPENDS+= +libpcre
-+ DEPENDS+= +libpcre2
- CONFLICTS:=nginx-ssl-util-nopcre,
- endef
-
-diff --git a/net/nginx-util/src/CMakeLists.txt b/net/nginx-util/src/CMakeLists.txt
-index 2adff1c71..e023f1eb6 100644
---- a/net/nginx-util/src/CMakeLists.txt
-+++ b/net/nginx-util/src/CMakeLists.txt
-@@ -27,7 +27,7 @@ FIND_LIBRARY(ubus NAMES ubus)
- INCLUDE_DIRECTORIES(${ubus_include_dir})
-
- ADD_EXECUTABLE(nginx-ssl-util nginx-util.cpp)
--TARGET_LINK_LIBRARIES(nginx-ssl-util ${uci} ${ubox} ${ubus} pthread ssl crypto pcre)
-+TARGET_LINK_LIBRARIES(nginx-ssl-util ${uci} ${ubox} ${ubus} pthread ssl crypto pcre2-8)
- INSTALL(TARGETS nginx-ssl-util RUNTIME DESTINATION bin)
-
- ADD_EXECUTABLE(nginx-ssl-util-nopcre nginx-util.cpp)
-@@ -51,7 +51,7 @@ INSTALL(TARGETS px5g RUNTIME DESTINATION bin)
-
- ADD_EXECUTABLE(nginx-ssl-util-noubus nginx-util.cpp)
- TARGET_COMPILE_DEFINITIONS(nginx-ssl-util-noubus PUBLIC -DNO_UBUS)
--TARGET_LINK_LIBRARIES(nginx-ssl-util-noubus ${uci} ${ubox} pthread ssl crypto pcre)
-+TARGET_LINK_LIBRARIES(nginx-ssl-util-noubus ${uci} ${ubox} pthread ssl crypto pcre2-8)
- INSTALL(TARGETS nginx-ssl-util-noubus RUNTIME DESTINATION bin)
-
- ADD_EXECUTABLE(nginx-ssl-util-nopcre-noubus nginx-util.cpp)
-diff --git a/net/nginx-util/src/regex-pcre.hpp b/net/nginx-util/src/regex-pcre.hpp
-index f63d5f90c..ab255542b 100644
---- a/net/nginx-util/src/regex-pcre.hpp
-+++ b/net/nginx-util/src/regex-pcre.hpp
-@@ -1,7 +1,9 @@
- #ifndef __REGEXP_PCRE_HPP
- #define __REGEXP_PCRE_HPP
-
--#include
-+#define PCRE2_CODE_UNIT_WIDTH 8
-+
-+#include
- #include
- #include
- #include
-@@ -65,11 +67,9 @@ class regex {
- private:
- int errcode = 0;
-
-- const char* errptr = nullptr;
--
-- int erroffset = 0;
-+ PCRE2_SIZE erroffset = 0;
-
-- pcre* const re = nullptr;
-+ pcre2_code* const re = nullptr;
-
- static const std::array errcode_pcre2regex;
-
-@@ -89,10 +89,18 @@ class regex {
- explicit regex(const std::string& str) : regex(str.c_str()) {}
-
- explicit regex(const char* const str)
-- : re{pcre_compile2(str, 0, &errcode, &errptr, &erroffset, nullptr)}
-+ : re{pcre2_compile((PCRE2_SPTR)str, PCRE2_ZERO_TERMINATED, 0, &errcode, &erroffset, nullptr)}
- {
- if (re == nullptr) {
-- std::string what = std::string("regex error: ") + errptr + '\n';
-+ std::vector buffer(256);
-+ int errlen;
-+
-+ errlen = pcre2_get_error_message(errcode, buffer.data(), buffer.size());
-+ if (errlen < 0)
-+ throw regex_error(errcode_pcre2regex.at(errlen));
-+
-+ std::string what = std::string("regex error: ") +
-+ std::string(buffer.data(), buffer.data() + errlen) + '\n';
- what += " '" + std::string{str} + "'\n";
- what += " " + std::string(erroffset, ' ') + '^';
-
-@@ -103,11 +111,11 @@ class regex {
- ~regex()
- {
- if (re != nullptr) {
-- pcre_free(re);
-+ pcre2_code_free(re);
- }
- }
-
-- inline auto operator()() const -> const pcre*
-+ inline auto operator()() const -> const pcre2_code*
- {
- return re;
- }
-@@ -187,11 +195,19 @@ auto regex_search(std::string::const_iterator begin,
-
- inline auto regex_search(const std::string& subj, const regex& rgx)
- {
-+ pcre2_match_data *match_data;
-+
- if (rgx() == nullptr) {
- throw std::runtime_error("regex_search error: no regex given");
- }
-+
-+ match_data = pcre2_match_data_create_from_pattern(rgx(), NULL);
-+
- int n =
-- pcre_exec(rgx(), nullptr, subj.c_str(), static_cast(subj.length()), 0, 0, nullptr, 0);
-+ pcre2_match(rgx(), (PCRE2_SPTR)subj.c_str(), static_cast(subj.length()), 0, 0, match_data, nullptr);
-+
-+ pcre2_match_data_free(match_data);
-+
- return n >= 0;
- }
-
-@@ -205,7 +221,7 @@ auto regex_search(const std::string::const_iterator begin,
- }
-
- int sz = 0;
-- pcre_fullinfo(rgx(), nullptr, PCRE_INFO_CAPTURECOUNT, &sz);
-+ pcre2_pattern_info(rgx(), PCRE2_INFO_CAPTURECOUNT, &sz);
- sz = 3 * (sz + 1);
-
- match.vec.reserve(sz);
-@@ -216,7 +232,9 @@ auto regex_search(const std::string::const_iterator begin,
- match.begin = begin;
- match.end = end;
-
-- match.n = pcre_exec(rgx(), nullptr, subj, len, 0, 0, &match.vec[0], sz);
-+ pcre2_match_data *match_data = pcre2_match_data_create(sz, NULL);
-+ match.n = pcre2_match(rgx(), (PCRE2_SPTR)subj, len, 0, 0, match_data, NULL);
-+ pcre2_match_data_free(match_data);
-
- if (match.n < 0) {
- return false;
---
-2.39.3
-
diff --git a/openwrt/nginx/uci.conf.template b/openwrt/nginx/uci.conf.template
index ef053d075..0dd4ec4c7 100644
--- a/openwrt/nginx/uci.conf.template
+++ b/openwrt/nginx/uci.conf.template
@@ -1,11 +1,14 @@
# Consider using UCI or creating files in /etc/nginx/conf.d/ for configuration.
# Parsing UCI configuration is skipped if uci set nginx.global.uci_enable=false
# For details see: https://openwrt.org/docs/guide-user/services/webserver/nginx
+# UCI_CONF_VERSION=1.2
worker_processes 2;
user root;
+include module.d/*.module;
+
events {
worker_connections 1024;
}
@@ -14,7 +17,7 @@ http {
access_log off;
server_names_hash_bucket_size 128;
server_tokens build;
- keepalive_timeout 600s;
+ keepalive_timeout 300s;
log_format openwrt
'$request_method $scheme://$host$request_uri => $status'
' (${body_bytes_sent}B in ${request_time}s) <- $http_referer';
@@ -23,29 +26,13 @@ http {
default_type application/octet-stream;
sendfile on;
- client_max_body_size 8192M;
+ client_max_body_size 0;
+ client_body_buffer_size 128k;
large_client_header_buffers 4 32k;
gzip on;
gzip_vary on;
gzip_proxied any;
- brotli on;
- brotli_comp_level 6;
- brotli_static on;
- brotli_types application/atom+xml application/javascript application/json application/rss+xml
- application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype
- application/x-font-ttf application/x-javascript application/xhtml+xml application/xml
- font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon
- image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml;
- zstd on;
- zstd_comp_level 7;
- zstd_min_length 1k;
- zstd_static on;
- zstd_types application/atom+xml application/javascript application/json application/rss+xml
- application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype
- application/x-font-ttf application/x-javascript application/xhtml+xml application/xml
- font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon
- image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml;
root /www;
diff --git a/openwrt/patch/FriendlyWrt/fa-fancontrol.tar.gz b/openwrt/patch/FriendlyWrt/fa-fancontrol.tar.gz
deleted file mode 100644
index deaf6b03c..000000000
Binary files a/openwrt/patch/FriendlyWrt/fa-fancontrol.tar.gz and /dev/null differ
diff --git a/openwrt/patch/apk/9000-io_url_wget-disbale-hsts.patch b/openwrt/patch/apk/9000-io_url_wget-disbale-hsts.patch
new file mode 100644
index 000000000..9250c5e80
--- /dev/null
+++ b/openwrt/patch/apk/9000-io_url_wget-disbale-hsts.patch
@@ -0,0 +1,25 @@
+From f53b64feb573f286cdd6bc8cd2a5601caf82cdef Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Sun, 15 Feb 2026 21:48:33 +0800
+Subject: [PATCH] io_url_wget: disbale hsts
+
+Signed-off-by: sbwml
+---
+ src/io_url_wget.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/io_url_wget.c b/src/io_url_wget.c
+index 2d5cd4a..28a0851 100644
+--- a/src/io_url_wget.c
++++ b/src/io_url_wget.c
+@@ -21,6 +21,7 @@ struct apk_istream *apk_io_url_istream(const char *url, time_t since)
+
+ argv[i++] = "wget";
+ argv[i++] = "-q";
++ argv[i++] = "--no-hsts";
+ argv[i++] = "-T";
+ argv[i++] = wget_timeout;
+ if (wget_no_check_certificate) argv[i++] = "--no-check-certificate";
+--
+2.43.5
+
diff --git a/openwrt/patch/cgroupfs-mount/0001-fix-cgroupfs-mount.patch b/openwrt/patch/cgroupfs-mount/0001-fix-cgroupfs-mount.patch
deleted file mode 100644
index 0c03d5878..000000000
--- a/openwrt/patch/cgroupfs-mount/0001-fix-cgroupfs-mount.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/utils/cgroupfs-mount/files/cgroupfs-mount.init b/utils/cgroupfs-mount/files/cgroupfs-mount.init
-index 0d6b68d..4ae3185 100755
---- a/utils/cgroupfs-mount/files/cgroupfs-mount.init
-+++ b/utils/cgroupfs-mount/files/cgroupfs-mount.init
-@@ -4,9 +4,17 @@ START=01
-
- boot() {
- # Procd mounts non-hierarchical cgroupfs so unmount first before cgroupfs-mount
-- if mountpoint -q /sys/fs/cgroup; then
-- umount /sys/fs/cgroup/
-- fi
-+ umount_cgroup() {
-+ for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
-+ if mountpoint -q /sys/fs/cgroup/$sys; then
-+ umount /sys/fs/cgroup/$sys || true
-+ fi
-+ done
-+ if mountpoint -q /sys/fs/cgroup; then
-+ umount /sys/fs/cgroup || true
-+ fi
-+ }
-
-- cgroupfs-mount
-+ umount_cgroup
-+ cgroupfs-mount
- }
diff --git a/openwrt/patch/cgroupfs-mount/900-mount-cgroup-v2-hierarchy-to-sys-fs-cgroup-cgroup2.patch b/openwrt/patch/cgroupfs-mount/900-mount-cgroup-v2-hierarchy-to-sys-fs-cgroup-cgroup2.patch
deleted file mode 100644
index 05fbbe2d9..000000000
--- a/openwrt/patch/cgroupfs-mount/900-mount-cgroup-v2-hierarchy-to-sys-fs-cgroup-cgroup2.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 3855430e665c09b8b36d177a39245d0a69453397 Mon Sep 17 00:00:00 2001
-From: sbwml
-Date: Wed, 23 Aug 2023 20:10:30 +0800
-Subject: [PATCH 1/2] mount cgroup v2 hierarchy to /sys/fs/cgroup/cgroup2
-
----
- cgroupfs-mount | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/cgroupfs-mount b/cgroupfs-mount
-index 40810ba..114f7a1 100755
---- a/cgroupfs-mount
-+++ b/cgroupfs-mount
-@@ -41,6 +41,12 @@ for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
- fi
- done
-
-+# mount cgroup v2 hierarchy to /sys/fs/cgroup/cgroup2 if kernel support cgroup2 filesystem
-+if grep -q cgroup2 /proc/filesystems; then
-+ mkdir -p /sys/fs/cgroup/cgroup2
-+ mount -t cgroup2 -o rw,nosuid,nodev,noexec,relatime,nsdelegate cgroup2 /sys/fs/cgroup/cgroup2
-+fi
-+
- # example /proc/cgroups:
- # #subsys_name hierarchy num_cgroups enabled
- # cpuset 2 3 1
---
-2.34.8
-
diff --git a/openwrt/patch/cgroupfs-mount/901-fix-cgroupfs-umount.patch b/openwrt/patch/cgroupfs-mount/901-fix-cgroupfs-umount.patch
deleted file mode 100644
index 85c652e28..000000000
--- a/openwrt/patch/cgroupfs-mount/901-fix-cgroupfs-umount.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 712d45f93d6d499f8c6e6da44084ed2bfdae1605 Mon Sep 17 00:00:00 2001
-From: sbwml
-Date: Wed, 23 Aug 2023 20:11:57 +0800
-Subject: [PATCH 2/2] fix cgroupfs-umount
-
----
- cgroupfs-umount | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/cgroupfs-umount b/cgroupfs-umount
-index ac26b6b..5b4c86e 100755
---- a/cgroupfs-umount
-+++ b/cgroupfs-umount
-@@ -24,8 +24,11 @@ for sys in *; do
- umount $sys
- fi
- if [ -d $sys ]; then
-- rmdir $sys || true
-+ rm -rf $sys || true
- fi
- done
-
-+cd /
-+umount /sys/fs/cgroup || true
-+
- exit 0
---
-2.34.8
-
diff --git a/openwrt/patch/cgroupfs-mount/902-mount-sys-fs-cgroup-systemd-for-docker-systemd-suppo.patch b/openwrt/patch/cgroupfs-mount/902-mount-sys-fs-cgroup-systemd-for-docker-systemd-suppo.patch
deleted file mode 100644
index 31b000152..000000000
--- a/openwrt/patch/cgroupfs-mount/902-mount-sys-fs-cgroup-systemd-for-docker-systemd-suppo.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 7f6837183da98c4ec5697d9c609e7da4ce354dea Mon Sep 17 00:00:00 2001
-From: sbwml
-Date: Wed, 23 Aug 2023 21:41:37 +0800
-Subject: [PATCH] mount /sys/fs/cgroup/systemd for docker systemd support
-
----
- cgroupfs-mount | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/cgroupfs-mount b/cgroupfs-mount
-index 8274c7c..4c1f954 100755
---- a/cgroupfs-mount
-+++ b/cgroupfs-mount
-@@ -47,6 +47,12 @@ if grep -q cgroup2 /proc/filesystems; then
- mount -t cgroup2 -o rw,nosuid,nodev,noexec,relatime,nsdelegate cgroup2 /sys/fs/cgroup/cgroup2
- fi
-
-+# mount /sys/fs/cgroup/systemd for docker systemd
-+mkdir -p /sys/fs/cgroup/systemd
-+if ! mountpoint -q /sys/fs/cgroup/systemd; then
-+ mount -t cgroup -o none,name=systemd systemd /sys/fs/cgroup/systemd
-+fi
-+
- # example /proc/cgroups:
- # #subsys_name hierarchy num_cgroups enabled
- # cpuset 2 3 1
---
-2.34.8
-
diff --git a/openwrt/patch/coremark/README.md b/openwrt/patch/coremark/README.md
index f692ccdc8..4a1e7421c 100644
--- a/openwrt/patch/coremark/README.md
+++ b/openwrt/patch/coremark/README.md
@@ -1 +1 @@
-# CoreMark (aarch64) prebuilt with GCC15
+# CoreMark (aarch64) prebuilt with GCC15.2.0
diff --git a/openwrt/patch/coremark/coremark.aarch64-16-threads b/openwrt/patch/coremark/coremark.aarch64-16-threads
old mode 100755
new mode 100644
index 8342442fe..982a2c1d2
Binary files a/openwrt/patch/coremark/coremark.aarch64-16-threads and b/openwrt/patch/coremark/coremark.aarch64-16-threads differ
diff --git a/openwrt/patch/coremark/coremark.aarch64-4-threads b/openwrt/patch/coremark/coremark.aarch64-4-threads
deleted file mode 100755
index ebebdf9a7..000000000
Binary files a/openwrt/patch/coremark/coremark.aarch64-4-threads and /dev/null differ
diff --git a/openwrt/patch/coremark/coremark.aarch64-6-threads b/openwrt/patch/coremark/coremark.aarch64-6-threads
deleted file mode 100755
index d5933c290..000000000
Binary files a/openwrt/patch/coremark/coremark.aarch64-6-threads and /dev/null differ
diff --git a/openwrt/patch/docker/0001-dockerd-fix-bridge-network.patch b/openwrt/patch/docker/0001-dockerd-fix-bridge-network.patch
deleted file mode 100644
index a853692e0..000000000
--- a/openwrt/patch/docker/0001-dockerd-fix-bridge-network.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 52fd8d3590e62a7a1949e1236cce362fbd7f33c6 Mon Sep 17 00:00:00 2001
-From: sbwml <984419930@qq.com>
-Date: Fri, 9 Dec 2022 13:01:48 +0800
-Subject: [PATCH] dockerd: fix bridge network
-
----
- utils/dockerd/files/dockerd.init | 3 +++
- utils/dockerd/files/etc/config/dockerd | 2 +-
- 2 files changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/utils/dockerd/files/dockerd.init b/utils/dockerd/files/dockerd.init
-index 111e2cd8db1b..0ae6fd9af403 100755
---- a/utils/dockerd/files/dockerd.init
-+++ b/utils/dockerd/files/dockerd.init
-@@ -91,6 +91,9 @@ uciadd() {
- uci_quiet set firewall.@zone[-1].output="ACCEPT"
- uci_quiet set firewall.@zone[-1].forward="ACCEPT"
- uci_quiet set firewall.@zone[-1].name="${zone}"
-+ uci_quiet set firewall.dockerd=forwarding
-+ uci_quiet set firewall.@forwarding[-1].src="${zone}"
-+ uci_quiet set firewall.@forwarding[-1].dest='wan'
- uci_quiet commit firewall
- fi
-
-diff --git a/utils/dockerd/files/etc/config/dockerd b/utils/dockerd/files/etc/config/dockerd
-index dd7523543c22..414fa6e5c26e 100644
---- a/utils/dockerd/files/etc/config/dockerd
-+++ b/utils/dockerd/files/etc/config/dockerd
-@@ -34,5 +34,5 @@ config globals 'globals'
- # then docker restarted to load in new changes.
- config firewall 'firewall'
- option device 'docker0'
-- list blocked_interfaces 'wan'
-+# list blocked_interfaces 'wan'
- # option extra_iptables_args '--match conntrack ! --ctstate RELATED,ESTABLISHED' # allow outbound connections
diff --git a/openwrt/patch/docker/0002-docker-add-buildkit-experimental-support.patch b/openwrt/patch/docker/0002-docker-add-buildkit-experimental-support.patch
deleted file mode 100644
index 45a521dbb..000000000
--- a/openwrt/patch/docker/0002-docker-add-buildkit-experimental-support.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 342451357cc3718748d4a2fed40b480044adb1a7 Mon Sep 17 00:00:00 2001
-From: sbwml
-Date: Wed, 3 Apr 2024 02:38:08 +0800
-Subject: [PATCH] docker: add buildkit & experimental support
-
-Signed-off-by: sbwml
----
- utils/dockerd/files/dockerd.init | 8 ++++++++
- utils/dockerd/files/etc/config/dockerd | 2 ++
- 2 files changed, 10 insertions(+)
-
-diff --git a/utils/dockerd/files/dockerd.init b/utils/dockerd/files/dockerd.init
-index 1e45c44..6a3c5f7 100755
---- a/utils/dockerd/files/dockerd.init
-+++ b/utils/dockerd/files/dockerd.init
-@@ -187,12 +187,20 @@ process_config() {
- config_get ip globals ip ""
- config_get fixed_cidr globals fixed_cidr ""
- config_get fixed_cidr_v6 globals fixed_cidr_v6 ""
-+ config_get buildkit globals buildkit "0"
-+ config_get experimental globals experimental "0"
-
- . /usr/share/libubox/jshn.sh
- json_init
- json_add_string "data-root" "${data_root}"
- json_add_string "log-level" "${log_level}"
- json_add_boolean "iptables" "${iptables}"
-+ [ "${buildkit}" = "1" ] && {
-+ json_add_object 'features'
-+ json_add_boolean "buildkit" "${buildkit}"
-+ json_close_object
-+ }
-+ [ "${experimental}" = "1" ] && json_add_boolean "experimental" "${experimental}"
- [ -z "${log_driver}" ] || json_add_string "log-driver" "${log_driver}"
- [ -z "${bip}" ] || json_add_string "bip" "${bip}"
- [ -z "${registry_mirrors}" ] || json_add_array "registry-mirrors"
-diff --git a/utils/dockerd/files/etc/config/dockerd b/utils/dockerd/files/etc/config/dockerd
-index 414fa6e..8958b95 100644
---- a/utils/dockerd/files/etc/config/dockerd
-+++ b/utils/dockerd/files/etc/config/dockerd
-@@ -20,6 +20,8 @@ config globals 'globals'
- # list dns '172.17.0.1'
- # list registry_mirrors 'https://'
- # list registry_mirrors 'https://hub.docker.com'
-+ option buildkit '0'
-+ option experimental '0'
-
- # Docker doesn't work well out of the box with fw4. This is because Docker relies on a compatibility layer that
- # naively translates iptables rules. For the best compatibility replace the following dependencies:
---
-2.42.0
-
diff --git a/openwrt/patch/docker/0003-dockerd-disable-ip6tables-for-bridge-network-by-defa.patch b/openwrt/patch/docker/0003-dockerd-disable-ip6tables-for-bridge-network-by-defa.patch
deleted file mode 100644
index 31b6c317d..000000000
--- a/openwrt/patch/docker/0003-dockerd-disable-ip6tables-for-bridge-network-by-defa.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 6d0c70c705f9ece064eee9a8b2e0293147c4abae Mon Sep 17 00:00:00 2001
-From: sbwml
-Date: Sun, 30 Jun 2024 11:17:42 +0800
-Subject: [PATCH] dockerd: disable ip6tables for bridge network by default
-
-Signed-off-by: sbwml
----
- utils/dockerd/files/dockerd.init | 2 ++
- utils/dockerd/files/etc/config/dockerd | 1 +
- 2 files changed, 3 insertions(+)
-
-diff --git a/utils/dockerd/files/dockerd.init b/utils/dockerd/files/dockerd.init
-index 6a3c5f7..17dd9d1 100755
---- a/utils/dockerd/files/dockerd.init
-+++ b/utils/dockerd/files/dockerd.init
-@@ -175,6 +175,7 @@ process_config() {
- config_get data_root globals data_root "/opt/docker/"
- config_get log_level globals log_level "warn"
- config_get_bool iptables globals iptables "1"
-+ config_get_bool ip6tables globals ip6tables "0"
-
- # Don't add these options by default
- # omission == docker defaults
-@@ -195,6 +196,7 @@ process_config() {
- json_add_string "data-root" "${data_root}"
- json_add_string "log-level" "${log_level}"
- json_add_boolean "iptables" "${iptables}"
-+ json_add_boolean "ip6tables" "${ip6tables}"
- [ "${buildkit}" = "1" ] && {
- json_add_object 'features'
- json_add_boolean "buildkit" "${buildkit}"
-diff --git a/utils/dockerd/files/etc/config/dockerd b/utils/dockerd/files/etc/config/dockerd
-index 8958b95..9035c13 100644
---- a/utils/dockerd/files/etc/config/dockerd
-+++ b/utils/dockerd/files/etc/config/dockerd
-@@ -11,6 +11,7 @@ config globals 'globals'
- # option log_driver 'local'
- option log_level 'warn'
- option iptables '1'
-+ option ip6tables '0'
- # list hosts 'unix:///var/run/docker.sock'
- # option bip '172.18.0.1/24'
- # option fixed_cidr '172.17.0.0/16'
---
-2.42.0
-
diff --git a/openwrt/patch/dpdk/dpdk/Makefile b/openwrt/patch/dpdk/dpdk/Makefile
index b13764a2b..8b6f3d6fb 100644
--- a/openwrt/patch/dpdk/dpdk/Makefile
+++ b/openwrt/patch/dpdk/dpdk/Makefile
@@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=dpdk
-PKG_VERSION:=24.03
+PKG_VERSION:=24.07
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://codeload.github.com/DPDK/dpdk/tar.gz/v$(PKG_VERSION)?
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_HASH:=1dcbddec31ea0abd1bb8fe9bed2187272fb8d719443332b5d6c36162c42120f8
+PKG_HASH:=f6963d4219019da6f05103ef91c38568f382a628dfda0aad1ffb0f6cd078b345
PKG_MAINTAINER:=Zbynek Kocur
PKG_LICENSE:=BSD-3-Clause
@@ -154,6 +154,7 @@ MESON_ARGS+= \
$(if $(CONFIG_aarch64), -Dplatform=$(PLATFORM)) \
$(if $(CONFIG_x86_64),-Dplatform=generic -Dcpu_instruction_set=$(CPU_INST)) \
-Denable_drivers=$(subst $(SPACE),$(COMMA),$(strip $(DRIVERS))) \
+ -Ddefault_library=shared
define Package/libdpdk
SECTION:=libs
@@ -195,7 +196,6 @@ define Build/InstallDev
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libdpdk*.pc $(1)/usr/lib/pkgconfig/
endef
-
define Package/libdpdk/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/librte_*.so.* $(1)/usr/lib/
diff --git a/openwrt/patch/dpdk/dpdk/patches/010-dpdk_arm_build_platform_fix.patch b/openwrt/patch/dpdk/dpdk/patches/010-dpdk_arm_build_platform_fix.patch
index e30009985..b0eb3686b 100644
--- a/openwrt/patch/dpdk/dpdk/patches/010-dpdk_arm_build_platform_fix.patch
+++ b/openwrt/patch/dpdk/dpdk/patches/010-dpdk_arm_build_platform_fix.patch
@@ -1,6 +1,6 @@
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
-@@ -699,8 +699,10 @@ if dpdk_conf.get('RTE_ARCH_32')
+@@ -718,8 +718,10 @@ if dpdk_conf.get('RTE_ARCH_32')
if meson.is_cross_build()
update_flags = true
soc = meson.get_cross_property('platform', '')
@@ -13,7 +13,7 @@
endif
soc_config = socs.get(soc, {'not_supported': true})
flags_common = []
-@@ -754,8 +756,10 @@ else
+@@ -773,8 +775,10 @@ else
else
# cross build
soc = meson.get_cross_property('platform', '')
diff --git a/openwrt/patch/dpdk/dpdk/patches/201-r8125-add-r8125-ethernet-poll-mode-driver.patch b/openwrt/patch/dpdk/dpdk/patches/201-r8125-add-r8125-ethernet-poll-mode-driver.patch
index 8386f9357..8c59c9053 100644
--- a/openwrt/patch/dpdk/dpdk/patches/201-r8125-add-r8125-ethernet-poll-mode-driver.patch
+++ b/openwrt/patch/dpdk/dpdk/patches/201-r8125-add-r8125-ethernet-poll-mode-driver.patch
@@ -66,7 +66,7 @@ Signed-off-by: Howard Wang
--- a/MAINTAINERS
+++ b/MAINTAINERS
-@@ -1062,6 +1062,11 @@ F: drivers/net/memif/
+@@ -1076,6 +1076,11 @@ F: drivers/net/memif/
F: doc/guides/nics/memif.rst
F: doc/guides/nics/features/memif.ini
@@ -139,7 +139,7 @@ Signed-off-by: Howard Wang
+* Jumbo frames supported
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
-@@ -52,6 +52,7 @@ drivers = [
+@@ -53,6 +53,7 @@ drivers = [
'pfe',
'qede',
'ring',
diff --git a/openwrt/patch/dpdk/numactl/Makefile b/openwrt/patch/dpdk/numactl/Makefile
index 82ae3cb9b..7bda113aa 100644
--- a/openwrt/patch/dpdk/numactl/Makefile
+++ b/openwrt/patch/dpdk/numactl/Makefile
@@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=numactl
-PKG_VERSION:=2.0.18
+PKG_VERSION:=2.0.19
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://codeload.github.com/numactl/numactl/tar.gz/v$(PKG_VERSION)?
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_HASH:=8cd6c13f3096e9c2293c1d732f56e2aa37a7ada1a98deed3fac7bd6da1aaaaf6
+PKG_HASH:=8b84ffdebfa0d730fb2fc71bb7ec96bb2d38bf76fb67246fde416a68e04125e4
PKG_MAINTAINER:=Zbynek Kocur
PKG_LICENSE:=GPL-2.0-or-later
@@ -54,7 +54,6 @@ define Package/libnuma/description
Incompatible changes will use new symbol version numbers.
endef
-
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
@@ -66,7 +65,6 @@ define Build/InstallDev
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/numa.pc $(1)/usr/lib/pkgconfig/
endef
-
define Package/numactl/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
diff --git a/openwrt/patch/firewall4/01-luci-app-firewall_add_nft-fullcone-bcm-fullcone_option.patch b/openwrt/patch/firewall4/01-luci-app-firewall_add_nft-fullcone-bcm-fullcone_option.patch
deleted file mode 100644
index 71452b080..000000000
--- a/openwrt/patch/firewall4/01-luci-app-firewall_add_nft-fullcone-bcm-fullcone_option.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
-index 1de98c2..ac72083 100644
---- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
-+++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
-@@ -58,6 +58,15 @@ return view.extend({
-
- o = s.option(form.Flag, 'drop_invalid', _('Drop invalid packets'));
-
-+ if (L.hasSystemFeature('fullcone')) {
-+ o = s.option(form.Flag, 'fullcone', _('Enable FullCone NAT'));
-+
-+ o = s.option(form.Flag, 'brcmfullcone', _('BCM FullCone NAT scheme'),
-+ _('Use the Broadcom FullCone NAT scheme if enabled, and use the NFT FullCone scheme if the option is disabled.'));
-+ o.modalonly = true;
-+ o.depends('fullcone', '1');
-+ };
-+
- var p = [
- s.option(form.ListValue, 'input', _('Input')),
- s.option(form.ListValue, 'output', _('Output')),
diff --git a/openwrt/patch/firewall4/02-luci-app-firewall_add_shortcut-fe.patch b/openwrt/patch/firewall4/02-luci-app-firewall_add_shortcut-fe.patch
deleted file mode 100644
index 759e37c3d..000000000
--- a/openwrt/patch/firewall4/02-luci-app-firewall_add_shortcut-fe.patch
+++ /dev/null
@@ -1,34 +0,0 @@
---- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
-+++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
-@@ -91,7 +91,7 @@ return view.extend({
- o = s.option(form.Flag, 'flow_offloading',
- _('Software flow offloading'),
- _('Software based offloading for routing/NAT'));
-- o.optional = true;
-+ o.optional = false;
-
- o = s.option(form.Flag, 'flow_offloading_hw',
- _('Hardware flow offloading'),
-@@ -100,6 +100,22 @@ return view.extend({
- o.depends('flow_offloading', '1');
- }
-
-+ /* Shortcut-FE flow offload support */
-+ if (L.hasSystemFeature('shortcutfe')) {
-+ o = s.option(form.Flag, 'shortcut_fe',
-+ _('Shortcut-FE flow offloading'),
-+ _('Shortcut-FE based offloading for routing/NAT'));
-+ o.optional = true;
-+ o.depends('flow_offloading', '0');
-+
-+ o = s.option(form.ListValue, 'shortcut_fe_module',
-+ _('Connection Manager'),
-+ _('Set up the Shortcut-FE engine connection manager'));
-+ o.value('shortcut-fe-cm', _('shortcut-fe-cm'));
-+ o.value('fast-classifier', _('fast-classifier'));
-+ o.modalonly = true;
-+ o.depends('shortcut_fe', '1');
-+ }
-
- s = m.section(form.GridSection, 'zone', _('Zones'));
- s.addremove = true;
diff --git a/openwrt/patch/firewall4/03-luci-app-firewall_add_ipv6-nat.patch b/openwrt/patch/firewall4/03-luci-app-firewall_add_ipv6-nat.patch
deleted file mode 100644
index 5579cbca3..000000000
--- a/openwrt/patch/firewall4/03-luci-app-firewall_add_ipv6-nat.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
-+++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
-@@ -67,6 +67,12 @@ return view.extend({
- o.depends('fullcone', '1');
- };
-
-+ if (L.hasSystemFeature('ipv6')) {
-+ o = s.option(form.Flag, 'nat6',
-+ _('IPv6 NAT'),
-+ _('Applicable to internet environments where the router is not assigned an IPv6 prefix, such as when using an upstream optical modem for dial-up.'));
-+ };
-+
- var p = [
- s.option(form.ListValue, 'input', _('Input')),
- s.option(form.ListValue, 'output', _('Output')),
diff --git a/openwrt/patch/firewall4/100-openwrt-firewall4-add-custom-nft-command-support.patch b/openwrt/patch/firewall4/100-openwrt-firewall4-add-custom-nft-command-support.patch
index 424e2b28e..a9d983807 100644
--- a/openwrt/patch/firewall4/100-openwrt-firewall4-add-custom-nft-command-support.patch
+++ b/openwrt/patch/firewall4/100-openwrt-firewall4-add-custom-nft-command-support.patch
@@ -1,4 +1,4 @@
-From 16eb81b40f5b5f6a6200ec584d9aa6aacdbafa54 Mon Sep 17 00:00:00 2001
+From fc404ac0cc99efbd174cd6ef2a531913e26734a6 Mon Sep 17 00:00:00 2001
From: sbwml
Date: Thu, 14 Mar 2024 12:16:11 +0800
Subject: [PATCH] firewall4: add custom nft command support
@@ -11,10 +11,10 @@ Signed-off-by: sbwml
create mode 100644 package/network/config/firewall4/patches/100-fw4-add-custom-nft-command-support.patch
diff --git a/package/network/config/firewall4/Makefile b/package/network/config/firewall4/Makefile
-index 8764f5a..0cde6a6 100644
+index 6ae34ea..3b56e66 100644
--- a/package/network/config/firewall4/Makefile
+++ b/package/network/config/firewall4/Makefile
-@@ -38,6 +38,7 @@ endef
+@@ -39,6 +39,7 @@ endef
define Package/firewall4/conffiles
/etc/config/firewall
/etc/nftables.d/
@@ -59,5 +59,5 @@ index 0000000..6030936
+ ACTION=includes \
+ utpl -S $MAIN
--
-2.42.0
+2.43.5
diff --git a/openwrt/patch/firewall4/firewall4_patches/001-fix-fw4-flow-offload.patch b/openwrt/patch/firewall4/firewall4_patches/001-fix-fw4-flow-offload.patch
index 3a2c443bc..f9aa1ac9b 100644
--- a/openwrt/patch/firewall4/firewall4_patches/001-fix-fw4-flow-offload.patch
+++ b/openwrt/patch/firewall4/firewall4_patches/001-fix-fw4-flow-offload.patch
@@ -1,6 +1,6 @@
--- a/root/usr/share/ucode/fw4.uc
+++ b/root/usr/share/ucode/fw4.uc
-@@ -2045,8 +2045,8 @@ return {
+@@ -2068,8 +2068,8 @@ return {
});
}
diff --git a/openwrt/patch/firewall4/firewall4_patches/002-fix-fw4.uc-adept-kernel-version-type-of-x.x.patch b/openwrt/patch/firewall4/firewall4_patches/002-fix-fw4.uc-adept-kernel-version-type-of-x.x.patch
deleted file mode 100644
index 386531b5c..000000000
--- a/openwrt/patch/firewall4/firewall4_patches/002-fix-fw4.uc-adept-kernel-version-type-of-x.x.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From ba78896dffc386e641ac0eb9397761a24f4b5d87 Mon Sep 17 00:00:00 2001
-From: ZiMing Mo
-Date: Sun, 7 Aug 2022 15:52:55 +0800
-Subject: [PATCH] fix(fw4.uc): adept kernel version type of x.x
-
-fix kernel version match if the kernel version type is x.x (not x.x.x)
-
-Signed-off-by: ZiMing Mo
----
- root/usr/share/ucode/fw4.uc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/root/usr/share/ucode/fw4.uc
-+++ b/root/usr/share/ucode/fw4.uc
-@@ -496,7 +496,7 @@ return {
- v = 0;
-
- if (fd) {
-- let m = match(fd.read("line"), /^Linux version ([0-9]+)\.([0-9]+)\.([0-9]+)/);
-+ let m = match(fd.read("line"), /^Linux version ([0-9]+)\.([0-9]+)\.?([0-9]+)?/);
-
- v = m ? (+m[1] << 24) | (+m[2] << 16) | (+m[3] << 8) : 0;
- fd.close();
diff --git a/openwrt/patch/firewall4/firewall4_patches/990-unconditionally-allow-ct-status-dnat.patch b/openwrt/patch/firewall4/firewall4_patches/990-unconditionally-allow-ct-status-dnat.patch
deleted file mode 100644
index e7e484c27..000000000
--- a/openwrt/patch/firewall4/firewall4_patches/990-unconditionally-allow-ct-status-dnat.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 38423fae4ba0f116ae7b5853b1c459202fe2c9a4 Mon Sep 17 00:00:00 2001
-From: Stijn Tintel
-Date: Tue, 22 Mar 2022 21:20:40 +0200
-Subject: [PATCH] test: unconditionally allow ct status dnat
-
----
- root/usr/share/firewall4/templates/ruleset.uc | 4 ----
- 1 file changed, 4 deletions(-)
-
---- a/root/usr/share/firewall4/templates/ruleset.uc
-+++ b/root/usr/share/firewall4/templates/ruleset.uc
-@@ -224,9 +224,7 @@ table inet fw4 {
- {% for (let rule in fw4.rules(`input_${zone.name}`)): %}
- {%+ include("rule.uc", { fw4, zone, rule }) %}
- {% endfor %}
--{% if (zone.dflags.dnat): %}
- ct status dnat accept comment "!fw4: Accept port redirections"
--{% endif %}
- {% fw4.includes('chain-append', `input_${zone.name}`) %}
- jump {{ zone.input }}_from_{{ zone.name }}
- }
-@@ -245,9 +243,7 @@ table inet fw4 {
- {% for (let rule in fw4.rules(`forward_${zone.name}`)): %}
- {%+ include("rule.uc", { fw4, zone, rule }) %}
- {% endfor %}
--{% if (zone.dflags.dnat): %}
- ct status dnat accept comment "!fw4: Accept port forwards"
--{% endif %}
- {% fw4.includes('chain-append', `forward_${zone.name}`) %}
- jump {{ zone.forward }}_to_{{ zone.name }}
- {% if (fw4.forward_policy() != "accept" && (zone.log & 1)): %}
diff --git a/openwrt/patch/firewall4/firewall4_patches/999-01-firewall4-add-fullcone-support.patch b/openwrt/patch/firewall4/firewall4_patches/999-01-firewall4-add-fullcone-support.patch
index d71475925..42e5d6670 100644
--- a/openwrt/patch/firewall4/firewall4_patches/999-01-firewall4-add-fullcone-support.patch
+++ b/openwrt/patch/firewall4/firewall4_patches/999-01-firewall4-add-fullcone-support.patch
@@ -25,19 +25,19 @@ IPv6 traffic do NOT need this FullCone NAT functionality.
option forward REJECT
# Uncomment this line to disable ipv6 rules
# option disable_ipv6 1
-+ option fullcone '1'
++ option fullcone 0
config zone
option name lan
-@@ -20,6 +21,8 @@ config zone
- option input REJECT
- option output ACCEPT
- option forward REJECT
-+ option fullcone4 '1'
-+ option fullcone6 '1'
+@@ -22,6 +23,8 @@ config zone
+ option forward DROP
option masq 1
option mtu_fix 1
++ option fullcone4 1
++ option fullcone6 0
+ config forwarding
+ option src lan
--- a/root/usr/share/firewall4/templates/ruleset.uc
+++ b/root/usr/share/firewall4/templates/ruleset.uc
@@ -327,6 +327,12 @@ table inet fw4 {
@@ -123,7 +123,7 @@ IPv6 traffic do NOT need this FullCone NAT functionality.
return {
read_kernel_version: function() {
-@@ -832,6 +853,18 @@ return {
+@@ -855,6 +876,18 @@ return {
warn(`[!] ${msg}\n`);
},
@@ -142,7 +142,7 @@ IPv6 traffic do NOT need this FullCone NAT functionality.
get: function(sid, opt) {
return this.cursor.get("firewall", sid, opt);
},
-@@ -1013,6 +1046,21 @@ return {
+@@ -1036,6 +1069,21 @@ return {
}
},
@@ -164,7 +164,7 @@ IPv6 traffic do NOT need this FullCone NAT functionality.
parse_policy: function(val) {
return this.parse_enum(val, [
"accept",
-@@ -1452,6 +1500,7 @@ return {
+@@ -1475,6 +1523,7 @@ return {
"dnat",
"snat",
"masquerade",
@@ -172,7 +172,7 @@ IPv6 traffic do NOT need this FullCone NAT functionality.
"accept",
"reject",
"drop"
-@@ -1923,6 +1972,7 @@ return {
+@@ -1946,6 +1995,7 @@ return {
}
let defs = this.parse_options(data, {
@@ -180,7 +180,7 @@ IPv6 traffic do NOT need this FullCone NAT functionality.
input: [ "policy", "drop" ],
output: [ "policy", "drop" ],
forward: [ "policy", "drop" ],
-@@ -1957,6 +2007,11 @@ return {
+@@ -1980,6 +2030,11 @@ return {
delete defs.syn_flood;
@@ -192,7 +192,7 @@ IPv6 traffic do NOT need this FullCone NAT functionality.
this.state.defaults = defs;
},
-@@ -1981,6 +2036,8 @@ return {
+@@ -2004,6 +2059,8 @@ return {
masq_dest: [ "network", null, PARSE_LIST ],
masq6: [ "bool" ],
@@ -201,7 +201,7 @@ IPv6 traffic do NOT need this FullCone NAT functionality.
extra: [ "string", null, UNSUPPORTED ],
extra_src: [ "string", null, UNSUPPORTED ],
-@@ -2013,6 +2070,18 @@ return {
+@@ -2036,6 +2093,18 @@ return {
}
}
@@ -220,7 +220,7 @@ IPv6 traffic do NOT need this FullCone NAT functionality.
if (zone.mtu_fix && this.kernel < 0x040a0000) {
this.warn_section(data, "option 'mtu_fix' requires kernel 4.10 or later");
return;
-@@ -2182,10 +2251,15 @@ return {
+@@ -2205,10 +2274,15 @@ return {
zone.related_subnets = related_subnets;
zone.related_physdevs = related_physdevs;
diff --git a/openwrt/patch/firewall4/firewall4_patches/999-02-firewall4-add-bcm-fullconenat-support.patch b/openwrt/patch/firewall4/firewall4_patches/999-02-firewall4-add-bcm-fullconenat-support.patch
index 4d32e6e08..7176299a3 100644
--- a/openwrt/patch/firewall4/firewall4_patches/999-02-firewall4-add-bcm-fullconenat-support.patch
+++ b/openwrt/patch/firewall4/firewall4_patches/999-02-firewall4-add-bcm-fullconenat-support.patch
@@ -3,16 +3,16 @@
@@ -6,6 +6,9 @@ config defaults
# Uncomment this line to disable ipv6 rules
# option disable_ipv6 1
- option fullcone '1'
+ option fullcone 0
+# 0 - use nft_fullcone originated from Chion82
+# 1 - use bcm fullconenat from broadcom ASUS Merlin
-+ option brcmfullcone '0'
++ option brcmfullcone 0
config zone
option name lan
--- a/root/usr/share/firewall4/templates/ruleset.uc
+++ b/root/usr/share/firewall4/templates/ruleset.uc
-@@ -323,11 +323,13 @@ table inet fw4 {
+@@ -327,11 +327,13 @@ table inet fw4 {
{% for (let redirect in fw4.redirects(`dstnat_${zone.name}`)): %}
{%+ include("redirect.uc", { fw4, zone, redirect }) %}
{% endfor %}
@@ -29,7 +29,7 @@
{% endif %}
{% fw4.includes('chain-append', `dstnat_${zone.name}`) %}
}
-@@ -353,11 +355,18 @@ table inet fw4 {
+@@ -357,11 +359,18 @@ table inet fw4 {
{% endfor %}
{% endfor %}
{% endif %}
@@ -81,7 +81,7 @@
return {
read_kernel_version: function() {
-@@ -1972,6 +1986,7 @@ return {
+@@ -1995,6 +2009,7 @@ return {
}
let defs = this.parse_options(data, {
@@ -89,7 +89,7 @@
fullcone: [ "bool", "0" ],
input: [ "policy", "drop" ],
output: [ "policy", "drop" ],
-@@ -2007,9 +2022,20 @@ return {
+@@ -2030,9 +2045,20 @@ return {
delete defs.syn_flood;
@@ -113,7 +113,7 @@
}
this.state.defaults = defs;
-@@ -2075,6 +2101,10 @@ return {
+@@ -2098,6 +2124,10 @@ return {
zone.fullcone4 = false;
zone.fullcone6 = false;
}
@@ -124,7 +124,7 @@
if (zone.fullcone4) {
this.myinfo_section(data, "IPv4 fullcone enabled for zone '" + zone.name + "'");
}
-@@ -2259,6 +2289,9 @@ return {
+@@ -2282,6 +2312,9 @@ return {
if (zone.masq || zone.masq6)
zone.dflags.snat = true;
diff --git a/openwrt/patch/firewall4/libnftnl/001-libnftnl-add-fullcone-expression-support.patch b/openwrt/patch/firewall4/libnftnl/0001-libnftnl-add-fullcone-expression-support.patch
similarity index 96%
rename from openwrt/patch/firewall4/libnftnl/001-libnftnl-add-fullcone-expression-support.patch
rename to openwrt/patch/firewall4/libnftnl/0001-libnftnl-add-fullcone-expression-support.patch
index 88e10ccc8..ffbc608f1 100644
--- a/openwrt/patch/firewall4/libnftnl/001-libnftnl-add-fullcone-expression-support.patch
+++ b/openwrt/patch/firewall4/libnftnl/0001-libnftnl-add-fullcone-expression-support.patch
@@ -1,7 +1,7 @@
-From 6c39f04febd7cfdbd474233379416babcd0fc341 Mon Sep 17 00:00:00 2001
+From d1fb9ccb094e6cb9d33c3eae427003c9aefb5c99 Mon Sep 17 00:00:00 2001
From: Syrone Wong
Date: Fri, 8 Apr 2022 23:52:11 +0800
-Subject: [PATCH] libnftnl: add fullcone expression support
+Subject: [PATCH 1/2] libnftnl: add fullcone expression support
Signed-off-by: Syrone Wong
---
@@ -15,7 +15,7 @@ Signed-off-by: Syrone Wong
--- a/include/libnftnl/expr.h
+++ b/include/libnftnl/expr.h
-@@ -245,6 +245,12 @@ enum {
+@@ -273,6 +273,12 @@ enum {
};
enum {
@@ -30,7 +30,7 @@ Signed-off-by: Syrone Wong
NFTNL_EXPR_REDIR_FLAGS,
--- a/include/linux/netfilter/nf_tables.h
+++ b/include/linux/netfilter/nf_tables.h
-@@ -1464,6 +1464,22 @@ enum nft_masq_attributes {
+@@ -1510,6 +1510,22 @@ enum nft_masq_attributes {
#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
/**
@@ -55,7 +55,7 @@ Signed-off-by: Syrone Wong
* @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
--- a/src/Makefile.am
+++ b/src/Makefile.am
-@@ -55,6 +55,7 @@ libnftnl_la_SOURCES = utils.c \
+@@ -56,6 +56,7 @@ libnftnl_la_SOURCES = utils.c \
expr/target.c \
expr/tunnel.c \
expr/masq.c \
@@ -226,7 +226,7 @@ Signed-off-by: Syrone Wong
+struct expr_ops expr_ops_fullcone = {
+ .name = "fullcone",
+ .alloc_len = sizeof(struct nftnl_expr_fullcone),
-+ .max_attr = NFTA_FULLCONE_MAX,
++ .nftnl_max_attr = NFTA_FULLCONE_MAX,
+ .set = nftnl_expr_fullcone_set,
+ .get = nftnl_expr_fullcone_get,
+ .parse = nftnl_expr_fullcone_parse,
diff --git a/openwrt/patch/firewall4/libnftnl/002-libnftnl-add-brcm-fullcone-support.patch b/openwrt/patch/firewall4/libnftnl/0002-libnftnl-add-brcm-fullcone-support.patch
similarity index 75%
rename from openwrt/patch/firewall4/libnftnl/002-libnftnl-add-brcm-fullcone-support.patch
rename to openwrt/patch/firewall4/libnftnl/0002-libnftnl-add-brcm-fullcone-support.patch
index f40a7a167..6cdd9392b 100644
--- a/openwrt/patch/firewall4/libnftnl/002-libnftnl-add-brcm-fullcone-support.patch
+++ b/openwrt/patch/firewall4/libnftnl/0002-libnftnl-add-brcm-fullcone-support.patch
@@ -1,17 +1,29 @@
+From 945f840452091ded57ed9db799991bde6b8f6fe3 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Sat, 26 Oct 2024 06:08:38 +0800
+Subject: [PATCH 2/2] libnftnl: add brcm fullcone support
+
+Signed-off-by: sbwml
+---
+ include/libnftnl/expr.h | 2 ++
+ include/linux/netfilter/nf_tables.h | 4 +++
+ src/expr/masq.c | 42 +++++++++++++++++++++++++++++
+ 3 files changed, 48 insertions(+)
+
--- a/include/libnftnl/expr.h
+++ b/include/libnftnl/expr.h
-@@ -242,6 +242,8 @@ enum {
+@@ -269,6 +269,8 @@ enum {
NFTNL_EXPR_MASQ_FLAGS = NFTNL_EXPR_BASE,
NFTNL_EXPR_MASQ_REG_PROTO_MIN,
NFTNL_EXPR_MASQ_REG_PROTO_MAX,
+ NFTNL_EXPR_MASQ_REG_ADDR_MIN,
+ NFTNL_EXPR_MASQ_REG_ADDR_MAX,
+ __NFTNL_EXPR_MASQ_MAX
};
- enum {
--- a/include/linux/netfilter/nf_tables.h
+++ b/include/linux/netfilter/nf_tables.h
-@@ -1453,12 +1453,16 @@ enum nft_tproxy_attributes {
+@@ -1499,12 +1499,16 @@ enum nft_tproxy_attributes {
* @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
* @NFTA_MASQ_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
* @NFTA_MASQ_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
@@ -30,7 +42,7 @@
#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
--- a/src/expr/masq.c
+++ b/src/expr/masq.c
-@@ -24,6 +24,8 @@ struct nftnl_expr_masq {
+@@ -20,6 +20,8 @@ struct nftnl_expr_masq {
uint32_t flags;
enum nft_registers sreg_proto_min;
enum nft_registers sreg_proto_max;
@@ -39,20 +51,20 @@
};
static int
-@@ -42,6 +44,12 @@ nftnl_expr_masq_set(struct nftnl_expr *e
+@@ -38,6 +40,12 @@ nftnl_expr_masq_set(struct nftnl_expr *e
case NFTNL_EXPR_MASQ_REG_PROTO_MAX:
- memcpy(&masq->sreg_proto_max, data, sizeof(masq->sreg_proto_max));
+ memcpy(&masq->sreg_proto_max, data, data_len);
break;
+ case NFTNL_EXPR_MASQ_REG_ADDR_MIN:
-+ memcpy(&masq->sreg_addr_min, data, sizeof(masq->sreg_addr_min));
++ memcpy(&masq->sreg_addr_min, data, data_len);
+ break;
+ case NFTNL_EXPR_MASQ_REG_ADDR_MAX:
-+ memcpy(&masq->sreg_addr_max, data, sizeof(masq->sreg_addr_max));
++ memcpy(&masq->sreg_addr_max, data, data_len);
+ break;
- default:
- return -1;
}
-@@ -64,6 +72,12 @@ nftnl_expr_masq_get(const struct nftnl_e
+ return 0;
+ }
+@@ -58,6 +66,12 @@ nftnl_expr_masq_get(const struct nftnl_e
case NFTNL_EXPR_MASQ_REG_PROTO_MAX:
*data_len = sizeof(masq->sreg_proto_max);
return &masq->sreg_proto_max;
@@ -65,7 +77,7 @@
}
return NULL;
}
-@@ -80,6 +94,8 @@ static int nftnl_expr_masq_cb(const stru
+@@ -74,6 +88,8 @@ static int nftnl_expr_masq_cb(const stru
case NFTA_MASQ_REG_PROTO_MIN:
case NFTA_MASQ_REG_PROTO_MAX:
case NFTA_MASQ_FLAGS:
@@ -74,7 +86,7 @@
if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0)
abi_breakage();
break;
-@@ -102,6 +118,12 @@ nftnl_expr_masq_build(struct nlmsghdr *n
+@@ -96,6 +112,12 @@ nftnl_expr_masq_build(struct nlmsghdr *n
if (e->flags & (1 << NFTNL_EXPR_MASQ_REG_PROTO_MAX))
mnl_attr_put_u32(nlh, NFTA_MASQ_REG_PROTO_MAX,
htobe32(masq->sreg_proto_max));
@@ -87,7 +99,7 @@
}
static int
-@@ -127,6 +149,16 @@ nftnl_expr_masq_parse(struct nftnl_expr
+@@ -121,6 +143,16 @@ nftnl_expr_masq_parse(struct nftnl_expr
be32toh(mnl_attr_get_u32(tb[NFTA_MASQ_REG_PROTO_MAX]));
e->flags |= (1 << NFTNL_EXPR_MASQ_REG_PROTO_MAX);
}
@@ -104,7 +116,7 @@
return 0;
}
-@@ -151,6 +183,16 @@ static int nftnl_expr_masq_snprintf(char
+@@ -145,6 +177,16 @@ static int nftnl_expr_masq_snprintf(char
ret = snprintf(buf + offset, remain, "flags 0x%x ", masq->flags);
SNPRINTF_BUFFER_SIZE(ret, remain, offset);
}
diff --git a/openwrt/patch/firewall4/luci-25.12/0001-luci-app-firewall-add-nft-fullcone-and-bcm-fullcone-.patch b/openwrt/patch/firewall4/luci-25.12/0001-luci-app-firewall-add-nft-fullcone-and-bcm-fullcone-.patch
new file mode 100644
index 000000000..3a25dbea1
--- /dev/null
+++ b/openwrt/patch/firewall4/luci-25.12/0001-luci-app-firewall-add-nft-fullcone-and-bcm-fullcone-.patch
@@ -0,0 +1,46 @@
+From 6f3aa7ebe51fa2ab1629740d502c109ef68c7077 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Sat, 26 Oct 2024 03:35:05 +0800
+Subject: [PATCH 1/7] luci-app-firewall: add nft-fullcone and bcm-fullcone
+ option
+
+Signed-off-by: sbwml
+---
+ .../resources/view/firewall/zones.js | 21 +++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+index 129d290..4675a44 100644
+--- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
++++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+@@ -56,6 +56,27 @@ return view.extend({
+
+ o = s.option(form.Flag, 'drop_invalid', _('Drop invalid packets'));
+
++ /* Netfilter FullCone NAT support */
++
++ if (L.hasSystemFeature('fullcone')) {
++ o = s.option(form.RichListValue, "fullcone_type", _("Full Cone NAT"));
++ o.value('0', _("Disable"));
++ o.value('1', _("Nftables Fullcone nat"), _('Nftables based fullcone nat scheme.'));
++ o.value('2', _("Broadcom Fullcone nat"), _('Broadcom based fullcone nat scheme.'));
++ o.optional = false;
++ o.load = function (section_id) {
++ var fullcone = uci.get('firewall', section_id, 'fullcone');
++ var brcmfullcone = uci.get('firewall', section_id, 'brcmfullcone');
++ return (fullcone === '1')
++ ? (brcmfullcone === '1' ? '2' : '1')
++ : '0';
++ };
++ o.write = function(section_id, value) {
++ uci.set('firewall', section_id, 'fullcone', value === '0' ? null : '1');
++ uci.set('firewall', section_id, 'brcmfullcone', value === '2' ? '1' : null);
++ };
++ }
++
+ let p = [
+ s.option(form.ListValue, 'input', _('Input')),
+ s.option(form.ListValue, 'output', _('Output')),
+--
+2.43.5
+
diff --git a/openwrt/patch/firewall4/luci-25.12/0002-luci-app-firewall-add-shortcut-fe-option.patch b/openwrt/patch/firewall4/luci-25.12/0002-luci-app-firewall-add-shortcut-fe-option.patch
new file mode 100644
index 000000000..847ef4935
--- /dev/null
+++ b/openwrt/patch/firewall4/luci-25.12/0002-luci-app-firewall-add-shortcut-fe-option.patch
@@ -0,0 +1,60 @@
+From b048a9d3fdaa1a51481ef1b4fa2025359785351b Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Fri, 25 Oct 2024 17:40:35 +0800
+Subject: [PATCH 2/7] luci-app-firewall: add shortcut-fe option
+
+Signed-off-by: sbwml
+---
+ .../resources/view/firewall/zones.js | 27 ++++++++++++++++---
+ 1 file changed, 24 insertions(+), 3 deletions(-)
+
+diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+index 4675a44..98334c9 100644
+--- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
++++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+@@ -102,18 +102,39 @@ return view.extend({
+ o.value('0', _("None"));
+ o.value('1', _("Software flow offloading"), _('Software based offloading for routing/NAT.'));
+ o.value('2', _("Hardware flow offloading"), _('Hardware based offloading for routing with/without NAT.') + ' ' + _(' Requires hardware NAT support.'));
++ if (L.hasSystemFeature('shortcutfe')) {
++ o.value('3', _("Shortcut-FE flow offloading"), _('Shortcut-FE based offloading for routing/NAT'));
++ }
+ o.optional = false;
+ o.load = function (section_id) {
+ const flow_offloading = uci.get('firewall', section_id, 'flow_offloading');
+ const flow_offloading_hw = uci.get('firewall', section_id, 'flow_offloading_hw');
+- return (flow_offloading === '1')
+- ? (flow_offloading_hw === '1' ? '2' : '1')
+- : '0';
++ const shortcut_fe = uci.get('firewall', section_id, 'shortcut_fe');
++ if (flow_offloading === '1') {
++ return flow_offloading_hw === '1' ? '2' : '1';
++ } else {
++ return shortcut_fe === '1' ? '3' : '0';
++ }
+ };
+ o.write = function(section_id, value) {
++ uci.unset('firewall', section_id, 'shortcut_fe');
+ uci.set('firewall', section_id, 'flow_offloading', value === '0' ? null : '1');
+ uci.set('firewall', section_id, 'flow_offloading_hw', value === '2' ? '1' : null);
++ if (value === '3') {
++ uci.unset('firewall', section_id, 'flow_offloading');
++ uci.unset('firewall', section_id, 'flow_offloading_hw');
++ uci.set('firewall', section_id, 'shortcut_fe', value === '3' ? '1' : null);
++ }
+ };
++
++ /* Shortcut-FE flow connection manager */
++ o = s.option(form.ListValue, 'shortcut_fe_module',
++ _('Connection Manager'),
++ _('Set up the Shortcut-FE engine connection manager'));
++ o.value('shortcut-fe-cm', _('shortcut-fe-cm'));
++ o.value('fast-classifier', _('fast-classifier'));
++ o.default = 'shortcut-fe-cm';
++ o.depends('offloading_type', '3');
+ }
+
+
+--
+2.43.5
+
diff --git a/openwrt/patch/firewall4/luci-25.12/0003-luci-app-firewall-add-ipv6-nat-option.patch b/openwrt/patch/firewall4/luci-25.12/0003-luci-app-firewall-add-ipv6-nat-option.patch
new file mode 100644
index 000000000..678179cdc
--- /dev/null
+++ b/openwrt/patch/firewall4/luci-25.12/0003-luci-app-firewall-add-ipv6-nat-option.patch
@@ -0,0 +1,30 @@
+From 6b3ff020f1a194684d1f3555a95e6da691a457fc Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Sat, 26 Oct 2024 03:37:02 +0800
+Subject: [PATCH 3/7] luci-app-firewall: add ipv6 nat option
+
+Signed-off-by: sbwml
+---
+ .../htdocs/luci-static/resources/view/firewall/zones.js | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+index 98334c9..8417eb2 100644
+--- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
++++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+@@ -77,6 +77,12 @@ return view.extend({
+ };
+ }
+
++ if (L.hasSystemFeature('ipv6')) {
++ o = s.option(form.Flag, 'nat6',
++ _('IPv6 NAT'),
++ _('Applicable to internet environments where the router is not assigned an IPv6 prefix, such as when using an upstream optical modem for dial-up.'));
++ };
++
+ let p = [
+ s.option(form.ListValue, 'input', _('Input')),
+ s.option(form.ListValue, 'output', _('Output')),
+--
+2.43.5
+
diff --git a/openwrt/patch/firewall4/04-luci-add-firewall4-nft-rules-file.patch b/openwrt/patch/firewall4/luci-25.12/0004-luci-add-firewall-add-custom-nft-rule-support.patch
similarity index 64%
rename from openwrt/patch/firewall4/04-luci-add-firewall4-nft-rules-file.patch
rename to openwrt/patch/firewall4/luci-25.12/0004-luci-add-firewall-add-custom-nft-rule-support.patch
index ebbbd05bd..9896eb799 100644
--- a/openwrt/patch/firewall4/04-luci-add-firewall4-nft-rules-file.patch
+++ b/openwrt/patch/firewall4/luci-25.12/0004-luci-add-firewall-add-custom-nft-rule-support.patch
@@ -1,15 +1,29 @@
+From f025e3b7b999e9375079b0afb1d060038cd146a2 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Wed, 4 Sep 2024 12:36:11 +0800
+Subject: [PATCH 4/7] luci-add-firewall: add custom nft rule support
+
+Signed-off-by: sbwml
+---
+ .../htdocs/luci-static/resources/view/firewall/custom.js | 6 +++---
+ .../root/usr/share/luci/menu.d/luci-app-firewall.json | 3 ---
+ .../root/usr/share/rpcd/acl.d/luci-app-firewall.json | 6 ++++--
+ 3 files changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/custom.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/custom.js
+index b273db4..9bb4d3a 100644
--- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/custom.js
+++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/custom.js
@@ -5,13 +5,13 @@
return view.extend({
- load: function() {
+ load() {
- return L.resolveDefault(fs.read('/etc/firewall.user'), '');
+ return L.resolveDefault(fs.read('/etc/firewall4.user'), '');
},
- handleSave: function(ev) {
- var value = (document.querySelector('textarea').value || '').trim().replace(/\r\n/g, '\n') + '\n';
+ handleSave(ev) {
+ const value = (document.querySelector('textarea').value || '').trim().replace(/\r\n/g, '\n') + '\n';
- return fs.write('/etc/firewall.user', value).then(function(rc) {
+ return fs.write('/etc/firewall4.user', value).then(function(rc) {
@@ -17,7 +31,7 @@
ui.addNotification(null, E('p', _('Contents have been saved.')), 'info');
fs.exec('/etc/init.d/firewall', ['restart']);
@@ -23,7 +23,7 @@ return view.extend({
- render: function(fwuser) {
+ render(fwuser) {
return E([
E('h2', _('Firewall - Custom Rules')),
- E('p', {}, _('Custom rules allow you to execute arbitrary iptables commands which are not otherwise covered by the firewall framework. The commands are executed after each firewall restart, right after the default ruleset has been loaded.')),
@@ -25,6 +39,8 @@
E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 25 }, [ fwuser != null ? fwuser : '' ]))
]);
},
+diff --git a/applications/luci-app-firewall/root/usr/share/luci/menu.d/luci-app-firewall.json b/applications/luci-app-firewall/root/usr/share/luci/menu.d/luci-app-firewall.json
+index f024dcf..8aea702 100644
--- a/applications/luci-app-firewall/root/usr/share/luci/menu.d/luci-app-firewall.json
+++ b/applications/luci-app-firewall/root/usr/share/luci/menu.d/luci-app-firewall.json
@@ -64,9 +64,6 @@
@@ -37,6 +53,8 @@
}
}
}
+diff --git a/applications/luci-app-firewall/root/usr/share/rpcd/acl.d/luci-app-firewall.json b/applications/luci-app-firewall/root/usr/share/rpcd/acl.d/luci-app-firewall.json
+index 17d1fba..7e06de7 100644
--- a/applications/luci-app-firewall/root/usr/share/rpcd/acl.d/luci-app-firewall.json
+++ b/applications/luci-app-firewall/root/usr/share/rpcd/acl.d/luci-app-firewall.json
@@ -3,7 +3,8 @@
@@ -59,3 +77,6 @@
},
"ubus": {
"file": [ "write" ]
+--
+2.43.5
+
diff --git a/openwrt/patch/firewall4/luci-25.12/0005-luci-app-firewall-add-natflow-offload-support.patch b/openwrt/patch/firewall4/luci-25.12/0005-luci-app-firewall-add-natflow-offload-support.patch
new file mode 100644
index 000000000..99b85f42e
--- /dev/null
+++ b/openwrt/patch/firewall4/luci-25.12/0005-luci-app-firewall-add-natflow-offload-support.patch
@@ -0,0 +1,72 @@
+From 62a17b33b8ae6ad05234c7ffdc76801b5eba735b Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Fri, 25 Oct 2024 17:58:57 +0800
+Subject: [PATCH 5/7] luci-app-firewall: add natflow offload support
+
+Signed-off-by: sbwml
+---
+ .../resources/view/firewall/zones.js | 23 ++++++++++++++++++-
+ 1 file changed, 22 insertions(+), 1 deletion(-)
+
+diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+index 8417eb2..5ad81a4 100644
+--- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
++++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+@@ -111,25 +111,38 @@ return view.extend({
+ if (L.hasSystemFeature('shortcutfe')) {
+ o.value('3', _("Shortcut-FE flow offloading"), _('Shortcut-FE based offloading for routing/NAT'));
+ }
++ if (L.hasSystemFeature('natflow')) {
++ o.value('4', _("Natflow offloading"), _('Natflow based offloading for routing/NAT'));
++ }
+ o.optional = false;
+ o.load = function (section_id) {
+ const flow_offloading = uci.get('firewall', section_id, 'flow_offloading');
+ const flow_offloading_hw = uci.get('firewall', section_id, 'flow_offloading_hw');
+ const shortcut_fe = uci.get('firewall', section_id, 'shortcut_fe');
++ const natflow = uci.get('firewall', section_id, 'natflow');
+ if (flow_offloading === '1') {
+ return flow_offloading_hw === '1' ? '2' : '1';
+- } else {
++ } else if (shortcut_fe === '1') {
+ return shortcut_fe === '1' ? '3' : '0';
++ } else if (natflow === '1'){
++ return natflow === '1' ? '4' : '0';
+ }
+ };
+ o.write = function(section_id, value) {
+ uci.unset('firewall', section_id, 'shortcut_fe');
++ uci.unset('firewall', section_id, 'natflow');
+ uci.set('firewall', section_id, 'flow_offloading', value === '0' ? null : '1');
+ uci.set('firewall', section_id, 'flow_offloading_hw', value === '2' ? '1' : null);
+ if (value === '3') {
+ uci.unset('firewall', section_id, 'flow_offloading');
+ uci.unset('firewall', section_id, 'flow_offloading_hw');
++ uci.unset('firewall', section_id, 'natflow');
+ uci.set('firewall', section_id, 'shortcut_fe', value === '3' ? '1' : null);
++ } else if (value === '4') {
++ uci.unset('firewall', section_id, 'flow_offloading');
++ uci.unset('firewall', section_id, 'flow_offloading_hw');
++ uci.unset('firewall', section_id, 'shortcut_fe');
++ uci.set('firewall', section_id, 'natflow', value === '4' ? '1' : null);
+ }
+ };
+
+@@ -141,6 +154,14 @@ return view.extend({
+ o.value('fast-classifier', _('fast-classifier'));
+ o.default = 'shortcut-fe-cm';
+ o.depends('offloading_type', '3');
++
++ /* Natflow delay packet */
++ o = s.option(form.Value, 'natflow_delay_pkts',
++ _('Natflow delay packet'),
++ _('Set up the natflow delay packet'));
++ o.datatype = 'and(uinteger,min(0))';
++ o.default = 4;
++ o.depends('offloading_type', '4');
+ }
+
+
+--
+2.43.5
+
diff --git a/openwrt/patch/firewall4/luci-25.12/0006-luci-app-firewall-enable-hardware-offload-only-on-de.patch b/openwrt/patch/firewall4/luci-25.12/0006-luci-app-firewall-enable-hardware-offload-only-on-de.patch
new file mode 100644
index 000000000..1e2664029
--- /dev/null
+++ b/openwrt/patch/firewall4/luci-25.12/0006-luci-app-firewall-enable-hardware-offload-only-on-de.patch
@@ -0,0 +1,29 @@
+From 1c7faac708c5c28bf3764d07502e3d9e8b555801 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Fri, 25 Oct 2024 21:04:10 +0800
+Subject: [PATCH 6/7] luci-app-firewall: enable hardware offload only on
+ devices with `offload_hw` system feature
+
+Signed-off-by: sbwml
+---
+ .../htdocs/luci-static/resources/view/firewall/zones.js | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+index 5ad81a4..df2f6d6 100644
+--- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
++++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+@@ -107,7 +107,9 @@ return view.extend({
+ o = s.option(form.RichListValue, "offloading_type", _("Flow offloading type"));
+ o.value('0', _("None"));
+ o.value('1', _("Software flow offloading"), _('Software based offloading for routing/NAT.'));
+- o.value('2', _("Hardware flow offloading"), _('Hardware based offloading for routing with/without NAT.') + ' ' + _(' Requires hardware NAT support.'));
++ if (L.hasSystemFeature('offload_hw')) {
++ o.value('2', _("Hardware flow offloading"), _('Hardware based offloading for routing with/without NAT.') + ' ' + _(' Requires hardware NAT support.'));
++ }
+ if (L.hasSystemFeature('shortcutfe')) {
+ o.value('3', _("Shortcut-FE flow offloading"), _('Shortcut-FE based offloading for routing/NAT'));
+ }
+--
+2.43.5
+
diff --git a/openwrt/patch/firewall4/luci-25.12/0007-luci-app-firewall-add-fullcone6-option-for-nftables-.patch b/openwrt/patch/firewall4/luci-25.12/0007-luci-app-firewall-add-fullcone6-option-for-nftables-.patch
new file mode 100644
index 000000000..5764c8424
--- /dev/null
+++ b/openwrt/patch/firewall4/luci-25.12/0007-luci-app-firewall-add-fullcone6-option-for-nftables-.patch
@@ -0,0 +1,43 @@
+From 4cd5c39d1dfef115e81e148ceb5f821cf8a30aa7 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Wed, 18 Dec 2024 23:38:26 +0800
+Subject: [PATCH 7/7] luci-app-firewall: add fullcone6 option for nftables
+ based fullcone
+
+Signed-off-by: sbwml
+---
+ .../resources/view/firewall/zones.js | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+index df2f6d6..45351b3 100644
+--- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
++++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+@@ -74,6 +74,24 @@ return view.extend({
+ o.write = function(section_id, value) {
+ uci.set('firewall', section_id, 'fullcone', value === '0' ? null : '1');
+ uci.set('firewall', section_id, 'brcmfullcone', value === '2' ? '1' : null);
++
++ if (value === '0') {
++ uci.set('firewall', '@zone[1]', 'fullcone6', '0');
++ }
++ };
++
++ /* nft-fullcone 6 */
++ o = s.option(form.RichListValue, "fullcone6", _("Full Cone NAT6"));
++ o.value('0', _("Disable"));
++ o.value('1', _("Enable"));
++ o.optional = false;
++ o.depends('fullcone_type', '1');
++ o.load = function (section_id) {
++ var fullcone6 = uci.get('firewall', '@zone[1]', 'fullcone6');
++ return (fullcone6 === '1') ? '1' : '0';
++ };
++ o.write = function(section_id, value) {
++ uci.set('firewall', '@zone[1]', 'fullcone6', value === '1' ? '1' : '0');
+ };
+ }
+
+--
+2.43.5
+
diff --git a/openwrt/patch/firewall4/nftables/002-nftables-add-fullcone-expression-support.patch b/openwrt/patch/firewall4/nftables/0001-nftables-add-fullcone-expression-support.patch
similarity index 90%
rename from openwrt/patch/firewall4/nftables/002-nftables-add-fullcone-expression-support.patch
rename to openwrt/patch/firewall4/nftables/0001-nftables-add-fullcone-expression-support.patch
index f1bf9c5d6..a62cb4505 100644
--- a/openwrt/patch/firewall4/nftables/002-nftables-add-fullcone-expression-support.patch
+++ b/openwrt/patch/firewall4/nftables/0001-nftables-add-fullcone-expression-support.patch
@@ -1,7 +1,7 @@
-From 58c89e8768711a959fdc6e953df3ea2254ff93c1 Mon Sep 17 00:00:00 2001
+From 8c921fcda2d782f95864efc37989a153c16fc673 Mon Sep 17 00:00:00 2001
From: Syrone Wong
Date: Sat, 9 Apr 2022 00:38:51 +0800
-Subject: [PATCH] nftables: add fullcone expression support
+Subject: [PATCH 1/2] nftables: add fullcone expression support
Signed-off-by: Syrone Wong
---
@@ -16,7 +16,7 @@ Signed-off-by: Syrone Wong
--- a/include/linux/netfilter/nf_tables.h
+++ b/include/linux/netfilter/nf_tables.h
-@@ -1485,6 +1485,22 @@ enum nft_masq_attributes {
+@@ -1500,6 +1500,22 @@ enum nft_masq_attributes {
#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
/**
@@ -51,7 +51,7 @@ Signed-off-by: Syrone Wong
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
-@@ -1471,6 +1471,53 @@ out_err:
+@@ -1521,6 +1521,53 @@ out_err:
stmt_free(stmt);
}
@@ -105,7 +105,7 @@ Signed-off-by: Syrone Wong
static void netlink_parse_redir(struct netlink_parse_ctx *ctx,
const struct location *loc,
const struct nftnl_expr *nle)
-@@ -1901,6 +1948,7 @@ static const struct expr_handler netlink
+@@ -1952,6 +1999,7 @@ static const struct expr_handler netlink
{ .name = "tproxy", .parse = netlink_parse_tproxy },
{ .name = "notrack", .parse = netlink_parse_notrack },
{ .name = "masq", .parse = netlink_parse_masq },
@@ -115,7 +115,7 @@ Signed-off-by: Syrone Wong
{ .name = "queue", .parse = netlink_parse_queue },
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
-@@ -1222,6 +1222,13 @@ static void netlink_gen_nat_stmt(struct
+@@ -1266,6 +1266,13 @@ static void netlink_gen_nat_stmt(struct
nftnl_reg_pmin = NFTNL_EXPR_MASQ_REG_PROTO_MIN;
nftnl_reg_pmax = NFTNL_EXPR_MASQ_REG_PROTO_MAX;
break;
@@ -131,7 +131,7 @@ Signed-off-by: Syrone Wong
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
-@@ -623,6 +623,7 @@ int nft_lex(void *, void *, void *);
+@@ -668,6 +668,7 @@ int nft_lex(void *, void *, void *);
%token SNAT "snat"
%token DNAT "dnat"
%token MASQUERADE "masquerade"
@@ -139,7 +139,7 @@ Signed-off-by: Syrone Wong
%token REDIRECT "redirect"
%token RANDOM "random"
%token FULLY_RANDOM "fully-random"
-@@ -757,8 +758,8 @@ int nft_lex(void *, void *, void *);
+@@ -814,8 +815,8 @@ int nft_lex(void *, void *, void *);
%type limit_burst_pkts limit_burst_bytes limit_mode limit_bytes time_unit quota_mode
%type reject_stmt reject_stmt_alloc
%destructor { stmt_free($$); } reject_stmt reject_stmt_alloc
@@ -150,7 +150,7 @@ Signed-off-by: Syrone Wong
%type nf_nat_flags nf_nat_flag offset_opt
%type tproxy_stmt
%destructor { stmt_free($$); } tproxy_stmt
-@@ -3070,6 +3071,7 @@ stmt : verdict_stmt
+@@ -3274,6 +3275,7 @@ stmt : verdict_stmt
| queue_stmt
| ct_stmt
| masq_stmt close_scope_nat
@@ -158,7 +158,7 @@ Signed-off-by: Syrone Wong
| redir_stmt close_scope_nat
| dup_stmt close_scope_dup
| fwd_stmt close_scope_fwd
-@@ -3982,6 +3984,28 @@ masq_stmt_args : TO COLON stmt_expr
+@@ -4105,6 +4107,28 @@ masq_stmt_args : TO COLON stmt_expr
{
$0->nat.proto = $3;
}
@@ -189,7 +189,7 @@ Signed-off-by: Syrone Wong
$0->nat.proto = $3;
--- a/src/scanner.l
+++ b/src/scanner.l
-@@ -463,6 +463,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr
+@@ -470,6 +470,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr
"snat" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return SNAT; }
"dnat" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return DNAT; }
"masquerade" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return MASQUERADE; }
@@ -199,7 +199,7 @@ Signed-off-by: Syrone Wong
{
--- a/src/statement.c
+++ b/src/statement.c
-@@ -678,6 +678,7 @@ const char *nat_etype2str(enum nft_nat_e
+@@ -681,6 +681,7 @@ const char *nat_etype2str(enum nft_nat_e
[NFT_NAT_SNAT] = "snat",
[NFT_NAT_DNAT] = "dnat",
[NFT_NAT_MASQ] = "masquerade",
diff --git a/openwrt/patch/firewall4/nftables/003-nftables-add-brcm-fullconenat-support.patch b/openwrt/patch/firewall4/nftables/0002-nftables-add-brcm-fullconenat-support.patch
similarity index 79%
rename from openwrt/patch/firewall4/nftables/003-nftables-add-brcm-fullconenat-support.patch
rename to openwrt/patch/firewall4/nftables/0002-nftables-add-brcm-fullconenat-support.patch
index 1253e3df3..95fbd8878 100644
--- a/openwrt/patch/firewall4/nftables/003-nftables-add-brcm-fullconenat-support.patch
+++ b/openwrt/patch/firewall4/nftables/0002-nftables-add-brcm-fullconenat-support.patch
@@ -1,6 +1,21 @@
+From ae87b5c969b8020a229054493467b272a3f2a79d Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Sat, 26 Oct 2024 06:06:30 +0800
+Subject: [PATCH 2/2] nftables: add brcm fullconenat support
+
+Signed-off-by: sbwml
+---
+ include/linux/netfilter/nf_tables.h | 4 ++++
+ src/netlink_delinearize.c | 24 ++++++++++++++++++++++++
+ src/netlink_linearize.c | 15 ++++++++++-----
+ src/parser_bison.y | 10 ++++++++++
+ src/scanner.l | 1 +
+ src/statement.c | 9 ++++++---
+ 6 files changed, 55 insertions(+), 8 deletions(-)
+
--- a/include/linux/netfilter/nf_tables.h
+++ b/include/linux/netfilter/nf_tables.h
-@@ -1474,12 +1474,16 @@ enum nft_tproxy_attributes {
+@@ -1489,12 +1489,16 @@ enum nft_tproxy_attributes {
* @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
* @NFTA_MASQ_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
* @NFTA_MASQ_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
@@ -19,7 +34,7 @@
#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
-@@ -1430,6 +1430,7 @@ static void netlink_parse_masq(struct ne
+@@ -1480,6 +1480,7 @@ static void netlink_parse_masq(struct ne
{
enum nft_registers reg1, reg2;
struct expr *proto;
@@ -27,7 +42,7 @@
struct stmt *stmt;
uint32_t flags = 0;
-@@ -1465,6 +1466,29 @@ static void netlink_parse_masq(struct ne
+@@ -1515,6 +1516,29 @@ static void netlink_parse_masq(struct ne
stmt->nat.proto = proto;
}
@@ -59,7 +74,7 @@
out_err:
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
-@@ -1201,7 +1201,10 @@ static void netlink_gen_nat_stmt(struct
+@@ -1245,7 +1245,10 @@ static void netlink_gen_nat_stmt(struct
int registers = 0;
int nftnl_flag_attr;
int nftnl_reg_pmin, nftnl_reg_pmax;
@@ -70,7 +85,7 @@
switch (stmt->nat.type) {
case NFT_NAT_SNAT:
case NFT_NAT_DNAT:
-@@ -1221,6 +1224,8 @@ static void netlink_gen_nat_stmt(struct
+@@ -1265,6 +1268,8 @@ static void netlink_gen_nat_stmt(struct
nftnl_flag_attr = NFTNL_EXPR_MASQ_FLAGS;
nftnl_reg_pmin = NFTNL_EXPR_MASQ_REG_PROTO_MIN;
nftnl_reg_pmax = NFTNL_EXPR_MASQ_REG_PROTO_MAX;
@@ -79,7 +94,7 @@
break;
case NFT_NAT_FULLCONE:
nle = alloc_nft_expr("fullcone");
-@@ -1254,13 +1259,13 @@ static void netlink_gen_nat_stmt(struct
+@@ -1298,13 +1303,13 @@ static void netlink_gen_nat_stmt(struct
netlink_gen_expr(ctx, stmt->nat.addr->left, amin_reg);
netlink_gen_expr(ctx, stmt->nat.addr->right, amax_reg);
@@ -96,7 +111,7 @@
amin_reg);
if (stmt->nat.addr->etype == EXPR_MAP &&
stmt->nat.addr->mappings->set->data->flags & EXPR_F_INTERVAL) {
-@@ -1269,7 +1274,7 @@ static void netlink_gen_nat_stmt(struct
+@@ -1313,7 +1318,7 @@ static void netlink_gen_nat_stmt(struct
netlink_put_register(nle, nftnl_reg_pmin,
amin_reg);
} else {
@@ -105,7 +120,7 @@
amin_reg);
}
}
-@@ -1285,7 +1290,7 @@ static void netlink_gen_nat_stmt(struct
+@@ -1329,7 +1334,7 @@ static void netlink_gen_nat_stmt(struct
if (stmt->nat.type_flags & STMT_NAT_F_INTERVAL) {
pmin_reg += netlink_register_space(nat_addrlen(family));
@@ -116,7 +131,7 @@
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
-@@ -624,6 +624,7 @@ int nft_lex(void *, void *, void *);
+@@ -669,6 +669,7 @@ int nft_lex(void *, void *, void *);
%token DNAT "dnat"
%token MASQUERADE "masquerade"
%token FULLCONE "fullcone"
@@ -124,7 +139,7 @@
%token REDIRECT "redirect"
%token RANDOM "random"
%token FULLY_RANDOM "fully-random"
-@@ -3993,6 +3994,15 @@ masq_stmt_args : TO COLON stmt_expr
+@@ -4116,6 +4117,15 @@ masq_stmt_args : TO COLON stmt_expr
{
$0->nat.flags = $1;
}
@@ -142,7 +157,7 @@
fullcone_stmt : fullcone_stmt_alloc fullcone_stmt_args
--- a/src/scanner.l
+++ b/src/scanner.l
-@@ -464,6 +464,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr
+@@ -471,6 +471,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr
"dnat" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return DNAT; }
"masquerade" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return MASQUERADE; }
"fullcone" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return FULLCONE; }
@@ -152,7 +167,7 @@
{
--- a/src/statement.c
+++ b/src/statement.c
-@@ -687,6 +687,7 @@ const char *nat_etype2str(enum nft_nat_e
+@@ -690,6 +690,7 @@ const char *nat_etype2str(enum nft_nat_e
static void nat_stmt_print(const struct stmt *stmt, struct output_ctx *octx)
{
@@ -160,7 +175,7 @@
nft_print(octx, "%s", nat_etype2str(stmt->nat.type));
if (stmt->nat.addr || stmt->nat.proto) {
switch (stmt->nat.family) {
-@@ -700,11 +701,13 @@ static void nat_stmt_print(const struct
+@@ -703,11 +704,13 @@ static void nat_stmt_print(const struct
if (stmt->nat.type_flags & STMT_NAT_F_PREFIX)
nft_print(octx, " prefix");
diff --git a/openwrt/patch/fstools/22-fstools-support-extroot-for-non-MTD-rootfs_data-new-version.patch b/openwrt/patch/fstools/22-fstools-support-extroot-for-non-MTD-rootfs_data-new-version.patch
deleted file mode 100644
index 4491755d1..000000000
--- a/openwrt/patch/fstools/22-fstools-support-extroot-for-non-MTD-rootfs_data-new-version.patch
+++ /dev/null
@@ -1,141 +0,0 @@
-From: Qi Liu
-
-In order to support extroot, block extroot command has to be able to
-discover and properly mount the rootfs_data volume in order to discover
-the extroot volume. Currently this process can only discover MTD devices.
-This patch leverages libfstools in a similar way as mount_root to
-discover, initialize, and mount rootfs_data volume. It would enable any
-device with non-MTD rootfs_data volume to support extroot, including x86.
-
-Signed-off-by: Qi Liu
----
- CMakeLists.txt | 4 ++--
- block.c | 40 ++++++++++++++++++++++++++++++++++++++++
- libfstools/fstype.h | 13 +++++++++++++
- libfstools/libfstools.h | 12 +-----------
- 4 files changed, 56 insertions(+), 13 deletions(-)
- create mode 100644 libfstools/fstype.h
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 9a87979..c485913 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -78,9 +78,9 @@ INSTALL(TARGETS blockd RUNTIME DESTINATION sbin)
- ADD_EXECUTABLE(block block.c probe.c probe-libblkid.c)
- IF(DEFINED CMAKE_UBIFS_EXTROOT)
- ADD_DEFINITIONS(-DUBIFS_EXTROOT)
-- TARGET_LINK_LIBRARIES(block blkid-tiny dl uci ubox ubus blobmsg_json ubi-utils ${json})
-+ TARGET_LINK_LIBRARIES(block fstools blkid-tiny dl uci ubox ubus blobmsg_json ubi-utils ${json})
- ELSE(DEFINED CMAKE_UBIFS_EXTROOT)
-- TARGET_LINK_LIBRARIES(block blkid-tiny dl uci ubox ubus blobmsg_json ${json})
-+ TARGET_LINK_LIBRARIES(block fstools blkid-tiny dl uci ubox ubus blobmsg_json ${json})
- ENDIF(DEFINED CMAKE_UBIFS_EXTROOT)
- INSTALL(TARGETS block RUNTIME DESTINATION sbin)
-
-diff --git a/block.c b/block.c
-index 2176f72..454a046 100644
---- a/block.c
-+++ b/block.c
-@@ -44,6 +44,8 @@
- #include
- #include
-
-+#include "libfstools/fstype.h"
-+#include "libfstools/volume.h"
- #include "probe.h"
-
- #define AUTOFS_MOUNT_PATH "/tmp/run/blockd/"
-@@ -1700,6 +1702,44 @@ static int main_extroot(int argc, char **argv)
- }
- #endif
-
-+ /* Find volume using libfstools */
-+ struct volume *data = volume_find("rootfs_data");
-+ if (data) {
-+ volume_init(data);
-+
-+ switch (volume_identify(data)) {
-+ case FS_EXT4: {
-+ char cfg[] = "/tmp/ext4_cfg";
-+
-+ /* Mount volume and try extroot (using fstab from that vol) */
-+ mkdir_p(cfg, 0755);
-+ if (!mount(data->blk, cfg, "ext4", MS_NOATIME, NULL)) {
-+ err = mount_extroot(cfg);
-+ umount2(cfg, MNT_DETACH);
-+ }
-+ if (err < 0)
-+ rmdir("/tmp/overlay");
-+ rmdir(cfg);
-+ return err;
-+ }
-+
-+ case FS_F2FS: {
-+ char cfg[] = "/tmp/f2fs_cfg";
-+
-+ /* Mount volume and try extroot (using fstab from that vol) */
-+ mkdir_p(cfg, 0755);
-+ if (!mount(data->blk, cfg, "f2fs", MS_NOATIME, NULL)) {
-+ err = mount_extroot(cfg);
-+ umount2(cfg, MNT_DETACH);
-+ }
-+ if (err < 0)
-+ rmdir("/tmp/overlay");
-+ rmdir(cfg);
-+ return err;
-+ }
-+ }
-+ }
-+
- /* As a last resort look for /etc/config/fstab on "rootfs" partition */
- return mount_extroot(NULL);
- }
-diff --git a/libfstools/fstype.h b/libfstools/fstype.h
-new file mode 100644
-index 0000000..8ea0bbf
---- /dev/null
-+++ b/libfstools/fstype.h
-@@ -0,0 +1,13 @@
-+#ifndef _FS_TYPE_H__
-+#define _FS_TYPE_H__
-+enum {
-+ FS_NONE,
-+ FS_SNAPSHOT,
-+ FS_JFFS2,
-+ FS_DEADCODE,
-+ FS_UBIFS,
-+ FS_F2FS,
-+ FS_EXT4,
-+ FS_TARGZ,
-+};
-+#endif
-\ No newline at end of file
-diff --git a/libfstools/libfstools.h b/libfstools/libfstools.h
-index 340e2dc..c327314 100644
---- a/libfstools/libfstools.h
-+++ b/libfstools/libfstools.h
-@@ -18,20 +18,10 @@
- #include
- #include
- #include
-+#include "fstype.h"
-
- struct volume;
-
--enum {
-- FS_NONE,
-- FS_SNAPSHOT,
-- FS_JFFS2,
-- FS_DEADCODE,
-- FS_UBIFS,
-- FS_F2FS,
-- FS_EXT4,
-- FS_TARGZ,
--};
--
- enum fs_state {
- FS_STATE_UNKNOWN,
- FS_STATE_PENDING,
---
-2.34.1
-
diff --git a/openwrt/patch/fstools/22-fstools-support-extroot-for-non-MTD-rootfs_data.patch b/openwrt/patch/fstools/22-fstools-support-extroot-for-non-MTD-rootfs_data.patch
deleted file mode 100644
index 65d1a087c..000000000
--- a/openwrt/patch/fstools/22-fstools-support-extroot-for-non-MTD-rootfs_data.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From: Qi Liu
-
-In order to support extroot, block extroot command has to be able to
-discover and properly mount the rootfs_data volume in order to discover
-the extroot volume. Currently this process can only discover MTD devices.
-This patch leverages libfstools in a similar way as mount_root to
-discover, initialize, and mount rootfs_data volume. It would enable any
-device with non-MTD rootfs_data volume to support extroot, including x86.
-
-Signed-off-by: Qi Liu
----
- CMakeLists.txt | 4 ++--
- block.c | 40 ++++++++++++++++++++++++++++++++++++++++
- libfstools/fstype.h | 12 ++++++++++++
- libfstools/libfstools.h | 11 +----------
- 4 files changed, 55 insertions(+), 12 deletions(-)
- create mode 100644 libfstools/fstype.h
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index a586577..4b6e3e7 100644
-
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -75,9 +75,9 @@ INSTALL(TARGETS blockd RUNTIME DESTINATION sbin)
- ADD_EXECUTABLE(block block.c probe.c probe-libblkid.c)
- IF(DEFINED CMAKE_UBIFS_EXTROOT)
- ADD_DEFINITIONS(-DUBIFS_EXTROOT)
-- TARGET_LINK_LIBRARIES(block blkid-tiny dl uci ubox ubus blobmsg_json ubi-utils ${json})
-+ TARGET_LINK_LIBRARIES(block fstools blkid-tiny dl uci ubox ubus blobmsg_json ubi-utils ${json})
- ELSE(DEFINED CMAKE_UBIFS_EXTROOT)
-- TARGET_LINK_LIBRARIES(block blkid-tiny dl uci ubox ubus blobmsg_json ${json})
-+ TARGET_LINK_LIBRARIES(block fstools blkid-tiny dl uci ubox ubus blobmsg_json ${json})
- ENDIF(DEFINED CMAKE_UBIFS_EXTROOT)
- INSTALL(TARGETS block RUNTIME DESTINATION sbin)
-
-diff --git a/block.c b/block.c
-index 569bf56..66cce46 100644
---- a/block.c
-+++ b/block.c
-@@ -45,6 +45,8 @@
- #include
- #include
-
-+#include "libfstools/fstype.h"
-+#include "libfstools/volume.h"
- #include "probe.h"
-
- #define AUTOFS_MOUNT_PATH "/tmp/run/blockd/"
-@@ -1590,6 +1592,44 @@ static int main_extroot(int argc, char **argv)
- }
- #endif
-
-+ /* Find volume using libfstools */
-+ struct volume *data = volume_find("rootfs_data");
-+ if (data) {
-+ volume_init(data);
-+
-+ switch (volume_identify(data)) {
-+ case FS_EXT4: {
-+ char cfg[] = "/tmp/ext4_cfg";
-+
-+ /* Mount volume and try extroot (using fstab from that vol) */
-+ mkdir_p(cfg, 0755);
-+ if (!mount(data->blk, cfg, "ext4", MS_NOATIME, NULL)) {
-+ err = mount_extroot(cfg);
-+ umount2(cfg, MNT_DETACH);
-+ }
-+ if (err < 0)
-+ rmdir("/tmp/overlay");
-+ rmdir(cfg);
-+ return err;
-+ }
-+
-+ case FS_F2FS: {
-+ char cfg[] = "/tmp/f2fs_cfg";
-+
-+ /* Mount volume and try extroot (using fstab from that vol) */
-+ mkdir_p(cfg, 0755);
-+ if (!mount(data->blk, cfg, "f2fs", MS_NOATIME, NULL)) {
-+ err = mount_extroot(cfg);
-+ umount2(cfg, MNT_DETACH);
-+ }
-+ if (err < 0)
-+ rmdir("/tmp/overlay");
-+ rmdir(cfg);
-+ return err;
-+ }
-+ }
-+ }
-+
- /* As a last resort look for /etc/config/fstab on "rootfs" partition */
- return mount_extroot(NULL);
- }
-diff --git a/libfstools/fstype.h b/libfstools/fstype.h
-new file mode 100644
-index 0000000..8882343
---- /dev/null
-+++ b/libfstools/fstype.h
-@@ -0,0 +1,13 @@
-+#ifndef _FS_TYPE_H__
-+#define _FS_TYPE_H__
-+enum {
-+ FS_NONE,
-+ FS_SNAPSHOT,
-+ FS_JFFS2,
-+ FS_DEADCODE,
-+ FS_UBIFS,
-+ FS_F2FS,
-+ FS_EXT4,
-+ FS_TARGZ,
-+};
-+#endif
-\ No newline at end of file
-diff --git a/libfstools/libfstools.h b/libfstools/libfstools.h
-index f27307a..8d3362f 100644
---- a/libfstools/libfstools.h
-+++ b/libfstools/libfstools.h
-@@ -18,20 +18,10 @@
- #include
- #include
- #include
-+#include "fstype.h"
-
- struct volume;
-
--enum {
-- FS_NONE,
-- FS_SNAPSHOT,
-- FS_JFFS2,
-- FS_DEADCODE,
-- FS_UBIFS,
-- FS_F2FS,
-- FS_EXT4,
-- FS_TARGZ,
--};
--
- enum fs_state {
- FS_STATE_UNKNOWN,
- FS_STATE_PENDING,
diff --git a/openwrt/patch/fstools/block-mount-add-fstools-depends.patch b/openwrt/patch/fstools/block-mount-add-fstools-depends.patch
deleted file mode 100644
index 84c8fc909..000000000
--- a/openwrt/patch/fstools/block-mount-add-fstools-depends.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/package/system/fstools/Makefile
-+++ b/package/system/fstools/Makefile
-@@ -82,7 +82,7 @@ define Package/block-mount
- SECTION:=base
- CATEGORY:=Base system
- TITLE:=Block device mounting and checking
-- DEPENDS:=+ubox +libubox +libuci +libblobmsg-json +libjson-c
-+ DEPENDS:=+ubox +libubox +libuci +libblobmsg-json +libjson-c +fstools
- endef
-
- define Package/blockd
diff --git a/openwrt/patch/fstools/fstools-set-ntfs3-utf8-new.patch b/openwrt/patch/fstools/fstools-set-ntfs3-utf8-new.patch
deleted file mode 100644
index 43ab03340..000000000
--- a/openwrt/patch/fstools/fstools-set-ntfs3-utf8-new.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-diff --git a/block.c b/block.c
-index 3842ca7..2176f72 100644
---- a/block.c
-+++ b/block.c
-@@ -945,8 +945,12 @@ static int handle_mount(const char *source, const char *target,
- int err = -EINVAL;
- size_t count;
- int i;
-+ char _data[128] = {0};
-+ if (strstr(fstype, "fat") || strstr(fstype, "ntfs3")) {
-+ snprintf(_data, sizeof(_data), "%s", "iocharset=utf8,uid=65534,gid=65534");
-+ }
-
-- if (!strcmp(fstype, "ntfs")) {
-+ if (!strcmp(fstype, "ntfs3")) {
- filesystems = ntfs_fs;
- count = ARRAY_SIZE(ntfs_fs);
- } else {
-@@ -958,7 +962,7 @@ static int handle_mount(const char *source, const char *target,
- const char *fs = filesystems[i];
-
- err = mount(source, target, fs, m ? m->flags : 0,
-- (m && m->options) ? m->options : "");
-+ (m && m->options) ? m->options : _data);
- if (!err || errno != ENODEV)
- break;
- }
diff --git a/openwrt/patch/fstools/glibc/0001-libblkid-tiny-add-support-for-XFS-superblock.patch b/openwrt/patch/fstools/glibc/0001-libblkid-tiny-add-support-for-XFS-superblock.patch
deleted file mode 100644
index 2331ef654..000000000
--- a/openwrt/patch/fstools/glibc/0001-libblkid-tiny-add-support-for-XFS-superblock.patch
+++ /dev/null
@@ -1,324 +0,0 @@
-From 1aedbf4d07d8417f656a6363f5db6b4cae765721 Mon Sep 17 00:00:00 2001
-From: sbwml <984419930@qq.com>
-Date: Sat, 28 Jan 2023 19:33:16 +0800
-Subject: [PATCH 1/3] libblkid-tiny: add support for XFS superblock
-
----
- CMakeLists.txt | 1 +
- libblkid-tiny/libblkid-tiny.c | 2 +
- libblkid-tiny/xfs.c | 278 ++++++++++++++++++++++++++++++++++
- 3 files changed, 281 insertions(+)
- create mode 100644 libblkid-tiny/xfs.c
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 9a87979..506b2df 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -36,6 +36,7 @@ ADD_LIBRARY(blkid-tiny SHARED
- libblkid-tiny/squashfs.c
- libblkid-tiny/btrfs.c
- libblkid-tiny/f2fs.c
-+ libblkid-tiny/xfs.c
- )
- INSTALL(TARGETS blkid-tiny LIBRARY DESTINATION lib)
- INSTALL(FILES libblkid-tiny/libblkid-tiny.h DESTINATION include)
-diff --git a/libblkid-tiny/libblkid-tiny.c b/libblkid-tiny/libblkid-tiny.c
-index 8520f8a..3aca958 100644
---- a/libblkid-tiny/libblkid-tiny.c
-+++ b/libblkid-tiny/libblkid-tiny.c
-@@ -188,6 +188,8 @@ static const struct blkid_idinfo *idinfos[] =
- &hfs_idinfo,
- &btrfs_idinfo,
- &f2fs_idinfo,
-+ &xfs_idinfo,
-+ &xfs_log_idinfo,
- };
-
- int probe_block(char *block, struct blkid_struct_probe *pr)
-diff --git a/libblkid-tiny/xfs.c b/libblkid-tiny/xfs.c
-new file mode 100644
-index 0000000..0e35a44
---- /dev/null
-+++ b/libblkid-tiny/xfs.c
-@@ -0,0 +1,278 @@
-+/*
-+ * Copyright (C) 1999 by Andries Brouwer
-+ * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o
-+ * Copyright (C) 2001 by Andreas Dilger
-+ * Copyright (C) 2004 Kay Sievers
-+ * Copyright (C) 2008 Karel Zak
-+ * Copyright (C) 2013 Eric Sandeen
-+ *
-+ * This file may be redistributed under the terms of the
-+ * GNU Lesser General Public License.
-+ */
-+
-+#include
-+#include
-+#include
-+#include
-+#include
-+#include
-+#include
-+
-+#include "superblocks.h"
-+
-+struct xfs_super_block {
-+ uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */
-+ uint32_t sb_blocksize; /* logical block size, bytes */
-+ uint64_t sb_dblocks; /* number of data blocks */
-+ uint64_t sb_rblocks; /* number of realtime blocks */
-+ uint64_t sb_rextents; /* number of realtime extents */
-+ unsigned char sb_uuid[16]; /* file system unique id */
-+ uint64_t sb_logstart; /* starting block of log if internal */
-+ uint64_t sb_rootino; /* root inode number */
-+ uint64_t sb_rbmino; /* bitmap inode for realtime extents */
-+ uint64_t sb_rsumino; /* summary inode for rt bitmap */
-+ uint32_t sb_rextsize; /* realtime extent size, blocks */
-+ uint32_t sb_agblocks; /* size of an allocation group */
-+ uint32_t sb_agcount; /* number of allocation groups */
-+ uint32_t sb_rbmblocks; /* number of rt bitmap blocks */
-+ uint32_t sb_logblocks; /* number of log blocks */
-+
-+ uint16_t sb_versionnum; /* header version == XFS_SB_VERSION */
-+ uint16_t sb_sectsize; /* volume sector size, bytes */
-+ uint16_t sb_inodesize; /* inode size, bytes */
-+ uint16_t sb_inopblock; /* inodes per block */
-+ char sb_fname[12]; /* file system name */
-+ uint8_t sb_blocklog; /* log2 of sb_blocksize */
-+ uint8_t sb_sectlog; /* log2 of sb_sectsize */
-+ uint8_t sb_inodelog; /* log2 of sb_inodesize */
-+ uint8_t sb_inopblog; /* log2 of sb_inopblock */
-+ uint8_t sb_agblklog; /* log2 of sb_agblocks (rounded up) */
-+ uint8_t sb_rextslog; /* log2 of sb_rextents */
-+ uint8_t sb_inprogress; /* mkfs is in progress, don't mount */
-+ uint8_t sb_imax_pct; /* max % of fs for inode space */
-+ /* statistics */
-+ uint64_t sb_icount; /* allocated inodes */
-+ uint64_t sb_ifree; /* free inodes */
-+ uint64_t sb_fdblocks; /* free data blocks */
-+ uint64_t sb_frextents; /* free realtime extents */
-+
-+ /* this is not all... but enough for libblkid */
-+
-+} __attribute__((packed));
-+
-+#define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */
-+#define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */
-+#define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
-+#define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
-+#define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */
-+#define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */
-+#define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)
-+#define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)
-+
-+#define XFS_DINODE_MIN_LOG 8
-+#define XFS_DINODE_MAX_LOG 11
-+#define XFS_DINODE_MIN_SIZE (1 << XFS_DINODE_MIN_LOG)
-+#define XFS_DINODE_MAX_SIZE (1 << XFS_DINODE_MAX_LOG)
-+
-+#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024) /* 1GB */
-+#define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64kB */
-+#define XFS_MIN_RTEXTSIZE (4 * 1024) /* 4kB */
-+
-+#define XFS_MIN_AG_BLOCKS 64
-+#define XFS_MAX_DBLOCKS(s) ((uint64_t)(s)->sb_agcount * (s)->sb_agblocks)
-+#define XFS_MIN_DBLOCKS(s) ((uint64_t)((s)->sb_agcount - 1) * \
-+ (s)->sb_agblocks + XFS_MIN_AG_BLOCKS)
-+
-+
-+static void sb_from_disk(struct xfs_super_block *from,
-+ struct xfs_super_block *to)
-+{
-+
-+ to->sb_magicnum = be32_to_cpu(from->sb_magicnum);
-+ to->sb_blocksize = be32_to_cpu(from->sb_blocksize);
-+ to->sb_dblocks = be64_to_cpu(from->sb_dblocks);
-+ to->sb_rblocks = be64_to_cpu(from->sb_rblocks);
-+ to->sb_rextents = be64_to_cpu(from->sb_rextents);
-+ to->sb_logstart = be64_to_cpu(from->sb_logstart);
-+ to->sb_rootino = be64_to_cpu(from->sb_rootino);
-+ to->sb_rbmino = be64_to_cpu(from->sb_rbmino);
-+ to->sb_rsumino = be64_to_cpu(from->sb_rsumino);
-+ to->sb_rextsize = be32_to_cpu(from->sb_rextsize);
-+ to->sb_agblocks = be32_to_cpu(from->sb_agblocks);
-+ to->sb_agcount = be32_to_cpu(from->sb_agcount);
-+ to->sb_rbmblocks = be32_to_cpu(from->sb_rbmblocks);
-+ to->sb_logblocks = be32_to_cpu(from->sb_logblocks);
-+ to->sb_versionnum = be16_to_cpu(from->sb_versionnum);
-+ to->sb_sectsize = be16_to_cpu(from->sb_sectsize);
-+ to->sb_inodesize = be16_to_cpu(from->sb_inodesize);
-+ to->sb_inopblock = be16_to_cpu(from->sb_inopblock);
-+ to->sb_blocklog = from->sb_blocklog;
-+ to->sb_sectlog = from->sb_sectlog;
-+ to->sb_inodelog = from->sb_inodelog;
-+ to->sb_inopblog = from->sb_inopblog;
-+ to->sb_agblklog = from->sb_agblklog;
-+ to->sb_rextslog = from->sb_rextslog;
-+ to->sb_inprogress = from->sb_inprogress;
-+ to->sb_imax_pct = from->sb_imax_pct;
-+ to->sb_icount = be64_to_cpu(from->sb_icount);
-+ to->sb_ifree = be64_to_cpu(from->sb_ifree);
-+ to->sb_fdblocks = be64_to_cpu(from->sb_fdblocks);
-+ to->sb_frextents = be64_to_cpu(from->sb_frextents);
-+}
-+
-+static int xfs_verify_sb(struct xfs_super_block *ondisk)
-+{
-+ struct xfs_super_block sb, *sbp = &sb;
-+
-+ /* beXX_to_cpu(), but don't convert UUID and fsname! */
-+ sb_from_disk(ondisk, sbp);
-+
-+ /* sanity checks, we don't want to rely on magic string only */
-+ if (sbp->sb_agcount <= 0 ||
-+ sbp->sb_sectsize < XFS_MIN_SECTORSIZE ||
-+ sbp->sb_sectsize > XFS_MAX_SECTORSIZE ||
-+ sbp->sb_sectlog < XFS_MIN_SECTORSIZE_LOG ||
-+ sbp->sb_sectlog > XFS_MAX_SECTORSIZE_LOG ||
-+ sbp->sb_sectsize != (1 << sbp->sb_sectlog) ||
-+ sbp->sb_blocksize < XFS_MIN_BLOCKSIZE ||
-+ sbp->sb_blocksize > XFS_MAX_BLOCKSIZE ||
-+ sbp->sb_blocklog < XFS_MIN_BLOCKSIZE_LOG ||
-+ sbp->sb_blocklog > XFS_MAX_BLOCKSIZE_LOG ||
-+ sbp->sb_blocksize != (1ULL << sbp->sb_blocklog) ||
-+ sbp->sb_inodesize < XFS_DINODE_MIN_SIZE ||
-+ sbp->sb_inodesize > XFS_DINODE_MAX_SIZE ||
-+ sbp->sb_inodelog < XFS_DINODE_MIN_LOG ||
-+ sbp->sb_inodelog > XFS_DINODE_MAX_LOG ||
-+ sbp->sb_inodesize != (1 << sbp->sb_inodelog) ||
-+ (sbp->sb_blocklog - sbp->sb_inodelog != sbp->sb_inopblog) ||
-+ (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) ||
-+ (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) ||
-+ (sbp->sb_imax_pct > 100 /* zero sb_imax_pct is valid */) ||
-+ sbp->sb_dblocks == 0 ||
-+ sbp->sb_dblocks > XFS_MAX_DBLOCKS(sbp) ||
-+ sbp->sb_dblocks < XFS_MIN_DBLOCKS(sbp))
-+ return 0;
-+
-+ /* TODO: version 5 has also checksum CRC32, maybe we can check it too */
-+
-+ return 1;
-+}
-+
-+static int probe_xfs(blkid_probe pr, const struct blkid_idmag *mag)
-+{
-+ struct xfs_super_block *xs;
-+
-+ xs = blkid_probe_get_sb(pr, mag, struct xfs_super_block);
-+ if (!xs)
-+ return errno ? -errno : 1;
-+
-+ if (!xfs_verify_sb(xs))
-+ return 1;
-+
-+ if (*xs->sb_fname != '\0')
-+ blkid_probe_set_label(pr, (unsigned char *) xs->sb_fname,
-+ sizeof(xs->sb_fname));
-+ blkid_probe_set_uuid(pr, xs->sb_uuid);
-+ return 0;
-+}
-+
-+const struct blkid_idinfo xfs_idinfo =
-+{
-+ .name = "xfs",
-+ .usage = BLKID_USAGE_FILESYSTEM,
-+ .probefunc = probe_xfs,
-+ .magics =
-+ {
-+ { .magic = "XFSB", .len = 4 },
-+ { NULL }
-+ }
-+};
-+
-+struct xlog_rec_header {
-+ uint32_t h_magicno;
-+ uint32_t h_dummy1[1];
-+ uint32_t h_version;
-+ uint32_t h_len;
-+ uint32_t h_dummy2[71];
-+ uint32_t h_fmt;
-+ unsigned char h_uuid[16];
-+} __attribute__((packed));
-+
-+#define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe
-+
-+/*
-+ * For very small filesystems, the minimum log size
-+ * can be smaller, but that seems vanishingly unlikely
-+ * when used with an external log (which is used for
-+ * performance reasons; tiny conflicts with that goal).
-+ */
-+#define XFS_MIN_LOG_BYTES (10 * 1024 * 1024)
-+
-+#define XLOG_FMT_LINUX_LE 1
-+#define XLOG_FMT_LINUX_BE 2
-+#define XLOG_FMT_IRIX_BE 3
-+
-+#define XLOG_VERSION_1 1
-+#define XLOG_VERSION_2 2 /* Large IClogs, Log sunit */
-+#define XLOG_VERSION_OKBITS (XLOG_VERSION_1 | XLOG_VERSION_2)
-+
-+static int xlog_valid_rec_header(struct xlog_rec_header *rhead)
-+{
-+ uint32_t hlen;
-+
-+ if (rhead->h_magicno != cpu_to_be32(XLOG_HEADER_MAGIC_NUM))
-+ return 0;
-+
-+ if (!rhead->h_version ||
-+ (be32_to_cpu(rhead->h_version) & (~XLOG_VERSION_OKBITS)))
-+ return 0;
-+
-+ /* LR body must have data or it wouldn't have been written */
-+ hlen = be32_to_cpu(rhead->h_len);
-+ if (hlen <= 0 || hlen > INT_MAX)
-+ return 0;
-+
-+ if (rhead->h_fmt != cpu_to_be32(XLOG_FMT_LINUX_LE) &&
-+ rhead->h_fmt != cpu_to_be32(XLOG_FMT_LINUX_BE) &&
-+ rhead->h_fmt != cpu_to_be32(XLOG_FMT_IRIX_BE))
-+ return 0;
-+
-+ return 1;
-+}
-+
-+/* xlog record header will be in some sector in the first 256k */
-+static int probe_xfs_log(blkid_probe pr,
-+ const struct blkid_idmag *mag __attribute__((__unused__)))
-+{
-+ int i;
-+ struct xlog_rec_header *rhead;
-+ unsigned char *buf;
-+
-+ buf = blkid_probe_get_buffer(pr, 0, 256*1024);
-+ if (!buf)
-+ return errno ? -errno : 1;
-+
-+ if (memcmp(buf, "XFSB", 4) == 0)
-+ return 1; /* this is regular XFS, ignore */
-+
-+ /* check the first 512 512-byte sectors */
-+ for (i = 0; i < 512; i++) {
-+ rhead = (struct xlog_rec_header *)&buf[i*512];
-+
-+ if (xlog_valid_rec_header(rhead)) {
-+ blkid_probe_set_uuid_as(pr, rhead->h_uuid, "LOGUUID");
-+ return 0;
-+ }
-+ }
-+
-+ return 1;
-+}
-+
-+const struct blkid_idinfo xfs_log_idinfo =
-+{
-+ .name = "xfs_external_log",
-+ .usage = BLKID_USAGE_OTHER,
-+ .probefunc = probe_xfs_log,
-+ .magics = BLKID_NONE_MAGIC,
-+ .minsz = XFS_MIN_LOG_BYTES,
-+};
---
-2.34.1
-
diff --git a/openwrt/patch/fstools/glibc/0003-block-add-xfsck-support.patch b/openwrt/patch/fstools/glibc/0003-block-add-xfsck-support.patch
deleted file mode 100644
index 902e88210..000000000
--- a/openwrt/patch/fstools/glibc/0003-block-add-xfsck-support.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 71f459400f0990eb577a43345cd8507c8c9f5638 Mon Sep 17 00:00:00 2001
-From: sbwml <984419930@qq.com>
-Date: Sat, 28 Jan 2023 20:31:55 +0800
-Subject: [PATCH 3/3] block: add xfsck support
-
----
- block.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/block.c b/block.c
-index 4b45200..6b8b28a 100644
---- a/block.c
-+++ b/block.c
-@@ -764,6 +764,7 @@ static void check_filesystem(struct probe_info *pr)
- const char *e2fsck = "/usr/sbin/e2fsck";
- const char *f2fsck = "/usr/sbin/fsck.f2fs";
- const char *fatfsck = "/usr/sbin/fsck.fat";
-+ const char *xfsck = "/usr/sbin/xfs_repair";
- const char *btrfsck = "/usr/bin/btrfsck";
- const char *ntfsck = "/usr/bin/ntfsfix";
- const char *ckfs;
-@@ -776,6 +777,8 @@ static void check_filesystem(struct probe_info *pr)
- ckfs = fatfsck;
- } else if (!strncmp(pr->type, "f2fs", 4)) {
- ckfs = f2fsck;
-+ } else if (!strncmp(pr->type, "xfs", 3)) {
-+ ckfs = xfsck;
- } else if (!strncmp(pr->type, "ext", 3)) {
- ckfs = e2fsck;
- } else if (!strncmp(pr->type, "btrfs", 5)) {
---
-2.34.1
-
diff --git a/openwrt/patch/fstools/ntfs3.patch b/openwrt/patch/fstools/ntfs3.patch
deleted file mode 100644
index 94cad6031..000000000
--- a/openwrt/patch/fstools/ntfs3.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-diff --git a/block.c b/block.c
-index f094216..ec05fb6 100644
---- a/block.c
-+++ b/block.c
-@@ -721,7 +721,7 @@ static void check_filesystem(struct probe_info *pr)
- ckfs = e2fsck;
- } else if (!strncmp(pr->type, "btrfs", 5)) {
- ckfs = btrfsck;
-- } else if (!strncmp(pr->type, "ntfs", 4)) {
-+ } else if (!strncmp(pr->type, "ntfs3", 4)) {
- ckfs = ntfsck;
- } else {
- ULOG_ERR("check_filesystem: %s is not supported\n", pr->type);
-@@ -741,7 +741,7 @@ static void check_filesystem(struct probe_info *pr)
- } else if(!strncmp(pr->type, "btrfs", 5)) {
- execl(ckfs, ckfs, "--repair", pr->dev, NULL);
- exit(EXIT_FAILURE);
-- } else if(!strncmp(pr->type, "ntfs", 4)) {
-+ } else if(!strncmp(pr->type, "ntfs3", 4)) {
- execl(ckfs, ckfs, "-b", pr->dev, NULL);
- exit(EXIT_FAILURE);
- } else {
-@@ -1462,9 +1462,9 @@ static int mount_extroot(char *cfg)
- if (strncmp(pr->type, "ext", 3) &&
- strncmp(pr->type, "f2fs", 4) &&
- strncmp(pr->type, "btrfs", 5) &&
-- strncmp(pr->type, "ntfs", 4) &&
-+ strncmp(pr->type, "ntfs3", 4) &&
- strncmp(pr->type, "ubifs", 5)) {
-- ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs, btrfs, ntfs or ubifs\n", pr->type);
-+ ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs, btrfs, ntfs3 or ubifs\n", pr->type);
- return -1;
- }
-
-diff --git a/libblkid-tiny/ntfs.c b/libblkid-tiny/ntfs.c
-index 2426e70..bba6271 100644
---- a/libblkid-tiny/ntfs.c
-+++ b/libblkid-tiny/ntfs.c
-@@ -214,7 +214,7 @@ static int probe_ntfs(blkid_probe pr, const struct blkid_idmag *mag)
-
- const struct blkid_idinfo ntfs_idinfo =
- {
-- .name = "ntfs",
-+ .name = "ntfs3",
- .usage = BLKID_USAGE_FILESYSTEM,
- .probefunc = probe_ntfs,
- .magics =
diff --git a/openwrt/patch/generic-25.12/0001-tools-add-upx-tools.patch b/openwrt/patch/generic-25.12/0001-tools-add-upx-tools.patch
new file mode 100644
index 000000000..d86615cfe
--- /dev/null
+++ b/openwrt/patch/generic-25.12/0001-tools-add-upx-tools.patch
@@ -0,0 +1,63 @@
+From de1387e3780afbb3a79e361f3b97124eca6c0aa0 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Fri, 4 Oct 2024 10:39:25 +0800
+Subject: [PATCH 01/13] tools: add upx tools
+
+Signed-off-by: sbwml
+---
+ tools/Makefile | 1 +
+ tools/upx/Makefile | 30 ++++++++++++++++++++++++++++++
+ 2 files changed, 31 insertions(+)
+ create mode 100644 tools/upx/Makefile
+
+diff --git a/tools/Makefile b/tools/Makefile
+index 79d3954..42b1265 100644
+--- a/tools/Makefile
++++ b/tools/Makefile
+@@ -67,6 +67,7 @@ tools-y += pkgconf
+ tools-y += quilt
+ tools-y += squashfs4
+ tools-y += sstrip
++tools-y += upx
+ tools-y += util-linux
+ tools-y += xz
+ tools-y += zip
+diff --git a/tools/upx/Makefile b/tools/upx/Makefile
+new file mode 100644
+index 0000000..9004514
+--- /dev/null
++++ b/tools/upx/Makefile
+@@ -0,0 +1,30 @@
++include $(TOPDIR)/rules.mk
++
++PKG_NAME:=upx
++PKG_VERSION:=4.2.4
++
++PKG_SOURCE:=upx-$(PKG_VERSION)-src.tar.xz
++PKG_SOURCE_URL:=https://github.com/upx/upx/releases/download/v$(PKG_VERSION)/
++PKG_HASH:=5ed6561607d27fb4ef346fc19f08a93696fa8fa127081e7a7114068306b8e1c4
++
++HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)-src
++HOST_BUILD_PARALLEL:=1
++
++include $(INCLUDE_DIR)/host-build.mk
++
++define Host/Compile
++ $(MAKE) -C $(HOST_BUILD_DIR)/src \
++ LDFLAGS="$(HOST_LDFLAGS)" \
++ CXX="$(HOSTCXX)"
++endef
++
++define Host/Install
++ $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
++ $(INSTALL_BIN) $(HOST_BUILD_DIR)/build/release/upx $(STAGING_DIR_HOST)/bin/upx
++endef
++
++define Host/Clean
++ rm -f $(STAGING_DIR_HOST)/bin/upx
++endef
++
++$(eval $(call HostBuild))
+--
+2.43.5
+
diff --git a/openwrt/patch/generic/0002-rootfs-add-upx-compression-support.patch b/openwrt/patch/generic-25.12/0002-rootfs-add-upx-compression-support.patch
similarity index 79%
rename from openwrt/patch/generic/0002-rootfs-add-upx-compression-support.patch
rename to openwrt/patch/generic-25.12/0002-rootfs-add-upx-compression-support.patch
index 9a334425a..76ba78cd7 100644
--- a/openwrt/patch/generic/0002-rootfs-add-upx-compression-support.patch
+++ b/openwrt/patch/generic-25.12/0002-rootfs-add-upx-compression-support.patch
@@ -1,7 +1,7 @@
-From 79765552324d8c08e31e7ab80a53b1a29654d473 Mon Sep 17 00:00:00 2001
+From 54de7991f8fcfe4399e476f385286e02517cca9e Mon Sep 17 00:00:00 2001
From: sbwml
-Date: Sun, 7 Apr 2024 04:08:40 +0800
-Subject: [PATCH 2/7] rootfs: add upx compression support
+Date: Fri, 4 Oct 2024 10:46:49 +0800
+Subject: [PATCH 02/13] rootfs: add upx compression support
* When the upx_list.txt file exists in the source code root directory,
it will be compressed by upx.
@@ -18,10 +18,10 @@ Signed-off-by: sbwml
1 file changed, 5 insertions(+)
diff --git a/include/rootfs.mk b/include/rootfs.mk
-index f2ed648..eb69a99 100644
+index 02fa3b1..f778aef 100644
--- a/include/rootfs.mk
+++ b/include/rootfs.mk
-@@ -95,6 +95,11 @@ define prepare_rootfs
+@@ -121,6 +121,11 @@ define prepare_rootfs
$(1)/usr/lib/opkg/info/*.postinst* \
$(1)/usr/lib/opkg/lists/* \
$(1)/var/lock/*.lock
diff --git a/openwrt/patch/generic/0005-rootfs-add-r-w-permissions-for-UCI-configuration-fil.patch b/openwrt/patch/generic-25.12/0003-rootfs-add-r-w-permissions-for-UCI-configuration-fil.patch
similarity index 68%
rename from openwrt/patch/generic/0005-rootfs-add-r-w-permissions-for-UCI-configuration-fil.patch
rename to openwrt/patch/generic-25.12/0003-rootfs-add-r-w-permissions-for-UCI-configuration-fil.patch
index 18bec73ed..1e77aa0df 100644
--- a/openwrt/patch/generic/0005-rootfs-add-r-w-permissions-for-UCI-configuration-fil.patch
+++ b/openwrt/patch/generic-25.12/0003-rootfs-add-r-w-permissions-for-UCI-configuration-fil.patch
@@ -1,7 +1,7 @@
-From 42f9a52f66ef69a0085055facf8a14cab3f279ce Mon Sep 17 00:00:00 2001
+From c2e70e8b792bd3c99fe5584966ab69edcd6ead42 Mon Sep 17 00:00:00 2001
From: sbwml
-Date: Sun, 30 Jun 2024 21:58:24 +0800
-Subject: [PATCH 5/7] rootfs: add r/w permissions for UCI configuration files
+Date: Fri, 4 Oct 2024 10:47:41 +0800
+Subject: [PATCH 03/13] rootfs: add r/w permissions for UCI configuration files
Signed-off-by: sbwml
---
@@ -9,10 +9,10 @@ Signed-off-by: sbwml
1 file changed, 1 insertion(+)
diff --git a/include/rootfs.mk b/include/rootfs.mk
-index eb69a99..f8bc2ed 100644
+index f778aef..d049ca5 100644
--- a/include/rootfs.mk
+++ b/include/rootfs.mk
-@@ -100,6 +100,7 @@ define prepare_rootfs
+@@ -126,6 +126,7 @@ define prepare_rootfs
$(STAGING_DIR_HOST)/bin/upx --lzma --best "$(1)$$file" || true; \
done < "$(TOPDIR)/upx_list.txt"; \
fi
diff --git a/openwrt/patch/generic/0007-rootfs-Add-support-for-local-kmod-installation-sourc.patch b/openwrt/patch/generic-25.12/0004-rootfs-Add-support-for-local-kmod-installation-sourc.patch
similarity index 80%
rename from openwrt/patch/generic/0007-rootfs-Add-support-for-local-kmod-installation-sourc.patch
rename to openwrt/patch/generic-25.12/0004-rootfs-Add-support-for-local-kmod-installation-sourc.patch
index 70a36db41..2375db580 100644
--- a/openwrt/patch/generic/0007-rootfs-Add-support-for-local-kmod-installation-sourc.patch
+++ b/openwrt/patch/generic-25.12/0004-rootfs-Add-support-for-local-kmod-installation-sourc.patch
@@ -1,7 +1,7 @@
-From 910f99cb7ede0303321b1062507681685b660925 Mon Sep 17 00:00:00 2001
+From 24cf67d16f2a819eeaa937e888ef974993c2455a Mon Sep 17 00:00:00 2001
From: sbwml
-Date: Sun, 14 Jul 2024 12:43:06 +0800
-Subject: [PATCH 7/7] rootfs: Add support for local kmod installation sources
+Date: Fri, 4 Oct 2024 10:48:29 +0800
+Subject: [PATCH 04/13] rootfs: Add support for local kmod installation sources
* CONFIG_TARGET_ROOTFS_LOCAL_PACKAGES=y
@@ -12,10 +12,10 @@ Signed-off-by: sbwml
2 files changed, 14 insertions(+)
diff --git a/config/Config-images.in b/config/Config-images.in
-index c32fa00..79d89f5 100644
+index fcc5fa5..8094136 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
-@@ -318,4 +318,12 @@ menu "Target Images"
+@@ -356,4 +356,12 @@ menu "Target Images"
across reboots. When enabled, /var/run will still be linked
to /tmp/run.
@@ -29,10 +29,10 @@ index c32fa00..79d89f5 100644
+
endmenu
diff --git a/include/rootfs.mk b/include/rootfs.mk
-index f8bc2ed..06662d4 100644
+index d049ca5..cb19964 100644
--- a/include/rootfs.mk
+++ b/include/rootfs.mk
-@@ -101,6 +101,12 @@ define prepare_rootfs
+@@ -127,6 +127,12 @@ define prepare_rootfs
done < "$(TOPDIR)/upx_list.txt"; \
fi
chmod 600 $(1)/etc/config/*
diff --git a/openwrt/patch/generic/0003-kernel-Add-support-for-llvm-clang-compiler.patch b/openwrt/patch/generic-25.12/0005-kernel-Add-support-for-llvm-clang-compiler.patch
similarity index 52%
rename from openwrt/patch/generic/0003-kernel-Add-support-for-llvm-clang-compiler.patch
rename to openwrt/patch/generic-25.12/0005-kernel-Add-support-for-llvm-clang-compiler.patch
index cfb799e0d..32ae04a83 100644
--- a/openwrt/patch/generic/0003-kernel-Add-support-for-llvm-clang-compiler.patch
+++ b/openwrt/patch/generic-25.12/0005-kernel-Add-support-for-llvm-clang-compiler.patch
@@ -1,21 +1,20 @@
-From 59e101ebf7ac9ffe7b9dfd82a6e41050dbc5d13f Mon Sep 17 00:00:00 2001
+From 5019245030b26f3602095de80ab7fc43051e37a2 Mon Sep 17 00:00:00 2001
From: sbwml
-Date: Mon, 6 May 2024 03:21:07 +0800
-Subject: [PATCH 3/7] kernel: Add support for llvm/clang compiler
+Date: Fri, 4 Oct 2024 10:51:22 +0800
+Subject: [PATCH 05/13] kernel: Add support for llvm/clang compiler
Signed-off-by: sbwml
---
- config/Config-devel.in | 7 +++++++
- include/kernel-defaults.mk | 11 +++++++++++
- include/kernel.mk | 13 ++++++++++++-
- include/package.mk | 4 ++++
- 4 files changed, 34 insertions(+), 1 deletion(-)
+ config/Config-devel.in | 7 +++++++
+ include/kernel.mk | 13 ++++++++++++-
+ include/package.mk | 4 ++++
+ 3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/config/Config-devel.in b/config/Config-devel.in
-index cbac91c..9079303 100644
+index 3fe78f3..46287bf 100644
--- a/config/Config-devel.in
+++ b/config/Config-devel.in
-@@ -95,6 +95,13 @@ menuconfig DEVEL
+@@ -149,6 +149,13 @@ menuconfig DEVEL
default "-falign-functions=32" if TARGET_bcm53xx
default ""
@@ -29,30 +28,8 @@ index cbac91c..9079303 100644
config EXTERNAL_KERNEL_TREE
string "Use external kernel tree" if DEVEL
default ""
-diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
-index b17ff7f..b8a1479 100644
---- a/include/kernel-defaults.mk
-+++ b/include/kernel-defaults.mk
-@@ -13,6 +13,17 @@ ifneq (,$(KERNEL_CC))
- KERNEL_MAKEOPTS += CC="$(KERNEL_CC)"
- endif
-
-+ifneq (,$(findstring clang,$(KERNEL_CC)))
-+ ifneq (,$(filter clang-%,$(KERNEL_CC)))
-+ LLVM := $(subst clang-,,$(KERNEL_CC))
-+ LLVM_LLD := ld.lld-$(subst clang-,,$(KERNEL_CC))
-+ else
-+ LLVM := 1
-+ LLVM_LLD := ld.lld
-+ endif
-+ KERNEL_MAKE_FLAGS += CC="$(KERNEL_CC)" LD="$(LLVM_LLD)" LD=ld.lld LLVM=$(LLVM) LLVM_IAS=1
-+endif
-+
- export HOST_EXTRACFLAGS=-I$(STAGING_DIR_HOST)/include
-
- # defined in quilt.mk
diff --git a/include/kernel.mk b/include/kernel.mk
-index 3012eb8..1d85a8f 100644
+index 6ef7663..1648a6f 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -35,7 +35,7 @@ else
@@ -64,9 +41,9 @@ index 3012eb8..1d85a8f 100644
KERNEL_CROSS?=$(TARGET_CROSS)
endif
-@@ -119,6 +119,17 @@ KERNEL_MAKE_FLAGS = \
- cmd_syscalls= \
- $(if $(__package_mk),KBUILD_EXTRA_SYMBOLS="$(wildcard $(PKG_SYMVERS_DIR)/*.symvers)")
+@@ -125,6 +125,17 @@ ifneq (,$(KERNEL_CC))
+ KERNEL_MAKE_FLAGS += CC="$(KERNEL_CC)"
+ endif
+ifneq (,$(findstring clang,$(KERNEL_CC)))
+ ifneq (,$(filter clang-%,$(KERNEL_CC)))
@@ -76,14 +53,14 @@ index 3012eb8..1d85a8f 100644
+ LLVM := 1
+ LLVM_LLD := ld.lld
+ endif
-+ KERNEL_MAKE_FLAGS += CC="$(KERNEL_CC)" LD="$(LLVM_LLD)" LLVM=$(LLVM) LLVM_IAS=1
++ KERNEL_MAKE_FLAGS += LD="$(LLVM_LLD)" LLVM=$(LLVM) LLVM_IAS=1
+endif
+
KERNEL_NOSTDINC_FLAGS = \
-nostdinc $(if $(DUMP),, -isystem $(shell $(TARGET_CC) -print-file-name=include))
diff --git a/include/package.mk b/include/package.mk
-index c391d32..802e33a 100644
+index 5392bdf..5bcc4f3 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -23,6 +23,10 @@ else
@@ -95,7 +72,7 @@ index c391d32..802e33a 100644
+endif
+
PKG_BUILD_FLAGS?=
- __unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections lto no-lto,$(PKG_BUILD_FLAGS))
+ __unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections lto no-lto no-mold,$(PKG_BUILD_FLAGS))
ifneq ($(__unknown_flags),)
--
2.43.5
diff --git a/openwrt/patch/generic/0006-build-kernel-add-out-of-tree-kernel-config.patch b/openwrt/patch/generic-25.12/0006-build-kernel-add-out-of-tree-kernel-config.patch
similarity index 91%
rename from openwrt/patch/generic/0006-build-kernel-add-out-of-tree-kernel-config.patch
rename to openwrt/patch/generic-25.12/0006-build-kernel-add-out-of-tree-kernel-config.patch
index c309684b6..2f2af1951 100644
--- a/openwrt/patch/generic/0006-build-kernel-add-out-of-tree-kernel-config.patch
+++ b/openwrt/patch/generic-25.12/0006-build-kernel-add-out-of-tree-kernel-config.patch
@@ -1,7 +1,7 @@
-From 3f003e591567a7640b2d61f0bffc11ac9ff7c7dc Mon Sep 17 00:00:00 2001
+From 687ed9e452ea3ce1508af0c661eba9019dc5d16d Mon Sep 17 00:00:00 2001
From: sbwml
-Date: Sun, 7 Jul 2024 18:51:18 +0800
-Subject: [PATCH 6/7] build: kernel: add out-of-tree kernel config
+Date: Fri, 4 Oct 2024 10:56:57 +0800
+Subject: [PATCH 06/13] build: kernel: add out-of-tree kernel config
Signed-off-by: sbwml
---
@@ -10,10 +10,10 @@ Signed-off-by: sbwml
2 files changed, 79 insertions(+)
diff --git a/config/Config-devel.in b/config/Config-devel.in
-index 9079303..2cbefc2 100644
+index 46287bf..a73832e 100644
--- a/config/Config-devel.in
+++ b/config/Config-devel.in
-@@ -102,6 +102,13 @@ menuconfig DEVEL
+@@ -156,6 +156,13 @@ menuconfig DEVEL
Enter C compiler name or full pathname i.e.: clang
If not set, uses '$(TARGET_CC)'
@@ -28,24 +28,24 @@ index 9079303..2cbefc2 100644
string "Use external kernel tree" if DEVEL
default ""
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
-index b8a1479..408bf2f 100644
+index bdfdaaa..f1202bc 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
-@@ -110,6 +110,78 @@ define Kernel/SetNoInitramfs
- grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set
+@@ -107,6 +107,78 @@ define Kernel/SetNoInitramfs
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set
echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set
+ echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config.set
+# CLANG
+ mv $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.old
+ grep -v CONFIG_LTO $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set
+ifneq (,$(findstring clang,$(KERNEL_CC)))
+ echo 'CONFIG_LTO=y' >> $(LINUX_DIR)/.config.set
+ echo 'CONFIG_LTO_CLANG=y' >> $(LINUX_DIR)/.config.set
-+ echo 'CONFIG_LTO_CLANG_FULL=y' >> $(LINUX_DIR)/.config.set
++ echo 'CONFIG_LTO_CLANG_THIN=y' >> $(LINUX_DIR)/.config.set
+ echo 'CONFIG_HAS_LTO_CLANG=y' >> $(LINUX_DIR)/.config.set
+ echo 'CONFIG_RANDSTRUCT_NONE=y' >> $(LINUX_DIR)/.config.set
+ echo '# CONFIG_CFI_CLANG is not set' >> $(LINUX_DIR)/.config.set
-+ echo '# CONFIG_LTO_CLANG_THIN is not set' >> $(LINUX_DIR)/.config.set
++ echo '# CONFIG_LTO_CLANG_FULL is not set' >> $(LINUX_DIR)/.config.set
+ echo '# CONFIG_LTO_NONE is not set' >> $(LINUX_DIR)/.config.set
+ echo '# CONFIG_RANDSTRUCT_FULL is not set' >> $(LINUX_DIR)/.config.set
+ echo '# CONFIG_RELR is not set' >> $(LINUX_DIR)/.config.set
diff --git a/openwrt/patch/generic-25.12/0007-include-kernel-add-miss-config-for-linux-6.11.patch b/openwrt/patch/generic-25.12/0007-include-kernel-add-miss-config-for-linux-6.11.patch
new file mode 100644
index 000000000..12eb422dd
--- /dev/null
+++ b/openwrt/patch/generic-25.12/0007-include-kernel-add-miss-config-for-linux-6.11.patch
@@ -0,0 +1,25 @@
+From 8a78c2447e9842da14227edbddd5989bc399a04a Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Fri, 4 Oct 2024 10:58:29 +0800
+Subject: [PATCH 07/13] include: kernel: add miss config for linux-6.11
+
+Signed-off-by: sbwml
+---
+ include/kernel-defaults.mk | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
+index f1202bc..20b3a12 100644
+--- a/include/kernel-defaults.mk
++++ b/include/kernel-defaults.mk
+@@ -107,6 +107,7 @@ define Kernel/SetNoInitramfs
+ echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set
+ echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set
+ echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config.set
++ echo '# CONFIG_FSCACHE is not set' >> $(LINUX_DIR)/.config.set
+ # CLANG
+ mv $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.old
+ grep -v CONFIG_LTO $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set
+--
+2.43.5
+
diff --git a/openwrt/patch/generic/010-meson-add-platform-variable-to-cross-compilation-file.patch b/openwrt/patch/generic-25.12/0008-meson-add-platform-variable-to-cross-compilation-fil.patch
similarity index 55%
rename from openwrt/patch/generic/010-meson-add-platform-variable-to-cross-compilation-file.patch
rename to openwrt/patch/generic-25.12/0008-meson-add-platform-variable-to-cross-compilation-fil.patch
index 26b16ab4f..d6285e97a 100644
--- a/openwrt/patch/generic/010-meson-add-platform-variable-to-cross-compilation-file.patch
+++ b/openwrt/patch/generic-25.12/0008-meson-add-platform-variable-to-cross-compilation-fil.patch
@@ -1,19 +1,19 @@
-From ff6ba001d151cf07a25af592e30a28df0b50ff19 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Zbyn=C4=9Bk=20Kocur?=
-Date: Wed, 31 Jan 2024 15:17:51 +0100
-Subject: [PATCH] meson: add platform variable to cross-compilation file
+From 643e0796f188993c5caea1655c4836aae8307336 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Fri, 4 Oct 2024 10:58:54 +0800
+Subject: [PATCH 08/13] meson: add platform variable to cross-compilation file
-This patch adds the "platform" variable to the meson cross-compilation file for the ARM SoC. This variable is necessary to compile DPDK framework on ARM SoCs.(https://doc.dpdk.org/guides/linux_gsg/cross_build_dpdk_for_arm64.html)
+Signed-off-by: sbwml
---
include/meson.mk | 1 +
tools/meson/files/openwrt-cross.txt.in | 1 +
2 files changed, 2 insertions(+)
diff --git a/include/meson.mk b/include/meson.mk
-index 7d67dcf298b3e..5a7c7a36fb4de 100644
+index 62dc7bd..91cd7e6 100644
--- a/include/meson.mk
+++ b/include/meson.mk
-@@ -89,6 +89,7 @@ define Meson/CreateCrossFile
+@@ -96,6 +96,7 @@ define Meson/CreateCrossFile
-e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \
-e "s|@ARCH@|$(MESON_ARCH)|" \
-e "s|@CPU@|$(MESON_CPU)|" \
@@ -22,12 +22,15 @@ index 7d67dcf298b3e..5a7c7a36fb4de 100644
< $(MESON_DIR)/openwrt-cross.txt.in \
> $(1)
diff --git a/tools/meson/files/openwrt-cross.txt.in b/tools/meson/files/openwrt-cross.txt.in
-index ec4b027f1b783..e7cbcd0872111 100644
+index 836a0e5..cc83bc8 100644
--- a/tools/meson/files/openwrt-cross.txt.in
+++ b/tools/meson/files/openwrt-cross.txt.in
-@@ -22,4 +22,5 @@ cpu = '@CPU@'
+@@ -24,4 +24,5 @@ cpu = '@CPU@'
endian = '@ENDIAN@'
[properties]
+platform = '@PLAT@'
needs_exe_wrapper = true
+--
+2.43.5
+
diff --git a/openwrt/patch/generic-25.12/0009-tools-squashfs4-enable-lz4-zstd-compression-support.patch b/openwrt/patch/generic-25.12/0009-tools-squashfs4-enable-lz4-zstd-compression-support.patch
new file mode 100644
index 000000000..136dbb86a
--- /dev/null
+++ b/openwrt/patch/generic-25.12/0009-tools-squashfs4-enable-lz4-zstd-compression-support.patch
@@ -0,0 +1,29 @@
+From 2959e6624a39b223527d654828022fe1d79ea6fc Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Sun, 21 Dec 2025 15:14:08 +0800
+Subject: [PATCH 09/13] tools: squashfs4: enable lz4 & zstd compression support
+
+Signed-off-by: sbwml
+---
+ tools/squashfs4/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile
+index 6b88735..31c884a 100644
+--- a/tools/squashfs4/Makefile
++++ b/tools/squashfs4/Makefile
+@@ -24,9 +24,9 @@ include $(INCLUDE_DIR)/host-build.mk
+ define Host/Compile
+ +$(HOST_MAKE_VARS) \
+ $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/squashfs-tools \
+- LZ4_SUPPORT=0 \
++ LZ4_SUPPORT=1 \
+ LZO_SUPPORT=0 \
+- ZSTD_SUPPORT=0 \
++ ZSTD_SUPPORT=1 \
+ GZIP_SUPPORT=1 \
+ XZ_SUPPORT=1 \
+ LZMA_XZ_SUPPORT=1 \
+--
+2.43.5
+
diff --git a/openwrt/patch/generic-25.12/0010-kernel-add-PREEMPT_RT-support-for-aarch64-x86_64.patch b/openwrt/patch/generic-25.12/0010-kernel-add-PREEMPT_RT-support-for-aarch64-x86_64.patch
new file mode 100644
index 000000000..5d730bab3
--- /dev/null
+++ b/openwrt/patch/generic-25.12/0010-kernel-add-PREEMPT_RT-support-for-aarch64-x86_64.patch
@@ -0,0 +1,37 @@
+From 5ebcd78dec9b1c9cd5ca4abaad34abe6a794058c Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Sat, 12 Oct 2024 08:36:46 +0800
+Subject: [PATCH 10/13] kernel: add PREEMPT_RT support for aarch64/x86_64
+
+Signed-off-by: sbwml
+---
+ config/Config-kernel.in | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/config/Config-kernel.in b/config/Config-kernel.in
+index 8692063..6c75038 100644
+--- a/config/Config-kernel.in
++++ b/config/Config-kernel.in
+@@ -20,6 +20,19 @@ config KERNEL_BUILD_DOMAIN
+ returned by 'uname -a' on running systems.
+ If not set, uses system hostname at build time.
+
++config KERNEL_PREEMPT_RT
++ bool "Fully Preemptible Kernel (Real-Time)"
++ depends on (aarch64 || x86_64) && LINUX_6_12
++ help
++ This option turns the kernel into a real-time kernel by replacing
++ various locking primitives (spinlocks, rwlocks, etc.) with
++ preemptible priority-inheritance aware variants, enforcing
++ interrupt threading and introducing mechanisms to break up long
++ non-preemptible sections. This makes the kernel, except for very
++ low level and critical code paths (entry code, scheduler, low
++ level interrupt handling) fully preemptible and brings most
++ execution contexts under scheduler control.
++
+ config KERNEL_PRINTK
+ bool "Enable support for printk"
+ default y
+--
+2.43.5
+
diff --git a/openwrt/patch/generic-25.12/0011-config-include-image-add-support-for-squashfs-zstd-c.patch b/openwrt/patch/generic-25.12/0011-config-include-image-add-support-for-squashfs-zstd-c.patch
new file mode 100644
index 000000000..4cc620bc2
--- /dev/null
+++ b/openwrt/patch/generic-25.12/0011-config-include-image-add-support-for-squashfs-zstd-c.patch
@@ -0,0 +1,48 @@
+From 0649947c4c8d0b21bd40124c3d2bd004c0118549 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Thu, 29 May 2025 17:12:37 +0800
+Subject: [PATCH 11/13] config/include: image: add support for squashfs zstd
+ compression algorithm
+
+Signed-off-by: sbwml
+---
+ config/Config-images.in | 7 +++++++
+ include/image.mk | 4 ++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/config/Config-images.in b/config/Config-images.in
+index 8094136..3721292 100644
+--- a/config/Config-images.in
++++ b/config/Config-images.in
+@@ -194,6 +194,13 @@ menu "Target Images"
+ Specify the number of parallel small file reader threads
+ (for files less than the squashfs block size).
+
++ config TARGET_ROOTFS_SQUASHFS_ZSTD
++ bool "SquashFS Zstd"
++ depends on TARGET_ROOTFS_SQUASHFS
++ default n
++ help
++ Build a squashfs root filesystem using zstd compression.
++
+ menuconfig TARGET_ROOTFS_UBIFS
+ bool "ubifs"
+ default y if USES_UBIFS
+diff --git a/include/image.mk b/include/image.mk
+index 38005b2..078d2f7 100644
+--- a/include/image.mk
++++ b/include/image.mk
+@@ -100,6 +100,10 @@ ifeq ($(CONFIG_SQUASHFS_XZ),y)
+ SQUASHFSCOMP := xz $(LZMA_XZ_OPTIONS) $(BCJ_FILTER)
+ endif
+
++ifeq ($(CONFIG_TARGET_ROOTFS_SQUASHFS_ZSTD),y)
++ SQUASHFSCOMP := zstd -Xcompression-level 22
++endif
++
+ JFFS2_BLOCKSIZE ?= 64k 128k
+
+ EROFS_PCLUSTERSIZE = $(shell echo $$(($(CONFIG_TARGET_EROFS_PCLUSTER_SIZE)*1024)))
+--
+2.43.5
+
diff --git a/openwrt/patch/generic-25.12/0012-include-kernel-Always-collect-module-symvers.patch b/openwrt/patch/generic-25.12/0012-include-kernel-Always-collect-module-symvers.patch
new file mode 100644
index 000000000..d14365c62
--- /dev/null
+++ b/openwrt/patch/generic-25.12/0012-include-kernel-Always-collect-module-symvers.patch
@@ -0,0 +1,34 @@
+From 13032f8109b35d761d61d0631b73b305299078f4 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Sun, 26 Oct 2025 16:12:19 +0800
+Subject: [PATCH 12/13] include: kernel: Always collect module symvers
+
+Signed-off-by: sbwml
+---
+ include/kernel.mk | 10 +++-------
+ 1 file changed, 3 insertions(+), 7 deletions(-)
+
+diff --git a/include/kernel.mk b/include/kernel.mk
+index 1648a6f..f63f367 100644
+--- a/include/kernel.mk
++++ b/include/kernel.mk
+@@ -160,13 +160,9 @@ PKG_EXTMOD_SUBDIRS ?= .
+ PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers
+
+ define collect_module_symvers
+- for subdir in $(PKG_EXTMOD_SUBDIRS); do \
+- realdir=$$$$(readlink -f $(PKG_BUILD_DIR)); \
+- grep -F $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \
+- [ "$(PKG_BUILD_DIR)" = "$$$$realdir" ] || \
+- grep -F $$$$realdir $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \
+- done; \
+- sort -u $(PKG_BUILD_DIR)/Module.symvers.tmp > $(PKG_BUILD_DIR)/Module.symvers; \
++ sort -u $(PKG_BUILD_DIR)/Module.symvers > $(PKG_BUILD_DIR)/Module.symvers.tmp; \
++ rm -f $(PKG_BUILD_DIR)/Module.symvers; \
++ mv $(PKG_BUILD_DIR)/Module.symvers.tmp $(PKG_BUILD_DIR)/Module.symvers; \
+ mkdir -p $(PKG_SYMVERS_DIR); \
+ mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_SYMVERS_DIR)/$(PKG_NAME).symvers
+ endef
+--
+2.43.5
+
diff --git a/openwrt/patch/generic-25.12/0013-toolchain-gcc-add-support-for-GCC-16.patch b/openwrt/patch/generic-25.12/0013-toolchain-gcc-add-support-for-GCC-16.patch
new file mode 100644
index 000000000..98f61f52c
--- /dev/null
+++ b/openwrt/patch/generic-25.12/0013-toolchain-gcc-add-support-for-GCC-16.patch
@@ -0,0 +1,887 @@
+From a9d317aa12af81e7c829ce9a01abcd29cb9f8cc1 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Mon, 11 May 2026 15:40:54 +0800
+Subject: [PATCH 1/2] toolchain: gcc: add support for GCC-16
+
+Signed-off-by: sbwml
+---
+ toolchain/gcc/Config.in | 3 +
+ toolchain/gcc/Config.version | 5 +
+ toolchain/gcc/common.mk | 4 +
+ .../patches-16.x/002-case_insensitive.patch | 24 +++
+ ...t-choke-when-building-32bit-on-64bit.patch | 13 ++
+ .../gcc/patches-16.x/010-documentation.patch | 35 +++++
+ .../patches-16.x/110-Fix-MIPS-PR-84790.patch | 20 +++
+ .../gcc/patches-16.x/230-musl_libssp.patch | 13 ++
+ .../300-mips_Os_cpu_rtx_cost_model.patch | 21 +++
+ .../800-arm_v5te_no_ldrd_strd.patch | 11 ++
+ .../810-arm-softfloat-libgcc.patch | 33 ++++
+ .../gcc/patches-16.x/820-libgcc_pic.patch | 44 ++++++
+ .../patches-16.x/830-aarch64-libatomic.patch | 32 ++++
+ .../840-armv4_pass_fix-v4bx_to_ld.patch | 28 ++++
+ .../patches-16.x/850-use_shared_libgcc.patch | 54 +++++++
+ .../patches-16.x/851-libgcc_no_compat.patch | 22 +++
+ .../patches-16.x/870-ppc_no_crtsavres.patch | 11 ++
+ .../gcc/patches-16.x/881-no_tm_section.patch | 11 ++
+ .../gcc/patches-16.x/900-bad-mips16-crt.patch | 9 ++
+ .../gcc/patches-16.x/910-mbsd_multi.patch | 146 ++++++++++++++++++
+ .../920-specs_nonfatal_getenv.patch | 22 +++
+ ...mpilation-when-making-cross-compiler.patch | 67 ++++++++
+ .../970-macos_arm64-building-fix.patch | 45 ++++++
+ 23 files changed, 673 insertions(+)
+ create mode 100644 toolchain/gcc/patches-16.x/002-case_insensitive.patch
+ create mode 100644 toolchain/gcc/patches-16.x/003-dont-choke-when-building-32bit-on-64bit.patch
+ create mode 100644 toolchain/gcc/patches-16.x/010-documentation.patch
+ create mode 100644 toolchain/gcc/patches-16.x/110-Fix-MIPS-PR-84790.patch
+ create mode 100644 toolchain/gcc/patches-16.x/230-musl_libssp.patch
+ create mode 100644 toolchain/gcc/patches-16.x/300-mips_Os_cpu_rtx_cost_model.patch
+ create mode 100644 toolchain/gcc/patches-16.x/800-arm_v5te_no_ldrd_strd.patch
+ create mode 100644 toolchain/gcc/patches-16.x/810-arm-softfloat-libgcc.patch
+ create mode 100644 toolchain/gcc/patches-16.x/820-libgcc_pic.patch
+ create mode 100644 toolchain/gcc/patches-16.x/830-aarch64-libatomic.patch
+ create mode 100644 toolchain/gcc/patches-16.x/840-armv4_pass_fix-v4bx_to_ld.patch
+ create mode 100644 toolchain/gcc/patches-16.x/850-use_shared_libgcc.patch
+ create mode 100644 toolchain/gcc/patches-16.x/851-libgcc_no_compat.patch
+ create mode 100644 toolchain/gcc/patches-16.x/870-ppc_no_crtsavres.patch
+ create mode 100644 toolchain/gcc/patches-16.x/881-no_tm_section.patch
+ create mode 100644 toolchain/gcc/patches-16.x/900-bad-mips16-crt.patch
+ create mode 100644 toolchain/gcc/patches-16.x/910-mbsd_multi.patch
+ create mode 100644 toolchain/gcc/patches-16.x/920-specs_nonfatal_getenv.patch
+ create mode 100644 toolchain/gcc/patches-16.x/960-gotools-fix-compilation-when-making-cross-compiler.patch
+ create mode 100644 toolchain/gcc/patches-16.x/970-macos_arm64-building-fix.patch
+
+diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in
+index d296249..68c91c1 100644
+--- a/toolchain/gcc/Config.in
++++ b/toolchain/gcc/Config.in
+@@ -17,6 +17,9 @@ choice
+
+ config GCC_USE_VERSION_15
+ bool "gcc 15.x"
++
++ config GCC_USE_VERSION_16
++ bool "gcc 16.x"
+ endchoice
+
+ config GCC_USE_GRAPHITE
+diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version
+index 5960fe3..4f94ac7 100644
+--- a/toolchain/gcc/Config.version
++++ b/toolchain/gcc/Config.version
+@@ -10,12 +10,17 @@ config GCC_VERSION_15
+ default y if GCC_USE_VERSION_15
+ bool
+
++config GCC_VERSION_16
++ default y if GCC_USE_VERSION_16
++ bool
++
+ config GCC_VERSION
+ string
+ default EXTERNAL_GCC_VERSION if EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
+ default "12.3.0" if GCC_VERSION_12
+ default "13.4.0" if GCC_VERSION_13
+ default "15.2.0" if GCC_VERSION_15
++ default "16.1.0" if GCC_VERSION_16
+ default "14.3.0"
+
+ config GCC_USE_DEFAULT_VERSION
+diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
+index 8bd898e..9928e1f 100644
+--- a/toolchain/gcc/common.mk
++++ b/toolchain/gcc/common.mk
+@@ -50,6 +50,10 @@ ifeq ($(PKG_VERSION),15.2.0)
+ PKG_HASH:=438fd996826b0c82485a29da03a72d71d6e3541a83ec702df4271f6fe025d24e
+ endif
+
++ifeq ($(PKG_VERSION),16.1.0)
++ PKG_HASH:=50efb4d94c3397aff3b0d61a5abd748b4dd31d9d3f2ab7be05b171d36a510f79
++endif
++
+ PATCH_DIR=../patches-$(GCC_MAJOR_VERSION).x
+
+ BUGURL=http://bugs.openwrt.org/
+diff --git a/toolchain/gcc/patches-16.x/002-case_insensitive.patch b/toolchain/gcc/patches-16.x/002-case_insensitive.patch
+new file mode 100644
+index 0000000..409497e
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/002-case_insensitive.patch
+@@ -0,0 +1,24 @@
++commit 81cc26c706b2bc8c8c1eb1a322e5c5157900836e
++Author: Felix Fietkau
++Date: Sun Oct 19 21:45:51 2014 +0000
++
++ gcc: do not assume that the Mac OS X filesystem is case insensitive
++
++ Signed-off-by: Felix Fietkau
++
++ SVN-Revision: 42973
++
++--- a/include/filenames.h
+++++ b/include/filenames.h
++@@ -44,11 +44,6 @@ extern "C" {
++ # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
++ # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
++ #else /* not DOSish */
++-# if defined(__APPLE__)
++-# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
++-# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
++-# endif
++-# endif /* __APPLE__ */
++ # define HAS_DRIVE_SPEC(f) (0)
++ # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
++ # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
+diff --git a/toolchain/gcc/patches-16.x/003-dont-choke-when-building-32bit-on-64bit.patch b/toolchain/gcc/patches-16.x/003-dont-choke-when-building-32bit-on-64bit.patch
+new file mode 100644
+index 0000000..c41f35e
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/003-dont-choke-when-building-32bit-on-64bit.patch
+@@ -0,0 +1,13 @@
++--- a/gcc/real.h
+++++ b/gcc/real.h
++@@ -77,8 +77,10 @@ struct GTY(()) real_value {
++ + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
++
++ /* Verify the guess. */
+++#ifndef __LP64__
++ extern char test_real_width
++ [sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1];
+++#endif
++
++ /* Calculate the format for CONST_DOUBLE. We need as many slots as
++ are necessary to overlay a REAL_VALUE_TYPE on them. This could be
+diff --git a/toolchain/gcc/patches-16.x/010-documentation.patch b/toolchain/gcc/patches-16.x/010-documentation.patch
+new file mode 100644
+index 0000000..34d9f41
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/010-documentation.patch
+@@ -0,0 +1,35 @@
++commit 098bd91f5eae625c7d2ee621e10930fc4434e5e2
++Author: Luka Perkov
++Date: Tue Feb 26 16:16:33 2013 +0000
++
++ gcc: don't build documentation
++
++ This closes #13039.
++
++ Signed-off-by: Luka Perkov
++
++ SVN-Revision: 35807
++
++--- a/gcc/Makefile.in
+++++ b/gcc/Makefile.in
++@@ -3846,18 +3846,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
++ doc/gccint.info: $(TEXI_GCCINT_FILES)
++ doc/cppinternals.info: $(TEXI_CPPINT_FILES)
++
++-doc/%.info: %.texi
++- if [ x$(BUILD_INFO) = xinfo ]; then \
++- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
++- -I $(gcc_docdir)/include -o $@ $<; \
++- fi
+++doc/%.info:
++
++ # Duplicate entry to handle renaming of gccinstall.info
++-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
++- if [ x$(BUILD_INFO) = xinfo ]; then \
++- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
++- -I $(gcc_docdir)/include -o $@ $<; \
++- fi
+++doc/gccinstall.info:
++
++ doc/cpp.dvi: $(TEXI_CPP_FILES)
++ doc/gcc.dvi: $(TEXI_GCC_FILES)
+diff --git a/toolchain/gcc/patches-16.x/110-Fix-MIPS-PR-84790.patch b/toolchain/gcc/patches-16.x/110-Fix-MIPS-PR-84790.patch
+new file mode 100644
+index 0000000..7d2b4a1
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/110-Fix-MIPS-PR-84790.patch
+@@ -0,0 +1,20 @@
++Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790.
++MIPS16 functions have a static assembler prologue which clobbers
++registers v0 and v1. Add these register clobbers to function call
++instructions.
++
++--- a/gcc/config/mips/mips.cc
+++++ b/gcc/config/mips/mips.cc
++@@ -3307,6 +3307,12 @@ mips_emit_call_insn (rtx pattern, rtx or
++ emit_insn (gen_update_got_version ());
++ }
++
+++ if (TARGET_MIPS16 && TARGET_USE_GOT)
+++ {
+++ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP);
+++ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode));
+++ }
+++
++ if (TARGET_MIPS16
++ && TARGET_EXPLICIT_RELOCS
++ && TARGET_CALL_CLOBBERED_GP)
+diff --git a/toolchain/gcc/patches-16.x/230-musl_libssp.patch b/toolchain/gcc/patches-16.x/230-musl_libssp.patch
+new file mode 100644
+index 0000000..ec14131
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/230-musl_libssp.patch
+@@ -0,0 +1,13 @@
++--- a/gcc/gcc.cc
+++++ b/gcc/gcc.cc
++@@ -1018,7 +1018,9 @@ proper position among the other output f
++ #endif
++
++ #ifndef LINK_SSP_SPEC
++-#ifdef TARGET_LIBC_PROVIDES_SSP
+++#if DEFAULT_LIBC == LIBC_MUSL
+++#define LINK_SSP_SPEC "-lssp_nonshared"
+++#elif defined(TARGET_LIBC_PROVIDES_SSP)
++ #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
++ "|fstack-protector-strong|fstack-protector-explicit:}"
++ #else
+diff --git a/toolchain/gcc/patches-16.x/300-mips_Os_cpu_rtx_cost_model.patch b/toolchain/gcc/patches-16.x/300-mips_Os_cpu_rtx_cost_model.patch
+new file mode 100644
+index 0000000..1048cfd
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/300-mips_Os_cpu_rtx_cost_model.patch
+@@ -0,0 +1,21 @@
++commit ecf7671b769fe96f7b5134be442089f8bdba55d2
++Author: Felix Fietkau
++Date: Thu Aug 4 20:29:45 2016 +0200
++
++gcc: add a patch to generate better code with Os on mips
++
++Also happens to reduce compressed code size a bit
++
++Signed-off-by: Felix Fietkau
++
++--- a/gcc/config/mips/mips.cc
+++++ b/gcc/config/mips/mips.cc
++@@ -20626,7 +20626,7 @@ mips_option_override (void)
++ flag_pcc_struct_return = 0;
++
++ /* Decide which rtx_costs structure to use. */
++- if (optimize_size)
+++ if (0 && optimize_size)
++ mips_cost = &mips_rtx_cost_optimize_size;
++ else
++ mips_cost = &mips_rtx_cost_data[mips_tune];
+diff --git a/toolchain/gcc/patches-16.x/800-arm_v5te_no_ldrd_strd.patch b/toolchain/gcc/patches-16.x/800-arm_v5te_no_ldrd_strd.patch
+new file mode 100644
+index 0000000..bae244c
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/800-arm_v5te_no_ldrd_strd.patch
+@@ -0,0 +1,11 @@
++--- a/gcc/config/arm/arm.h
+++++ b/gcc/config/arm/arm.h
++@@ -158,7 +158,7 @@ emission of floating point pcs attribute
++ /* Thumb-1 only. */
++ #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
++
++-#define TARGET_LDRD (arm_arch5te && ARM_DOUBLEWORD_ALIGN \
+++#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
++ && !TARGET_THUMB1)
++
++ #define TARGET_CRC32 (arm_arch_crc)
+diff --git a/toolchain/gcc/patches-16.x/810-arm-softfloat-libgcc.patch b/toolchain/gcc/patches-16.x/810-arm-softfloat-libgcc.patch
+new file mode 100644
+index 0000000..5c9d86a
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/810-arm-softfloat-libgcc.patch
+@@ -0,0 +1,33 @@
++commit 8570c4be394cff7282f332f97da2ff569a927ddb
++Author: Imre Kaloz
++Date: Wed Feb 2 20:06:12 2011 +0000
++
++ fixup arm soft-float symbols
++
++ SVN-Revision: 25325
++
++--- a/libgcc/config/arm/t-linux
+++++ b/libgcc/config/arm/t-linux
++@@ -1,6 +1,10 @@
++ LIB1ASMSRC = arm/lib1funcs.S
++ LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
++- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
+++ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
+++ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
+++ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
+++ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
+++ _arm_fixsfsi _arm_fixunssfsi
++
++ # Just for these, we omit the frame pointer since it makes such a big
++ # difference.
++--- a/gcc/config/arm/linux-elf.h
+++++ b/gcc/config/arm/linux-elf.h
++@@ -58,8 +58,6 @@
++ %{shared:-lc} \
++ %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
++
++-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
++-
++ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++
++ #define LINUX_TARGET_LINK_SPEC "%{h*} \
+diff --git a/toolchain/gcc/patches-16.x/820-libgcc_pic.patch b/toolchain/gcc/patches-16.x/820-libgcc_pic.patch
+new file mode 100644
+index 0000000..f6aa204
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/820-libgcc_pic.patch
+@@ -0,0 +1,44 @@
++commit c96312958c0621e72c9b32da5bc224ffe2161384
++Author: Felix Fietkau
++Date: Mon Oct 19 23:26:09 2009 +0000
++
++ gcc: create a proper libgcc_pic.a static library for relinking (4.3.3+ for now, backport will follow)
++
++ SVN-Revision: 18086
++
++--- a/libgcc/Makefile.in
+++++ b/libgcc/Makefile.in
++@@ -946,11 +946,12 @@ $(libgcov-driver-objects): %$(objext): $
++
++ # Static libraries.
++ libgcc.a: $(libgcc-objects)
+++libgcc_pic.a: $(libgcc-s-objects)
++ libgcov.a: $(libgcov-objects)
++ libunwind.a: $(libunwind-objects)
++ libgcc_eh.a: $(libgcc-eh-objects)
++
++-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
+++libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
++ -rm -f $@
++
++ objects="$(objects)"; \
++@@ -974,7 +975,7 @@ all: libunwind.a
++ endif
++
++ ifeq ($(enable_shared),yes)
++-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
+++all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
++ ifneq ($(LIBUNWIND),)
++ all: libunwind$(SHLIB_EXT)
++ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
++@@ -1183,6 +1184,10 @@ install-shared:
++ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++
+++ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
+++ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+++ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+++
++ $(subst @multilib_dir@,$(MULTIDIR),$(subst \
++ @shlib_base_name@,libgcc_s,$(subst \
++ @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
+diff --git a/toolchain/gcc/patches-16.x/830-aarch64-libatomic.patch b/toolchain/gcc/patches-16.x/830-aarch64-libatomic.patch
+new file mode 100644
+index 0000000..4779ef8
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/830-aarch64-libatomic.patch
+@@ -0,0 +1,32 @@
++libatomic: Do not enforce march on aarch64
++
++Inspired by The Yocto Project [1].
++
++[1] https://github.com/yoctoproject/poky/blob/51192a79f1717786dda42776f916c3d97ada7971/meta/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch
++
++Signed-off-by: Konstantin Demin
++
++ libatomic/Makefile.am | 1 -
++ libatomic/Makefile.in | 1 -
++ 2 files changed, 2 deletions(-)
++
++--- a/libatomic/Makefile.am
+++++ b/libatomic/Makefile.am
++@@ -133,7 +133,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZE
++ ## On a target-specific basis, include alternates to be selected by IFUNC.
++ if HAVE_IFUNC
++ if ARCH_AARCH64_LINUX
++-IFUNC_OPTIONS = -march=armv8-a+lse
++ libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
++
++ endif
++--- a/libatomic/Makefile.in
+++++ b/libatomic/Makefile.in
++@@ -470,7 +470,6 @@ libatomic_la_LDFLAGS = $(libatomic_versi
++ @PARTIAL_VXWORKS_FALSE@ _$(s)_.lo,$(SIZEOBJS))) $(am__append_1) \
++ @PARTIAL_VXWORKS_FALSE@ $(am__append_2) $(am__append_3) \
++ @PARTIAL_VXWORKS_FALSE@ $(am__append_4) $(am__append_5)
++-@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@@PARTIAL_VXWORKS_FALSE@IFUNC_OPTIONS = -march=armv8-a+lse
++ @ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@@PARTIAL_VXWORKS_FALSE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64
++ @ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@@PARTIAL_VXWORKS_FALSE@IFUNC_OPTIONS = -march=i586
++ @ARCH_LOONGARCH_TRUE@@HAVE_IFUNC_TRUE@@PARTIAL_VXWORKS_FALSE@IFUNC_OPTIONS = -mlsx|-mscq
+diff --git a/toolchain/gcc/patches-16.x/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches-16.x/840-armv4_pass_fix-v4bx_to_ld.patch
+new file mode 100644
+index 0000000..e3cb616
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/840-armv4_pass_fix-v4bx_to_ld.patch
+@@ -0,0 +1,28 @@
++commit 7edc8ca5456d9743dd0075eb3cc5b04f4f24c8cc
++Author: Imre Kaloz
++Date: Wed Feb 2 19:34:36 2011 +0000
++
++ add armv4 fixup patches
++
++ SVN-Revision: 25322
++
++
++--- a/gcc/config/arm/linux-eabi.h
+++++ b/gcc/config/arm/linux-eabi.h
++@@ -91,10 +91,15 @@
++ #define MUSL_DYNAMIC_LINKER \
++ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
++
+++/* For armv4 we pass --fix-v4bx to linker to support EABI */
+++#undef TARGET_FIX_V4BX_SPEC
+++#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
+++ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
+++
++ /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
++ use the GNU/Linux version, not the generic BPABI version. */
++ #undef LINK_SPEC
++-#define LINK_SPEC EABI_LINK_SPEC \
+++#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \
++ LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
++ LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
++
+diff --git a/toolchain/gcc/patches-16.x/850-use_shared_libgcc.patch b/toolchain/gcc/patches-16.x/850-use_shared_libgcc.patch
+new file mode 100644
+index 0000000..210c790
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/850-use_shared_libgcc.patch
+@@ -0,0 +1,54 @@
++commit dcfc40358b5a3cae7320c17f8d1cebd5ad5540cd
++Author: Felix Fietkau
++Date: Sun Feb 12 20:25:47 2012 +0000
++
++ gcc 4.6: port over the missing patch 850-use_shared_libgcc.patch to prevent libgcc crap from leaking into every single binary
++
++ SVN-Revision: 30486
++--- a/gcc/config/arm/linux-eabi.h
+++++ b/gcc/config/arm/linux-eabi.h
++@@ -132,10 +132,6 @@
++ "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \
++ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
++
++-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
++- do not use -lfloat. */
++-#undef LIBGCC_SPEC
++-
++ /* Clear the instruction cache from `beg' to `end'. This is
++ implemented in lib1funcs.S, so ensure an error if this definition
++ is used. */
++--- a/gcc/config/linux.h
+++++ b/gcc/config/linux.h
++@@ -58,6 +58,10 @@ see the files COPYING3 and COPYING.RUNTI
++ builtin_assert ("system=posix"); \
++ } while (0)
++
+++#ifndef LIBGCC_SPEC
+++#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
+++#endif
+++
++ /* Determine which dynamic linker to use depending on whether GLIBC or
++ uClibc or Bionic or musl is the default C library and whether
++ -muclibc or -mglibc or -mbionic or -mmusl has been passed to change
++--- a/libgcc/mkmap-symver.awk
+++++ b/libgcc/mkmap-symver.awk
++@@ -136,5 +136,5 @@ function output(lib) {
++ else if (inherit[lib])
++ printf("} %s;\n", inherit[lib]);
++ else
++- printf ("\n local:\n\t*;\n};\n");
+++ printf ("\n\t*;\n};\n");
++ }
++--- a/gcc/config/rs6000/linux.h
+++++ b/gcc/config/rs6000/linux.h
++@@ -70,6 +70,9 @@
++ #undef CPP_OS_DEFAULT_SPEC
++ #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
++
+++#undef LIBGCC_SPEC
+++#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
+++
++ #undef LINK_SHLIB_SPEC
++ #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
++ %{static-pie:-static -pie --no-dynamic-linker -z text}"
+diff --git a/toolchain/gcc/patches-16.x/851-libgcc_no_compat.patch b/toolchain/gcc/patches-16.x/851-libgcc_no_compat.patch
+new file mode 100644
+index 0000000..d710e40
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/851-libgcc_no_compat.patch
+@@ -0,0 +1,22 @@
++commit 64661de100da1ec1061ef3e5e400285dce115e6b
++Author: Felix Fietkau
++Date: Sun May 10 13:16:35 2015 +0000
++
++ gcc: add some size optimization patches
++
++ Signed-off-by: Felix Fietkau
++
++ SVN-Revision: 45664
++
++--- a/libgcc/config/t-libunwind
+++++ b/libgcc/config/t-libunwind
++@@ -2,8 +2,7 @@
++
++ HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
++
++-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
++- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
+++LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
++ LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
++
++ # Override the default value from t-slibgcc-elf-ver and mention -lunwind
+diff --git a/toolchain/gcc/patches-16.x/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches-16.x/870-ppc_no_crtsavres.patch
+new file mode 100644
+index 0000000..0dca688
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/870-ppc_no_crtsavres.patch
+@@ -0,0 +1,11 @@
++--- a/gcc/config/rs6000/rs6000-logue.cc
+++++ b/gcc/config/rs6000/rs6000-logue.cc
++@@ -344,7 +344,7 @@ rs6000_savres_strategy (rs6000_stack_t *
++ /* Define cutoff for using out-of-line functions to save registers. */
++ if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
++ {
++- if (!optimize_size)
+++ if (1)
++ {
++ strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
++ strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
+diff --git a/toolchain/gcc/patches-16.x/881-no_tm_section.patch b/toolchain/gcc/patches-16.x/881-no_tm_section.patch
+new file mode 100644
+index 0000000..2029910
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/881-no_tm_section.patch
+@@ -0,0 +1,11 @@
++--- a/libgcc/crtstuff.c
+++++ b/libgcc/crtstuff.c
++@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
++ #endif
++
++ #if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
++-# define USE_TM_CLONE_REGISTRY 1
+++# define USE_TM_CLONE_REGISTRY 0
++ #elif !defined(USE_TM_CLONE_REGISTRY)
++ # define USE_TM_CLONE_REGISTRY 0
++ #endif
+diff --git a/toolchain/gcc/patches-16.x/900-bad-mips16-crt.patch b/toolchain/gcc/patches-16.x/900-bad-mips16-crt.patch
+new file mode 100644
+index 0000000..b355545
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/900-bad-mips16-crt.patch
+@@ -0,0 +1,9 @@
++--- a/libgcc/config/mips/t-mips16
+++++ b/libgcc/config/mips/t-mips16
++@@ -42,3 +42,6 @@ SYNC_CFLAGS = -mno-mips16
++
++ # Version these symbols if building libgcc.so.
++ SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
+++
+++CRTSTUFF_T_CFLAGS += -mno-mips16
+++CRTSTUFF_T_CFLAGS_S += -mno-mips16
+diff --git a/toolchain/gcc/patches-16.x/910-mbsd_multi.patch b/toolchain/gcc/patches-16.x/910-mbsd_multi.patch
+new file mode 100644
+index 0000000..23cd6ef
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/910-mbsd_multi.patch
+@@ -0,0 +1,146 @@
++commit 99368862e44740ff4fd33760893f04e14f9dbdf1
++Author: Felix Fietkau
++Date: Tue Jul 31 00:52:27 2007 +0000
++
++ Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly
++
++ SVN-Revision: 8256
++
++ This patch brings over a feature from MirBSD:
++ * -fhonour-copts
++ If this option is not given, it's warned (depending
++ on environment variables). This is to catch errors
++ of misbuilt packages which override CFLAGS themselves.
++
++ This patch was authored by Thorsten Glaser
++ with copyright assignment to the FSF in effect.
++
++--- a/gcc/c-family/c-opts.cc
+++++ b/gcc/c-family/c-opts.cc
++@@ -110,6 +110,9 @@ static size_t include_cursor;
++ /* Whether any standard preincluded header has been preincluded. */
++ static bool done_preinclude;
++
+++/* Check if a port honours COPTS. */
+++static int honour_copts = 0;
+++
++ static void handle_OPT_d (const char *);
++ static void set_std_cxx98 (int);
++ static void set_std_cxx11 (int);
++@@ -503,6 +506,12 @@ c_common_handle_option (size_t scode, co
++ flag_no_builtin = !value;
++ break;
++
+++ case OPT_fhonour_copts:
+++ if (c_language == clk_c) {
+++ honour_copts++;
+++ }
+++ break;
+++
++ case OPT_fconstant_string_class_:
++ constant_string_class_name = arg;
++ break;
++@@ -1410,6 +1419,47 @@ c_common_init (void)
++ return false;
++ }
++
+++ if (c_language == clk_c) {
+++ char *ev = getenv ("GCC_HONOUR_COPTS");
+++ int evv;
+++ if (ev == NULL)
+++ evv = -1;
+++ else if ((*ev == '0') || (*ev == '\0'))
+++ evv = 0;
+++ else if (*ev == '1')
+++ evv = 1;
+++ else if (*ev == '2')
+++ evv = 2;
+++ else if (*ev == 's')
+++ evv = -1;
+++ else {
+++ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
+++ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
+++ }
+++ if (evv == 1) {
+++ if (honour_copts == 0) {
+++ error ("someone does not honour COPTS at all in lenient mode");
+++ return false;
+++ } else if (honour_copts != 1) {
+++ warning (0, "someone does not honour COPTS correctly, passed %d times",
+++ honour_copts);
+++ }
+++ } else if (evv == 2) {
+++ if (honour_copts == 0) {
+++ error ("someone does not honour COPTS at all in strict mode");
+++ return false;
+++ } else if (honour_copts != 1) {
+++ error ("someone does not honour COPTS correctly, passed %d times",
+++ honour_copts);
+++ return false;
+++ }
+++ } else if (evv == 0) {
+++ if (honour_copts != 1)
+++ inform (UNKNOWN_LOCATION, "someone does not honour COPTS correctly, passed %d times",
+++ honour_copts);
+++ }
+++ }
+++
++ return true;
++ }
++
++--- a/gcc/c-family/c.opt
+++++ b/gcc/c-family/c.opt
++@@ -2080,6 +2080,9 @@ C++ ObjC++ Optimization Alias(fexception
++ fhonor-std
++ C++ ObjC++ WarnRemoved
++
+++fhonour-copts
+++C ObjC C++ ObjC++ RejectNegative
+++
++ fhosted
++ C ObjC
++ Assume normal C execution environment.
++--- a/gcc/common.opt
+++++ b/gcc/common.opt
++@@ -2004,6 +2004,9 @@ Enum(hardcfr_check_noreturn_calls) Strin
++ EnumValue
++ Enum(hardcfr_check_noreturn_calls) String(always) Value(HCFRNR_ALWAYS)
++
+++fhonour-copts
+++Common RejectNegative
+++
++ ; Nonzero means do not emit .ident assembler directives and ignore
++ ; `#ident' preprocessor directives.
++ fident
++--- a/gcc/doc/invoke.texi
+++++ b/gcc/doc/invoke.texi
++@@ -11476,6 +11476,17 @@ This option is only supported for C and
++
++ This warning is upgraded to an error by @option{-pedantic-errors}.
++
+++@item -fhonour-copts
+++@opindex fhonour-copts
+++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
+++given at least once, and warn if it is given more than once.
+++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
+++given exactly once.
+++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
+++is not given exactly once.
+++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
+++This flag and environment variable only affect the C language.
+++
++ @opindex Wstack-protector
++ @opindex Wno-stack-protector
++ @item -Wstack-protector
++--- a/gcc/opts.cc
+++++ b/gcc/opts.cc
++@@ -2927,6 +2927,9 @@ common_handle_option (struct gcc_options
++ add_comma_separated_to_vector (&opts->x_flag_ignored_attributes, arg);
++ break;
++
+++ case OPT_fhonour_copts:
+++ break;
+++
++ case OPT_Werror:
++ dc->set_warning_as_error_requested (value);
++ break;
+diff --git a/toolchain/gcc/patches-16.x/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches-16.x/920-specs_nonfatal_getenv.patch
+new file mode 100644
+index 0000000..78dd5e0
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/920-specs_nonfatal_getenv.patch
+@@ -0,0 +1,22 @@
++Author: Jo-Philipp Wich
++Date: Sat Apr 21 03:02:39 2012 +0000
++
++ gcc: add patch to make the getenv() spec function nonfatal if requested environment variable is unset
++
++ SVN-Revision: 31390
++
++--- a/gcc/gcc.cc
+++++ b/gcc/gcc.cc
++@@ -10501,8 +10501,10 @@ getenv_spec_function (int argc, const ch
++ }
++
++ if (!value)
++- fatal_error (input_location,
++- "environment variable %qs not defined", varname);
+++ {
+++ warning (input_location, "environment variable %qs not defined", varname);
+++ value = "";
+++ }
++
++ /* We have to escape every character of the environment variable so
++ they are not interpreted as active spec characters. A
+diff --git a/toolchain/gcc/patches-16.x/960-gotools-fix-compilation-when-making-cross-compiler.patch b/toolchain/gcc/patches-16.x/960-gotools-fix-compilation-when-making-cross-compiler.patch
+new file mode 100644
+index 0000000..b1d7576
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/960-gotools-fix-compilation-when-making-cross-compiler.patch
+@@ -0,0 +1,67 @@
++From dda6b050cd74a352670787a294596a9c56c21327 Mon Sep 17 00:00:00 2001
++From: Yousong Zhou
++Date: Fri, 4 May 2018 18:20:53 +0800
++Subject: [PATCH] gotools: fix compilation when making cross compiler
++
++libgo is "the runtime support library for the Go programming language.
++This library is intended for use with the Go frontend."
++
++gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but
++the linker will complain that it cannot find it. That's because shared libgcc
++is not present in the install directory yet. libgo.so was made without problem
++because gcc will emit -lgcc_s when compiled with -shared option. When gotools
++were being made, it was supplied with -static-libgcc thus no link option was
++provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec
++for linking with libgo.so
++
++- GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation
++- Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html
++
++When 3-pass GCC compilation is used, shared libgcc runtime libraries will be
++available after gcc pass2 completed and will meet the gotools link requirement
++at gcc pass3
++---
++ gotools/Makefile.am | 4 +++-
++ gotools/Makefile.in | 4 +++-
++ 2 files changed, 6 insertions(+), 2 deletions(-)
++
++--- a/gotools/Makefile.am
+++++ b/gotools/Makefile.am
++@@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd}
++ STAMP = echo timestamp >
++
++ libgodir = ../$(target_noncanonical)/libgo
+++libgccdir = ../$(target_noncanonical)/libgcc
++ LIBGODEP = $(libgodir)/libgo.la
++
++ LIBGOTOOL = $(libgodir)/libgotool.a
++@@ -41,7 +42,8 @@ GOCFLAGS = $(CFLAGS_FOR_TARGET)
++ GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
++
++ AM_GOCFLAGS = -I $(libgodir)
++-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+++AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+++ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
++ GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
++
++ libgosrcdir = $(srcdir)/../libgo/go
++--- a/gotools/Makefile.in
+++++ b/gotools/Makefile.in
++@@ -337,6 +337,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
++ PWD_COMMAND = $${PWDCMD-pwd}
++ STAMP = echo timestamp >
++ libgodir = ../$(target_noncanonical)/libgo
+++libgccdir = ../$(target_noncanonical)/libgcc
++ LIBGODEP = $(libgodir)/libgo.la
++ LIBGOTOOL = $(libgodir)/libgotool.a
++ @NATIVE_FALSE@GOCOMPILER = $(GOC)
++@@ -346,7 +347,8 @@ LIBGOTOOL = $(libgodir)/libgotool.a
++ GOCFLAGS = $(CFLAGS_FOR_TARGET)
++ GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
++ AM_GOCFLAGS = -I $(libgodir)
++-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+++AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+++ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
++ GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
++ libgosrcdir = $(srcdir)/../libgo/go
++ cmdsrcdir = $(libgosrcdir)/cmd
+diff --git a/toolchain/gcc/patches-16.x/970-macos_arm64-building-fix.patch b/toolchain/gcc/patches-16.x/970-macos_arm64-building-fix.patch
+new file mode 100644
+index 0000000..73bb1ad
+--- /dev/null
++++ b/toolchain/gcc/patches-16.x/970-macos_arm64-building-fix.patch
+@@ -0,0 +1,45 @@
++commit 9c6e71079b46ad5433165feaa2001450f2017b56
++Author: Przemysław Buczkowski
++Date: Mon Aug 16 13:16:21 2021 +0100
++
++ GCC: Patch for Apple Silicon compatibility
++
++ This patch fixes a linker error occuring when compiling
++ the cross-compiler on macOS and ARM64 architecture.
++
++ Adapted from:
++ https://github.com/richfelker/musl-cross-make/issues/116#issuecomment-823612404
++
++ Change-Id: Ia3ee98a163bbb62689f42e2da83a5ef36beb0913
++ Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4329
++ Reviewed-by: John Scipione
++ Reviewed-by: Adrien Destugues
++
++--- a/gcc/config/aarch64/aarch64.h
+++++ b/gcc/config/aarch64/aarch64.h
++@@ -1531,7 +1531,7 @@ extern enum aarch64_code_model aarch64_c
++
++ /* Extra specs when building a native AArch64-hosted compiler.
++ Option rewriting rules based on host system. */
++-#if defined(__aarch64__)
+++#if defined(__aarch64__) && ! defined(__APPLE__)
++ extern const char *host_detect_local_cpu (int argc, const char **argv);
++ #define HAVE_LOCAL_CPU_DETECT
++ # define EXTRA_SPEC_FUNCTIONS \
++--- a/gcc/config/host-darwin.cc
+++++ b/gcc/config/host-darwin.cc
++@@ -23,6 +23,8 @@
++ #include "options.h"
++ #include "diagnostic-core.h"
++ #include "config/host-darwin.h"
+++#include "hosthooks.h"
+++#include "hosthooks-def.h"
++ #include
++
++ /* For Darwin (macOS only) platforms, without ASLR (PIE) enabled on the
++@@ -181,3 +183,5 @@ darwin_gt_pch_use_address (void *&addr,
++
++ return 1;
++ }
+++
+++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
+--
+2.47.3
+
diff --git a/openwrt/patch/generic-25.12/0014-tools-mold-update-to-2.41.0.patch b/openwrt/patch/generic-25.12/0014-tools-mold-update-to-2.41.0.patch
new file mode 100644
index 000000000..fd704df85
--- /dev/null
+++ b/openwrt/patch/generic-25.12/0014-tools-mold-update-to-2.41.0.patch
@@ -0,0 +1,33 @@
+From 39c5582d99c6c52d55dadf060c2045b378320530 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Mon, 11 May 2026 15:41:56 +0800
+Subject: [PATCH 2/2] tools: mold: update to 2.41.0
+
+Signed-off-by: sbwml
+---
+ tools/mold/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/mold/Makefile b/tools/mold/Makefile
+index 8c3e33f..ff1f5c7 100644
+--- a/tools/mold/Makefile
++++ b/tools/mold/Makefile
+@@ -3,13 +3,13 @@
+ include $(TOPDIR)/rules.mk
+
+ PKG_NAME:=mold
+-PKG_VERSION:=2.40.4
++PKG_VERSION:=2.41.0
+ PKG_RELEASE:=1
+
+ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+ PKG_SOURCE_URL_FILE:=v$(PKG_VERSION).tar.gz
+ PKG_SOURCE_URL:=https://github.com/rui314/mold/archive/refs/tags
+-PKG_HASH:=69414c702ec1084e1fa8ca16da24f167f549e5e11e9ecd5d70a8dcda6f08c249
++PKG_HASH:=0a61abac85d818437b425df856822e9d6e9982baeae5a93bcb02fe6c0060c61a
+
+ include $(INCLUDE_DIR)/host-build.mk
+ include $(INCLUDE_DIR)/cmake.mk
+--
+2.47.3
+
diff --git a/openwrt/patch/generic-25.12/0015-tools-build-lz4-by-default.patch b/openwrt/patch/generic-25.12/0015-tools-build-lz4-by-default.patch
new file mode 100644
index 000000000..9b9e3f94c
--- /dev/null
+++ b/openwrt/patch/generic-25.12/0015-tools-build-lz4-by-default.patch
@@ -0,0 +1,52 @@
+From be2b8b3b012a549f8a0fc3d1c4fe84644ee65cf0 Mon Sep 17 00:00:00 2001
+From: sbwml
+Date: Mon, 11 May 2026 18:10:42 +0800
+Subject: [PATCH] tools: build lz4 by default
+
+Signed-off-by: sbwml
+---
+ tools/Makefile | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/tools/Makefile b/tools/Makefile
+index 42b1265..7719ca6 100644
+--- a/tools/Makefile
++++ b/tools/Makefile
+@@ -23,9 +23,6 @@ endif
+ ifneq ($(CONFIG_SDK)$(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),)
+ BUILD_BZIP2_TOOLS = y
+ endif
+-ifneq ($(CONFIG_SDK)$(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),)
+- BUILD_LZ4_TOOLS = y
+-endif
+ ifneq ($(CONFIG_SDK)$(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),)
+ BUILD_LZO_TOOLS = y
+ endif
+@@ -50,6 +47,7 @@ tools-y += gengetopt
+ tools-y += gnulib
+ tools-y += libressl
+ tools-y += libtool
++tools-y += lz4
+ tools-y += lzma
+ tools-y += m4
+ tools-y += make-ext4fs
+@@ -76,7 +74,6 @@ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS),y) += liblzo
+ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_B43_TOOLS),y) += b43-tools
+ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_BZIP2_TOOLS),y) += bzip2
+ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_ISL),y) += isl
+-tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_LZ4_TOOLS),y) += lz4
+ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_LZO_TOOLS),y) += lzop
+ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_TOOLCHAIN),y) += gmp mpc mpfr
+ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini),y) += genext2fs
+@@ -133,7 +130,7 @@ $(curdir)/pkgconf/compile := $(curdir)/meson/compile
+ $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile
+ $(curdir)/sdcc/compile := $(curdir)/bison/compile
+ $(curdir)/squashfs3-lzma/compile := $(curdir)/lzma-old/compile
+-$(curdir)/squashfs4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile
++$(curdir)/squashfs4/compile := $(curdir)/lz4/compile $(curdir)/xz/compile $(curdir)/zlib/compile
+ $(curdir)/util-linux/compile := $(curdir)/bison/compile $(curdir)/meson/compile
+ $(curdir)/yafut/compile := $(curdir)/cmake/compile
+
+--
+2.43.5
+
diff --git a/openwrt/patch/generic/0001-kernel-add-MODULE_ALLOW_BTF_MISMATCH-option.patch b/openwrt/patch/generic/0001-kernel-add-MODULE_ALLOW_BTF_MISMATCH-option.patch
deleted file mode 100644
index 672f07bce..000000000
--- a/openwrt/patch/generic/0001-kernel-add-MODULE_ALLOW_BTF_MISMATCH-option.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From b0f013ccfa66842e9739c6e11b81eadc44a2f8eb Mon Sep 17 00:00:00 2001
-From: Tianling Shen
-Date: Tue, 16 May 2023 12:38:53 +0800
-Subject: [PATCH 1/7] kernel: add MODULE_ALLOW_BTF_MISMATCH option
-
-BTF mismatch can occur for a separately-built module even when the ABI
-is otherwise compatible and nothing else would prevent successfully
-loading. Add a new config to control how mismatches are handled. By
-default, preserve the current behavior of refusing to load the
-module. If MODULE_ALLOW_BTF_MISMATCH is enabled, load the module but
-ignore its BTF information.
-
-Signed-off-by: Tianling Shen
----
- config/Config-kernel.in | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/config/Config-kernel.in b/config/Config-kernel.in
-index ea828ae..a262d59 100644
---- a/config/Config-kernel.in
-+++ b/config/Config-kernel.in
-@@ -364,6 +364,16 @@ config KERNEL_DEBUG_INFO_BTF
-
- Required to run BPF CO-RE applications.
-
-+config KERNEL_MODULE_ALLOW_BTF_MISMATCH
-+ bool "Allow loading modules with non-matching BTF type info"
-+ depends on KERNEL_DEBUG_INFO_BTF
-+ help
-+ For modules whose split BTF does not match vmlinux, load without
-+ BTF rather than refusing to load. The default behavior with
-+ module BTF enabled is to reject modules with such mismatches;
-+ this option will still load module BTF where possible but ignore
-+ it when a mismatch is found.
-+
- config KERNEL_DEBUG_INFO_REDUCED
- bool "Reduce debugging information"
- default y
---
-2.43.5
-
diff --git a/openwrt/patch/generic/0004-libquadmath-Add-libquadmath-to-the-toolchain.patch b/openwrt/patch/generic/0004-libquadmath-Add-libquadmath-to-the-toolchain.patch
deleted file mode 100644
index be2aec5fe..000000000
--- a/openwrt/patch/generic/0004-libquadmath-Add-libquadmath-to-the-toolchain.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 6547a0bb12550411d4bf880e718759d5ea81db1e Mon Sep 17 00:00:00 2001
-From: Carlos Miguel Ferreira
-Date: Wed, 12 Jun 2024 01:20:59 +0100
-Subject: [PATCH 4/7] libquadmath: Add libquadmath to the toolchain
-
-This commit makes the libquadmath library available to the GCC
-toolchain. This library is important for libraries such as
-Boost.charconv
-
-Signed-off-by: Carlos Miguel Ferreira
-Link: https://github.com/openwrt/openwrt/pull/15637
-Signed-off-by: Christian Marangi
----
- package/libs/toolchain/Makefile | 41 +++++++++++++++++++++++++++++++++
- 1 file changed, 41 insertions(+)
-
-diff --git a/package/libs/toolchain/Makefile b/package/libs/toolchain/Makefile
-index f9f8ac9..8066e35 100644
---- a/package/libs/toolchain/Makefile
-+++ b/package/libs/toolchain/Makefile
-@@ -83,6 +83,33 @@ define Package/libatomic/config
- endmenu
- endef
-
-+define Package/libquadmath
-+$(call Package/gcc/Default)
-+ DEPENDS:=@TARGET_x86||TARGET_x86_64 +libgcc
-+ TITLE:=Quadmath support library
-+ ABI_VERSION:=1
-+endef
-+
-+define Package/libquadmath/config
-+ menu "Configuration"
-+ depends on EXTERNAL_TOOLCHAIN && PACKAGE_libquadmath
-+
-+ config LIBQUADMATH_ROOT_DIR
-+ string
-+ prompt "libquadmath shared library base directory"
-+ depends on EXTERNAL_TOOLCHAIN && PACKAGE_libquadmath
-+ default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
-+ default "/" if NATIVE_TOOLCHAIN
-+
-+ config LIBQUADMATH_FILE_SPEC
-+ string
-+ prompt "libquadmath shared library files (use wildcards)"
-+ depends on EXTERNAL_TOOLCHAIN && PACKAGE_libquadmath
-+ default "./lib/libquadmath.so.*"
-+
-+ endmenu
-+endef
-+
- define Package/libstdcpp
- $(call Package/gcc/Default)
- NAME:=libstdc++
-@@ -482,6 +509,11 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
- $(CP) $(TOOLCHAIN_DIR)/lib/libatomic.so.* $(1)/lib/
- endef
-
-+ define Package/libquadmath/install
-+ $(INSTALL_DIR) $(1)/lib
-+ $(CP) $(TOOLCHAIN_DIR)/lib/libquadmath.so.* $(1)/lib/
-+ endef
-+
- define Package/libgfortran/install
- $(INSTALL_DIR) $(1)/usr/lib
- $(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/
-@@ -692,6 +724,14 @@ else
- exit 0
- endef
-
-+ define Package/libquadmath/install
-+ for file in $(call qstrip,$(CONFIG_LIBQUADMATH_FILE_SPEC)); do \
-+ $(INSTALL_DIR) $(1)/lib ; \
-+ $(CP) $(call qstrip,$(CONFIG_LIBQUADMATH_ROOT_DIR))/$$$$file $(1)/lib/ ; \
-+ done ; \
-+ exit 0
-+ endef
-+
- define Package/libgomp/install
- for file in $(call qstrip,$(CONFIG_LIBGOMP_FILE_SPEC)); do \
- $(INSTALL_DIR) $(1)/lib ; \
-@@ -723,6 +763,7 @@ endif
- $(eval $(call BuildPackage,libc))
- $(eval $(call BuildPackage,libgcc))
- $(eval $(call BuildPackage,libatomic))
-+$(eval $(call BuildPackage,libquadmath))
- $(eval $(call BuildPackage,libstdcpp))
- $(eval $(call BuildPackage,libasan))
- $(eval $(call BuildPackage,libtsan))
---
-2.43.5
-
diff --git a/openwrt/patch/generic/200-toolchain-gcc-update-to-13.2.patch b/openwrt/patch/generic/200-toolchain-gcc-update-to-13.2.patch
deleted file mode 100644
index 31e048c3c..000000000
--- a/openwrt/patch/generic/200-toolchain-gcc-update-to-13.2.patch
+++ /dev/null
@@ -1,2206 +0,0 @@
-From bd47c3f6ab80a3ebd69f7793de94ef3fc1592c1f Mon Sep 17 00:00:00 2001
-From: sbwml
-Date: Fri, 16 Feb 2024 23:44:25 +0800
-Subject: [PATCH] toolchain: gcc: update to 13.2
-
-Signed-off-by: sbwml
----
- toolchain/gcc/Config.version | 2 +-
- toolchain/gcc/common.mk | 4 +-
- ...imization-109585-alias-analysis-typo.patch | 69 -
- .../700-RISCV-Inline-subword-atomic-ops.patch | 2021 -----------------
- ...linux-Don-t-add-latomic-with-pthread.patch | 36 -
- .../gcc/patches-13.x/910-mbsd_multi.patch | 2 +-
- 6 files changed, 4 insertions(+), 2130 deletions(-)
- delete mode 100644 toolchain/gcc/patches-13.x/001-rtl-optimization-109585-alias-analysis-typo.patch
- delete mode 100644 toolchain/gcc/patches-13.x/700-RISCV-Inline-subword-atomic-ops.patch
- delete mode 100644 toolchain/gcc/patches-13.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch
-
-diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version
-index e40d6b2..92033af 100644
---- a/toolchain/gcc/Config.version
-+++ b/toolchain/gcc/Config.version
-@@ -9,7 +9,7 @@ config GCC_VERSION_13
- config GCC_VERSION
- string
- default "11.3.0" if GCC_VERSION_11
-- default "13.1.0" if GCC_VERSION_13
-+ default "13.2.0" if GCC_VERSION_13
- default "12.3.0"
-
- config GCC_USE_DEFAULT_VERSION
-diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
-index 31a1492..cdbf9fa 100644
---- a/toolchain/gcc/common.mk
-+++ b/toolchain/gcc/common.mk
-@@ -38,8 +38,8 @@ ifeq ($(PKG_VERSION),12.3.0)
- PKG_HASH:=949a5d4f99e786421a93b532b22ffab5578de7321369975b91aec97adfda8c3b
- endif
-
--ifeq ($(PKG_VERSION),13.1.0)
-- PKG_HASH:=61d684f0aa5e76ac6585ad8898a2427aade8979ed5e7f85492286c4dfc13ee86
-+ifeq ($(PKG_VERSION),13.2.0)
-+ PKG_HASH:=e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da
- endif
-
- PATCH_DIR=../patches-$(GCC_MAJOR_VERSION).x
-diff --git a/toolchain/gcc/patches-13.x/001-rtl-optimization-109585-alias-analysis-typo.patch b/toolchain/gcc/patches-13.x/001-rtl-optimization-109585-alias-analysis-typo.patch
-deleted file mode 100644
-index 7f73be4..0000000
---- a/toolchain/gcc/patches-13.x/001-rtl-optimization-109585-alias-analysis-typo.patch
-+++ /dev/null
-@@ -1,69 +0,0 @@
--From bb406a6aea336966681927a27f54ee89c4fd4ea1 Mon Sep 17 00:00:00 2001
--From: Richard Biener
--Date: Mon, 24 Apr 2023 13:31:07 +0200
--Subject: [PATCH] rtl-optimization/109585 - alias analysis typo
--
--When r10-514-gc6b84edb6110dd2b4fb improved access path analysis
--it introduced a typo that triggers when there's an access to a
--trailing array in the first access path leading to false
--disambiguation.
--
-- PR rtl-optimization/109585
-- * tree-ssa-alias.cc (aliasing_component_refs_p): Fix typo.
--
-- * gcc.dg/torture/pr109585.c: New testcase.
--
--(cherry picked from commit 6d4bd27a60447c7505cb4783e675e98a191a8904)
-----
-- gcc/testsuite/gcc.dg/torture/pr109585.c | 33 +++++++++++++++++++++++++
-- gcc/tree-ssa-alias.cc | 2 +-
-- 2 files changed, 34 insertions(+), 1 deletion(-)
-- create mode 100644 gcc/testsuite/gcc.dg/torture/pr109585.c
--
----- /dev/null
--+++ b/gcc/testsuite/gcc.dg/torture/pr109585.c
--@@ -0,0 +1,33 @@
--+/* { dg-do run } */
--+
--+#include
--+
--+struct P {
--+ long v;
--+ struct P *n;
--+};
--+
--+struct F {
--+ long x;
--+ struct P fam[];
--+};
--+
--+int __attribute__((noipa))
--+f(struct F *f, int i)
--+{
--+ struct P *p = f->fam;
--+ asm("" : "+r"(f): "r"(p));
--+ p->v = 0;
--+ p->n = 0;
--+ return f->fam->n != 0;
--+}
--+
--+int
--+main()
--+{
--+ struct F *m = malloc (sizeof (long) + 2 * sizeof (struct P));
--+ m->fam[0].n = &m->fam[1];
--+ if (f (m, 0))
--+ abort ();
--+ return 0;
--+}
----- a/gcc/tree-ssa-alias.cc
--+++ b/gcc/tree-ssa-alias.cc
--@@ -1330,7 +1330,7 @@ aliasing_component_refs_p (tree ref1,
-- /* If we didn't find a common base, try the other way around. */
-- if (cmp_outer <= 0
-- || (end_struct_ref1
--- && compare_type_sizes (TREE_TYPE (end_struct_ref1), type1) <= 0))
--+ && compare_type_sizes (TREE_TYPE (end_struct_ref1), type2) <= 0))
-- {
-- int res = aliasing_component_refs_walk (ref2, type2, base2,
-- offset2, max_size2,
-diff --git a/toolchain/gcc/patches-13.x/700-RISCV-Inline-subword-atomic-ops.patch b/toolchain/gcc/patches-13.x/700-RISCV-Inline-subword-atomic-ops.patch
-deleted file mode 100644
-index 752480b..0000000
---- a/toolchain/gcc/patches-13.x/700-RISCV-Inline-subword-atomic-ops.patch
-+++ /dev/null
-@@ -1,2021 +0,0 @@
--From f797260adaf52bee0ec0e16190bbefbe1bfc3692 Mon Sep 17 00:00:00 2001
--From: Patrick O'Neill
--Date: Tue, 18 Apr 2023 14:33:13 -0700
--Subject: [PATCH] RISCV: Inline subword atomic ops
--
--RISC-V has no support for subword atomic operations; code currently
--generates libatomic library calls.
--
--This patch changes the default behavior to inline subword atomic calls
--(using the same logic as the existing library call).
--Behavior can be specified using the -minline-atomics and
---mno-inline-atomics command line flags.
--
--gcc/libgcc/config/riscv/atomic.c has the same logic implemented in asm.
--This will need to stay for backwards compatibility and the
---mno-inline-atomics flag.
--
--2023-04-18 Patrick O'Neill
--
--gcc/ChangeLog:
-- PR target/104338
-- * config/riscv/riscv-protos.h: Add helper function stubs.
-- * config/riscv/riscv.cc: Add helper functions for subword masking.
-- * config/riscv/riscv.opt: Add command-line flag.
-- * config/riscv/sync.md: Add masking logic and inline asm for fetch_and_op,
-- fetch_and_nand, CAS, and exchange ops.
-- * doc/invoke.texi: Add blurb regarding command-line flag.
--
--libgcc/ChangeLog:
-- PR target/104338
-- * config/riscv/atomic.c: Add reference to duplicate logic.
--
--gcc/testsuite/ChangeLog:
-- PR target/104338
-- * gcc.target/riscv/inline-atomics-1.c: New test.
-- * gcc.target/riscv/inline-atomics-2.c: New test.
-- * gcc.target/riscv/inline-atomics-3.c: New test.
-- * gcc.target/riscv/inline-atomics-4.c: New test.
-- * gcc.target/riscv/inline-atomics-5.c: New test.
-- * gcc.target/riscv/inline-atomics-6.c: New test.
-- * gcc.target/riscv/inline-atomics-7.c: New test.
-- * gcc.target/riscv/inline-atomics-8.c: New test.
--
--Signed-off-by: Patrick O'Neill
--Signed-off-by: Palmer Dabbelt
-----
-- gcc/config/riscv/riscv-protos.h | 2 +
-- gcc/config/riscv/riscv.cc | 49 ++
-- gcc/config/riscv/riscv.opt | 4 +
-- gcc/config/riscv/sync.md | 301 +++++++++
-- gcc/doc/invoke.texi | 10 +-
-- .../gcc.target/riscv/inline-atomics-1.c | 18 +
-- .../gcc.target/riscv/inline-atomics-2.c | 9 +
-- .../gcc.target/riscv/inline-atomics-3.c | 569 ++++++++++++++++++
-- .../gcc.target/riscv/inline-atomics-4.c | 566 +++++++++++++++++
-- .../gcc.target/riscv/inline-atomics-5.c | 87 +++
-- .../gcc.target/riscv/inline-atomics-6.c | 87 +++
-- .../gcc.target/riscv/inline-atomics-7.c | 69 +++
-- .../gcc.target/riscv/inline-atomics-8.c | 69 +++
-- libgcc/config/riscv/atomic.c | 2 +
-- 14 files changed, 1841 insertions(+), 1 deletion(-)
-- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-1.c
-- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-2.c
-- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-3.c
-- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-4.c
-- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-5.c
-- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-6.c
-- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-7.c
-- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-8.c
--
----- a/gcc/config/riscv/riscv-protos.h
--+++ b/gcc/config/riscv/riscv-protos.h
--@@ -79,6 +79,8 @@ extern void riscv_reinit (void);
-- extern poly_uint64 riscv_regmode_natural_size (machine_mode);
-- extern bool riscv_v_ext_vector_mode_p (machine_mode);
-- extern bool riscv_shamt_matches_mask_p (int, HOST_WIDE_INT);
--+extern void riscv_subword_address (rtx, rtx *, rtx *, rtx *, rtx *);
--+extern void riscv_lshift_subword (machine_mode, rtx, rtx, rtx *);
--
-- /* Routines implemented in riscv-c.cc. */
-- void riscv_cpu_cpp_builtins (cpp_reader *);
----- a/gcc/config/riscv/riscv.cc
--+++ b/gcc/config/riscv/riscv.cc
--@@ -7143,6 +7143,55 @@ riscv_zero_call_used_regs (HARD_REG_SET
-- & ~zeroed_hardregs);
-- }
--
--+/* Given memory reference MEM, expand code to compute the aligned
--+ memory address, shift and mask values and store them into
--+ *ALIGNED_MEM, *SHIFT, *MASK and *NOT_MASK. */
--+
--+void
--+riscv_subword_address (rtx mem, rtx *aligned_mem, rtx *shift, rtx *mask,
--+ rtx *not_mask)
--+{
--+ /* Align the memory address to a word. */
--+ rtx addr = force_reg (Pmode, XEXP (mem, 0));
--+
--+ rtx addr_mask = gen_int_mode (-4, Pmode);
--+
--+ rtx aligned_addr = gen_reg_rtx (Pmode);
--+ emit_move_insn (aligned_addr, gen_rtx_AND (Pmode, addr, addr_mask));
--+
--+ *aligned_mem = change_address (mem, SImode, aligned_addr);
--+
--+ /* Calculate the shift amount. */
--+ emit_move_insn (*shift, gen_rtx_AND (SImode, gen_lowpart (SImode, addr),
--+ gen_int_mode (3, SImode)));
--+ emit_move_insn (*shift, gen_rtx_ASHIFT (SImode, *shift,
--+ gen_int_mode (3, SImode)));
--+
--+ /* Calculate the mask. */
--+ int unshifted_mask = GET_MODE_MASK (GET_MODE (mem));
--+
--+ emit_move_insn (*mask, gen_int_mode (unshifted_mask, SImode));
--+
--+ emit_move_insn (*mask, gen_rtx_ASHIFT (SImode, *mask,
--+ gen_lowpart (QImode, *shift)));
--+
--+ emit_move_insn (*not_mask, gen_rtx_NOT(SImode, *mask));
--+}
--+
--+/* Leftshift a subword within an SImode register. */
--+
--+void
--+riscv_lshift_subword (machine_mode mode, rtx value, rtx shift,
--+ rtx *shifted_value)
--+{
--+ rtx value_reg = gen_reg_rtx (SImode);
--+ emit_move_insn (value_reg, simplify_gen_subreg (SImode, value,
--+ mode, 0));
--+
--+ emit_move_insn(*shifted_value, gen_rtx_ASHIFT (SImode, value_reg,
--+ gen_lowpart (QImode, shift)));
--+}
--+
-- /* Initialize the GCC target structure. */
-- #undef TARGET_ASM_ALIGNED_HI_OP
-- #define TARGET_ASM_ALIGNED_HI_OP "\t.half\t"
----- a/gcc/config/riscv/riscv.opt
--+++ b/gcc/config/riscv/riscv.opt
--@@ -238,6 +238,10 @@ int riscv_sv_subext
-- TargetVariable
-- int riscv_xthead_subext
--
--+minline-atomics
--+Target Var(TARGET_INLINE_SUBWORD_ATOMIC) Init(1)
--+Always inline subword atomic operations.
--+
-- Enum
-- Name(isa_spec_class) Type(enum riscv_isa_spec_class)
-- Supported ISA specs (for use with the -misa-spec= option):
----- a/gcc/config/riscv/sync.md
--+++ b/gcc/config/riscv/sync.md
--@@ -21,8 +21,11 @@
--
-- (define_c_enum "unspec" [
-- UNSPEC_COMPARE_AND_SWAP
--+ UNSPEC_COMPARE_AND_SWAP_SUBWORD
-- UNSPEC_SYNC_OLD_OP
--+ UNSPEC_SYNC_OLD_OP_SUBWORD
-- UNSPEC_SYNC_EXCHANGE
--+ UNSPEC_SYNC_EXCHANGE_SUBWORD
-- UNSPEC_ATOMIC_STORE
-- UNSPEC_MEMORY_BARRIER
-- ])
--@@ -91,6 +94,135 @@
-- [(set_attr "type" "atomic")
-- (set (attr "length") (const_int 8))])
--
--+(define_insn "subword_atomic_fetch_strong_"
--+ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
--+ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
--+ (set (match_dup 1)
--+ (unspec_volatile:SI
--+ [(any_atomic:SI (match_dup 1)
--+ (match_operand:SI 2 "register_operand" "rI")) ;; value for op
--+ (match_operand:SI 3 "register_operand" "rI")] ;; mask
--+ UNSPEC_SYNC_OLD_OP_SUBWORD))
--+ (match_operand:SI 4 "register_operand" "rI") ;; not_mask
--+ (clobber (match_scratch:SI 5 "=&r")) ;; tmp_1
--+ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_2
--+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
--+ {
--+ return "1:\;"
--+ "lr.w.aq\t%0, %1\;"
--+ "\t%5, %0, %2\;"
--+ "and\t%5, %5, %3\;"
--+ "and\t%6, %0, %4\;"
--+ "or\t%6, %6, %5\;"
--+ "sc.w.rl\t%5, %6, %1\;"
--+ "bnez\t%5, 1b";
--+ }
--+ [(set (attr "length") (const_int 28))])
--+
--+(define_expand "atomic_fetch_nand"
--+ [(match_operand:SHORT 0 "register_operand") ;; old value at mem
--+ (not:SHORT (and:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location
--+ (match_operand:SHORT 2 "reg_or_0_operand"))) ;; value for op
--+ (match_operand:SI 3 "const_int_operand")] ;; model
--+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
--+{
--+ /* We have no QImode/HImode atomics, so form a mask, then use
--+ subword_atomic_fetch_strong_nand to implement a LR/SC version of the
--+ operation. */
--+
--+ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining
--+ is disabled */
--+
--+ rtx old = gen_reg_rtx (SImode);
--+ rtx mem = operands[1];
--+ rtx value = operands[2];
--+ rtx aligned_mem = gen_reg_rtx (SImode);
--+ rtx shift = gen_reg_rtx (SImode);
--+ rtx mask = gen_reg_rtx (SImode);
--+ rtx not_mask = gen_reg_rtx (SImode);
--+
--+ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask);
--+
--+ rtx shifted_value = gen_reg_rtx (SImode);
--+ riscv_lshift_subword (mode, value, shift, &shifted_value);
--+
--+ emit_insn (gen_subword_atomic_fetch_strong_nand (old, aligned_mem,
--+ shifted_value,
--+ mask, not_mask));
--+
--+ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old,
--+ gen_lowpart (QImode, shift)));
--+
--+ emit_move_insn (operands[0], gen_lowpart (mode, old));
--+
--+ DONE;
--+})
--+
--+(define_insn "subword_atomic_fetch_strong_nand"
--+ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
--+ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
--+ (set (match_dup 1)
--+ (unspec_volatile:SI
--+ [(not:SI (and:SI (match_dup 1)
--+ (match_operand:SI 2 "register_operand" "rI"))) ;; value for op
--+ (match_operand:SI 3 "register_operand" "rI")] ;; mask
--+ UNSPEC_SYNC_OLD_OP_SUBWORD))
--+ (match_operand:SI 4 "register_operand" "rI") ;; not_mask
--+ (clobber (match_scratch:SI 5 "=&r")) ;; tmp_1
--+ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_2
--+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
--+ {
--+ return "1:\;"
--+ "lr.w.aq\t%0, %1\;"
--+ "and\t%5, %0, %2\;"
--+ "not\t%5, %5\;"
--+ "and\t%5, %5, %3\;"
--+ "and\t%6, %0, %4\;"
--+ "or\t%6, %6, %5\;"
--+ "sc.w.rl\t%5, %6, %1\;"
--+ "bnez\t%5, 1b";
--+ }
--+ [(set (attr "length") (const_int 32))])
--+
--+(define_expand "atomic_fetch_"
--+ [(match_operand:SHORT 0 "register_operand") ;; old value at mem
--+ (any_atomic:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location
--+ (match_operand:SHORT 2 "reg_or_0_operand")) ;; value for op
--+ (match_operand:SI 3 "const_int_operand")] ;; model
--+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
--+{
--+ /* We have no QImode/HImode atomics, so form a mask, then use
--+ subword_atomic_fetch_strong_ to implement a LR/SC version of the
--+ operation. */
--+
--+ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining
--+ is disabled */
--+
--+ rtx old = gen_reg_rtx (SImode);
--+ rtx mem = operands[1];
--+ rtx value = operands[2];
--+ rtx aligned_mem = gen_reg_rtx (SImode);
--+ rtx shift = gen_reg_rtx (SImode);
--+ rtx mask = gen_reg_rtx (SImode);
--+ rtx not_mask = gen_reg_rtx (SImode);
--+
--+ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask);
--+
--+ rtx shifted_value = gen_reg_rtx (SImode);
--+ riscv_lshift_subword (mode, value, shift, &shifted_value);
--+
--+ emit_insn (gen_subword_atomic_fetch_strong_ (old, aligned_mem,
--+ shifted_value,
--+ mask, not_mask));
--+
--+ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old,
--+ gen_lowpart (QImode, shift)));
--+
--+ emit_move_insn (operands[0], gen_lowpart (mode, old));
--+
--+ DONE;
--+})
--+
-- (define_insn "atomic_exchange"
-- [(set (match_operand:GPR 0 "register_operand" "=&r")
-- (unspec_volatile:GPR
--@@ -104,6 +236,56 @@
-- [(set_attr "type" "atomic")
-- (set (attr "length") (const_int 8))])
--
--+(define_expand "atomic_exchange"
--+ [(match_operand:SHORT 0 "register_operand") ;; old value at mem
--+ (match_operand:SHORT 1 "memory_operand") ;; mem location
--+ (match_operand:SHORT 2 "register_operand") ;; value
--+ (match_operand:SI 3 "const_int_operand")] ;; model
--+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
--+{
--+ rtx old = gen_reg_rtx (SImode);
--+ rtx mem = operands[1];
--+ rtx value = operands[2];
--+ rtx aligned_mem = gen_reg_rtx (SImode);
--+ rtx shift = gen_reg_rtx (SImode);
--+ rtx mask = gen_reg_rtx (SImode);
--+ rtx not_mask = gen_reg_rtx (SImode);
--+
--+ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask);
--+
--+ rtx shifted_value = gen_reg_rtx (SImode);
--+ riscv_lshift_subword (mode, value, shift, &shifted_value);
--+
--+ emit_insn (gen_subword_atomic_exchange_strong (old, aligned_mem,
--+ shifted_value, not_mask));
--+
--+ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old,
--+ gen_lowpart (QImode, shift)));
--+
--+ emit_move_insn (operands[0], gen_lowpart (mode, old));
--+ DONE;
--+})
--+
--+(define_insn "subword_atomic_exchange_strong"
--+ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
--+ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
--+ (set (match_dup 1)
--+ (unspec_volatile:SI
--+ [(match_operand:SI 2 "reg_or_0_operand" "rI") ;; value
--+ (match_operand:SI 3 "reg_or_0_operand" "rI")] ;; not_mask
--+ UNSPEC_SYNC_EXCHANGE_SUBWORD))
--+ (clobber (match_scratch:SI 4 "=&r"))] ;; tmp_1
--+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
--+ {
--+ return "1:\;"
--+ "lr.w.aq\t%0, %1\;"
--+ "and\t%4, %0, %3\;"
--+ "or\t%4, %4, %2\;"
--+ "sc.w.rl\t%4, %4, %1\;"
--+ "bnez\t%4, 1b";
--+ }
--+ [(set (attr "length") (const_int 20))])
--+
-- (define_insn "atomic_cas_value_strong"
-- [(set (match_operand:GPR 0 "register_operand" "=&r")
-- (match_operand:GPR 1 "memory_operand" "+A"))
--@@ -153,6 +335,125 @@
-- DONE;
-- })
--
--+(define_expand "atomic_compare_and_swap"
--+ [(match_operand:SI 0 "register_operand") ;; bool output
--+ (match_operand:SHORT 1 "register_operand") ;; val output
--+ (match_operand:SHORT 2 "memory_operand") ;; memory
--+ (match_operand:SHORT 3 "reg_or_0_operand") ;; expected value
--+ (match_operand:SHORT 4 "reg_or_0_operand") ;; desired value
--+ (match_operand:SI 5 "const_int_operand") ;; is_weak
--+ (match_operand:SI 6 "const_int_operand") ;; mod_s
--+ (match_operand:SI 7 "const_int_operand")] ;; mod_f
--+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
--+{
--+ emit_insn (gen_atomic_cas_value_strong (operands[1], operands[2],
--+ operands[3], operands[4],
--+ operands[6], operands[7]));
--+
--+ rtx val = gen_reg_rtx (SImode);
--+ if (operands[1] != const0_rtx)
--+ emit_move_insn (val, gen_rtx_SIGN_EXTEND (SImode, operands[1]));
--+ else
--+ emit_move_insn (val, const0_rtx);
--+
--+ rtx exp = gen_reg_rtx (SImode);
--+ if (operands[3] != const0_rtx)
--+ emit_move_insn (exp, gen_rtx_SIGN_EXTEND (SImode, operands[3]));
--+ else
--+ emit_move_insn (exp, const0_rtx);
--+
--+ rtx compare = val;
--+ if (exp != const0_rtx)
--+ {
--+ rtx difference = gen_rtx_MINUS (SImode, val, exp);
--+ compare = gen_reg_rtx (SImode);
--+ emit_move_insn (compare, difference);
--+ }
--+
--+ if (word_mode != SImode)
--+ {
--+ rtx reg = gen_reg_rtx (word_mode);
--+ emit_move_insn (reg, gen_rtx_SIGN_EXTEND (word_mode, compare));
--+ compare = reg;
--+ }
--+
--+ emit_move_insn (operands[0], gen_rtx_EQ (SImode, compare, const0_rtx));
--+ DONE;
--+})
--+
--+(define_expand "atomic_cas_value_strong"
--+ [(match_operand:SHORT 0 "register_operand") ;; val output
--+ (match_operand:SHORT 1 "memory_operand") ;; memory
--+ (match_operand:SHORT 2 "reg_or_0_operand") ;; expected value
--+ (match_operand:SHORT 3 "reg_or_0_operand") ;; desired value
--+ (match_operand:SI 4 "const_int_operand") ;; mod_s
--+ (match_operand:SI 5 "const_int_operand") ;; mod_f
--+ (match_scratch:SHORT 6)]
--+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
--+{
--+ /* We have no QImode/HImode atomics, so form a mask, then use
--+ subword_atomic_cas_strong to implement a LR/SC version of the
--+ operation. */
--+
--+ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining
--+ is disabled */
--+
--+ rtx old = gen_reg_rtx (SImode);
--+ rtx mem = operands[1];
--+ rtx aligned_mem = gen_reg_rtx (SImode);
--+ rtx shift = gen_reg_rtx (SImode);
--+ rtx mask = gen_reg_rtx (SImode);
--+ rtx not_mask = gen_reg_rtx (SImode);
--+
--+ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask);
--+
--+ rtx o = operands[2];
--+ rtx n = operands[3];
--+ rtx shifted_o = gen_reg_rtx (SImode);
--+ rtx shifted_n = gen_reg_rtx (SImode);
--+
--+ riscv_lshift_subword (mode, o, shift, &shifted_o);
--+ riscv_lshift_subword (mode, n, shift, &shifted_n);
--+
--+ emit_move_insn (shifted_o, gen_rtx_AND (SImode, shifted_o, mask));
--+ emit_move_insn (shifted_n, gen_rtx_AND (SImode, shifted_n, mask));
--+
--+ emit_insn (gen_subword_atomic_cas_strong (old, aligned_mem,
--+ shifted_o, shifted_n,
--+ mask, not_mask));
--+
--+ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old,
--+ gen_lowpart (QImode, shift)));
--+
--+ emit_move_insn (operands[0], gen_lowpart (mode, old));
--+
--+ DONE;
--+})
--+
--+(define_insn "subword_atomic_cas_strong"
--+ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
--+ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
--+ (set (match_dup 1)
--+ (unspec_volatile:SI [(match_operand:SI 2 "reg_or_0_operand" "rJ") ;; expected value
--+ (match_operand:SI 3 "reg_or_0_operand" "rJ")] ;; desired value
--+ UNSPEC_COMPARE_AND_SWAP_SUBWORD))
--+ (match_operand:SI 4 "register_operand" "rI") ;; mask
--+ (match_operand:SI 5 "register_operand" "rI") ;; not_mask
--+ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_1
--+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
--+ {
--+ return "1:\;"
--+ "lr.w.aq\t%0, %1\;"
--+ "and\t%6, %0, %4\;"
--+ "bne\t%6, %z2, 1f\;"
--+ "and\t%6, %0, %5\;"
--+ "or\t%6, %6, %3\;"
--+ "sc.w.rl\t%6, %6, %1\;"
--+ "bnez\t%6, 1b\;"
--+ "1:";
--+ }
--+ [(set (attr "length") (const_int 28))])
--+
-- (define_expand "atomic_test_and_set"
-- [(match_operand:QI 0 "register_operand" "") ;; bool output
-- (match_operand:QI 1 "memory_operand" "+A") ;; memory
----- a/gcc/doc/invoke.texi
--+++ b/gcc/doc/invoke.texi
--@@ -1226,7 +1226,8 @@ See RS/6000 and PowerPC Options.
-- -mbig-endian -mlittle-endian
-- -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg}
-- -mstack-protector-guard-offset=@var{offset}
----mcsr-check -mno-csr-check}
--+-mcsr-check -mno-csr-check
--+-minline-atomics -mno-inline-atomics}
--
-- @emph{RL78 Options}
-- @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
--@@ -29006,6 +29007,13 @@ Do or don't use smaller but slower prolo
-- library function calls. The default is to use fast inline prologues and
-- epilogues.
--
--+@opindex minline-atomics
--+@item -minline-atomics
--+@itemx -mno-inline-atomics
--+Do or don't use smaller but slower subword atomic emulation code that uses
--+libatomic function calls. The default is to use fast inline subword atomics
--+that do not require libatomic.
--+
-- @opindex mshorten-memrefs
-- @item -mshorten-memrefs
-- @itemx -mno-shorten-memrefs
----- /dev/null
--+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-1.c
--@@ -0,0 +1,18 @@
--+/* { dg-do compile } */
--+/* { dg-options "-mno-inline-atomics" } */
--+/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "fetch_and_nand" { target *-*-* } 0 } */
--+/* { dg-final { scan-assembler "\tcall\t__sync_fetch_and_add_1" } } */
--+/* { dg-final { scan-assembler "\tcall\t__sync_fetch_and_nand_1" } } */
--+/* { dg-final { scan-assembler "\tcall\t__sync_bool_compare_and_swap_1" } } */
--+
--+char foo;
--+char bar;
--+char baz;
--+
--+int
--+main ()
--+{
--+ __sync_fetch_and_add(&foo, 1);
--+ __sync_fetch_and_nand(&bar, 1);
--+ __sync_bool_compare_and_swap (&baz, 1, 2);
--+}
----- /dev/null
--+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-2.c
--@@ -0,0 +1,9 @@
--+/* { dg-do compile } */
--+/* Verify that subword atomics do not generate calls. */
--+/* { dg-options "-minline-atomics" } */
--+/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "fetch_and_nand" { target *-*-* } 0 } */
--+/* { dg-final { scan-assembler-not "\tcall\t__sync_fetch_and_add_1" } } */
--+/* { dg-final { scan-assembler-not "\tcall\t__sync_fetch_and_nand_1" } } */
--+/* { dg-final { scan-assembler-not "\tcall\t__sync_bool_compare_and_swap_1" } } */
--+
--+#include "inline-atomics-1.c"
--\ No newline at end of file
----- /dev/null
--+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-3.c
--@@ -0,0 +1,569 @@
--+/* Check all char alignments. */
--+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-op-1.c */
--+/* Test __atomic routines for existence and proper execution on 1 byte
--+ values with each valid memory model. */
--+/* { dg-do run } */
--+/* { dg-options "-minline-atomics -Wno-address-of-packed-member" } */
--+
--+/* Test the execution of the __atomic_*OP builtin routines for a char. */
--+
--+extern void abort(void);
--+
--+char count, res;
--+const char init = ~0;
--+
--+struct A
--+{
--+ char a;
--+ char b;
--+ char c;
--+ char d;
--+} __attribute__ ((packed)) A;
--+
--+/* The fetch_op routines return the original value before the operation. */
--+
--+void
--+test_fetch_add (char* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ if (__atomic_fetch_add (v, count, __ATOMIC_RELAXED) != 0)
--+ abort ();
--+
--+ if (__atomic_fetch_add (v, 1, __ATOMIC_CONSUME) != 1)
--+ abort ();
--+
--+ if (__atomic_fetch_add (v, count, __ATOMIC_ACQUIRE) != 2)
--+ abort ();
--+
--+ if (__atomic_fetch_add (v, 1, __ATOMIC_RELEASE) != 3)
--+ abort ();
--+
--+ if (__atomic_fetch_add (v, count, __ATOMIC_ACQ_REL) != 4)
--+ abort ();
--+
--+ if (__atomic_fetch_add (v, 1, __ATOMIC_SEQ_CST) != 5)
--+ abort ();
--+}
--+
--+
--+void
--+test_fetch_sub (char* v)
--+{
--+ *v = res = 20;
--+ count = 0;
--+
--+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_RELAXED) != res--)
--+ abort ();
--+
--+ if (__atomic_fetch_sub (v, 1, __ATOMIC_CONSUME) != res--)
--+ abort ();
--+
--+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQUIRE) != res--)
--+ abort ();
--+
--+ if (__atomic_fetch_sub (v, 1, __ATOMIC_RELEASE) != res--)
--+ abort ();
--+
--+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQ_REL) != res--)
--+ abort ();
--+
--+ if (__atomic_fetch_sub (v, 1, __ATOMIC_SEQ_CST) != res--)
--+ abort ();
--+}
--+
--+void
--+test_fetch_and (char* v)
--+{
--+ *v = init;
--+
--+ if (__atomic_fetch_and (v, 0, __ATOMIC_RELAXED) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_and (v, init, __ATOMIC_CONSUME) != 0)
--+ abort ();
--+
--+ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQUIRE) != 0)
--+ abort ();
--+
--+ *v = ~*v;
--+ if (__atomic_fetch_and (v, init, __ATOMIC_RELEASE) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQ_REL) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST) != 0)
--+ abort ();
--+}
--+
--+void
--+test_fetch_nand (char* v)
--+{
--+ *v = init;
--+
--+ if (__atomic_fetch_nand (v, 0, __ATOMIC_RELAXED) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_nand (v, init, __ATOMIC_CONSUME) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_nand (v, 0, __ATOMIC_ACQUIRE) != 0 )
--+ abort ();
--+
--+ if (__atomic_fetch_nand (v, init, __ATOMIC_RELEASE) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL) != 0)
--+ abort ();
--+
--+ if (__atomic_fetch_nand (v, 0, __ATOMIC_SEQ_CST) != init)
--+ abort ();
--+}
--+
--+void
--+test_fetch_xor (char* v)
--+{
--+ *v = init;
--+ count = 0;
--+
--+ if (__atomic_fetch_xor (v, count, __ATOMIC_RELAXED) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQUIRE) != 0)
--+ abort ();
--+
--+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE) != 0)
--+ abort ();
--+
--+ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_SEQ_CST) != init)
--+ abort ();
--+}
--+
--+void
--+test_fetch_or (char* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ if (__atomic_fetch_or (v, count, __ATOMIC_RELAXED) != 0)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_fetch_or (v, 2, __ATOMIC_CONSUME) != 1)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_fetch_or (v, count, __ATOMIC_ACQUIRE) != 3)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_fetch_or (v, 8, __ATOMIC_RELEASE) != 7)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_fetch_or (v, count, __ATOMIC_ACQ_REL) != 15)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_fetch_or (v, count, __ATOMIC_SEQ_CST) != 31)
--+ abort ();
--+}
--+
--+/* The OP_fetch routines return the new value after the operation. */
--+
--+void
--+test_add_fetch (char* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ if (__atomic_add_fetch (v, count, __ATOMIC_RELAXED) != 1)
--+ abort ();
--+
--+ if (__atomic_add_fetch (v, 1, __ATOMIC_CONSUME) != 2)
--+ abort ();
--+
--+ if (__atomic_add_fetch (v, count, __ATOMIC_ACQUIRE) != 3)
--+ abort ();
--+
--+ if (__atomic_add_fetch (v, 1, __ATOMIC_RELEASE) != 4)
--+ abort ();
--+
--+ if (__atomic_add_fetch (v, count, __ATOMIC_ACQ_REL) != 5)
--+ abort ();
--+
--+ if (__atomic_add_fetch (v, count, __ATOMIC_SEQ_CST) != 6)
--+ abort ();
--+}
--+
--+
--+void
--+test_sub_fetch (char* v)
--+{
--+ *v = res = 20;
--+ count = 0;
--+
--+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED) != --res)
--+ abort ();
--+
--+ if (__atomic_sub_fetch (v, 1, __ATOMIC_CONSUME) != --res)
--+ abort ();
--+
--+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQUIRE) != --res)
--+ abort ();
--+
--+ if (__atomic_sub_fetch (v, 1, __ATOMIC_RELEASE) != --res)
--+ abort ();
--+
--+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL) != --res)
--+ abort ();
--+
--+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_SEQ_CST) != --res)
--+ abort ();
--+}
--+
--+void
--+test_and_fetch (char* v)
--+{
--+ *v = init;
--+
--+ if (__atomic_and_fetch (v, 0, __ATOMIC_RELAXED) != 0)
--+ abort ();
--+
--+ *v = init;
--+ if (__atomic_and_fetch (v, init, __ATOMIC_CONSUME) != init)
--+ abort ();
--+
--+ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE) != 0)
--+ abort ();
--+
--+ *v = ~*v;
--+ if (__atomic_and_fetch (v, init, __ATOMIC_RELEASE) != init)
--+ abort ();
--+
--+ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL) != 0)
--+ abort ();
--+
--+ *v = ~*v;
--+ if (__atomic_and_fetch (v, 0, __ATOMIC_SEQ_CST) != 0)
--+ abort ();
--+}
--+
--+void
--+test_nand_fetch (char* v)
--+{
--+ *v = init;
--+
--+ if (__atomic_nand_fetch (v, 0, __ATOMIC_RELAXED) != init)
--+ abort ();
--+
--+ if (__atomic_nand_fetch (v, init, __ATOMIC_CONSUME) != 0)
--+ abort ();
--+
--+ if (__atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE) != init)
--+ abort ();
--+
--+ if (__atomic_nand_fetch (v, init, __ATOMIC_RELEASE) != 0)
--+ abort ();
--+
--+ if (__atomic_nand_fetch (v, init, __ATOMIC_ACQ_REL) != init)
--+ abort ();
--+
--+ if (__atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST) != init)
--+ abort ();
--+}
--+
--+
--+
--+void
--+test_xor_fetch (char* v)
--+{
--+ *v = init;
--+ count = 0;
--+
--+ if (__atomic_xor_fetch (v, count, __ATOMIC_RELAXED) != init)
--+ abort ();
--+
--+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_CONSUME) != 0)
--+ abort ();
--+
--+ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE) != 0)
--+ abort ();
--+
--+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_RELEASE) != init)
--+ abort ();
--+
--+ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQ_REL) != init)
--+ abort ();
--+
--+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST) != 0)
--+ abort ();
--+}
--+
--+void
--+test_or_fetch (char* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ if (__atomic_or_fetch (v, count, __ATOMIC_RELAXED) != 1)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_or_fetch (v, 2, __ATOMIC_CONSUME) != 3)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_or_fetch (v, count, __ATOMIC_ACQUIRE) != 7)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_or_fetch (v, 8, __ATOMIC_RELEASE) != 15)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_or_fetch (v, count, __ATOMIC_ACQ_REL) != 31)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_or_fetch (v, count, __ATOMIC_SEQ_CST) != 63)
--+ abort ();
--+}
--+
--+
--+/* Test the OP routines with a result which isn't used. Use both variations
--+ within each function. */
--+
--+void
--+test_add (char* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ __atomic_add_fetch (v, count, __ATOMIC_RELAXED);
--+ if (*v != 1)
--+ abort ();
--+
--+ __atomic_fetch_add (v, count, __ATOMIC_CONSUME);
--+ if (*v != 2)
--+ abort ();
--+
--+ __atomic_add_fetch (v, 1 , __ATOMIC_ACQUIRE);
--+ if (*v != 3)
--+ abort ();
--+
--+ __atomic_fetch_add (v, 1, __ATOMIC_RELEASE);
--+ if (*v != 4)
--+ abort ();
--+
--+ __atomic_add_fetch (v, count, __ATOMIC_ACQ_REL);
--+ if (*v != 5)
--+ abort ();
--+
--+ __atomic_fetch_add (v, count, __ATOMIC_SEQ_CST);
--+ if (*v != 6)
--+ abort ();
--+}
--+
--+
--+void
--+test_sub (char* v)
--+{
--+ *v = res = 20;
--+ count = 0;
--+
--+ __atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED);
--+ if (*v != --res)
--+ abort ();
--+
--+ __atomic_fetch_sub (v, count + 1, __ATOMIC_CONSUME);
--+ if (*v != --res)
--+ abort ();
--+
--+ __atomic_sub_fetch (v, 1, __ATOMIC_ACQUIRE);
--+ if (*v != --res)
--+ abort ();
--+
--+ __atomic_fetch_sub (v, 1, __ATOMIC_RELEASE);
--+ if (*v != --res)
--+ abort ();
--+
--+ __atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL);
--+ if (*v != --res)
--+ abort ();
--+
--+ __atomic_fetch_sub (v, count + 1, __ATOMIC_SEQ_CST);
--+ if (*v != --res)
--+ abort ();
--+}
--+
--+void
--+test_and (char* v)
--+{
--+ *v = init;
--+
--+ __atomic_and_fetch (v, 0, __ATOMIC_RELAXED);
--+ if (*v != 0)
--+ abort ();
--+
--+ *v = init;
--+ __atomic_fetch_and (v, init, __ATOMIC_CONSUME);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE);
--+ if (*v != 0)
--+ abort ();
--+
--+ *v = ~*v;
--+ __atomic_fetch_and (v, init, __ATOMIC_RELEASE);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL);
--+ if (*v != 0)
--+ abort ();
--+
--+ *v = ~*v;
--+ __atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST);
--+ if (*v != 0)
--+ abort ();
--+}
--+
--+void
--+test_nand (char* v)
--+{
--+ *v = init;
--+
--+ __atomic_fetch_nand (v, 0, __ATOMIC_RELAXED);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_fetch_nand (v, init, __ATOMIC_CONSUME);
--+ if (*v != 0)
--+ abort ();
--+
--+ __atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_nand_fetch (v, init, __ATOMIC_RELEASE);
--+ if (*v != 0)
--+ abort ();
--+
--+ __atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST);
--+ if (*v != init)
--+ abort ();
--+}
--+
--+
--+
--+void
--+test_xor (char* v)
--+{
--+ *v = init;
--+ count = 0;
--+
--+ __atomic_xor_fetch (v, count, __ATOMIC_RELAXED);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME);
--+ if (*v != 0)
--+ abort ();
--+
--+ __atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE);
--+ if (*v != 0)
--+ abort ();
--+
--+ __atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST);
--+ if (*v != 0)
--+ abort ();
--+}
--+
--+void
--+test_or (char* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ __atomic_or_fetch (v, count, __ATOMIC_RELAXED);
--+ if (*v != 1)
--+ abort ();
--+
--+ count *= 2;
--+ __atomic_fetch_or (v, count, __ATOMIC_CONSUME);
--+ if (*v != 3)
--+ abort ();
--+
--+ count *= 2;
--+ __atomic_or_fetch (v, 4, __ATOMIC_ACQUIRE);
--+ if (*v != 7)
--+ abort ();
--+
--+ count *= 2;
--+ __atomic_fetch_or (v, 8, __ATOMIC_RELEASE);
--+ if (*v != 15)
--+ abort ();
--+
--+ count *= 2;
--+ __atomic_or_fetch (v, count, __ATOMIC_ACQ_REL);
--+ if (*v != 31)
--+ abort ();
--+
--+ count *= 2;
--+ __atomic_fetch_or (v, count, __ATOMIC_SEQ_CST);
--+ if (*v != 63)
--+ abort ();
--+}
--+
--+int
--+main ()
--+{
--+ char* V[] = {&A.a, &A.b, &A.c, &A.d};
--+
--+ for (int i = 0; i < 4; i++) {
--+ test_fetch_add (V[i]);
--+ test_fetch_sub (V[i]);
--+ test_fetch_and (V[i]);
--+ test_fetch_nand (V[i]);
--+ test_fetch_xor (V[i]);
--+ test_fetch_or (V[i]);
--+
--+ test_add_fetch (V[i]);
--+ test_sub_fetch (V[i]);
--+ test_and_fetch (V[i]);
--+ test_nand_fetch (V[i]);
--+ test_xor_fetch (V[i]);
--+ test_or_fetch (V[i]);
--+
--+ test_add (V[i]);
--+ test_sub (V[i]);
--+ test_and (V[i]);
--+ test_nand (V[i]);
--+ test_xor (V[i]);
--+ test_or (V[i]);
--+ }
--+
--+ return 0;
--+}
----- /dev/null
--+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-4.c
--@@ -0,0 +1,566 @@
--+/* Check all short alignments. */
--+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-op-2.c */
--+/* Test __atomic routines for existence and proper execution on 2 byte
--+ values with each valid memory model. */
--+/* { dg-do run } */
--+/* { dg-options "-minline-atomics -Wno-address-of-packed-member" } */
--+
--+/* Test the execution of the __atomic_*OP builtin routines for a short. */
--+
--+extern void abort(void);
--+
--+short count, res;
--+const short init = ~0;
--+
--+struct A
--+{
--+ short a;
--+ short b;
--+} __attribute__ ((packed)) A;
--+
--+/* The fetch_op routines return the original value before the operation. */
--+
--+void
--+test_fetch_add (short* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ if (__atomic_fetch_add (v, count, __ATOMIC_RELAXED) != 0)
--+ abort ();
--+
--+ if (__atomic_fetch_add (v, 1, __ATOMIC_CONSUME) != 1)
--+ abort ();
--+
--+ if (__atomic_fetch_add (v, count, __ATOMIC_ACQUIRE) != 2)
--+ abort ();
--+
--+ if (__atomic_fetch_add (v, 1, __ATOMIC_RELEASE) != 3)
--+ abort ();
--+
--+ if (__atomic_fetch_add (v, count, __ATOMIC_ACQ_REL) != 4)
--+ abort ();
--+
--+ if (__atomic_fetch_add (v, 1, __ATOMIC_SEQ_CST) != 5)
--+ abort ();
--+}
--+
--+
--+void
--+test_fetch_sub (short* v)
--+{
--+ *v = res = 20;
--+ count = 0;
--+
--+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_RELAXED) != res--)
--+ abort ();
--+
--+ if (__atomic_fetch_sub (v, 1, __ATOMIC_CONSUME) != res--)
--+ abort ();
--+
--+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQUIRE) != res--)
--+ abort ();
--+
--+ if (__atomic_fetch_sub (v, 1, __ATOMIC_RELEASE) != res--)
--+ abort ();
--+
--+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQ_REL) != res--)
--+ abort ();
--+
--+ if (__atomic_fetch_sub (v, 1, __ATOMIC_SEQ_CST) != res--)
--+ abort ();
--+}
--+
--+void
--+test_fetch_and (short* v)
--+{
--+ *v = init;
--+
--+ if (__atomic_fetch_and (v, 0, __ATOMIC_RELAXED) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_and (v, init, __ATOMIC_CONSUME) != 0)
--+ abort ();
--+
--+ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQUIRE) != 0)
--+ abort ();
--+
--+ *v = ~*v;
--+ if (__atomic_fetch_and (v, init, __ATOMIC_RELEASE) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQ_REL) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST) != 0)
--+ abort ();
--+}
--+
--+void
--+test_fetch_nand (short* v)
--+{
--+ *v = init;
--+
--+ if (__atomic_fetch_nand (v, 0, __ATOMIC_RELAXED) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_nand (v, init, __ATOMIC_CONSUME) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_nand (v, 0, __ATOMIC_ACQUIRE) != 0 )
--+ abort ();
--+
--+ if (__atomic_fetch_nand (v, init, __ATOMIC_RELEASE) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL) != 0)
--+ abort ();
--+
--+ if (__atomic_fetch_nand (v, 0, __ATOMIC_SEQ_CST) != init)
--+ abort ();
--+}
--+
--+void
--+test_fetch_xor (short* v)
--+{
--+ *v = init;
--+ count = 0;
--+
--+ if (__atomic_fetch_xor (v, count, __ATOMIC_RELAXED) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQUIRE) != 0)
--+ abort ();
--+
--+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE) != 0)
--+ abort ();
--+
--+ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL) != init)
--+ abort ();
--+
--+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_SEQ_CST) != init)
--+ abort ();
--+}
--+
--+void
--+test_fetch_or (short* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ if (__atomic_fetch_or (v, count, __ATOMIC_RELAXED) != 0)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_fetch_or (v, 2, __ATOMIC_CONSUME) != 1)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_fetch_or (v, count, __ATOMIC_ACQUIRE) != 3)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_fetch_or (v, 8, __ATOMIC_RELEASE) != 7)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_fetch_or (v, count, __ATOMIC_ACQ_REL) != 15)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_fetch_or (v, count, __ATOMIC_SEQ_CST) != 31)
--+ abort ();
--+}
--+
--+/* The OP_fetch routines return the new value after the operation. */
--+
--+void
--+test_add_fetch (short* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ if (__atomic_add_fetch (v, count, __ATOMIC_RELAXED) != 1)
--+ abort ();
--+
--+ if (__atomic_add_fetch (v, 1, __ATOMIC_CONSUME) != 2)
--+ abort ();
--+
--+ if (__atomic_add_fetch (v, count, __ATOMIC_ACQUIRE) != 3)
--+ abort ();
--+
--+ if (__atomic_add_fetch (v, 1, __ATOMIC_RELEASE) != 4)
--+ abort ();
--+
--+ if (__atomic_add_fetch (v, count, __ATOMIC_ACQ_REL) != 5)
--+ abort ();
--+
--+ if (__atomic_add_fetch (v, count, __ATOMIC_SEQ_CST) != 6)
--+ abort ();
--+}
--+
--+
--+void
--+test_sub_fetch (short* v)
--+{
--+ *v = res = 20;
--+ count = 0;
--+
--+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED) != --res)
--+ abort ();
--+
--+ if (__atomic_sub_fetch (v, 1, __ATOMIC_CONSUME) != --res)
--+ abort ();
--+
--+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQUIRE) != --res)
--+ abort ();
--+
--+ if (__atomic_sub_fetch (v, 1, __ATOMIC_RELEASE) != --res)
--+ abort ();
--+
--+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL) != --res)
--+ abort ();
--+
--+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_SEQ_CST) != --res)
--+ abort ();
--+}
--+
--+void
--+test_and_fetch (short* v)
--+{
--+ *v = init;
--+
--+ if (__atomic_and_fetch (v, 0, __ATOMIC_RELAXED) != 0)
--+ abort ();
--+
--+ *v = init;
--+ if (__atomic_and_fetch (v, init, __ATOMIC_CONSUME) != init)
--+ abort ();
--+
--+ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE) != 0)
--+ abort ();
--+
--+ *v = ~*v;
--+ if (__atomic_and_fetch (v, init, __ATOMIC_RELEASE) != init)
--+ abort ();
--+
--+ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL) != 0)
--+ abort ();
--+
--+ *v = ~*v;
--+ if (__atomic_and_fetch (v, 0, __ATOMIC_SEQ_CST) != 0)
--+ abort ();
--+}
--+
--+void
--+test_nand_fetch (short* v)
--+{
--+ *v = init;
--+
--+ if (__atomic_nand_fetch (v, 0, __ATOMIC_RELAXED) != init)
--+ abort ();
--+
--+ if (__atomic_nand_fetch (v, init, __ATOMIC_CONSUME) != 0)
--+ abort ();
--+
--+ if (__atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE) != init)
--+ abort ();
--+
--+ if (__atomic_nand_fetch (v, init, __ATOMIC_RELEASE) != 0)
--+ abort ();
--+
--+ if (__atomic_nand_fetch (v, init, __ATOMIC_ACQ_REL) != init)
--+ abort ();
--+
--+ if (__atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST) != init)
--+ abort ();
--+}
--+
--+
--+
--+void
--+test_xor_fetch (short* v)
--+{
--+ *v = init;
--+ count = 0;
--+
--+ if (__atomic_xor_fetch (v, count, __ATOMIC_RELAXED) != init)
--+ abort ();
--+
--+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_CONSUME) != 0)
--+ abort ();
--+
--+ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE) != 0)
--+ abort ();
--+
--+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_RELEASE) != init)
--+ abort ();
--+
--+ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQ_REL) != init)
--+ abort ();
--+
--+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST) != 0)
--+ abort ();
--+}
--+
--+void
--+test_or_fetch (short* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ if (__atomic_or_fetch (v, count, __ATOMIC_RELAXED) != 1)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_or_fetch (v, 2, __ATOMIC_CONSUME) != 3)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_or_fetch (v, count, __ATOMIC_ACQUIRE) != 7)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_or_fetch (v, 8, __ATOMIC_RELEASE) != 15)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_or_fetch (v, count, __ATOMIC_ACQ_REL) != 31)
--+ abort ();
--+
--+ count *= 2;
--+ if (__atomic_or_fetch (v, count, __ATOMIC_SEQ_CST) != 63)
--+ abort ();
--+}
--+
--+
--+/* Test the OP routines with a result which isn't used. Use both variations
--+ within each function. */
--+
--+void
--+test_add (short* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ __atomic_add_fetch (v, count, __ATOMIC_RELAXED);
--+ if (*v != 1)
--+ abort ();
--+
--+ __atomic_fetch_add (v, count, __ATOMIC_CONSUME);
--+ if (*v != 2)
--+ abort ();
--+
--+ __atomic_add_fetch (v, 1 , __ATOMIC_ACQUIRE);
--+ if (*v != 3)
--+ abort ();
--+
--+ __atomic_fetch_add (v, 1, __ATOMIC_RELEASE);
--+ if (*v != 4)
--+ abort ();
--+
--+ __atomic_add_fetch (v, count, __ATOMIC_ACQ_REL);
--+ if (*v != 5)
--+ abort ();
--+
--+ __atomic_fetch_add (v, count, __ATOMIC_SEQ_CST);
--+ if (*v != 6)
--+ abort ();
--+}
--+
--+
--+void
--+test_sub (short* v)
--+{
--+ *v = res = 20;
--+ count = 0;
--+
--+ __atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED);
--+ if (*v != --res)
--+ abort ();
--+
--+ __atomic_fetch_sub (v, count + 1, __ATOMIC_CONSUME);
--+ if (*v != --res)
--+ abort ();
--+
--+ __atomic_sub_fetch (v, 1, __ATOMIC_ACQUIRE);
--+ if (*v != --res)
--+ abort ();
--+
--+ __atomic_fetch_sub (v, 1, __ATOMIC_RELEASE);
--+ if (*v != --res)
--+ abort ();
--+
--+ __atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL);
--+ if (*v != --res)
--+ abort ();
--+
--+ __atomic_fetch_sub (v, count + 1, __ATOMIC_SEQ_CST);
--+ if (*v != --res)
--+ abort ();
--+}
--+
--+void
--+test_and (short* v)
--+{
--+ *v = init;
--+
--+ __atomic_and_fetch (v, 0, __ATOMIC_RELAXED);
--+ if (*v != 0)
--+ abort ();
--+
--+ *v = init;
--+ __atomic_fetch_and (v, init, __ATOMIC_CONSUME);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE);
--+ if (*v != 0)
--+ abort ();
--+
--+ *v = ~*v;
--+ __atomic_fetch_and (v, init, __ATOMIC_RELEASE);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL);
--+ if (*v != 0)
--+ abort ();
--+
--+ *v = ~*v;
--+ __atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST);
--+ if (*v != 0)
--+ abort ();
--+}
--+
--+void
--+test_nand (short* v)
--+{
--+ *v = init;
--+
--+ __atomic_fetch_nand (v, 0, __ATOMIC_RELAXED);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_fetch_nand (v, init, __ATOMIC_CONSUME);
--+ if (*v != 0)
--+ abort ();
--+
--+ __atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_nand_fetch (v, init, __ATOMIC_RELEASE);
--+ if (*v != 0)
--+ abort ();
--+
--+ __atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST);
--+ if (*v != init)
--+ abort ();
--+}
--+
--+
--+
--+void
--+test_xor (short* v)
--+{
--+ *v = init;
--+ count = 0;
--+
--+ __atomic_xor_fetch (v, count, __ATOMIC_RELAXED);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME);
--+ if (*v != 0)
--+ abort ();
--+
--+ __atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE);
--+ if (*v != 0)
--+ abort ();
--+
--+ __atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL);
--+ if (*v != init)
--+ abort ();
--+
--+ __atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST);
--+ if (*v != 0)
--+ abort ();
--+}
--+
--+void
--+test_or (short* v)
--+{
--+ *v = 0;
--+ count = 1;
--+
--+ __atomic_or_fetch (v, count, __ATOMIC_RELAXED);
--+ if (*v != 1)
--+ abort ();
--+
--+ count *= 2;
--+ __atomic_fetch_or (v, count, __ATOMIC_CONSUME);
--+ if (*v != 3)
--+ abort ();
--+
--+ count *= 2;
--+ __atomic_or_fetch (v, 4, __ATOMIC_ACQUIRE);
--+ if (*v != 7)
--+ abort ();
--+
--+ count *= 2;
--+ __atomic_fetch_or (v, 8, __ATOMIC_RELEASE);
--+ if (*v != 15)
--+ abort ();
--+
--+ count *= 2;
--+ __atomic_or_fetch (v, count, __ATOMIC_ACQ_REL);
--+ if (*v != 31)
--+ abort ();
--+
--+ count *= 2;
--+ __atomic_fetch_or (v, count, __ATOMIC_SEQ_CST);
--+ if (*v != 63)
--+ abort ();
--+}
--+
--+int
--+main () {
--+ short* V[] = {&A.a, &A.b};
--+
--+ for (int i = 0; i < 2; i++) {
--+ test_fetch_add (V[i]);
--+ test_fetch_sub (V[i]);
--+ test_fetch_and (V[i]);
--+ test_fetch_nand (V[i]);
--+ test_fetch_xor (V[i]);
--+ test_fetch_or (V[i]);
--+
--+ test_add_fetch (V[i]);
--+ test_sub_fetch (V[i]);
--+ test_and_fetch (V[i]);
--+ test_nand_fetch (V[i]);
--+ test_xor_fetch (V[i]);
--+ test_or_fetch (V[i]);
--+
--+ test_add (V[i]);
--+ test_sub (V[i]);
--+ test_and (V[i]);
--+ test_nand (V[i]);
--+ test_xor (V[i]);
--+ test_or (V[i]);
--+ }
--+
--+ return 0;
--+}
----- /dev/null
--+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-5.c
--@@ -0,0 +1,87 @@
--+/* Test __atomic routines for existence and proper execution on 1 byte
--+ values with each valid memory model. */
--+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c */
--+/* { dg-do run } */
--+/* { dg-options "-minline-atomics" } */
--+
--+/* Test the execution of the __atomic_compare_exchange_n builtin for a char. */
--+
--+extern void abort(void);
--+
--+char v = 0;
--+char expected = 0;
--+char max = ~0;
--+char desired = ~0;
--+char zero = 0;
--+
--+#define STRONG 0
--+#define WEAK 1
--+
--+int
--+main ()
--+{
--+
--+ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+
--+ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
--+ abort ();
--+ if (expected != max)
--+ abort ();
--+
--+ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
--+ abort ();
--+ if (expected != max)
--+ abort ();
--+ if (v != 0)
--+ abort ();
--+
--+ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+
--+ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+ if (v != max)
--+ abort ();
--+
--+ /* Now test the generic version. */
--+
--+ v = 0;
--+
--+ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+
--+ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
--+ abort ();
--+ if (expected != max)
--+ abort ();
--+
--+ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
--+ abort ();
--+ if (expected != max)
--+ abort ();
--+ if (v != 0)
--+ abort ();
--+
--+ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+
--+ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+ if (v != max)
--+ abort ();
--+
--+ return 0;
--+}
----- /dev/null
--+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-6.c
--@@ -0,0 +1,87 @@
--+/* Test __atomic routines for existence and proper execution on 2 byte
--+ values with each valid memory model. */
--+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c */
--+/* { dg-do run } */
--+/* { dg-options "-minline-atomics" } */
--+
--+/* Test the execution of the __atomic_compare_exchange_n builtin for a short. */
--+
--+extern void abort(void);
--+
--+short v = 0;
--+short expected = 0;
--+short max = ~0;
--+short desired = ~0;
--+short zero = 0;
--+
--+#define STRONG 0
--+#define WEAK 1
--+
--+int
--+main ()
--+{
--+
--+ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+
--+ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
--+ abort ();
--+ if (expected != max)
--+ abort ();
--+
--+ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
--+ abort ();
--+ if (expected != max)
--+ abort ();
--+ if (v != 0)
--+ abort ();
--+
--+ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+
--+ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+ if (v != max)
--+ abort ();
--+
--+ /* Now test the generic version. */
--+
--+ v = 0;
--+
--+ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+
--+ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
--+ abort ();
--+ if (expected != max)
--+ abort ();
--+
--+ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
--+ abort ();
--+ if (expected != max)
--+ abort ();
--+ if (v != 0)
--+ abort ();
--+
--+ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+
--+ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
--+ abort ();
--+ if (expected != 0)
--+ abort ();
--+ if (v != max)
--+ abort ();
--+
--+ return 0;
--+}
----- /dev/null
--+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-7.c
--@@ -0,0 +1,69 @@
--+/* Test __atomic routines for existence and proper execution on 1 byte
--+ values with each valid memory model. */
--+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-exchange-1.c */
--+/* { dg-do run } */
--+/* { dg-options "-minline-atomics" } */
--+
--+/* Test the execution of the __atomic_exchange_n builtin for a char. */
--+
--+extern void abort(void);
--+
--+char v, count, ret;
--+
--+int
--+main ()
--+{
--+ v = 0;
--+ count = 0;
--+
--+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count)
--+ abort ();
--+ count++;
--+
--+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count)
--+ abort ();
--+ count++;
--+
--+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count)
--+ abort ();
--+ count++;
--+
--+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count)
--+ abort ();
--+ count++;
--+
--+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count)
--+ abort ();
--+ count++;
--+
--+ /* Now test the generic version. */
--+
--+ count++;
--+
--+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED);
--+ if (ret != count - 1 || v != count)
--+ abort ();
--+ count++;
--+
--+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE);
--+ if (ret != count - 1 || v != count)
--+ abort ();
--+ count++;
--+
--+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE);
--+ if (ret != count - 1 || v != count)
--+ abort ();
--+ count++;
--+
--+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL);
--+ if (ret != count - 1 || v != count)
--+ abort ();
--+ count++;
--+
--+ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST);
--+ if (ret != count - 1 || v != count)
--+ abort ();
--+ count++;
--+
--+ return 0;
--+}
----- /dev/null
--+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-8.c
--@@ -0,0 +1,69 @@
--+/* Test __atomic routines for existence and proper execution on 2 byte
--+ values with each valid memory model. */
--+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-exchange-2.c */
--+/* { dg-do run } */
--+/* { dg-options "-minline-atomics" } */
--+
--+/* Test the execution of the __atomic_X builtin for a short. */
--+
--+extern void abort(void);
--+
--+short v, count, ret;
--+
--+int
--+main ()
--+{
--+ v = 0;
--+ count = 0;
--+
--+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count)
--+ abort ();
--+ count++;
--+
--+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count)
--+ abort ();
--+ count++;
--+
--+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count)
--+ abort ();
--+ count++;
--+
--+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count)
--+ abort ();
--+ count++;
--+
--+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count)
--+ abort ();
--+ count++;
--+
--+ /* Now test the generic version. */
--+
--+ count++;
--+
--+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED);
--+ if (ret != count - 1 || v != count)
--+ abort ();
--+ count++;
--+
--+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE);
--+ if (ret != count - 1 || v != count)
--+ abort ();
--+ count++;
--+
--+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE);
--+ if (ret != count - 1 || v != count)
--+ abort ();
--+ count++;
--+
--+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL);
--+ if (ret != count - 1 || v != count)
--+ abort ();
--+ count++;
--+
--+ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST);
--+ if (ret != count - 1 || v != count)
--+ abort ();
--+ count++;
--+
--+ return 0;
--+}
----- a/libgcc/config/riscv/atomic.c
--+++ b/libgcc/config/riscv/atomic.c
--@@ -30,6 +30,8 @@ see the files COPYING3 and COPYING.RUNTI
-- #define INVERT "not %[tmp1], %[tmp1]\n\t"
-- #define DONT_INVERT ""
--
--+/* Logic duplicated in gcc/gcc/config/riscv/sync.md for use when inlining is enabled */
--+
-- #define GENERATE_FETCH_AND_OP(type, size, opname, insn, invert, cop) \
-- type __sync_fetch_and_ ## opname ## _ ## size (type *p, type v) \
-- { \
-diff --git a/toolchain/gcc/patches-13.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch b/toolchain/gcc/patches-13.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch
-deleted file mode 100644
-index 328c7be..0000000
---- a/toolchain/gcc/patches-13.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch
-+++ /dev/null
-@@ -1,36 +0,0 @@
--From 203f3060dd363361b172f7295f42bb6bf5ac0b3b Mon Sep 17 00:00:00 2001
--From: Andreas Schwab
--Date: Sat, 23 Apr 2022 15:48:42 +0200
--Subject: [PATCH] riscv/linux: Don't add -latomic with -pthread
--
--Now that we have support for inline subword atomic operations, it is no
--longer necessary to link against libatomic. This also fixes testsuite
--failures because the framework does not properly set up the linker flags
--for finding libatomic.
--The use of atomic operations is also independent of the use of libpthread.
--
--gcc/
-- * config/riscv/linux.h (LIB_SPEC): Don't redefine.
-----
-- gcc/config/riscv/linux.h | 10 ----------
-- 1 file changed, 10 deletions(-)
--
----- a/gcc/config/riscv/linux.h
--+++ b/gcc/config/riscv/linux.h
--@@ -35,16 +35,6 @@ along with GCC; see the file COPYING3.
-- #undef MUSL_DYNAMIC_LINKER
-- #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
--
---/* Because RISC-V only has word-sized atomics, it requries libatomic where
--- others do not. So link libatomic by default, as needed. */
---#undef LIB_SPEC
---#ifdef LD_AS_NEEDED_OPTION
---#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC \
--- " %{pthread:" LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION "}"
---#else
---#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic "
---#endif
---
-- #define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
--
-- #define CPP_SPEC "%{pthread:-D_REENTRANT}"
-diff --git a/toolchain/gcc/patches-13.x/910-mbsd_multi.patch b/toolchain/gcc/patches-13.x/910-mbsd_multi.patch
-index 8af05c9..4138e79 100644
---- a/toolchain/gcc/patches-13.x/910-mbsd_multi.patch
-+++ b/toolchain/gcc/patches-13.x/910-mbsd_multi.patch
-@@ -114,7 +114,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
- ; On SVR4 targets, it also controls whether or not to emit a
- --- a/gcc/doc/invoke.texi
- +++ b/gcc/doc/invoke.texi
--@@ -10062,6 +10062,17 @@ This option is only supported for C and
-+@@ -10065,6 +10065,17 @@ This option is only supported for C and
- @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
- @option{-Wno-pointer-sign}.
-
---
-2.42.0
-
diff --git a/openwrt/patch/generic/201-toolchain-gcc-add-support-for-GCC-14.patch b/openwrt/patch/generic/201-toolchain-gcc-add-support-for-GCC-14.patch
deleted file mode 100644
index 7dd83f268..000000000
--- a/openwrt/patch/generic/201-toolchain-gcc-add-support-for-GCC-14.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in
-index 9156f9c..ca89051 100644
---- a/toolchain/gcc/Config.in
-+++ b/toolchain/gcc/Config.in
-@@ -14,6 +14,9 @@ choice
-
- config GCC_USE_VERSION_13
- bool "gcc 13.x"
-+
-+ config GCC_USE_VERSION_14
-+ bool "gcc 14.x"
- endchoice
-
- config GCC_USE_GRAPHITE
-diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version
-index 92033af..200a356 100644
---- a/toolchain/gcc/Config.version
-+++ b/toolchain/gcc/Config.version
-@@ -6,10 +6,15 @@ config GCC_VERSION_13
- default y if GCC_USE_VERSION_13
- bool
-
-+config GCC_VERSION_14
-+ default y if GCC_USE_VERSION_14
-+ bool
-+
- config GCC_VERSION
- string
- default "11.3.0" if GCC_VERSION_11
- default "13.2.0" if GCC_VERSION_13
-+ default "14.2.0" if GCC_VERSION_14
- default "12.3.0"
-
- config GCC_USE_DEFAULT_VERSION
-diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
-index cdbf9fa..f5db99f 100644
---- a/toolchain/gcc/common.mk
-+++ b/toolchain/gcc/common.mk
-@@ -42,6 +42,10 @@ ifeq ($(PKG_VERSION),13.2.0)
- PKG_HASH:=e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da
- endif
-
-+ifeq ($(PKG_VERSION),14.2.0)
-+ PKG_HASH:=a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9
-+endif
-+
- PATCH_DIR=../patches-$(GCC_MAJOR_VERSION).x
-
- BUGURL=http://bugs.openwrt.org/
diff --git a/openwrt/patch/generic/202-toolchain-gcc-add-support-for-GCC-15.patch b/openwrt/patch/generic/202-toolchain-gcc-add-support-for-GCC-15.patch
deleted file mode 100644
index f3c4f555e..000000000
--- a/openwrt/patch/generic/202-toolchain-gcc-add-support-for-GCC-15.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in
-index ca89051..510c813 100644
---- a/toolchain/gcc/Config.in
-+++ b/toolchain/gcc/Config.in
-@@ -17,6 +17,9 @@ choice
-
- config GCC_USE_VERSION_14
- bool "gcc 14.x"
-+
-+ config GCC_USE_VERSION_15
-+ bool "gcc 15.x"
- endchoice
-
- config GCC_USE_GRAPHITE
-diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version
-index 200a356..5675b9a 100644
---- a/toolchain/gcc/Config.version
-+++ b/toolchain/gcc/Config.version
-@@ -10,11 +10,16 @@ config GCC_VERSION_14
- default y if GCC_USE_VERSION_14
- bool
-
-+config GCC_VERSION_15
-+ default y if GCC_USE_VERSION_15
-+ bool
-+
- config GCC_VERSION
- string
- default "11.3.0" if GCC_VERSION_11
- default "13.2.0" if GCC_VERSION_13
- default "14.2.0" if GCC_VERSION_14
-+ default "15.0.0" if GCC_VERSION_15
- default "12.3.0"
-
- config GCC_USE_DEFAULT_VERSION
-diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
-index f5db99f..24c6535 100644
---- a/toolchain/gcc/common.mk
-+++ b/toolchain/gcc/common.mk
-@@ -26,7 +26,11 @@ PKG_VERSION:=$(firstword $(subst +, ,$(GCC_VERSION)))
- GCC_MAJOR_VERSION:=$(word 1,$(subst ., ,$(PKG_VERSION)))
- GCC_DIR:=$(PKG_NAME)-$(PKG_VERSION)
-
--PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
-+ifeq ($(PKG_VERSION),15.0.0)
-+ PKG_SOURCE_URL:=https://us.cooluc.com/gcc
-+else
-+ PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
-+endif
- PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
- PKG_CPE_ID:=cpe:/a:gnu:gcc
-
-@@ -46,6 +50,10 @@ ifeq ($(PKG_VERSION),14.2.0)
- PKG_HASH:=e283c654987afe3de9d8080bc0bd79534b5ca0d681a73a11ff2b5d3767426840
- endif
-
-+ifeq ($(PKG_VERSION),15.0.0)
-+ PKG_HASH:=1be70eb828b6a0e8e6292e4a0ba27a5e8b5c920c5d5aa5ec88d7c3a53a2e398f
-+endif
-+
- PATCH_DIR=../patches-$(GCC_MAJOR_VERSION).x
-
- BUGURL=http://bugs.openwrt.org/
diff --git a/openwrt/patch/generic/gcc-14/910-mbsd_multi.patch b/openwrt/patch/generic/gcc-14/910-mbsd_multi.patch
deleted file mode 100644
index 4138e79bc..000000000
--- a/openwrt/patch/generic/gcc-14/910-mbsd_multi.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-commit 99368862e44740ff4fd33760893f04e14f9dbdf1
-Author: Felix Fietkau
-Date: Tue Jul 31 00:52:27 2007 +0000
-
- Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly
-
- SVN-Revision: 8256
-
- This patch brings over a feature from MirBSD:
- * -fhonour-copts
- If this option is not given, it's warned (depending
- on environment variables). This is to catch errors
- of misbuilt packages which override CFLAGS themselves.
-
- This patch was authored by Thorsten Glaser
- with copyright assignment to the FSF in effect.
-
---- a/gcc/c-family/c-opts.cc
-+++ b/gcc/c-family/c-opts.cc
-@@ -104,6 +104,9 @@ static size_t include_cursor;
- /* Whether any standard preincluded header has been preincluded. */
- static bool done_preinclude;
-
-+/* Check if a port honours COPTS. */
-+static int honour_copts = 0;
-+
- static void handle_OPT_d (const char *);
- static void set_std_cxx98 (int);
- static void set_std_cxx11 (int);
-@@ -475,6 +478,12 @@ c_common_handle_option (size_t scode, co
- flag_no_builtin = !value;
- break;
-
-+ case OPT_fhonour_copts:
-+ if (c_language == clk_c) {
-+ honour_copts++;
-+ }
-+ break;
-+
- case OPT_fconstant_string_class_:
- constant_string_class_name = arg;
- break;
-@@ -1228,6 +1237,47 @@ c_common_init (void)
- return false;
- }
-
-+ if (c_language == clk_c) {
-+ char *ev = getenv ("GCC_HONOUR_COPTS");
-+ int evv;
-+ if (ev == NULL)
-+ evv = -1;
-+ else if ((*ev == '0') || (*ev == '\0'))
-+ evv = 0;
-+ else if (*ev == '1')
-+ evv = 1;
-+ else if (*ev == '2')
-+ evv = 2;
-+ else if (*ev == 's')
-+ evv = -1;
-+ else {
-+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
-+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
-+ }
-+ if (evv == 1) {
-+ if (honour_copts == 0) {
-+ error ("someone does not honour COPTS at all in lenient mode");
-+ return false;
-+ } else if (honour_copts != 1) {
-+ warning (0, "someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ }
-+ } else if (evv == 2) {
-+ if (honour_copts == 0) {
-+ error ("someone does not honour COPTS at all in strict mode");
-+ return false;
-+ } else if (honour_copts != 1) {
-+ error ("someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ return false;
-+ }
-+ } else if (evv == 0) {
-+ if (honour_copts != 1)
-+ inform (UNKNOWN_LOCATION, "someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ }
-+ }
-+
- return true;
- }
-
---- a/gcc/c-family/c.opt
-+++ b/gcc/c-family/c.opt
-@@ -1837,6 +1837,9 @@ C++ ObjC++ Optimization Alias(fexception
- fhonor-std
- C++ ObjC++ WarnRemoved
-
-+fhonour-copts
-+C ObjC C++ ObjC++ RejectNegative
-+
- fhosted
- C ObjC
- Assume normal C execution environment.
---- a/gcc/common.opt
-+++ b/gcc/common.opt
-@@ -1801,6 +1801,9 @@ fharden-conditional-branches
- Common Var(flag_harden_conditional_branches) Optimization
- Harden conditional branches by checking reversed conditions.
-
-+fhonour-copts
-+Common RejectNegative
-+
- ; Nonzero means ignore `#ident' directives. 0 means handle them.
- ; Generate position-independent code for executables if possible
- ; On SVR4 targets, it also controls whether or not to emit a
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -10065,6 +10065,17 @@ This option is only supported for C and
- @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
- @option{-Wno-pointer-sign}.
-
-+@item -fhonour-copts
-+@opindex fhonour-copts
-+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
-+given at least once, and warn if it is given more than once.
-+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
-+given exactly once.
-+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
-+is not given exactly once.
-+The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
-+This flag and environment variable only affect the C language.
-+
- @opindex Wstack-protector
- @opindex Wno-stack-protector
- @item -Wstack-protector
---- a/gcc/opts.cc
-+++ b/gcc/opts.cc
-@@ -2767,6 +2767,9 @@ common_handle_option (struct gcc_options
- add_comma_separated_to_vector (&opts->x_flag_ignored_attributes, arg);
- break;
-
-+ case OPT_fhonour_copts:
-+ break;
-+
- case OPT_Werror:
- dc->warning_as_error_requested = value;
- break;
diff --git a/openwrt/patch/generic/gcc-15/970-macos_arm64-building-fix.patch b/openwrt/patch/generic/gcc-15/970-macos_arm64-building-fix.patch
deleted file mode 100644
index 042a92676..000000000
--- a/openwrt/patch/generic/gcc-15/970-macos_arm64-building-fix.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-commit 9c6e71079b46ad5433165feaa2001450f2017b56
-Author: Przemysław Buczkowski
-Date: Mon Aug 16 13:16:21 2021 +0100
-
- GCC: Patch for Apple Silicon compatibility
-
- This patch fixes a linker error occuring when compiling
- the cross-compiler on macOS and ARM64 architecture.
-
- Adapted from:
- https://github.com/richfelker/musl-cross-make/issues/116#issuecomment-823612404
-
- Change-Id: Ia3ee98a163bbb62689f42e2da83a5ef36beb0913
- Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4329
- Reviewed-by: John Scipione
- Reviewed-by: Adrien Destugues
-
---- a/gcc/config/aarch64/aarch64.h
-+++ b/gcc/config/aarch64/aarch64.h
-@@ -1410,7 +1410,7 @@ extern enum aarch64_code_model aarch64_cmodel;
-
- /* Extra specs when building a native AArch64-hosted compiler.
- Option rewriting rules based on host system. */
--#if defined(__aarch64__)
-+#if defined(__aarch64__) && ! defined(__APPLE__)
- extern const char *host_detect_local_cpu (int argc, const char **argv);
- #define HAVE_LOCAL_CPU_DETECT
- # define EXTRA_SPEC_FUNCTIONS \
---- a/gcc/config/host-darwin.cc
-+++ b/gcc/config/host-darwin.cc
-@@ -23,6 +23,8 @@
- #include "options.h"
- #include "diagnostic-core.h"
- #include "config/host-darwin.h"
-+#include "hosthooks.h"
-+#include "hosthooks-def.h"
- #include
-
- /* For Darwin (macOS only) platforms, without ASLR (PIE) enabled on the
-@@ -181,3 +183,5 @@ darwin_gt_pch_use_address (void *&addr, size_t sz, int fd, size_t off)
-
- return 1;
- }
-+
-+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
diff --git a/openwrt/patch/irqbalance/011-meson-numa.patch b/openwrt/patch/irqbalance/011-meson-numa.patch
deleted file mode 100644
index 33582fe8e..000000000
--- a/openwrt/patch/irqbalance/011-meson-numa.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/meson.build
-+++ b/meson.build
-@@ -10,11 +10,12 @@ m_dep = cc.find_library('m', required: false)
- capng_dep = dependency('libcap-ng', required: get_option('capng'))
- ncurses_dep = dependency('curses', required: get_option('ui'))
- systemd_dep = dependency('libsystemd', required: get_option('systemd'))
-+numa_dep = dependency('libnuma', required: get_option('numa'))
-
- cdata = configuration_data()
- cdata.set('HAVE_GETOPT_LONG', cc.has_function('getopt_long'))
- cdata.set('HAVE_IRQBALANCEUI', ncurses_dep.found())
--cdata.set('HAVE_NUMA_H', cc.has_header('numa.h'))
-+cdata.set('HAVE_NUMA_H', numa_dep.found())
- cdata.set('HAVE_LIBCAP_NG', capng_dep.found())
- cdata.set('HAVE_LIBSYSTEMD', systemd_dep.found())
- cdata.set_quoted('VERSION', meson.project_version())
---- a/meson_options.txt
-+++ b/meson_options.txt
-@@ -9,3 +9,7 @@ option('systemd', type : 'feature',
- option('ui', type : 'feature',
- description : 'Build the UI component',
- )
-+
-+option('numa', type : 'feature',
-+ description : 'Build with numa support',
-+)
diff --git a/openwrt/patch/kernel-6.6/arm64/312-arm64-cpuinfo-Add-model-name-in-proc-cpuinfo-for-64bit-ta.patch b/openwrt/patch/kernel-6.18/arm64/312-arm64-cpuinfo-Add-model-name-in-proc-cpuinfo-for-64bit-ta.patch
similarity index 59%
rename from openwrt/patch/kernel-6.6/arm64/312-arm64-cpuinfo-Add-model-name-in-proc-cpuinfo-for-64bit-ta.patch
rename to openwrt/patch/kernel-6.18/arm64/312-arm64-cpuinfo-Add-model-name-in-proc-cpuinfo-for-64bit-ta.patch
index 811224428..dc0fb9592 100644
--- a/openwrt/patch/kernel-6.6/arm64/312-arm64-cpuinfo-Add-model-name-in-proc-cpuinfo-for-64bit-ta.patch
+++ b/openwrt/patch/kernel-6.18/arm64/312-arm64-cpuinfo-Add-model-name-in-proc-cpuinfo-for-64bit-ta.patch
@@ -18,15 +18,15 @@ Signed-off-by: Sumit Gupta
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
-@@ -189,9 +189,8 @@ static int c_show(struct seq_file *m, vo
- * "processor". Give glibc what it expects.
- */
- seq_printf(m, "processor\t: %d\n", i);
-- if (compat)
-- seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
-- MIDR_REVISION(midr), COMPAT_ELF_PLATFORM);
-+ seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
-+ MIDR_REVISION(midr), COMPAT_ELF_PLATFORM);
+@@ -224,9 +224,8 @@ static int c_show(struct seq_file *m, vo
+ * "processor". Give glibc what it expects.
+ */
+ seq_printf(m, "processor\t: %d\n", cpu);
+- if (compat)
+- seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
+- MIDR_REVISION(midr), COMPAT_ELF_PLATFORM);
++ seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
++ MIDR_REVISION(midr), COMPAT_ELF_PLATFORM);
- seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
- loops_per_jiffy / (500000UL/HZ),
+ seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
+ loops_per_jiffy / (500000UL/HZ),
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0001-net-tcp_bbr-broaden-app-limited-rate-sample-detectio.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0001-net-tcp_bbr-broaden-app-limited-rate-sample-detectio.patch
similarity index 85%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0001-net-tcp_bbr-broaden-app-limited-rate-sample-detectio.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0001-net-tcp_bbr-broaden-app-limited-rate-sample-detectio.patch
index 69cce2a06..f0f22b801 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0001-net-tcp_bbr-broaden-app-limited-rate-sample-detectio.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0001-net-tcp_bbr-broaden-app-limited-rate-sample-detectio.patch
@@ -1,7 +1,7 @@
-From eb92cc2649fa5e8b31fe0577a7d2f6820699a9cc Mon Sep 17 00:00:00 2001
+From 2343b8617207cb536de6a7165188c681263f3407 Mon Sep 17 00:00:00 2001
From: Neal Cardwell
Date: Tue, 11 Jun 2019 12:26:55 -0400
-Subject: [PATCH 01/18] net-tcp_bbr: broaden app-limited rate sample detection
+Subject: [PATCH 01/19] net-tcp_bbr: broaden app-limited rate sample detection
This commit is a bug fix for the Linux TCP app-limited
(application-limited) logic that is used for collecting rate
@@ -32,7 +32,7 @@ Signed-off-by: Alexandre Frade
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
-@@ -3874,6 +3874,7 @@ static int tcp_ack(struct sock *sk, cons
+@@ -4048,6 +4048,7 @@ static int tcp_ack(struct sock *sk, cons
prior_fack = tcp_is_sack(tp) ? tcp_highest_sack_seq(tp) : tp->snd_una;
rs.prior_in_flight = tcp_packets_in_flight(tp);
@@ -42,10 +42,10 @@ Signed-off-by: Alexandre Frade
* is in window.
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
-@@ -664,6 +664,7 @@ void tcp_write_timer_handler(struct sock
+@@ -703,6 +703,7 @@ void tcp_write_timer_handler(struct sock
+ icsk_timeout(icsk));
return;
}
-
+ tcp_rate_check_app_limited(sk);
tcp_mstamp_refresh(tcp_sk(sk));
event = icsk->icsk_pending;
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0002-net-tcp_bbr-v2-shrink-delivered_mstamp-first_tx_msta.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0002-net-tcp_bbr-v2-shrink-delivered_mstamp-first_tx_msta.patch
similarity index 87%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0002-net-tcp_bbr-v2-shrink-delivered_mstamp-first_tx_msta.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0002-net-tcp_bbr-v2-shrink-delivered_mstamp-first_tx_msta.patch
index cd9eb0ac6..0667ead6c 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0002-net-tcp_bbr-v2-shrink-delivered_mstamp-first_tx_msta.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0002-net-tcp_bbr-v2-shrink-delivered_mstamp-first_tx_msta.patch
@@ -1,7 +1,7 @@
-From 94abfc4e52198e003444ef5139df915514b8c207 Mon Sep 17 00:00:00 2001
+From c7683b8a74098c5f48c61d8d578dd15929c24843 Mon Sep 17 00:00:00 2001
From: Neal Cardwell
Date: Sun, 24 Jun 2018 21:55:59 -0400
-Subject: [PATCH 02/18] net-tcp_bbr: v2: shrink delivered_mstamp,
+Subject: [PATCH 02/19] net-tcp_bbr: v2: shrink delivered_mstamp,
first_tx_mstamp to u32 to free up 8 bytes
Free up some space for tracking inflight and losses for each
@@ -25,7 +25,7 @@ Signed-off-by: Alexandre Frade
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
-@@ -822,6 +822,11 @@ static inline u32 tcp_stamp_us_delta(u64
+@@ -946,6 +946,11 @@ static inline u32 tcp_stamp_us_delta(u64
return max_t(s64, t1 - t0, 0);
}
@@ -34,10 +34,10 @@ Signed-off-by: Alexandre Frade
+ return max_t(s32, t1 - t0, 0);
+}
+
- static inline u32 tcp_skb_timestamp(const struct sk_buff *skb)
+ /* provide the departure time in us unit */
+ static inline u64 tcp_skb_timestamp_us(const struct sk_buff *skb)
{
- return tcp_ns_to_ts(skb->skb_mstamp_ns);
-@@ -897,9 +902,9 @@ struct tcp_skb_cb {
+@@ -1059,9 +1064,9 @@ struct tcp_skb_cb {
/* pkts S/ACKed so far upon tx of skb, incl retrans: */
__u32 delivered;
/* start of send pipeline phase */
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0003-net-tcp_bbr-v2-snapshot-packets-in-flight-at-transmi.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0003-net-tcp_bbr-v2-snapshot-packets-in-flight-at-transmi.patch
similarity index 90%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0003-net-tcp_bbr-v2-snapshot-packets-in-flight-at-transmi.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0003-net-tcp_bbr-v2-snapshot-packets-in-flight-at-transmi.patch
index 128f33ec5..6c284d409 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0003-net-tcp_bbr-v2-snapshot-packets-in-flight-at-transmi.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0003-net-tcp_bbr-v2-snapshot-packets-in-flight-at-transmi.patch
@@ -1,7 +1,7 @@
-From 497c9101c33baca0207cad3e7e328ccd72e3e62c Mon Sep 17 00:00:00 2001
+From a128e1c2f3d98794c7341f357628d1e7f737da23 Mon Sep 17 00:00:00 2001
From: Neal Cardwell
Date: Sat, 5 Aug 2017 11:49:50 -0400
-Subject: [PATCH 03/18] net-tcp_bbr: v2: snapshot packets in flight at transmit
+Subject: [PATCH 03/19] net-tcp_bbr: v2: snapshot packets in flight at transmit
time and pass in rate_sample
CC algorithms may want to snapshot the number of packets in flight at
@@ -27,7 +27,7 @@ Signed-off-by: Alexandre Frade
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
-@@ -905,6 +905,10 @@ struct tcp_skb_cb {
+@@ -1067,6 +1067,10 @@ struct tcp_skb_cb {
u32 first_tx_mstamp;
/* when we reached the "delivered" count */
u32 delivered_mstamp;
@@ -38,7 +38,7 @@ Signed-off-by: Alexandre Frade
} tx; /* only used for outgoing skbs */
union {
struct inet_skb_parm h4;
-@@ -1052,6 +1056,7 @@ struct rate_sample {
+@@ -1231,6 +1235,7 @@ struct rate_sample {
u64 prior_mstamp; /* starting timestamp for interval */
u32 prior_delivered; /* tp->delivered at "prior_mstamp" */
u32 prior_delivered_ce;/* tp->delivered_ce at "prior_mstamp" */
@@ -46,7 +46,7 @@ Signed-off-by: Alexandre Frade
s32 delivered; /* number of packets delivered over interval */
s32 delivered_ce; /* number of packets delivered w/ CE marks*/
long interval_us; /* time for tp->delivered to incr "delivered" */
-@@ -1174,6 +1179,7 @@ static inline void tcp_ca_event(struct s
+@@ -1374,6 +1379,7 @@ static inline void tcp_ca_event(struct s
void tcp_set_ca_state(struct sock *sk, const u8 ca_state);
/* From tcp_rate.c */
@@ -56,8 +56,8 @@ Signed-off-by: Alexandre Frade
struct rate_sample *rs);
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
-@@ -2703,6 +2703,7 @@ static bool tcp_write_xmit(struct sock *
- skb_set_delivery_time(skb, tp->tcp_wstamp_ns, true);
+@@ -2916,6 +2916,7 @@ static bool tcp_write_xmit(struct sock *
+ skb_set_delivery_time(skb, tp->tcp_wstamp_ns, SKB_CLOCK_MONOTONIC);
list_move_tail(&skb->tcp_tsorted_anchor, &tp->tsorted_sent_queue);
tcp_init_tso_segs(skb, mss_now);
+ tcp_set_tx_in_flight(sk, skb);
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0004-net-tcp_bbr-v2-count-packets-lost-over-TCP-rate-samp.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0004-net-tcp_bbr-v2-count-packets-lost-over-TCP-rate-samp.patch
similarity index 92%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0004-net-tcp_bbr-v2-count-packets-lost-over-TCP-rate-samp.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0004-net-tcp_bbr-v2-count-packets-lost-over-TCP-rate-samp.patch
index d9d335594..affccb9d6 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0004-net-tcp_bbr-v2-count-packets-lost-over-TCP-rate-samp.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0004-net-tcp_bbr-v2-count-packets-lost-over-TCP-rate-samp.patch
@@ -1,7 +1,7 @@
-From 9e07a8f79e42db42adcc961baabc6e142dd891ed Mon Sep 17 00:00:00 2001
+From 4a30ce7df55db785e1002dbd9d87f807fe14568a Mon Sep 17 00:00:00 2001
From: Neal Cardwell
Date: Thu, 12 Oct 2017 23:44:27 -0400
-Subject: [PATCH 04/18] net-tcp_bbr: v2: count packets lost over TCP rate
+Subject: [PATCH 04/19] net-tcp_bbr: v2: count packets lost over TCP rate
sampling interval
For understanding the relationship between inflight and packet loss
@@ -19,7 +19,7 @@ Signed-off-by: Alexandre Frade
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
-@@ -909,6 +909,7 @@ struct tcp_skb_cb {
+@@ -1071,6 +1071,7 @@ struct tcp_skb_cb {
#define TCPCB_IN_FLIGHT_MAX ((1U << TCPCB_IN_FLIGHT_BITS) - 1)
u32 in_flight:20, /* packets in flight at transmit */
unused2:12;
@@ -27,7 +27,7 @@ Signed-off-by: Alexandre Frade
} tx; /* only used for outgoing skbs */
union {
struct inet_skb_parm h4;
-@@ -1054,11 +1055,13 @@ struct ack_sample {
+@@ -1233,11 +1234,13 @@ struct ack_sample {
*/
struct rate_sample {
u64 prior_mstamp; /* starting timestamp for interval */
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0005-net-tcp_bbr-v2-export-FLAG_ECE-in-rate_sample.is_ece.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0005-net-tcp_bbr-v2-export-FLAG_ECE-in-rate_sample.is_ece.patch
similarity index 80%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0005-net-tcp_bbr-v2-export-FLAG_ECE-in-rate_sample.is_ece.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0005-net-tcp_bbr-v2-export-FLAG_ECE-in-rate_sample.is_ece.patch
index 9aafb04f3..7d08adfe5 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0005-net-tcp_bbr-v2-export-FLAG_ECE-in-rate_sample.is_ece.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0005-net-tcp_bbr-v2-export-FLAG_ECE-in-rate_sample.is_ece.patch
@@ -1,7 +1,7 @@
-From 5f7df19fe56d5ddaa7d3ba34ded446e26a5725a1 Mon Sep 17 00:00:00 2001
+From 27fa5566204ef20bb34b2e5b68a7f6807afce447 Mon Sep 17 00:00:00 2001
From: Neal Cardwell
Date: Mon, 19 Nov 2018 13:48:36 -0500
-Subject: [PATCH 05/18] net-tcp_bbr: v2: export FLAG_ECE in rate_sample.is_ece
+Subject: [PATCH 05/19] net-tcp_bbr: v2: export FLAG_ECE in rate_sample.is_ece
For understanding the relationship between inflight and ECN signals,
to try to find the highest inflight value that has acceptable levels
@@ -18,7 +18,7 @@ Signed-off-by: Alexandre Frade
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
-@@ -1073,6 +1073,7 @@ struct rate_sample {
+@@ -1252,6 +1252,7 @@ struct rate_sample {
bool is_app_limited; /* is sample from packet with bubble in pipe? */
bool is_retrans; /* is sample from retransmission? */
bool is_ack_delayed; /* is this (likely) a delayed ACK? */
@@ -28,8 +28,8 @@ Signed-off-by: Alexandre Frade
struct tcp_congestion_ops {
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
-@@ -3973,6 +3973,7 @@ static int tcp_ack(struct sock *sk, cons
- delivered = tcp_newly_delivered(sk, delivered, flag);
+@@ -4146,6 +4146,7 @@ static int tcp_ack(struct sock *sk, cons
+
lost = tp->lost - lost; /* freshly marked lost */
rs.is_ack_delayed = !!(flag & FLAG_ACK_MAYBE_DELAYED);
+ rs.is_ece = !!(flag & FLAG_ECE);
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0006-net-tcp_bbr-v2-introduce-ca_ops-skb_marked_lost-CC-m.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0006-net-tcp_bbr-v2-introduce-ca_ops-skb_marked_lost-CC-m.patch
similarity index 88%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0006-net-tcp_bbr-v2-introduce-ca_ops-skb_marked_lost-CC-m.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0006-net-tcp_bbr-v2-introduce-ca_ops-skb_marked_lost-CC-m.patch
index 04c29cdef..5295e0ddb 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0006-net-tcp_bbr-v2-introduce-ca_ops-skb_marked_lost-CC-m.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0006-net-tcp_bbr-v2-introduce-ca_ops-skb_marked_lost-CC-m.patch
@@ -1,7 +1,7 @@
-From 36f2ad7500c7fd665efbf38482fa838ba070acc0 Mon Sep 17 00:00:00 2001
+From c083bc8abfefbee48922f6ff7976020abc71253f Mon Sep 17 00:00:00 2001
From: Neal Cardwell
Date: Tue, 7 Aug 2018 21:52:06 -0400
-Subject: [PATCH 06/18] net-tcp_bbr: v2: introduce ca_ops->skb_marked_lost() CC
+Subject: [PATCH 06/19] net-tcp_bbr: v2: introduce ca_ops->skb_marked_lost() CC
module callback API
For connections experiencing reordering, RACK can mark packets lost
@@ -30,7 +30,7 @@ Signed-off-by: Alexandre Frade
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
-@@ -1100,6 +1100,9 @@ struct tcp_congestion_ops {
+@@ -1279,6 +1279,9 @@ struct tcp_congestion_ops {
/* override sysctl_tcp_min_tso_segs */
u32 (*min_tso_segs)(struct sock *sk);
@@ -42,7 +42,7 @@ Signed-off-by: Alexandre Frade
*/
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
-@@ -1103,7 +1103,12 @@ static void tcp_verify_retransmit_hint(s
+@@ -1290,7 +1290,12 @@ static void tcp_verify_retransmit_hint(s
*/
static void tcp_notify_skb_loss_event(struct tcp_sock *tp, const struct sk_buff *skb)
{
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0007-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-merge-in.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0007-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-merge-in.patch
similarity index 92%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0007-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-merge-in.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0007-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-merge-in.patch
index cf3a0f0c5..2e0a7e537 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0007-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-merge-in.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0007-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-merge-in.patch
@@ -1,7 +1,7 @@
-From 8c74d21f1869f7bc7a5c8700172181b4a6e4f04d Mon Sep 17 00:00:00 2001
+From 74522518932db459e21108dede9f1354cc2bb6b8 Mon Sep 17 00:00:00 2001
From: Neal Cardwell
Date: Wed, 1 May 2019 20:16:33 -0400
-Subject: [PATCH 07/18] net-tcp_bbr: v2: adjust skb tx.in_flight upon merge in
+Subject: [PATCH 07/19] net-tcp_bbr: v2: adjust skb tx.in_flight upon merge in
tcp_shifted_skb()
When tcp_shifted_skb() updates state as adjacent SACKed skbs are
@@ -39,7 +39,7 @@ Signed-off-by: Alexandre Frade
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
-@@ -1489,6 +1489,17 @@ static bool tcp_shifted_skb(struct sock
+@@ -1660,6 +1660,17 @@ static bool tcp_shifted_skb(struct sock
WARN_ON_ONCE(tcp_skb_pcount(skb) < pcount);
tcp_skb_pcount_add(skb, -pcount);
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0008-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-split-in.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0008-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-split-in.patch
similarity index 91%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0008-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-split-in.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0008-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-split-in.patch
index 202e536fa..89fb3ba89 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0008-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-split-in.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0008-net-tcp_bbr-v2-adjust-skb-tx.in_flight-upon-split-in.patch
@@ -1,7 +1,7 @@
-From 545f96f640c4ff7f485ef4314b990b5a380aef2e Mon Sep 17 00:00:00 2001
+From f64cb2d65d9412d32ae5e5261d2bd1ca650f8e8c Mon Sep 17 00:00:00 2001
From: Neal Cardwell
Date: Wed, 1 May 2019 20:16:25 -0400
-Subject: [PATCH 08/18] net-tcp_bbr: v2: adjust skb tx.in_flight upon split in
+Subject: [PATCH 08/19] net-tcp_bbr: v2: adjust skb tx.in_flight upon split in
tcp_fragment()
When we fragment an skb that has already been sent, we need to update
@@ -31,7 +31,7 @@ Signed-off-by: Alexandre Frade
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
-@@ -1199,6 +1199,21 @@ static inline bool tcp_skb_sent_after(u6
+@@ -1399,6 +1399,21 @@ static inline bool tcp_skb_sent_after(u6
return t1 > t2 || (t1 == t2 && after(seq1, seq2));
}
@@ -55,16 +55,16 @@ Signed-off-by: Alexandre Frade
* between different flows.
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
-@@ -1548,7 +1548,7 @@ int tcp_fragment(struct sock *sk, enum t
+@@ -1761,7 +1761,7 @@ int tcp_fragment(struct sock *sk, enum t
{
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *buff;
- int old_factor;
+ int old_factor, inflight_prev;
long limit;
+ u16 flags;
int nlen;
- u8 flags;
-@@ -1623,6 +1623,30 @@ int tcp_fragment(struct sock *sk, enum t
+@@ -1836,6 +1836,30 @@ int tcp_fragment(struct sock *sk, enum t
if (diff)
tcp_adjust_pcount(sk, skb, diff);
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0009-net-tcp-add-new-ca-opts-flag-TCP_CONG_WANTS_CE_EVENT.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0009-net-tcp-add-new-ca-opts-flag-TCP_CONG_WANTS_CE_EVENT.patch
similarity index 66%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0009-net-tcp-add-new-ca-opts-flag-TCP_CONG_WANTS_CE_EVENT.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0009-net-tcp-add-new-ca-opts-flag-TCP_CONG_WANTS_CE_EVENT.patch
index 898c976aa..2dd2abf6c 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0009-net-tcp-add-new-ca-opts-flag-TCP_CONG_WANTS_CE_EVENT.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0009-net-tcp-add-new-ca-opts-flag-TCP_CONG_WANTS_CE_EVENT.patch
@@ -1,7 +1,7 @@
-From 4baad1b6a9c1e9f84e0e0a40d789382e0826e49a Mon Sep 17 00:00:00 2001
+From d39a6429c0ec67f51478737f7a13f6295ca8b3c0 Mon Sep 17 00:00:00 2001
From: Yousuk Seung
Date: Wed, 23 May 2018 17:55:54 -0700
-Subject: [PATCH 09/18] net-tcp: add new ca opts flag TCP_CONG_WANTS_CE_EVENTS
+Subject: [PATCH 09/19] net-tcp: add new ca opts flag TCP_CONG_WANTS_CE_EVENTS
Add a a new ca opts flag TCP_CONG_WANTS_CE_EVENTS that allows a
congestion control module to receive CE events.
@@ -23,20 +23,20 @@ Signed-off-by: Alexandre Frade
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
-@@ -1035,7 +1035,11 @@ enum tcp_ca_ack_event_flags {
- #define TCP_CONG_NON_RESTRICTED 0x1
- /* Requires ECN/ECT set on all packets */
- #define TCP_CONG_NEEDS_ECN 0x2
--#define TCP_CONG_MASK (TCP_CONG_NON_RESTRICTED | TCP_CONG_NEEDS_ECN)
+@@ -1212,9 +1212,11 @@ enum tcp_ca_ack_event_flags {
+ #define TCP_CONG_ECT_1_NEGOTIATION BIT(3)
+ /* Cannot fallback to RFC3168 during AccECN negotiation */
+ #define TCP_CONG_NO_FALLBACK_RFC3168 BIT(4)
+/* Wants notification of CE events (CA_EVENT_ECN_IS_CE, CA_EVENT_ECN_NO_CE). */
-+#define TCP_CONG_WANTS_CE_EVENTS 0x4
-+#define TCP_CONG_MASK (TCP_CONG_NON_RESTRICTED | \
-+ TCP_CONG_NEEDS_ECN | \
-+ TCP_CONG_WANTS_CE_EVENTS)
++#define TCP_CONG_WANTS_CE_EVENTS BIT(2)
+ #define TCP_CONG_MASK (TCP_CONG_NON_RESTRICTED | TCP_CONG_NEEDS_ECN | \
+ TCP_CONG_NEEDS_ACCECN | TCP_CONG_ECT_1_NEGOTIATION | \
+- TCP_CONG_NO_FALLBACK_RFC3168)
++ TCP_CONG_NO_FALLBACK_RFC3168 | TCP_CONG_WANTS_CE_EVENTS)
union tcp_cc_info;
-@@ -1167,6 +1171,14 @@ static inline char *tcp_ca_get_name_by_k
+@@ -1346,6 +1348,14 @@ static inline char *tcp_ca_get_name_by_k
}
#endif
@@ -53,7 +53,7 @@ Signed-off-by: Alexandre Frade
const struct inet_connection_sock *icsk = inet_csk(sk);
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
-@@ -376,7 +376,7 @@ static void __tcp_ecn_check_ce(struct so
+@@ -358,7 +358,7 @@ static void tcp_data_ecn_check(struct so
tcp_enter_quickack_mode(sk, 2);
break;
case INET_ECN_CE:
@@ -61,13 +61,13 @@ Signed-off-by: Alexandre Frade
+ if (tcp_ca_wants_ce_events(sk))
tcp_ca_event(sk, CA_EVENT_ECN_IS_CE);
- if (!(tp->ecn_flags & TCP_ECN_DEMAND_CWR)) {
-@@ -387,7 +387,7 @@ static void __tcp_ecn_check_ce(struct so
+ if (!(tp->ecn_flags & TCP_ECN_DEMAND_CWR) &&
+@@ -376,7 +376,7 @@ static void tcp_data_ecn_check(struct so
tp->ecn_flags |= TCP_ECN_SEEN;
break;
default:
- if (tcp_ca_needs_ecn(sk))
+ if (tcp_ca_wants_ce_events(sk))
tcp_ca_event(sk, CA_EVENT_ECN_NO_CE);
- tp->ecn_flags |= TCP_ECN_SEEN;
- break;
+ if (!tcp_ecn_mode_rfc3168(tp))
+ break;
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0010-net-tcp-re-generalize-TSO-sizing-in-TCP-CC-module-AP.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0010-net-tcp-re-generalize-TSO-sizing-in-TCP-CC-module-AP.patch
similarity index 85%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0010-net-tcp-re-generalize-TSO-sizing-in-TCP-CC-module-AP.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0010-net-tcp-re-generalize-TSO-sizing-in-TCP-CC-module-AP.patch
index 4a7462ae4..dd5ac81a8 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0010-net-tcp-re-generalize-TSO-sizing-in-TCP-CC-module-AP.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0010-net-tcp-re-generalize-TSO-sizing-in-TCP-CC-module-AP.patch
@@ -1,7 +1,7 @@
-From d703f42b8914209f615f18cd2ba296f4f25d66a3 Mon Sep 17 00:00:00 2001
+From 8b64cdb009d7624b4a233a89e510e3a92fee9e71 Mon Sep 17 00:00:00 2001
From: Neal Cardwell
Date: Fri, 27 Sep 2019 17:10:26 -0400
-Subject: [PATCH 10/18] net-tcp: re-generalize TSO sizing in TCP CC module API
+Subject: [PATCH 10/19] net-tcp: re-generalize TSO sizing in TCP CC module API
Reorganize the API for CC modules so that the CC module once again
gets complete control of the TSO sizing decision. This is how the API
@@ -27,7 +27,7 @@ Signed-off-by: Alexandre Frade
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
-@@ -1101,8 +1101,8 @@ struct tcp_congestion_ops {
+@@ -1278,8 +1278,8 @@ struct tcp_congestion_ops {
/* hook for packet ack accounting (optional) */
void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample);
@@ -40,8 +40,8 @@ Signed-off-by: Alexandre Frade
void (*skb_marked_lost)(struct sock *sk, const struct sk_buff *skb);
--- a/net/ipv4/tcp_bbr.c
+++ b/net/ipv4/tcp_bbr.c
-@@ -300,20 +300,35 @@ __bpf_kfunc static u32 bbr_min_tso_segs(
- return sk->sk_pacing_rate < (bbr_min_tso_rate >> 3) ? 1 : 2;
+@@ -301,20 +301,35 @@ __bpf_kfunc static u32 bbr_min_tso_segs(
+ return READ_ONCE(sk->sk_pacing_rate) < (bbr_min_tso_rate >> 3) ? 1 : 2;
}
+/* Return the number of segments BBR would like in a TSO/GSO skb, given
@@ -54,7 +54,7 @@ Signed-off-by: Alexandre Frade
+ u64 bytes;
+
+ /* Budget a TSO/GSO burst size allowance based on bw (pacing_rate). */
-+ bytes = sk->sk_pacing_rate >> sk->sk_pacing_shift;
++ bytes = READ_ONCE(sk->sk_pacing_rate) >> READ_ONCE(sk->sk_pacing_shift);
+
+ bytes = min_t(u32, bytes, gso_max_size - 1 - MAX_TCP_HEADER);
+ segs = max_t(u32, bytes / mss_now, bbr_min_tso_segs(sk));
@@ -77,16 +77,16 @@ Signed-off-by: Alexandre Frade
- * driver provided sk_gso_max_size.
- */
- bytes = min_t(unsigned long,
-- sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift),
+- READ_ONCE(sk->sk_pacing_rate) >> READ_ONCE(sk->sk_pacing_shift),
- GSO_LEGACY_MAX_SIZE - 1 - MAX_TCP_HEADER);
- segs = max_t(u32, bytes / tp->mss_cache, bbr_min_tso_segs(sk));
- return min(segs, 0x7FU);
-+ return bbr_tso_segs_generic(sk, tp->mss_cache, GSO_MAX_SIZE);
++ return bbr_tso_segs_generic(sk, tp->mss_cache, GSO_MAX_SIZE);
}
/* Save "last known good" cwnd so we can restore it after losses or PROBE_RTT */
-@@ -1149,7 +1164,7 @@ static struct tcp_congestion_ops tcp_bbr
+@@ -1150,7 +1165,7 @@ static struct tcp_congestion_ops tcp_bbr
.undo_cwnd = bbr_undo_cwnd,
.cwnd_event = bbr_cwnd_event,
.ssthresh = bbr_ssthresh,
@@ -97,7 +97,7 @@ Signed-off-by: Alexandre Frade
};
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
-@@ -2022,13 +2022,12 @@ static u32 tcp_tso_autosize(const struct
+@@ -2216,13 +2216,12 @@ static u32 tcp_tso_autosize(const struct
static u32 tcp_tso_segs(struct sock *sk, unsigned int mss_now)
{
const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops;
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0011-net-tcp-add-fast_ack_mode-1-skip-rwin-check-in-tcp_f.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0011-net-tcp-add-fast_ack_mode-1-skip-rwin-check-in-tcp_f.patch
similarity index 69%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0011-net-tcp-add-fast_ack_mode-1-skip-rwin-check-in-tcp_f.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0011-net-tcp-add-fast_ack_mode-1-skip-rwin-check-in-tcp_f.patch
index 1398222ab..10c4ada05 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0011-net-tcp-add-fast_ack_mode-1-skip-rwin-check-in-tcp_f.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0011-net-tcp-add-fast_ack_mode-1-skip-rwin-check-in-tcp_f.patch
@@ -1,7 +1,7 @@
-From d40e81b25a4ebe05eee16c335e9698c09a9dfb14 Mon Sep 17 00:00:00 2001
+From 0ff8136eeca5fb038fdef3d8342838785df28685 Mon Sep 17 00:00:00 2001
From: Neal Cardwell
-Date: Sat, 16 Nov 2019 13:16:25 -0500
-Subject: [PATCH 11/18] net-tcp: add fast_ack_mode=1: skip rwin check in
+Date: Sun, 7 Jan 2024 21:11:26 -0300
+Subject: [PATCH 11/19] net-tcp: add fast_ack_mode=1: skip rwin check in
tcp_fast_ack_mode__tcp_ack_snd_check()
Add logic for an experimental TCP connection behavior, enabled with
@@ -21,19 +21,19 @@ Signed-off-by: Alexandre Frade
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
-@@ -257,7 +257,8 @@ struct tcp_sock {
- u8 compressed_ack;
- u8 dup_ack_counter:2,
- tlp_retrans:1, /* TLP is a retransmission */
-- unused:5;
-+ fast_ack_mode:2, /* which fast ack mode ? */
-+ unused:3;
- u32 chrono_start; /* Start time in jiffies of a TCP chrono */
- u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */
- u8 chrono_type:2, /* current chronograph type */
+@@ -235,7 +235,8 @@ struct tcp_sock {
+ tcp_usec_ts : 1, /* TSval values in usec */
+ is_sack_reneg:1, /* in recovery from loss with SACK reneg? */
+ is_cwnd_limited:1,/* forward progress limited by snd_cwnd? */
+- recvmsg_inq : 1;/* Indicate # of bytes in queue upon recvmsg */
++ recvmsg_inq : 1,/* Indicate # of bytes in queue upon recvmsg */
++ fast_ack_mode:1;/* ack ASAP if >1 rcv_mss received? */
+ __cacheline_group_end(tcp_sock_read_txrx);
+
+ /* RX read-mostly hotpath cache lines */
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
-@@ -3099,6 +3099,7 @@ int tcp_disconnect(struct sock *sk, int
+@@ -3468,6 +3468,7 @@ int tcp_disconnect(struct sock *sk, int
tp->rx_opt.dsack = 0;
tp->rx_opt.num_sacks = 0;
tp->rcv_ooopack = 0;
@@ -43,7 +43,7 @@ Signed-off-by: Alexandre Frade
/* Clean up fastopen related fields */
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
-@@ -241,6 +241,7 @@ void tcp_init_congestion_control(struct
+@@ -238,6 +238,7 @@ void tcp_init_congestion_control(struct
struct inet_connection_sock *icsk = inet_csk(sk);
tcp_sk(sk)->prior_ssthresh = 0;
@@ -53,7 +53,7 @@ Signed-off-by: Alexandre Frade
if (tcp_ca_needs_ecn(sk))
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
-@@ -5621,13 +5621,14 @@ static void __tcp_ack_snd_check(struct s
+@@ -5912,13 +5912,14 @@ static void __tcp_ack_snd_check(struct s
/* More than one full frame received... */
if (((tp->rcv_nxt - tp->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss &&
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0012-net-tcp_bbr-v2-record-app-limited-status-of-TLP-repa.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0012-net-tcp_bbr-v2-record-app-limited-status-of-TLP-repa.patch
similarity index 61%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0012-net-tcp_bbr-v2-record-app-limited-status-of-TLP-repa.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0012-net-tcp_bbr-v2-record-app-limited-status-of-TLP-repa.patch
index 1a5b4e1e9..427e1d655 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0012-net-tcp_bbr-v2-record-app-limited-status-of-TLP-repa.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0012-net-tcp_bbr-v2-record-app-limited-status-of-TLP-repa.patch
@@ -1,7 +1,7 @@
-From f59611bea9c062fb44ecb9040f074cac359e2993 Mon Sep 17 00:00:00 2001
+From 399c324888acd78cd0cac5407e2dc27bb2225ba0 Mon Sep 17 00:00:00 2001
From: Jianfeng Wang
Date: Fri, 19 Jun 2020 17:33:45 +0000
-Subject: [PATCH 12/18] net-tcp_bbr: v2: record app-limited status of
+Subject: [PATCH 12/19] net-tcp_bbr: v2: record app-limited status of
TLP-repaired flight
When sending a TLP retransmit, record whether the outstanding flight
@@ -23,19 +23,19 @@ Signed-off-by: Alexandre Frade
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
-@@ -258,7 +258,8 @@ struct tcp_sock {
- u8 dup_ack_counter:2,
- tlp_retrans:1, /* TLP is a retransmission */
- fast_ack_mode:2, /* which fast ack mode ? */
-- unused:3;
-+ tlp_orig_data_app_limited:1, /* app-limited before TLP rtx? */
-+ unused:2;
- u32 chrono_start; /* Start time in jiffies of a TCP chrono */
- u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */
- u8 chrono_type:2, /* current chronograph type */
+@@ -293,7 +293,8 @@ struct tcp_sock {
+ * 0x5?10 << 16 + snd_wnd in net byte order
+ */
+ u8 nonagle : 4,/* Disable Nagle algorithm? */
+- rate_app_limited:1; /* rate_{delivered,interval_us} limited? */
++ rate_app_limited:1, /* rate_{delivered,interval_us} limited? */
++ tlp_orig_data_app_limited:1; /* app-limited before TLP rtx? */
+ u8 received_ce_pending:4, /* Not yet transmit cnt of received_ce */
+ unused2:4;
+ u8 accecn_minlen:2,/* Minimum length of AccECN option sent */
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
-@@ -2940,6 +2940,7 @@ void tcp_send_loss_probe(struct sock *sk
+@@ -3152,6 +3152,7 @@ void tcp_send_loss_probe(struct sock *sk
if (WARN_ON(!skb || !tcp_skb_pcount(skb)))
goto rearm_timer;
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0013-net-tcp_bbr-v2-inform-CC-module-of-losses-repaired-b.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0013-net-tcp_bbr-v2-inform-CC-module-of-losses-repaired-b.patch
similarity index 86%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0013-net-tcp_bbr-v2-inform-CC-module-of-losses-repaired-b.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0013-net-tcp_bbr-v2-inform-CC-module-of-losses-repaired-b.patch
index 034ff70e4..1d075e54c 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0013-net-tcp_bbr-v2-inform-CC-module-of-losses-repaired-b.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0013-net-tcp_bbr-v2-inform-CC-module-of-losses-repaired-b.patch
@@ -1,7 +1,7 @@
-From 46024649ecd254cf303f2104406c6ffff3dce343 Mon Sep 17 00:00:00 2001
+From 43e59a05c78564807876ae8529c71b261e8cceff Mon Sep 17 00:00:00 2001
From: Jianfeng Wang
Date: Tue, 16 Jun 2020 17:41:19 +0000
-Subject: [PATCH 13/18] net-tcp_bbr: v2: inform CC module of losses repaired by
+Subject: [PATCH 13/19] net-tcp_bbr: v2: inform CC module of losses repaired by
TLP probe
Before this commit, when there is a packet loss that creates a sequence
@@ -25,7 +25,7 @@ Signed-off-by: Alexandre Frade
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
-@@ -1013,6 +1013,7 @@ enum tcp_ca_event {
+@@ -1184,6 +1184,7 @@ enum tcp_ca_event {
CA_EVENT_LOSS, /* loss timeout */
CA_EVENT_ECN_NO_CE, /* ECT set, but not CE marked */
CA_EVENT_ECN_IS_CE, /* received CE marked IP packet */
@@ -35,7 +35,7 @@ Signed-off-by: Alexandre Frade
/* Information about inbound ACK, passed to cong_ops->in_ack_event() */
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
-@@ -3772,6 +3772,7 @@ static void tcp_process_tlp_ack(struct s
+@@ -3924,6 +3924,7 @@ static void tcp_process_tlp_ack(struct s
/* ACK advances: there was a loss, so reduce cwnd. Reset
* tlp_high_seq in tcp_init_cwnd_reduction()
*/
diff --git a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0014-net-tcp_bbr-v2-introduce-is_acking_tlp_retrans_seq-i.patch b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0014-net-tcp_bbr-v2-introduce-is_acking_tlp_retrans_seq-i.patch
similarity index 80%
rename from openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0014-net-tcp_bbr-v2-introduce-is_acking_tlp_retrans_seq-i.patch
rename to openwrt/patch/kernel-6.18/bbr3/010-bbr3-0014-net-tcp_bbr-v2-introduce-is_acking_tlp_retrans_seq-i.patch
index 0a3016365..b399ac5d4 100644
--- a/openwrt/patch/kernel-6.6/bbr3_6.6/010-bbr3-0014-net-tcp_bbr-v2-introduce-is_acking_tlp_retrans_seq-i.patch
+++ b/openwrt/patch/kernel-6.18/bbr3/010-bbr3-0014-net-tcp_bbr-v2-introduce-is_acking_tlp_retrans_seq-i.patch
@@ -1,7 +1,7 @@
-From 3996591ce3544d9defec725579123f5d4867524c Mon Sep 17 00:00:00 2001
+From e8c17561fd4afb5966cb8e434375c26dd80e876b Mon Sep 17 00:00:00 2001
From: Neal Cardwell
Date: Mon, 21 Sep 2020 14:46:26 -0400
-Subject: [PATCH 14/18] net-tcp_bbr: v2: introduce is_acking_tlp_retrans_seq
+Subject: [PATCH 14/19] net-tcp_bbr: v2: introduce is_acking_tlp_retrans_seq
into rate_sample
Introduce is_acking_tlp_retrans_seq into rate_sample. This bool will
@@ -21,7 +21,7 @@ Signed-off-by: Alexandre Frade
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
-@@ -1077,6 +1077,7 @@ struct rate_sample {
+@@ -1254,6 +1254,7 @@ struct rate_sample {
u32 last_end_seq; /* end_seq of most recently ACKed packet */
bool is_app_limited; /* is sample from packet with bubble in pipe? */
bool is_retrans; /* is sample from retransmission? */
@@ -31,9 +31,9 @@ Signed-off-by: Alexandre Frade