glinet ar300m只烧录uboot进行mac与art恢复

参考glinet官网的uboot高级用法https://docs.gl-inet.com/en/2/dev/uboot/

固件下载:https://dl.gl-inet.com/firmware/ar300m/v1/

需要连接ttl, 默认网络服务端为192.168.1.1客户端(主机)为912.168.1.2

printenv查看变量设定

md 查看flash内容

如查看uboot首地址:md 0x9f000000

tftp 0x81000000 file.bin从tftp服务器上传file.bin到内存中

erase 0x9f050000 +0x10000格式化闪存

cp.b 0x81000000 0x9f050000 0x10000把内存内容写到闪存中

支持预置命令:

更换uboot: lu要求tffp服务器内uboot文件名uboot_for_gl-ar150.bin 

更新固件:run lf

更新mac: run lc

清理uboot env: erase 0x9f040000 +0x10000 reset

root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00fa0000 00010000 "firmware"
mtd3: 00190000 00010000 "kernel"
mtd4: 00e10000 00010000 "rootfs"
mtd5: 00610000 00010000 "rootfs_data"
mtd6: 00010000 00010000 "art"

There is a single MAC address present at offset 0x0 as well as repeated at 0x1002 on the device examined. There are ff bytes following that at the 0x6 offset indicated in the DTS for the second MAC. There are zeros following at 0x1008. An AR300M (two-Ethernet device) art partition did not appear to have a second MAC "burned into" the art.

实际操作:

从ttl打印看到系统启动前会校验是否存在art如果没有art就停止启动。

从printenv来看art位于最后的64k, flash的起始映射地址为0x9f000000, 

通过查看预置的lc命令分析mac所在的地址为0x9fff0000, 也是art的起始地址。

进行下面步骤操作进行art更新

1. 通过tftp上传art到内存tftp 0x81000000 art.bin

2. 格式化art分区erase 0x9fff0000 +0xffff

3. 将内存里的art写到flash中cp.b 0x81000000 0x9fff0000 0xffff

4. reset重启

可以做成预置命令la, 做好用savenv保存预置命令:

setenv la "if ping 192.168.1.2; then tftp 0x81000000 art.bin && erase 0x9fff0000 +0xffff && cp.b 0x81000000 0x9fff0000 0xffff; fi"

 

有了art, uboot还得有固件才能运行,在ttl下输入http开启web刷机网页

你可能感兴趣的:(路由网关,linux)