安装Ubuntu 16.04LTS
系统选用32位的版本,安装的时候,注意语言不要选中文,否则无法正常安装,会报错:
Unable to install busybox-initramfs
这是存在Ubuntu里面一个五六年之久的bug,大家都在无脑吹捧开源是多么多么好的时候,开源就是这么任性。
开启Ubuntu SSH远程登录
系统装好后,默认是没有SSH服务的,得自己安装,首先你得把apt源改为国内的源,否则连apt-get update都无法成功执行(这里我们感谢方滨兴校长给我们带来的各种便利),默认的源直接删掉,下载我改好的阿里云的源。
sudo rm /etc/apt/sources.list
sudo wget -P /etc/apt/ //hqidi.com/wp-content/uploads/2016/sources.list
sudo apt-get update
sudo apt-get install openssh-server
开启Ubuntu root用户
因为是虚拟机环境,所以直接启用root,用起来方便,sudo passwd root后回车,输入两次密码就行了。然后修改sshd配置文件,使root能正常远程登录。
sudo vi /etc/ssh/sshd_config
找到并用#注 释掉这行:PermitRootLogin prohibit-password
新建一行 添加:PermitRootLogin yes
sudo service ssh restart
ubuntu 16.04下静态IP地址的设置
vi /etc/network/interface
auto lo
iface lo inet loopback
auto ens32
iface ens32 inet static
address 192.168.8.100
netmask 255.255.255.0
gateway 192.168.8.2
dns-nameserver 223.5.5.5
重启网络服务 /etc/init.d/networking restart
安装编译固件所需要的工具
apt-get install git autoconf automake bison build-essential flex gawk gettext gperf libtool pkg-config zlib1g-dev libgmp3-dev libmpc-dev libmpfr-dev texinfo python-docutils mc autopoint lrzsz -y
这一步耗时大概90秒的样子。
切换到/opt目录,用git克隆Padavan 仓库
cd /opt
git clone https://git.oschina.net/gorden5566/rt-n56u.git
这一步耗时稍长,诸位可以泡一杯板蓝根喝。
编译交叉编译的工具链
这一步耗时会比较长,诸位打开一个screen进去执行,最保险。同时,可以泡一杯正山小种。
cd /opt/rt-n56u/toolchain-mipsel
./clean_sources
./build_toolchain
耗时24分钟
编译好的工具链在 /opt/rt-n56u/toolchain-mipsel/toolchain-3.4.x 目录,刚好128M
机型适配(优酷路由宝 L1)
生成配置文件
cp /opt/rt-n56u/trunk/configs/templates/n14u_base.config /opt/rt-n56u/trunk/.config
修改/opt/rt-n56u/trunk/.config文件
文件里写的很详细,按需打开和关闭需要的功能。
我主要改了一下几项
#CONFIG_FIRMWARE_INCLUDE_UVC=y 关闭相机模块
#CONFIG_FIRMWARE_INCLUDE_LANG_RU=y 关闭俄罗斯语言
CONFIG_FIRMWARE_INCLUDE_LANG_UK=y 开启英语
#CONFIG_FIRMWARE_INCLUDE_LPRD=y 关闭USB打印
#CONFIG_FIRMWARE_INCLUDE_XUPNPD=y 关闭IPVT
适配指示灯与复位键
编辑 /opt/rt-n56u/trunk/configs/boards/RT-N14U/board.h
/* ASUS RT-N14U */
#define BOARD_PID "RT-N14U"
#define BOARD_NAME "RT-N14U"
#define BOARD_DESC "ASUS RT-N14U Wireless Router"
#define BOARD_VENDOR_NAME "ASUSTek Computer Inc."
#define BOARD_VENDOR_URL "http://www.asus.com/"
#define BOARD_MODEL_URL "http://www.asus.com/Networking/RTN14U/"
#define BOARD_BOOT_TIME 20
#define BOARD_FLASH_TIME 120
#undef BOARD_GPIO_BTN_RESET
#define BOARD_GPIO_BTN_WPS 1
#undef BOARD_GPIO_BTN_WLTOG
#undef BOARD_GPIO_LED_ALL
#define BOARD_GPIO_LED_WIFI 72
#define BOARD_GPIO_LED_POWER 29
#undef BOARD_GPIO_LED_LAN
#define BOARD_GPIO_LED_WAN 44
#define BOARD_GPIO_LED_USB 35
#undef BOARD_GPIO_LED_ROUTER
#undef BOARD_GPIO_PWR_USB
#define BOARD_HAS_5G_11AC 0
#define BOARD_NUM_ANT_5G_TX 0
#define BOARD_NUM_ANT_5G_RX 0
#define BOARD_NUM_ANT_2G_TX 2
#define BOARD_NUM_ANT_2G_RX 2
#define BOARD_NUM_ETH_LEDS 1
#define BOARD_HAS_EPHY_L1000 0
#define BOARD_HAS_EPHY_W1000 0
适配WAN口与LAN口
编辑/opt/rt-n56u/trunk/configs/boards/RT-N14U/kernel-3.4.x.config
在1882行的地方
CONFIG_RAETH_ESW_PORT_WAN=4
CONFIG_RAETH_ESW_PORT_LAN1=1
CONFIG_RAETH_ESW_PORT_LAN2=0
CONFIG_RAETH_ESW_PORT_LAN3=3
CONFIG_RAETH_ESW_PORT_LAN4=2
修改内存配置
编辑/opt/rt-n56u/trunk/configs/boards/RT-N14U/kernel-3.4.x.config
// 没修改前是64M内存
CONFIG_RT2880_DRAM_16M is not set
CONFIG_RT2880_DRAM_32M is not set
CONFIG_RT2880_DRAM_64M=y
CONFIG_RT2880_DRAM_128M is not set
CONFIG_RT2880_DRAM_256M is not set
CONFIG_RALINK_RAM_SIZE=64
// 修改成128M
CONFIG_RT2880_DRAM_16M is not set
CONFIG_RT2880_DRAM_32M is not set
CONFIG_RT2880_DRAM_64M is not set
CONFIG_RT2880_DRAM_128M=y
CONFIG_RT2880_DRAM_256M is not set
CONFIG_RALINK_RAM_SIZE=128
增强无线信号
编辑/opt/rt-n56u/trunk/configs/boards/RT-N14U/kernel-3.4.x.config
删除# CONFIG_EXTERNAL_PA_EXTERNAL_LNA is not set 这一行代码,并加入下面的代码
CONFIG_EXTERNAL_PA_EXTERNAL_LNA=y
自定义路由器配置
编辑/opt/rt-n56u/trunk/user/shared/defaults.h
#ifndef _defaults_h_
#define _defaults_h_
#define SYS_SHELL "/bin/sh"
#define SYS_EXEC_PATH "/usr/sbin:/usr/bin:/sbin:/bin"
#define SYS_EXEC_PATH_OPT "/opt/sbin:/opt/bin:/usr/sbin:/usr/bin:/sbin:/bin"
#define SYS_HOME_PATH_ROOT "/home/admin"
#define SYS_USER_ROOT "admin"
#define SYS_GROUP_ROOT "root"
#define SYS_USER_NOBODY "nobody"
#define SYS_GROUP_NOGROUP "nogroup"
#define DEF_LAN_ADDR "192.168.8.1"
#define DEF_LAN_DHCP_BEG "192.168.8.2"
#define DEF_LAN_DHCP_END "192.168.8.180"
#define DEF_LAN_MASK "255.255.255.0"
#define DEF_WLAN_2G_CC "GB"
#define DEF_WLAN_5G_CC "GB"
#define DEF_WLAN_2G_SSID "ASUS"
#define DEF_WLAN_5G_SSID "ASUS_5G"
#define DEF_WLAN_2G_GSSID "ASUS_GUEST"
#define DEF_WLAN_5G_GSSID "ASUS_GUEST_5G"
#define DEF_WLAN_2G_PSK "1234567890"
#define DEF_WLAN_5G_PSK "1234567890"
#define DEF_ROOT_PASSWORD "admin"
#define DEF_SMB_WORKGROUP "WORKGROUP"
#define DEF_TIMEZONE "CST-8"
#define DEF_NTP_SERVER0 "ntp1.aliyun.com"
#define DEF_NTP_SERVER1 "time.nist.gov"
#define DEF_HTTPS_CIPH_LIST "DH+AESGCM:DH+AES256:DH+AES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!MD5:!DSS"
#endif
这里面的参数都可以自己改,主要记得改时区和ntp服务器。
关闭 telnet 开启 ssh
编辑/opt/rt-n56u/trunk/user/shared/defaults.c
{"telnetd","0"}.
{"sshd_enable","1"}
1是打开,0是关闭
最后一步,生成固件
cd /opt/rt-n56u/trunk
./clear_tree
./build_firmware
用sz命令把编译好的固件保存到桌面,
sz /opt/rt-n56u/trunk/images/RT-N14U_3.4.3.9-099.trx
刷入后的web界面
PS:
1、在screen里面,rz sz会报错 rz waiting to receive,所以要用rz sz的时候,退出screen.
2、像编译这种纯体力活,不建议用自己的笔记本电脑来做,当然,如果你家里特别冷的话除外。
原创文章,转载请注明: 转载自笛声
本文链接地址: Padavan完整编译教程
18 条评论
下载hiboy的固件,并用7-zip打开trx固件文件,提取里面的/www/EN.dict,编辑EN.dict,修改第二,三行内容如下,
LANG_RU=简体中文
LANG_EN=English
并另存为RU.dict文件,替换/opt/rt-n56u/trunk/user/www/dict/RU.dict文件
再编辑/opt/rt-n56u/trunk/user/www/Makefile文件,查找并将RU=后面的内容改为”简体中文”
echo "LANG_RU=简体中文" >> $(ROMFS_DIR)/www/EN.header
然后保存文件
求助:自己基于Padavan源码编译了一个MTK7620的固件,结果是LAN 口的LED指示灯显示不正常,其他都正常。
board.h文件:
#define BOARD_GPIO_LED_WIFI 72
#define BOARD_GPIO_LED_POWER 29
#define BOARD_GPIO_LED_LAN 43
#define BOARD_GPIO_LED_WAN 44
其中的#define BOARD_GPIO_LED_LAN 值尝试:
= 43,只有LAN1 亮
= 42 ,只有LAN2 亮
= 41,只有LAN3 亮
= 40 ,只有LAN4 亮
WAN 44 正常亮
求助大神如何修改??
用的哪一款路由器?
智博通ZBT-WE126.
试试39,若不行就19
能否帮我做一个电信HG320的支持打印机的固体,可以付费500元,QQ 908040817
不好意思,不会做,帮不上你。
说一个不用试的方法,大概可行,进入Breed后,telnet 192.168.1.1(就是你升级固件的那个地址) 然后输入 btntst,然后把四个lan口都插上有连接设备的网线,看telnet窗口有没有数字蹦出来,有的话,就是那个数字了。
按你的方法试了一下,还是不行。
breed> gpio led
GPIO status name
40 on lan1
41 on lan2
42 on lan3
43 on lan4
44 on lan5
72 off wlan
breed> btntst
Press Ctrl+C to stop.
GPIO#25 () changed to 1
GPIO#26 () changed to 1
GPIO#68 () changed to 0
GPIO#68 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#25 () changed to 0
GPIO#68 () changed to 0
GPIO#25 () changed to 1
GPIO#68 () changed to 1
GPIO#24 () changed to 1
GPIO#68 () changed to 0
GPIO#24 () changed to 0
GPIO#68 () changed to 1
GPIO#68 () changed to 0
GPIO#68 () changed to 1
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#25 () changed to 0
GPIO#68 () changed to 0
GPIO#25 () changed to 1
GPIO#68 () changed to 1
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#25 () changed to 0
GPIO#68 () changed to 0
GPIO#25 () changed to 1
GPIO#68 () changed to 1
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#68 () changed to 0
GPIO#68 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#68 () changed to 0
GPIO#68 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#68 () changed to 0
GPIO#68 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#68 () changed to 0
GPIO#24 () changed to 1
GPIO#68 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#68 () changed to 0
GPIO#68 () changed to 1
GPIO#68 () changed to 0
GPIO#68 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#68 () changed to 0
GPIO#24 () changed to 0
GPIO#68 () changed to 1
GPIO#25 () changed to 0
GPIO#68 () changed to 0
GPIO#25 () changed to 1
GPIO#68 () changed to 1
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#68 () changed to 0
GPIO#68 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#25 () changed to 0
GPIO#25 () changed to 1
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changed to 0
GPIO#24 () changed to 1
GPIO#24 () changedto 1
GPIO#24 () changed to 0
breed>
不好意思,那我也帮不上你了,这个路由器太小众了。
作者大大,我想默认无线密吗为开放具体怎么修改
默认是访客模式,没密码就能连接?我现在已经没有这个编译环境了,你自己好好看看/opt/rt-n56u/trunk/user/shared/defaults.h 文件。
我想请问小米路由R3G怎么填写下面序号,(是不是这个方法:测试进入Breed后,telnet 192.168.1.1(就是你升级固件的那个地址) 然后输入 btntst,然后把四个lan口都插上有连接设备的网线,看telnet窗口有没有数字蹦出来),这个方法我测试没有显示什么啊。有没有其他办法???
编辑/opt/rt-n56u/trunk/configs/boards/RT-N14U/kernel-3.4.x.config
在1882行的地方
CONFIG_RAETH_ESW_PORT_WAN=4
CONFIG_RAETH_ESW_PORT_LAN1=1
CONFIG_RAETH_ESW_PORT_LAN2=0
CONFIG_RAETH_ESW_PORT_LAN3=3
CONFIG_RAETH_ESW_PORT_LAN4=2
网上有人做出了现成的包啊,https://www.right.com.cn/forum/thread-257423-1-1.html ,你若想自己编译,下载别人做好的包,然后用7zip解开trx包,看看别人的序号是怎么写的,自己照抄就行。
解包后确实看不到序号,序号是在编译前设定的。
关键是7-zip解压别人的包后,具体看那个配置文件啊?
请教一个问题我的路由器是k2g相比k2配置一样,唯一不一样的是k2g的wan口是千兆,我怎么改配置文件才能使这个千兆wan口正常工作呢?
你可以去恩山论坛看看,我已经很久没研究这个东西了,也可以去Padavan官方看看文档。