执行 mtd -r write uboot.bin u-boot
错误信息如下, 一般情况下是锁死不给刷的,需要将路由器进入安全模式
Could not open mtd device: u-boot
Can't open device for writing!
修改: target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
parts[0].mask_flags = MTD_WRITEABLE; //去除本行
再重新编译, 这样u-boot就可以任意刷写了, 方便u-boot的调试修改
二. Flash右4M改8M, 修改2处, C源码和目标的Makefile
点击(此处)折叠或打开
-
static struct flash_layout layouts[] = {
-
{
-
.id = "4M",
-
.fw_max_len = 0x3c0000,
-
.kernel_la = 0x80060000,
-
.kernel_ep = 0x80060000,
-
.rootfs_ofs = 0x140000,
-
}, {
-
.id = "4Mlzma",
-
.fw_max_len = 0x3c0000,
-
.kernel_la = 0x80060000,
-
.kernel_ep = 0x80060000,
-
.rootfs_ofs = 0x100000,
-
}, {
-
.id = "8M",
-
.fw_max_len = 0x7c0000,
-
.kernel_la = 0x80060000,
-
.kernel_ep = 0x80060000,
-
.rootfs_ofs = 0x140000,
-
}, {
-
.id = "8Mlzma",
-
.fw_max_len = 0x7c0000,
-
.kernel_la = 0x80060000,
-
.kernel_ep = 0x80060000,
-
.rootfs_ofs = 0x100000,
-
}, {
.id = "16Mlzma",
.fw_max_len = 0xfc0000,
.kernel_la = 0x80060000,
.kernel_ep = 0x80060000,
.rootfs_ofs = 0x100000,
}, {
/* terminating entry */
} -
};
-
-
static struct board_info boards[] = {
-
{
-
.id = "TL-MR3020v1",
-
.hw_id = HWID_TL_MR3020_V1,
-
.hw_rev = 1,
-
.layout_id = "4Mlzma",
-
}, {
-
.id = "TL-MR3220v1",
-
.hw_id = HWID_TL_MR3220_V1,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-MR3420v1",
-
.hw_id = HWID_TL_MR3420_V1,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WA701Nv1",
-
.hw_id = HWID_TL_WA701N_V1,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WA901NDv1",
-
.hw_id = HWID_TL_WA901ND_V1,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WA901NDv2",
-
.hw_id = HWID_TL_WA901ND_V2,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WR741NDv1",
-
.hw_id = HWID_TL_WR741ND_V1,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WR741NDv4",
-
.hw_id = HWID_TL_WR741ND_V4,
-
.hw_rev = 1,
-
.layout_id = "4Mlzma",
-
}, {
-
.id = "TL-WR740Nv1",
-
.hw_id = HWID_TL_WR740N_V1,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WR740Nv3",
-
.hw_id = HWID_TL_WR740N_V3,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WR743NDv1",
-
.hw_id = HWID_TL_WR743ND_V1,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WR841Nv1.5",
-
.hw_id = HWID_TL_WR841N_V1_5,
-
.hw_rev = 2,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WR841NDv3",
-
.hw_id = HWID_TL_WR841ND_V3,
-
.hw_rev = 3,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WR841NDv5",
-
.hw_id = HWID_TL_WR841ND_V5,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WR841NDv7",
-
.hw_id = HWID_TL_WR841ND_V7,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WR941NDv2",
-
.hw_id = HWID_TL_WR941ND_V2,
-
.hw_rev = 2,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WR941NDv4",
-
.hw_id = HWID_TL_WR941ND_V4,
-
.hw_rev = 1,
-
.layout_id = "4M",
-
}, {
-
.id = "TL-WR1043NDv1",
-
.hw_id = HWID_TL_WR1043ND_V1,
-
.hw_rev = 1,
-
.layout_id = "8M",
-
}, {
-
.id = "TL-WR2543Nv1",
-
.hw_id = HWID_TL_WR2543N_V1,
-
.hw_rev = 1,
-
.layout_id = "8Mlzma",
-
}, {
-
.id = "TL-WR703Nv1",
-
.hw_id = HWID_TL_WR703N_V1,
-
.hw_rev = 1,
-
.layout_id = "4Mlzma", //-->8Mlzma/16Mlzma
-
}, {
-
/* terminating entry */
-
}
- };
$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR703,tl-wr703n-v1,TL-WR703N,ttyATH0,115200,0×07030101,1,8Mlzma/16Mlzma))
Part Three: Compile your openwrt firmware:
1. Checkout trunk and update feeds as other common tutorials
2. Modify Openwrt code to support and partition your flash:
/trunk/tools/firmware-utils/src/mktplinkfw.c
fw_max_len = 0x7c0000 /* for 8M Flash, use 0xfc0000 for 16M flash*/
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-mr3x20.c
4M:
.name = "u-boot",
.offset = 0,
.size = 0x020000,
.mask_flags = MTD_WRITEABLE,
}, {
.name = "kernel",
.offset = 0x020000,
.size = 0x140000,
}, {
.name = "rootfs",
.offset = 0x160000,
.size = 0x290000,
}, {
.name = "art",
.offset = 0x3f0000,
.size = 0x010000,
.mask_flags = MTD_WRITEABLE,
}, {
.name = "firmware",
.offset = 0x020000,
.size = 0x3d0000,
}
};
8M:
.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,
}
};
16M:
.name = "u-boot",
.offset = 0,
.size = 0x020000,
.mask_flags = MTD_WRITEABLE,
}, {
.name = "kernel",
.offset = 0x020000,
.size = 0x140000,
}, {
.name = "rootfs",
.offset = 0x160000,
.size = 0xe90000,
}, {
.name = "art",
.offset = 0xff0000,
.size = 0x010000,
.mask_flags = MTD_WRITEABLE,
}, {
.name = "firmware",
.offset = 0x020000,
.size = 0xfd0000,
}
};
0x000000000000-0x000000020000 : "u-boot" //128k
0x000000020000-0x000000160000 : "kernel" ///1280K
0x000000160000-0x000000ff0000 : "rootfs" //14912K
0x0000008c0000-0x000000ff0000 : "rootfs_data" //7360k
0x000000ff0000-0x000001000000 : "art" //64k
0x000000020000-0x000000ff0000 : "firmware" //16192k
3. menuconfig and make your image as common tutorials. save the image openwrt-ar71xx-generic-tl-mr3420-v1-squashfs-factory.bin for future usage.
4. back up your 64k art (wirelss driver data, without it your wireless does not work.) this is important! you can also use the backup one from other tp-link ar7241 chipset routers.