1.前言

  • 预览图:

  • 已额外适配除官方适配外的以下机型

    • MI-MINI (USB)
    • MI-3 (USB)
    • MI-3MI 小米路由3硬改sop8 16mb flash版(USB)
    • MI-3A
    • MI-3C
    • MI-4C

哈罗,各位小伙伴大家好哇,我是小渔知道我的小伙伴可以看看我之前做的几个视频,关于路由器硬改以及救砖的教程。

1.挑战不可能!全站首发!小米路由3A刷机提取eeprom全过程详解

2.小米路由3A刷机从拆解到验证

3.【全网首发】小米路由3C刷机提取eeprom教程

4.【手把手教学系列】从零开始学习小米路由mini救砖

5.【全网首发】小米路由3C刷机提取eeprom教程

6.【全网首发】小米路由3 硬改版 breed刷固件

也可以参阅我这一篇文章:小米路由3 breed 刷固件-魔改电阻后置换SPI flash 刷mini breed救砖

EEPROM信号文件提取工具下载:蓝奏云盘

2.正文-配置需求

下面开始正题,编译Padavan所需要的环境其实也并不复杂,只是配置需要耐心,清单如下:


我的虚拟机配置

  1. 已安装乌班图(ubuntu)系统16.0+的VM虚拟机

  2. 一定的自我查错能力(主要是根据报错学会百度)

  3. Xshell或者FinalShell Ssh连接工具一个

    3.正文-环境配置

    以我的虚拟机为例

    你们的需要自己换成你们自己虚拟机的IP地址

  4. 打开Ssh工具用root账号连接虚拟机

    ssh root@10.32.0.82

ssh连接
连接成功

然后运行此命令:

sudo apt install wget unzip libtool-bin curl cmake gperf gawk flex bison nano xxd fakeroot autoconf automake libtool autopoint byobu cmake p7zip p7zip-rar p7zip-full -y \
cpio git python-docutils gettext automake autopoint texinfo build-essential help2man \
pkg-config zlib1g-dev libgmp3-dev libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget
sudo apt update
sudo apt-get upgrade -y
git clone --depth=1 https://github.com/chongshengB/rt-n56u.git /opt/rt-n56u
cd /opt/rt-n56u/toolchain-mipsel
./clean_toolchain
./build_toolchain

安装环境中

等待大约2分钟左右可能会需要你手动"确定"一下
需要手动确认

这里从环境安装、库安装、克隆Padavan源码、编译工具链等一切都由脚本完成,你可以泡一杯82年的卡布奇洛安心等待大约1小时左右就好

克隆Padavan源码中
工具链编译中
等待工具链编译完成后执行以下命令:

cd /opt/rt-n56u/trunk
sudo ./clear_tree
fakeroot ./build_firmware_modify PSG1218
#脚本第一个参数为路由型号,在trunk/configs/templates/中
#编译好的固件在trunk/images里
#增加修改取消插件集成请修改/opt/rt-n56u/trunk/build_firmware_modify
#修改Logo 请替换/opt/rt-n56u/trunk/user/www/n56u_ribbon_fixed/bootstrap/img/asus_logo.png 规格为宽度5.19cm 高度2.54cm 分辨率72
#修改路由后台地址管理员密码等请修改 /opt/rt-n56u/trunk/user/shared/defaults.h
#修改路由中文页面内容等请修改 /opt/rt-n56u/trunk/user/www/dict/CN.dict

defaults.h

题外

建议可以安装一个宝塔面板,在线编辑剪切复制比较方便

安装要求:
内存:512M以上,推荐768M以上(纯面板约占系统60M内存)
硬盘:100M以上可用硬盘空间(纯面板约占20M磁盘空间)
系统:CentOS 7.1+ (Ubuntu16.04+.、Debian9.0+),确保是干净的操作系统,没有安装过其它环境带的Apache/Nginx/php/MySQL(已有环境不可安装)

安装宝塔(可选)

Linux面板7.4.2安装命令:
根据系统执行框内命令开始安装(大约2分钟完成面板安装)
Centos安装命令:

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

试验性Centos/Ubuntu/Debian安装命令 独立运行环境(py3.7) 可能存在少量兼容性问题 不断优化中:

curl -sSO http://download.bt.cn/install/install_panel.sh && bash install_panel.sh

Ubuntu/Deepin安装命令:

wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh

Debian安装命令:

wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh

Fedora安装命令:

wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh

Linux面板7.3.0升级命令:

curl http://download.bt.cn/install/update6.sh|bash

4.正文-手动自定义适配路由

命令行操作

cd /opt/rt-n56u/trunk/configs/

宝塔操作

ssh root@10.32.0.82
输入账号密码
bt
14

bt

因为宝塔可视化比较方便所以后面全部用宝塔操作,打开浏览器,输入Bt -URL(你们的根据自己实际的来,不要什么都不改,无脑)

Bt-Panel-URL: http://183.222.197.203:8088/c86b4eb6
username: rrbrzni5
password: 3bf49830
虚拟机请将183.222.197.203改为你的内网IP。(比如我的10.32.0.82)
宝塔登录页
输入账号密码;
username: rrbrzni5
password: 3bf49830
然后登陆
登陆成功页

然后点击文件,进入/opt/rt-n56u/trunk
宝塔页面

/opt/rt-n56u/trunk/configs/boards
/opt/rt-n56u/trunk/configs/templates
#这里存放路由器型号以及配置文件boards为配置文件夹,templates为Config文件

如果要自己新增某个路由器型号,需要在boards新建文件夹,在templates中新建Config文件
比如我的小米3硬改版
templates
boards

适配网口以及电源指示灯

因为我们复制的文件虽然也能编译并成功刷入后启动,但是一般会面临着网口错位,电源指示灯诡异等问题,所以我们需要根据实际来修改
首先进入/opt/rt-n56u/trunk/configs/boards/MI-3MI
可以看到有三个文件,分别是board.h board.mk kernel-3.4.x.config
三个文件
首先修改board.h
/ Xiaomi Mi 3 /

#define BOARD_PID       "MI-3"
#define BOARD_NAME      "MI-3"
#define BOARD_DESC      "Xiaomi Mi Mini Wireless Router"
#define BOARD_VENDOR_NAME   "Beijing Xiaomi Technology Co., Ltd."
#define BOARD_VENDOR_URL    "http://www.mi.com/"
#define BOARD_MODEL_URL     "http://www.mi.com/miwifi3"
#define BOARD_BOOT_TIME     25
#define BOARD_FLASH_TIME    120
#define BOARD_GPIO_BTN_RESET    30
#undef  BOARD_GPIO_BTN_WPS
#undef  BOARD_GPIO_LED_ALL
#undef  BOARD_GPIO_LED_WIFI
#define BOARD_GPIO_LED_POWER    24  /* 24: blue, 26: yellow, 29: red */
#undef  BOARD_GPIO_LED_LAN
#undef  BOARD_GPIO_LED_WAN
#define BOARD_GPIO_LED_USB  26
#undef  BOARD_GPIO_LED_ROUTER
#define BOARD_GPIO_PWR_USB  65
#define BOARD_GPIO_PWR_USB_ON   1   /* 1: 5V Power ON, 0: 5V Power OFF */
#define BOARD_HAS_5G_11AC   1
#define BOARD_NUM_ANT_5G_TX 2
#define BOARD_NUM_ANT_5G_RX 2
#define BOARD_NUM_ANT_2G_TX 2
#define BOARD_NUM_ANT_2G_RX 2
#define BOARD_NUM_ETH_LEDS  1
#define BOARD_NUM_ETH_EPHY  3
#define BOARD_HAS_EPHY_L1000    0
#define BOARD_HAS_EPHY_W1000    0

我们需要注意的是下面的内容,其他都还好。

#define BOARD_PID        "MI-3"
#define BOARD_NAME        "MI-3"
#define BOARD_DESC        "Xiaomi Mi Mini Wireless Router"
#define BOARD_VENDOR_NAME    "Beijing Xiaomi Technology Co., Ltd."
#define BOARD_VENDOR_URL    "http://www.mi.com/"
#define BOARD_MODEL_URL        "http://www.mi.com/miwifi3"
#define BOARD_BOOT_TIME        25
#define BOARD_FLASH_TIME    120
#define BOARD_GPIO_BTN_RESET    30
#undef  BOARD_GPIO_BTN_WPS
#undef  BOARD_GPIO_LED_ALL
#undef  BOARD_GPIO_LED_WIFI
#define BOARD_GPIO_LED_POWER    24    /* 电源指示灯:24: blue, 26: yellow, 29: red */

然后修改board.mk

##################################################################
# Board PID # Board Name       # PRODUCT # Note
##################################################################
# MI-3      # Xiaomi MiWiFi 3  # MT7620  #
##################################################################

CFLAGS += -DBOARD_MI3
BOARD_NUM_USB_PORTS=1

最后修改kernel-3.4.x.config,主要的目的是为了适配网口
只需要修改以下内容即可

# CONFIG_RAETH_ESW_IGMP_SNOOP_HW is not set
CONFIG_RAETH_ESW_PORT_WAN=0
CONFIG_RAETH_ESW_PORT_LAN1=1
CONFIG_RAETH_ESW_PORT_LAN2=2
CONFIG_RAETH_ESW_PORT_LAN3=3
CONFIG_RAETH_ESW_PORT_LAN4=4

从WAN到LAN40,1,2,3,4顺序不固定,请根据实际修改,小米3硬改版还有小米3C我是测试了很多遍试出来的哈哈

修改底部footer信息

footer
参考链接
修改 trunk/user/www/Makefile

    ifndef ROOTDIR
ROOTDIR=../..
endif

ROMFS_DIR = $(ROOTDIR)/romfs

include $(ROOTDIR)/user/shared/boards.mk

PROJECT_HOME_URL="https:\/\/bitbucket.org\/padavan\/rt-n56u\/"
PROJECT_HOME_URL_MOD="https:\/\/github.com\/hanwckf\/rt-n56u\/"

LABEL_COPYRIGHT_TEXT='? 2019-2020 <a href="https:\/\/xiaoxianyu.top" target="blank">小渔博客<\/a> \& Padavan with 小渔 \& by <a href="https:\/\/github.com\/hanwckf\/rt-n56u" target="blank">hanwckf<\/a>'

BOARD_PATTERN=s/ZVMODELVZ/$(CONFIG_FIRMWARE_PRODUCT_ID)/g
COPYR_PATTERN=s/ZVCOPYRVZ/$(LABEL_COPYRIGHT_TEXT)/g
DWURL_PATTERN=s/ZVDWURLVZ/$(PROJECT_HOME_URL)/g
DWURL_MOD_PATTERN=s/ZVMODWURLVZ/$(PROJECT_HOME_URL_MOD)/g

WEBUI_NAME=n56u_ribbon_fixed

all:

romfs:
    echo "Make www romfs"
    rm -Rf $(ROMFS_DIR)/www
    cp -R $(WEBUI_NAME) $(ROMFS_DIR)/www
    rm -f $(ROMFS_DIR)/www/httpd_check.htm
    echo "ASUSTeK" > $(ROMFS_DIR)/www/httpd_check.htm
    cd $(ROMFS_DIR)/www && ln -sf /opt/share/www/custom custom
    cp dict/EN.header $(ROMFS_DIR)/www
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_BR),y)
    echo "LANG_BR=Brazil" >> $(ROMFS_DIR)/www/EN.header
    cp dict/BR.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/BR.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/BR.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/BR.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_CZ),y)
    echo "LANG_CZ=?esky" >> $(ROMFS_DIR)/www/EN.header
    cp dict/CZ.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/CZ.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/CZ.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/CZ.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_DA),y)
    echo "LANG_DA=Dansk" >> $(ROMFS_DIR)/www/EN.header
    cp dict/DA.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/DA.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/DA.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/DA.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_DE),y)
    echo "LANG_DE=Deutsch" >> $(ROMFS_DIR)/www/EN.header
    cp dict/DE.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/DE.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/DE.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/DE.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_ES),y)
    echo "LANG_ES=Espa?ol" >> $(ROMFS_DIR)/www/EN.header
    cp dict/ES.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/ES.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/ES.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/ES.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_FI),y)
    echo "LANG_FI=Finsk" >> $(ROMFS_DIR)/www/EN.header
    cp dict/FI.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/FI.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/FI.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/FI.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_FR),y)
    echo "LANG_FR=Fran?ais" >> $(ROMFS_DIR)/www/EN.header
    cp dict/FR.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/FR.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/FR.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/FR.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_NO),y)
    echo "LANG_NO=Norsk" >> $(ROMFS_DIR)/www/EN.header
    cp dict/NO.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/NO.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/NO.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/NO.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_PL),y)
    echo "LANG_PL=Polski" >> $(ROMFS_DIR)/www/EN.header
    cp dict/PL.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/PL.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/PL.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/PL.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_RU),y)
    echo "LANG_RU=Pусский" >> $(ROMFS_DIR)/www/EN.header
    cp dict/RU.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/RU.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/RU.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/RU.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_SV),y)
    echo "LANG_SV=Svensk" >> $(ROMFS_DIR)/www/EN.header
    cp dict/SV.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/SV.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/SV.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/SV.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_UK),y)
    echo "LANG_UK=Укра?нська" >> $(ROMFS_DIR)/www/EN.header
    cp dict/UK.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/UK.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/UK.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/UK.dict
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_LANG_CN),y)
    echo "LANG_CN=简体中文" >> $(ROMFS_DIR)/www/EN.header
    cp dict/CN.dict $(ROMFS_DIR)/www
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/CN.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/CN.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/CN.dict
    sed $(DWURL_MOD_PATTERN) -i $(ROMFS_DIR)/www/CN.dict
endif
    cat $(ROMFS_DIR)/www/EN.header dict/EN.footer > $(ROMFS_DIR)/www/EN.dict
    sed $(BOARD_PATTERN) -i $(ROMFS_DIR)/www/EN.dict
    sed $(COPYR_PATTERN) -i $(ROMFS_DIR)/www/EN.dict
    sed $(DWURL_PATTERN) -i $(ROMFS_DIR)/www/EN.dict
    sed $(DWURL_MOD_PATTERN) -i $(ROMFS_DIR)/www/EN.dict
    rm -f $(ROMFS_DIR)/www/EN.header
    rm -f $(ROMFS_DIR)/www/bootstrap/js/bootstrap.js
    rm -f $(ROMFS_DIR)/www/bootstrap/js/engage.itoggle.js
    rm -f $(ROMFS_DIR)/www/bootstrap/js/jquery.backgroundpos.min.js
    rm -f $(ROMFS_DIR)/www/bootstrap/js/jquery.easing.1.3.js
    rm -f $(ROMFS_DIR)/www/bootstrap/css/bootstrap.css
ifeq ($(BOARD_HAS_5G_RADIO),0)
    rm -f $(INSTALLDIR)/www/Advanced_ACL_Content.asp
    rm -f $(INSTALLDIR)/www/Advanced_WAdvanced_Content.asp
    rm -f $(INSTALLDIR)/www/Advanced_WGuest_Content.asp
    rm -f $(INSTALLDIR)/www/Advanced_Wireless_Content.asp
    rm -f $(INSTALLDIR)/www/Advanced_WMode_Content.asp
    rm -f $(INSTALLDIR)/www/Advanced_WSecurity_Content.asp
    rm -f $(INSTALLDIR)/www/Main_WStatus_Content.asp
    rm -f $(INSTALLDIR)/www/wireless.js
    rm -f $(INSTALLDIR)/www/wds_aplist.asp
    rm -f $(INSTALLDIR)/www/device-map/router.asp
endif
ifndef CONFIG_IPV6
    rm -f $(INSTALLDIR)/www/Advanced_IPv6_Content.asp
endif
ifndef CONFIG_ATA
    rm -f $(INSTALLDIR)/www/device-map/sata.asp
endif
ifndef CONFIG_USB_SUPPORT
    rm -f $(INSTALLDIR)/www/Advanced_Modem_others.asp
    rm -f $(INSTALLDIR)/www/Advanced_Printer_others.asp
    rm -f $(INSTALLDIR)/www/modem_isp.js
    rm -f $(INSTALLDIR)/www/device-map/modem.asp
    rm -f $(INSTALLDIR)/www/device-map/printer.asp
    rm -f $(INSTALLDIR)/www/device-map/hub.asp
endif
ifneq ($(STORAGE_ENABLED),y)
    rm -f $(INSTALLDIR)/www/Advanced_AiDisk_ftp.asp
    rm -f $(INSTALLDIR)/www/Advanced_AiDisk_others.asp
    rm -f $(INSTALLDIR)/www/Advanced_AiDisk_samba.asp
    rm -f $(INSTALLDIR)/www/aidisk.asp
    rm -f $(INSTALLDIR)/www/disk_folder_tree.js
    rm -f $(INSTALLDIR)/www/device-map/disk.asp
    rm -f $(INSTALLDIR)/www/device-map/safely_remove_disk.asp
    rm -rf $(INSTALLDIR)/www/aidisk
    rm -rf $(INSTALLDIR)/www/images/AiDisk
    rm -rf $(INSTALLDIR)/www/images/Tree
endif
ifneq ($(CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT),y)
    rm -f $(INSTALLDIR)/www/scutclient.asp
    rm -f $(INSTALLDIR)/www/scutclient_log.asp
    rm -f $(INSTALLDIR)/www/scutclient_action.asp
endif
ifneq ($(CONFIG_FIRMWARE_INCLUDE_MENTOHUST),y)
    rm -f $(INSTALLDIR)/www/mentohust.asp
    rm -f $(INSTALLDIR)/www/mentohust_log.asp
    rm -f $(INSTALLDIR)/www/mentohust_action.asp
endif
ifneq ($(CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER),y)
    rm -f $(INSTALLDIR)/www/dns-forwarder.asp
endif
ifneq ($(CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS),y)
    rm -f $(INSTALLDIR)/www/Shadowsocks.asp
    rm -f $(INSTALLDIR)/www/Shadowsocks_action.asp
    rm -f $(INSTALLDIR)/www/Shadowsocks_log.asp
endif

ifeq ($(CONFIG_FIRMWARE_WEBUI_HIDE_VPN),y)
    rm -f $(INSTALLDIR)/www/vpn_clients.asp
    rm -f $(INSTALLDIR)/www/vpncli.asp
    rm -f $(INSTALLDIR)/www/vpnsrv.asp
endif
ifneq ($(CONFIG_FIRMWARE_INCLUDE_ADBYBY),y)
    rm -f $(INSTALLDIR)/www/Advanced_adbyby.asp
endif
ifneq ($(CONFIG_FIRMWARE_INCLUDE_ALIDDNS),y)
    rm -f $(INSTALLDIR)/www/Advanced_aliddns.asp
endif
ifneq ($(CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME),y)
    rm -f $(INSTALLDIR)/www/Advanced_adguardhome.asp
endif
ifneq ($(CONFIG_FIRMWARE_INCLUDE_KOOLPROXY),y)
    rm -f $(INSTALLDIR)/www/Advanced_koolproxy.asp
endif
ifneq ($(CONFIG_FIRMWARE_INCLUDE_CADDY),y)
    rm -f $(INSTALLDIR)/www/Advanced_caddy.asp
endif
ifneq ($(CONFIG_FIRMWARE_INCLUDE_WYY),y)
    rm -f $(INSTALLDIR)/www/Advanced_wyy.asp
endif
ifneq ($(CONFIG_FIRMWARE_INCLUDE_ZEROTIER),y)
    rm -f $(INSTALLDIR)/www/Advanced_zerotier.asp
endif
ifeq ($(CONFIG_FIRMWARE_INCLUDE_FRPC)_$(CONFIG_FIRMWARE_INCLUDE_FRPS), n_n)
    rm -f $(INSTALLDIR)/www/Advanced_frp.asp
endif

clean:
    @echo "Clean www romfs"

修改版本号

cd /opt/rt-n56u/trunk/
#进入目录
vim versions.inc
#编辑文件
FIRMWARE_ROOTFS_VER=3.9
FIRMWARE_BUILDS_VER=099
FIRMWARE_BUILDS_REV=$(shell git rev-parse --short HEAD 2>/dev/null)
/*最后一栏也可以这样写 `FIRMWARE_BUILDS_REV=20200730`*/

开启Openvpn

cd /opt/rt-n56u/trunk
vim build_firmware_modify

然后增加三行

##Openvpn服务##
echo "CONFIG_FIRMWARE_INCLUDE_OPENVPN=y" >> .config #Openvpn服务
##Openvpn服务##

预置路由定时重启

cd /opt/rt-n56u/trunk/user/shared
vim defaults.c

或者用宝塔编译
/autoreboot/
{ "reboot_schedule_enable", "0" },
{ "reboot_schedule", "00000000000" },
// 0代表关闭 1代表开启
// 0000000代表周一到周日 0000代表时间

预置开启vpn客户端

{ "vpns_enable", "0" },//vpn服务端关闭
{ "vpns_type", "0" },//vpn协议
{ "vpns_cast", "0" },
{ "vpns_auth", "0" },//认证算法
{ "vpns_mppe", "1" },//加密算法
{ "vpns_mtu", "1450" },//MTU
{ "vpns_mru", "1450" },//MRU
{ "vpns_vuse", "0" },//子网
{ "vpns_vnet", "10.8.0.0" },//vpn隧道使用的网络
{ "vpns_actl", "0" },//广播中继
{ "vpns_cli0", "245" },//客户端IP地址起
{ "vpns_cli1", "254" },//客户端IP地址终
{ "vpns_num_x", "0" },//客户端访问范围

{ "vpnc_enable", "1" },//vpn客户端开启
{ "vpnc_type", "1" },//vpn协议
{ "vpnc_peer", "" },//vpn服务器地址
{ "vpnc_user", "" },//用户名    
{ "vpnc_pass", "" },//密码
{ "vpnc_auth", "0" },//认证算法
{ "vpnc_mppe", "0" },//加密算法
{ "vpnc_pppd", "" },//pppd附加选项
{ "vpnc_rnet", "172.20.8.0" },//vpn服务器子网
{ "vpnc_rmsk", "255.255.255.0" },//vpn服务器掩码
{ "vpnc_pdns", "1" },//从VPN服务器获取DNS
{ "vpnc_mtu", "1450" },//MTU
{ "vpnc_mru", "1450" },//MRU
{ "vpnc_sfw", "2" },//限制来自 VPN 服务器的访问:否 0-2 2代表仅使用路由
{ "vpnc_dgw", "0" },//限制来自 VPN 服务器的访问:是0-2

修改默认http端口

cd /opt/rt-n56u/trunk/user/shared
vim defaults.c

/* Web server parameters */
{ "http_username", SYS_USER_ROOT }, /* Username */
{ "http_passwd", DEF_ROOT_PASSWORD },   /* Password */
{ "http_access", "0" },         /* HTTP access (0: ALL, 1: LAN only, 2: LAN + Wireless MainAP) */
{ "http_proto", "0" },          /* HTTP proto (0: HTTP, 1: HTTPS, 2: Both) */
{ "http_lanport", "80" },       /* HTTP LAN port to listen on */
{ "https_lport", "443" },       /* HTTPS LAN port to listen on */
{ "https_clist", DEF_HTTPS_CIPH_LIST }, /* HTTPS SSL cipher list */
{ "fw_dos_x", "0" },            // oleg patch
{ "dr_enable_x", "1" },         // oleg patch
{ "mr_enable_x", "0" },         // oleg patch
{ "mr_qleave_x", "1" },
// { "http_lanport", "80" },        /* HTTP LAN port to listen on */
// { "https_lport", "443" },        /* HTTPS LAN port to listen on */
// 可修改默认http端口不为80,默认http不为443

修改默认默认网关、子网掩码

cd /opt/rt-n56u/trunk/user/shared
vim defaults.h

#define DEF_LAN_ADDR        "10.32.0.1"
#define DEF_LAN_DHCP_BEG    "10.32.0.100"
#define DEF_LAN_DHCP_END    "10.32.1.244"
#define DEF_LAN_MASK        "255.255.254.0"

修改WIFI名字以及密码

#define DEF_WLAN_2G_CC "CN"
#define DEF_WLAN_5G_CC "CN"
#define DEF_WLAN_2G_SSID    BOARD_PID "_%s"
#define DEF_WLAN_5G_SSID    BOARD_PID "_5G_%s"
#define DEF_WLAN_2G_GSSID   BOARD_PID "_GUEST_%s"
#define DEF_WLAN_5G_GSSID   BOARD_PID "_GUEST_5G_%s"
#define DEF_WLAN_2G_PSK     "1234567890"
#define DEF_WLAN_5G_PSK     "1234567890"

修改登陆名字以及密码

#define SYS_USER_ROOT       "admin"
#define DEF_ROOT_PASSWORD   "admin"

插件的集成与删除

然后进入/opt/rt-n56u/trunk/configs/templates修改MI-3MI.config
这里可以选择是否集成某些插件
不过貌似用处不是很大,我一般修改/opt/rt-n56u/trunk中的build_firmware_modify来选择是否集成或者修改插件
修改方法也很简单,只需要将MENTOHUST=y改为MENTOHUST=n即表示放弃集成锐捷插件

##锐捷认证##
echo "CONFIG_FIRMWARE_INCLUDE_MENTOHUST=n" >> .config #锐捷认证插件,选择n后全部有关插件都不集成
echo "CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT=n" >> .config
##锐捷认证##

中文化适配修改

如果想修改中文化适配则修改/opt/rt-n56u/trunk/user/www/dict/CN.dict

主题背景以及Logo修改

主题文件下载地址:蓝奏云
如果想修改LOGO则替换/opt/rt-n56u/trunk/user/www/n56u_ribbon_fixed/bootstrap/img/asus_logo.png
如果想修改背景则修改/opt/rt-n56u/trunk/user/www/n56u_ribbon_fixed/bootstrap/css/main.css

如果不需要修改主题,请参考下面的代码

body{
background: url("?/index.php/archives/11/../img/bg/wood.jpg") repeat scroll center top transparent;
background-color: #282828;
overflow-y: scroll;
}
body.body_iframe{
background: #F5F5F5;
margin: 0 5px 0 5px;
min-width: inherit;
overflow-y: auto;
}
如果需要修改主题,请参考下面的代码

body{
    background: url("?/index.php/archives/11/../img/bg/wood.jpg") repeat scroll center top transparent;
    background-color: #282828;
    overflow-y: scroll;
    z-index:-1;
}
body.body_iframe{
    background-color: rgba(34, 34, 34, 0);
    margin: 0 5px 0 5px;
    min-width: inherit;
    overflow-y: auto;
    background-image: -moz-linear-gradient(top, rgba(34, 34, 34, 0.82), rgba(34, 34, 34, 0));
    background-image: -ms-linear-gradient(top, rgba(34, 34, 34, 0.82), rgba(34, 34, 34, 0));
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(34, 34, 34, 0.82)), to(rgba(34, 34, 34, 0)));
    background-image: -webkit-linear-gradient(top, rgba(34, 34, 34, 0.82), rgba(34, 34, 34, 0));
    background-image: -o-linear-gradient(top, rgba(34, 34, 34, 0.82), rgba(34, 34, 34, 0));
    background-image: linear-gradient(top, rgba(34, 34, 34, 0.82), rgba(34, 34, 34, 0));
    background-repeat: repeat-x;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='rgba(34, 34, 34, 0.82)', endColorstr='rgba(34, 34, 34, 0)', GradientType=0);
    border-color: rgba(34, 34, 34, 0.82) rgba(34, 34, 34, 0.82) rgba(34, 34, 34, 0.82);
    border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
    filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
    color:#ffffff;
    margin-bottom: 1px;
}

修改完主题后,还需要修改Logo与背景的图层顺序,即是

body{
    background: url("?/index.php/archives/11/../img/bg/wood.jpg") repeat scroll center top transparent;
    background-color: #282828;
    overflow-y: scroll;
    z-index:-1;/* 置于下层 */
}
body.body_iframe{
    background-color: rgba(34, 34, 34, 0);
    margin: 0 5px 0 5px;
    min-width: inherit;
    overflow-y: auto;
    background-image: -moz-linear-gradient(top, rgba(34, 34, 34, 0.82), rgba(34, 34, 34, 0));
    background-image: -ms-linear-gradient(top, rgba(34, 34, 34, 0.82), rgba(34, 34, 34, 0));
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(34, 34, 34, 0.82)), to(rgba(34, 34, 34, 0)));
    background-image: -webkit-linear-gradient(top, rgba(34, 34, 34, 0.82), rgba(34, 34, 34, 0));
    background-image: -o-linear-gradient(top, rgba(34, 34, 34, 0.82), rgba(34, 34, 34, 0));
    background-image: linear-gradient(top, rgba(34, 34, 34, 0.82), rgba(34, 34, 34, 0));
    background-repeat: repeat-x;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='rgba(34, 34, 34, 0.82)', endColorstr='rgba(34, 34, 34, 0)', GradientType=0);
    border-color: rgba(34, 34, 34, 0.82) rgba(34, 34, 34, 0.82) rgba(34, 34, 34, 0.82);
    border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
    filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
    color:#ffffff;
    margin-bottom: 1px;
}

.wrapper {
    width: 960px;
    margin: 0 auto;
}

#logo {  
    background-image: url("?/index.php/archives/11/../img/bg/asus_logo.png");
    width: 150px;
    height: 71px;
    margin-top: 40px;
    z-index:1;/* 置于上层 */
}
#logo:hover {
    cursor: pointer;
}

其中background: url("?/index.php/archives/11/../img/bg/wood.jpg") repeat scroll center top transparent;表示引入的背景图片
背景修改后效果如下:
效果图
主题修改后效果如下:
主题修改
通过查看Advanced_FirmwareUpgrade_Content.asp

<link rel="shortcut icon" href="images/favicon.ico">
<link rel="icon" href="images/favicon.png">
<link rel="stylesheet" type="text/css" href="/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/bootstrap/css/main.css">

得知网页预览图和书签预览图放在/opt/rt-n56u/trunk/user/www/n56u_ribbon_fixed/images
书签图标
所以自己做了对应规格的图标替换即可

Padavan其他功能备注

中文SSID支持的修改:

proprietary/rt_wifi/rtpci/3.0.X.X/mt76x2/common/cmm_info.c
proprietary/rt_wifi/rtpci/3.0.X.X/mt76x2/include/rtmp_def.h
proprietary/rt_wifi/rtsoc/2.7.X.X/rt2860v2/common/cmm_info.c
proprietary/rt_wifi/rtsoc/2.7.X.X/rt2860v2/include/rtmp_def.h
linux-3.4.x/drivers/net/wireless/ralink/mt76x2/common/cmm_info.c
linux-3.4.x/drivers/net/wireless/ralink/mt76x2/include/rtmp_def.h
linux-3.4.x/drivers/net/wireless/ralink/rt2860v2/common/cmm_info.c
linux-3.4.x/drivers/net/wireless/ralink/rt2860v2/include/rtmp_def.h
user/httpd/aspbw.c
user/httpd/httpd.h
user/rc/common_ex.c
user/rc/rc.h
user/www/n56u_ribbon_fixed/general.js

修改编译用户及主机信息

linux-3.4.x/scripts/mkcompile_h

关闭悬浮日志

user/shared/defaults.c
{ "log_float_ui", "0" },        /* WebUI syslog float panel mode */

开启默认中文界面

{ "preferred_lang", "CN" },

5G使用美国地区

user/shared/defaults.h
#define DEF_WLAN_5G_CC        "US"

添加花生壳动态DNS服务

user/www/n56u_ribbon_fixed/Advanced_DDNS_Content.asp

web界面添加手势图标
user/www/n56u_ribbon_fixed/Advanced_DHCP_Content.asp

修改编译版本以及时间
修改 /opt/rt-n56u/trunk/versions.inc

FIRMWARE_ROOTFS_VER=3.9
FIRMWARE_BUILDS_VER=099
FIRMWARE_BUILDS_REV=20200619

编译

然后再运行编译即可

cd /opt/rt-n56u/trunk/
./clear_tree
fakeroot ./build_firmware_modify MI-3
#MI-3 为路由器型号,要编译其他型号自行修改最后在`/opt/rt-n56u/trunk/images`下载编译好的固件刷入路由器即可。

先研究到这里有空了继续研究

5.固件下载

--
小渔自己编译的固件:
小渔网盘
蓝奏云盘
百度网盘提取码: 6bbw

6.编译环境下载

--
小渔自己的编译环境:

百度网盘提取码: tjdj

7.维护日志

--
2020-10-11
修复小米4C下载流量过大CPU满载导致路由断流的BUG
2020-10-9
完善小米路由4C的固件以及修正网口错位以及其他BUG。感谢网友@拥有是帮助测试
2020-09-01
完善小米路由3C、3A的固件以及修正网口错位以及其他BUG。累死我了,电脑一天开着电费都花了不少

8.随手记

--
2020-10-09 锐捷认证

PS:
貌似可以这样加文件?正在试验中

romfs:
    $(ROMFSINST) -p +x $(THISDIR)/$(SRC_NAME)/src/mentohust /usr/bin/bin_mentohust
    $(ROMFSINST) -p +x $(THISDIR)/scripts/mentohust.sh /usr/bin/mentohust.sh
    $(ROMFSINST) -p +x $(THISDIR)/Plug/8021x.exe /etc/storage/mentohust/8021x.exe
    $(ROMFSINST) -p +x $(THISDIR)/Plug/SuConfig.dat /etc/storage/mentohust/SuConfig.dat
    $(ROMFSINST) -p +x $(THISDIR)/Plug/W32N55.dll /etc/storage/mentohust/W32N55.dll
    $(ROMFSINST) -p +x $(THISDIR)/Plug/mentohust /etc/storage/mentohust/mentohust
    $(ROMFSINST) -p +x $(THISDIR)/Plug/network /etc/storage/mentohust/network

楼上已测试,貌似$(ROMFSINST) -p +x仅仅是一个复制命令,也就是说只能复制到现有的目录,不能凭空捏造,现在尝试新的方法,如下:

romfs:
    $(ROMFSINST) -p +x $(THISDIR)/$(SRC_NAME)/src/mentohust /usr/bin/bin_mentohust
    $(ROMFSINST) -p +x $(THISDIR)/scripts/mentohust.sh /usr/bin/mentohust.sh
    $(ROMFSINST) -p +x $(THISDIR)/Plug/8021x.exe /usr/bin/8021x.exe
    $(ROMFSINST) -p +x $(THISDIR)/Plug/SuConfig.dat /usr/bin/SuConfig.dat
    $(ROMFSINST) -p +x $(THISDIR)/Plug/W32N55.dll /usr/bin/W32N55.dll
    $(ROMFSINST) -p +x $(THISDIR)/Plug/mentohust /usr/bin/mentohust
    $(ROMFSINST) -p +x $(THISDIR)/Plug/network /usr/bin/network


2020-10-12 记录:如果尝试适配nps在makefile里这么写会怎么样呢?当然是成功了,不过要在开机自启脚本里加上以下代码,放在 WAN 上行/下行启动后执行:

cd /usr/bin/
./npc -server=域名+端口 -vkey=key -type=tcp

Makefile 猜想

先上图
源码:

THISDIR := $(shell pwd)
NPS_VER := 0.26.8
NPS_URL_BASE := https://github.com/ehang-io/nps/releases/download

NPS_NAME := linux_mipsle_client
NPS_URL := $(NPS_URL_BASE)/v$(NPS_VER)/$(NPS_NAME).tar.gz

all: download_test extra_test
    @echo "nps build done!"

download_test:
    ( if [ ! -f $(NPS_NAME).tar.gz ]; then \
        wget -t5 --timeout=20 --no-check-certificate -O $(NPS_NAME).tar.gz $(NPS_URL); \
    fi )

extra_test:
    ( if [ ! -d $(NPS_NAME) ]; then \
        tar xf $(NPS_NAME).tar.gz; \
        cat ./conf/*.patch | patch -d $(THISDIR) -p1 ; \
    fi )

clean:
    rm -rf $(NPS_NAME).tar.gz conf npc

romfs:
    $(ROMFSINST) -d $(THISDIR)/conf/multi_account.conf /usr/bin/conf/multi_account.conf
    $(ROMFSINST) -d $(THISDIR)/conf/npc.conf /usr/bin/conf/npc.conf
    $(ROMFSINST) -p +x $(THISDIR)/npc /usr/bin/npc

Last modification:January 6th, 2021 at 12:27 pm
如果觉得我的文章对你有用,请随意赞赏