由于没有设置uboot参数的分区,只能在uboot源码中修改默认参数以使uboot正常工作。
boot/u-boot/include/configs/ap123.h:
#define __gen_cmd(n, a, f, ec, cc, el)
\
#n "=tftp 0x80060000 ${dir}" #f "&&"
\
#ec " " #a " " #el "&&"
\
#cc " $fileaddr " #a " $filesize\0"
*/
#define __gen_cmd(n, a, f, ec, cc, el)
\
#n "=tftp 0x80060000 " #f "&&"
\
#ec " " #a " " #el "&&"
\
#cc " $fileaddr " #a " $filesize\0"
将${dir}去掉,因为在下载时一般用不带路径的文件名。
//#
define ATH_U_FILE
tuboot.bin
#
define ATH_U_FILE
tuboot-router.bin
uboot文件名
//#
define ATH_F_FILE
${bc}-jffs2
#
define ATH_F_FILE
ap123-router-jffs2
jffs2文件系统文件名
//#
define ATH_K_FILE
vmlinux_${bc}.lzma.uImage
#
define ATH_K_FILE vmlinux-router.lzma.uImage
kernel img文件名
//#
define ATH_K_ADDR
0x9f300000
#
define ATH_K_ADDR
0x9fdd0000
kernel img分区地址
//#
define MTDPARTS_DEFAULT
"mtdparts=ath-nor0:64k(u-boot),6016k(rootfs),2048k(uImage),6016k(spare_rootfs),2048k(spare_uImage),64k(log),64k(mib0),64k(caldata)"
#
define MTDPARTS_DEFAULT
"mtdparts=ath-nor0:64k(u-boot),14080k(rootfs),2048k(uImage),64k(log),64k(mib0),64k(caldata)"
分区及其地址的修改
//#
define ATH_U_CMD
gen_cmd(lu, 0x9f000000, ATH_U_FILE)
#
define ATH_U_CMD
gen_cmd_el(lu, 0x9f000000, ATH_U_FILE, 0x10000)
//#
define ATH_F_CMD
gen_cmd_el(lf, ATH_F_ADDR, ATH_F_FILE, ATH_F_LEN)
#
define ATH_F_CMD
gen_cmd_el(lf, ATH_F_ADDR, ATH_F_FILE, 0xdc0000)
//#
define ATH_K_CMD
gen_cmd(lk, ATH_K_ADDR, ATH_K_FILE)
#
define ATH_K_CMD
gen_cmd_el(lk, ATH_K_ADDR, ATH_K_FILE, 0x200000)
确保烧写文件到flash之前,erase分区的全部地址。如果只erase filesize,可能会出错。
//#define
CONFIG_BOOTARGS
"console=ttyS0,115200 root=" ATH_ROOT_DEV " rootfstype=squashfs init=/sbin/init " MTDPARTS_DEFAULT
#define
CONFIG_BOOTARGS
"console=ttyS0,115200 root=" ATH_ROOT_DEV " rootfstype=jffs2 init=/sbin/init " MTDPARTS_DEFAULT
文件系统改为jffs2
//#
define CONFIG_BOOTCOMMAND "bootm 0x9f5f0000"
#
define CONFIG_BOOTCOMMAND "bootm 0x9fdd0000"
kernel启动地址和kernel img分区起始地址一致
//#define CONFIG_IPADDR
192.168.1.1
//#define CONFIG_SERVERIP
192.168.1.10
#define CONFIG_IPADDR
192.168.2.167
#define CONFIG_SERVERIP
192.168.2.165
板子地址和tftp server地址
boot/u-boot/include/configs/
ar7100.h:
boot/u-boot/include/configs/
ar7240.h:
//#define CONFIG_BOOTDELAY
4
/* autoboot after 4 seconds
*/
#define CONFIG_BOOTDELAY
2
/* autoboot after 2 seconds
*/
改了两个文件,但是肯定只有一个文件起作用,不过没必要去深究哪个。
缩短了启动时间
修改后的uboot参数如下: