以openwrt-23.05分支为例,编译适用于Cudy TR3000的OP系统


安装WSL

教程详见:FAEP复现的第一部分,最好也修改一下软件包源,当然不同的是这次我们安装Ubuntu 22.04

编译前准备

  1. 安装依赖,此处适用于Ubuntu 22.04,其他系统命令详见:install-buildsystem

    1
    2
    sudo apt update
    sudo apt install build-essential clang flex bison g++ gawk gcc-multilib g++-multilib gettext git libncurses-dev libssl-dev python3-distutils python3-setuptools rsync swig unzip zlib1g-dev file wget
  2. 拉取openwrt-23.05分支代码

    1
    git clone https://github.com/openwrt/openwrt -b openwrt-23.05 openwrt
  3. 添加其他软件包源

    1
    2
    3
    4
    5
    # 进入openwrt文件夹中
    cd openwrt
    # 在feed源配置文件中添加源
    echo "src-git OpenClash https://github.com/vernesong/OpenClash" >> ./feeds.conf.default
    echo "src-git istore https://github.com/linkease/istore" >> ./feeds.conf.default
  4. 更新软件包,此处推荐在科学上网环境下,Clash需要开启TUN模式。

    1
    2
    ./scripts/feeds update -a
    ./scripts/feeds install -a
  5. 安装其他非官方包

    Argon主题,拉取到openwrt/package下

    1
    git clone https://github.com/jerrykuku/luci-theme-argon.git ./package/luci-theme-argon

    Argon 主题配置插件

    1
    git clone https://github.com/jerrykuku/luci-app-argon-config.git ./package/luci-app-argon-config

编译配置

使用 make menuconfig 进行编译配置,具体各项的含义可以参考:https://www.nodeseek.com/post-37859-1

  1. Target System(系统架构):空格或回车进入,选择MediaTek Ralink ARM
  2. Subtarget(芯片类型):Filogic 8x0 (MT798x)
  3. Target Profile(目标设备):Cudy TR3000 v1
  4. Target Images(镜像格式):选中状态的仅squashfs即可,双击ESC返回

接下来从Base system开始是一些可选的功能和组件,本篇博客仅做基础的组件推荐,需要更特殊功能的自行搜索

注意,在选择时应将其选为 <*>,而 <M> 只会被编译成独立的软件包,这没有意义;如果你看到了 -*-,这意味着其被其他已选组件所依赖,无法取消勾选。

Base system中去除dnsmasq,因为它会和OpenClash的依赖dnsmasq-full冲突

在Kernel modules中选中USB Support–>kmod-usb-net-rndis

Luci下的组件:

  1. Collections:luci
  2. Modules:Translations–>Chinese Simplified (zh_Hans)
  3. Applications:luci-app-argon-config、luci-app-ddns、luci-app-openclash、luci-app-store、luci-app-ttyd

在Network中添加ethtool,因为当前2.5G网口有时会不工作,所以我们要在刷机之后,在/etc/rc.local启动脚本中添加

1
2
3
4
5
6
echo "/etc/rc.local start"
ethtool -s eth0 autoneg on speed 2500 duplex full
ip link set eth0 down
sleep 2
ip link set eth0 up
exit 0

最后是Utilities中,Editors:vim-full

至此,我们在官方原版固件的基础上添加了简中支持、OpenClash、TTYD终端、Vim、iStore以及Argon主题

并且添加了对USB共享网络的支持

保存并退出配置页面,即 openwrt/.config 文件

GitHub Action编译

参考 P3TERX/Actions-OpenWrt 提供的模板实现,见 OpenWrt-for-Cudy-TR3000v1