網頁

2013年8月17日 星期六

TP-Link TL-WR703N 路由器的 U-Boot

TP-Link TL-WR703N 路由器的 U-Boot 

TP-Link TL-WR703N 路由器固件 Firmware是存放在機內的 Flash Memory,在 703N 的原廠 Flash Memory 容量是 4MB,而這 4MB Flash 內容包括了 U-Bootfw art 程式,每一個固件內的程式都是負責不同的功能,這 4MB 的程式就好像我們日常用到的 PC 電腦一樣,可以說路由器就是一部超迷你電腦,U-Boot 就像電腦的 BIOS Basic Input/Output System FW 就像電腦的作業系統,ART 就像電腦的驅動程式。

703N 4M Flash Memeory 路由器固件

Flash Start地址
Flash End 地址
TTL Start 地址
TTL End  地址
長度
U-Boot
0x000000
0x01FFFF
0x9F000000
0x9F01FFFF
128kB0x20000
FW
0x020000
0x3DFFFF
0x9F020000
0x9F3DFFFF
3840kB0x3c0000
ART
0x3F0000
0x3FFFFF
0x9F3F0000
0x9F3FFFFF
64kB0x10000

703N 8M Flash Memeory 路由器固件

Flash Start地址
Flash End 地址
TTL Start 地址
TTL End  地址
長度
U-Boot
0x000000
0x01FFFF
0x9F000000
0x9F01FFFF
128kB0x20000
FW
0x020000
0x7DFFFF
0x9F020000
0x9F7DFFFF
7936kB0x7c0000
ART
0x7F0000
0x7FFFFF
0x9F7F0000
0x9F7FFFFF
64kB0x10000
U-Boot 使用少量的閃存存儲空間 (長度為128KB = 0x20000,通常在同一個分區存儲在存儲一些重要的配置參數。

U-Boot Common Variables
Variable
Description
autoload
if set to no (or any string beginning with 'n'), the rarpb, bootp or dhcp commands will perform only a configuration lookup from the BOOTP / DHCP server, but not try to load any image using TFTP.
autostart
if set to yes, an image loaded using the rarpb, bootp, dhcp, tftp, disk, or docb commands will be automatically started (by internally calling the bootm command).
baudrate
a decimal number that selects the console baudrate (in bps).
bootargs
The contents of this variable are passed to the Linux kernel as boot arguments (aka "command line").
bootcmd
This variable defines a command string that is automatically executed when the initial countdown is not interrupted. This command is only executed when the variable bootdelay is also defined!
bootdelay
After reset, U-Boot will wait this number of seconds before it executes the contents of the bootcmd variable. During this time a countdown is printed, which can be interrupted by pressing any key.
Set this variable to 0 boot without delay. Be careful: depending on the contents of your
bootcmd variable, this can prevent you from entering interactive commands again forever!
Set this variable to -1 to disable autoboot.
bootfile
name of the default image to load with TFTP
ethaddr
Ethernet MAC address for first/only ethernet interface (eth0 in Linux).
This variable can be set only once (usually during manufacturing of the board). U-Boot refuses to delete or overwrite this variable once it has been set.
ipaddr
IP address; needed for tftp command
loadaddr
Default load address for commands like tftp or loads
serverip
TFTP server IP address; needed for tftp command.
silent
If the configuration option CONFIG_SILENT_CONSOLE has been enabled for your board, setting this variable to any value will suppress all console messages. Please see silent booting for details.
verify
If set to n or no disables the checksum calculation over the complete image in the bootm command to trade speed for safety in the boot process. Note that the header checksum is still verified.

703N 4M Flash Memeory U-Boot 地址
Start
Offset
Description
0
0x00000000
Flash Start, U-Boot code data (64kB)
+64kB
0x00010000
Start of block with MAC address

0x0001FC00
MAC address (6 byte)

0x0001FD00
TP-Link router model number

0x0001FE00
WPS pin (8 bytes)
+128kB
0x00020000
Firware start

檢查 U-Boot 版本:
# grep -a U-Boot /dev/mtd0ro | cut -d'I' -f1     
U-Boot 1.1.4 (Sep 25 2012 - 09:04:47)

檢查 703N mtd
#cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00020000 00010000 "u-boot"
mtd1: 000e9cac 00010000 "kernel"
mtd2: 002e6354 00010000 "rootfs"
mtd3: 00070000 00010000 "rootfs_data"
mtd4: 00010000 00010000 "art"
mtd5: 003d0000 00010000 "firmware"

TFTP 設定:
# setenv serverip 192.168.1.2   設置伺服器 IP
# setenv ipaddr 192.168.1.1    設置路由器 IP

4M 編程器固件:
刷編程器固件:
#tftp 0x80000000 full.bin
#erase 0x9f000000 +0x400000 抹掉原來的固件裏的空間
#cp.b 0x80000000 0x9f000000 0x400000  複製
uboot
#tftp 0x80000000 uboot.bin
#erase 0x9f000000 +0x20000
#cp.b 0x80000000 0x9f000000 0x20000
fw
#tftp 0x80000000 fw.bin
#erase 0x9f020000 +0x3c0000
#cp.b 0x80000000 0x9f020000 0x3c0000
art:
#tftp 0x80000000 art.bin
#erase 0x9f3f0000 +0x10000
#cp.b 0x80000000 0x9f3f0000 0x10000

8M 編程器固件:
刷编程器固件:
#tftp 0x80000000 full.bin
#erase 0x9f000000 +0x800000
#cp.b 0x80000000 0x9f000000 0x800000
uboot
#tftp 0x80000000 uboot.bin
#erase 0x9f000000 +0x20000
#cp.b 0x80000000 0x9f000000 0x20000
fw
#tftp 0x80000000 fw.bin
#erase 0x9f020000 +0x7c0000
#cp.b 0x80000000 0x9f020000 0x7c0000
art:
#tftp 0x80000000 art.bin
#erase 0x9f7f0000 +0x10000
#cp.b 0x80000000 0x9f7f0000 0x10000

參考網址:
OpenWrt TP-Link TL-WR703N 
U-Boot Environment Variables

相關網址:

2013 年 8月 17日 天氣報告
氣溫:28.1@ 23:00
相對濕度:百分之 85%
天氣:雨

沒有留言:

張貼留言