针对 padavan-4.4

新增支持某个路由器型号

比如说新增支持小米路由器R3G

1
2
3
4
5
6
7
8
9
10
11
12
trunk
├─configs
│ ├─boards/MI-R3G
│ │ ├─board.h (指示灯与复位键等)
│ │ ├─board.mk
│ │ ├─kernel-4.4.x.config
│ │ ├─l1profile.dat
│ └─templates
│ └─MI-R3G.config (编译的配置文件)

└─mi-r3g.dtslinux-4.4.x/arch/mips/boot/dts/ralink
└─mi-r3g.dts (Device Tree Source 设备树源码)

首先是

1
trunk/configs/boards/MI-R3G
  • board.h
  • board.mk
  • kernel-4.4.x.config
  • l1profile.dat

指示灯与复位键适配(board.h)

修改 board.h ,比如

1
#define BOARD_GPIO_BTN_RESET	18

RESET 按键的 GPIO 号就是 18

有breed可以在breed里测试GPIO,路由器进入breed,通过 telnet 访问 breed 默认的 192.168.1.1

1
telnet 192.168.1.1

可以使用的命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
breed> help
Available commands:
about - About this bootloader
abstatus - Interrupt status of autoboot
arp - Display ARP table
autoboot - Detect firmware type and boot automatically
boot - Boot firmware
btntst - Test GPIO of buttons
dhcp - Display DHCP leases
env - Environment variables utility
envconf - Configure environment variable block
exit - Exit from telnet
flash - Flash utility
gpio - GPIO utilities
help - Show available commands
jtagd - JTAG dongle over GPIO
mdio - MDIO utility
mem - Memory operation utilities
net - Network control
netstat - Display network state
reset - Restart device
setbrg - Set baudrate
spi - SPI utility
sysinfo - Display system information
thread - Display all threads
wget - Retrieval file through HTTP

breed> gpio ?
Usage:
gpio help - show this help
gpio status/list - show status of all GPIOs
gpio button - show status of all GPIO buttons
gpio led - show status of all GPIO LEDs
gpio get <n> - show status of GPIO <n>
gpio set <n> <hi|lo> - set status of GPIO <n>
gpio dir set <n> <in|out> - set direction of GPIO <n>
gpio led set <name> <on|off> - set status of GPIO LED <name>

通过 btntst 测试按键

1
2
3
4
5
breed> btntst
Press Ctrl+C to stop.

GPIO#18 (<gpio0,18>) changed to 0
GPIO#18 (<gpio0,18>) changed to 1

配适网口(kernel-4.4.x.config)

修改:kernel-4.4.x.config

1
2
3
4
5
CONFIG_RAETH_ESW_PORT_WAN=4
CONFIG_RAETH_ESW_PORT_LAN1=3
CONFIG_RAETH_ESW_PORT_LAN2=2
CONFIG_RAETH_ESW_PORT_LAN3=1
CONFIG_RAETH_ESW_PORT_LAN4=0

DTS文件(kernel-4.4.x.config)

修改:kernel-4.4.x.config

搜索 CONFIG_RALINK_BUILTIN_DTB_NAME ,修改对应的dts文件名

DTS文件的位置

1
trunk/linux-4.4.x/arch/mips/boot/dts/ralink/

路由器型号(MI-R3G.config)

修改 templates/目录下的编译的配置文件,比如 MI-R3G.config

修改里面的 CONFIG_FIRMWARE_PRODUCT_ID 参数,保持和上面的 boards/ 目录下的机型文件保持一致

1
trunk/configs/templates/

其它修改

替换左上角默认 Logo,分辨率为 72

1
trunk/user/www/n56u_ribbon_fixed/bootstrap/img/asus_logo.png

修改默认的背景等

1
trunk/user/www/n56u_ribbon_fixed/bootstrap/css/main.css

修改路由后台地址管理员密码等

1
trunk/user/shared/defaults.h

修改底部 footer 信息

1
trunk/user/www/Makefile

修改版本号

1
trunk/versions.inc

其它默认信息的修改

1
trunk/user/shared/defaults.c

比如说关闭默认开启的悬浮日志

1
{ "log_float_ui", "0" },