如何从uboot中推算路由器flash烧写地址
首先从uboot中得到flash分区的基地址
一、找到uboot编译生成的bootstrap.map或者u-boot.map文件,找到下面这句,
.text 0x000000009f000000 0x3520
其中 0x9f000000 就是flash分区的基地址;
二、查看uboot的源代码,例如qca9531芯片,其flash分区的基地址就定义在下面这个头文件中;
u-boot\include\configs\board953x.h
/* NOR Flash start address */
#define CFG_FLASH_BASE 0x9f000000
查看路由器flash分区信息
~ # cat /proc/mtd
dev: size erasesize name
mtd0: 00040000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00630000 00010000 "rootfs"
mtd3: 00160000 00010000 "uImage"
mtd4: 00010000 00010000 "mib0"
mtd5: 00010000 00010000 "ART"
~ # cat /proc/partitions
major minor #blocks name
31 0 256 mtdblock0
31 1 64 mtdblock1
31 2 6336 mtdblock2
31 3 1408 mtdblock3
31 4 64 mtdblock4
31 5 64 mtdblock5
开始计算各自模块的flash地址及烧写命令
烧写uboot:
tftp 0x80060000 u-boot.bin
erase 0x9f000000 +0x40000
cp.b 0x80060000 0x9f000000 0x40000
烧写jffs2
tftp 0x80060000 ap143-jffs2
erase 0x9f050000 +0x630000
cp.b 0x80060000 0x9f050000 0x630000
烧写vmlinux
tftp 0x80060000 vmlinux.lzma.uImage
erase 0x9f680000 +0x160000
cp.b 0x80060000 0x9f680000 0x160000
烧写art:
tftp 0x80060000 art.bin
erase 0x9f7f0000 +0x10000
cp.b 0x80060000 0x9f7f0000 0x10000
首先从uboot中得到flash分区的基地址
一、找到uboot编译生成的bootstrap.map或者u-boot.map文件,找到下面这句,
.text 0x000000009f000000 0x3520
其中 0x9f000000 就是flash分区的基地址;
二、查看uboot的源代码,例如qca9531芯片,其flash分区的基地址就定义在下面这个头文件中;
u-boot\include\configs\board953x.h
/* NOR Flash start address */
#define CFG_FLASH_BASE 0x9f000000
查看路由器flash分区信息
~ # cat /proc/mtd
dev: size erasesize name
mtd0: 00040000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00630000 00010000 "rootfs"
mtd3: 00160000 00010000 "uImage"
mtd4: 00010000 00010000 "mib0"
mtd5: 00010000 00010000 "ART"
~ # cat /proc/partitions
major minor #blocks name
31 0 256 mtdblock0
31 1 64 mtdblock1
31 2 6336 mtdblock2
31 3 1408 mtdblock3
31 4 64 mtdblock4
31 5 64 mtdblock5
开始计算各自模块的flash地址及烧写命令
烧写uboot:
tftp 0x80060000 u-boot.bin
erase 0x9f000000 +0x40000
cp.b 0x80060000 0x9f000000 0x40000
烧写jffs2
tftp 0x80060000 ap143-jffs2
erase 0x9f050000 +0x630000
cp.b 0x80060000 0x9f050000 0x630000
烧写vmlinux
tftp 0x80060000 vmlinux.lzma.uImage
erase 0x9f680000 +0x160000
cp.b 0x80060000 0x9f680000 0x160000
烧写art:
tftp 0x80060000 art.bin
erase 0x9f7f0000 +0x10000
cp.b 0x80060000 0x9f7f0000 0x10000