|
近期在学习ImageBuilder生成openwrt自定义固件 方法,、
因为一次刷机把breed刷没了
在网上找了大部分资料,发现Openwrt下用命令刷固件的方法
工具:winscp、Putty利用winscp把固件传入/tmp目录下
然后使用mtd命令刷入:
cat /proc/mtd 查看分区
mtd0: 00020000 00010000 "u-boot"
mtd1: 00140000 00010000 "kernel"
mtd2: 00690000 00010000 "rootfs"
mtd3: 00200000 00010000 "rootfs_data"
mtd4: 00010000 00010000 "art"
mtd5: 007d0000 00010000 "firmware"
然后
cd /tmd
mtd write breed.bin firmware
这里我把breed刷入了系统固件中了,本应该是
mtd write breed.bin u-boot 才对
这样也能启动breed,可是我只能刷4M的固件,编程器固件刷入了启动不了,
后来发觉这问题应该是我刷错了breed的分区位置
然后又
mtd write breed.bin u-boot
结果
Could not open mtd device: u-boot
Can't open device for writing!
查了很多资料才知道openwrt的uboot是锁死不给刷的,必须从新编译固件
修改: target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
找到
{
.name = "u-boot",
.offset = 0,
.size = 0x020000,
.mask_flags = MTD_WRITEABLE,
}, {
.name = "kernel",
.offset = 0x020000,
.size = 0x140000,
}, {
.name = "rootfs",
.offset = 0x160000,
.size = 0x690000,
}, {
.name = "art",
.offset = 0x7f0000,
.size = 0x010000,
.mask_flags = MTD_WRITEABLE,
}, {
.name = "firmware",
.offset = 0x020000,
.size = 0x7d0000,
}
};
刚好openwr里的 mtd 对uboot和 art都不能操作,尝试把art分区里
.mask_flags = MTD_WRITEABLE这行注释掉,编译it。
经过漫长的编译之后,刷新it,果然,art块可以刷了。。。。。刷进去art.bin 再刷
个openwrt系统,果然,无线恢复正常。再刷回 那行没注释的openwrt,省得下次不小新破坏了
。
.mask_flags = MTD_WRITEABLE 原来是标识不可写。。。。。这名字取得。
。。我了个去
好了,结束了。
顺便说一句:技术本来就应该共享。
how to restore art partition? (Page 1) — General Discussion — OpenWrt 沿途见识[4]
You need to (re)compile the kernel and remove the write protection from the mtd
partition:
--- target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c (revision 26848)
+++ target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c (working copy)
@@ -60,7 +60,6 @@
.name = "ART",
.offset = 0x7f0000,
.size = 0x010000,
- .mask_flags = MTD_WRITEABLE,
}, {
.name = "firmware",
.offset = 0x040000,
Oh and by the way - its "ART", not "art".
但是编译那速度真心太慢了,
请问在官方的ImageBuilder里如何才能修改这种情况呢?求大神指点一下。
|
|