烧写Uboot步骤
材料:
U-boot-2009.11-mini2440-nocompile-back.tar.gzuboot移植.txt
配置:
1在linux下将U-boot-2009.11-mini2440-nocompile-back.tar.gz文件解压到非共享目录下
2.根据uboot移植.txt修改U-boot-2009.11-mini2440-nocompile-back.tar.gz
并编译得到uboot-bin文件
uboot移植.txt:
/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(1)修改默认的环境变量bootargs
include/configs/mini2440.h
#define CONFIG_BOOTARGS "noinitrd root=/dev/nfs rw \
nfsroot=192.168.0.1:/home/tekkaman/working/nfs/rootfs \
ip=192.168.0.2:192.168.0.1::255.255.255.0 \
console=ttySAC0,115200 init=/linuxrc mem=64M"
修改为:
include/configs/mini2440.h
#define CONFIG_BOOTARGS "noinitrd root=/dev/mtdblock3 rw \
rootfstype=yaffs2 console=ttySAC0,115200 \
init=/linuxrc mem=64M"
(2)修改默认的环境变量bootcmd
include/configs/mini2440.h
#define CONFIG_BOOTCOMMAND "nfs 0x30008000 \
192.168.0.1:/home/working/nfs/zImage.img;bootm"
修改为:
include/configs/mini2440.h
#define CONFIG_BOOTCOMMAND "nand read 0x30008000 \
0x60000 0x267000;bootm 0x30008000"
(3)修改默认的环境变量在Nandflash中的位置
因为环境变量在Nandflash中的起始位置与内核文件在Nandflash中的起始位置一致,这样两者之间会出现覆盖之一。
include/configs/mini2440.h
#define CONFIG_ENV_IS_IN_NAND 1
//#define CONFIG_ENV_IS_IN_FLASH 1
#define CONFIG_ENV_OFFSET 0X60000
#define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */
修改为:
include/configs/mini2440.h
#define CONFIG_ENV_IS_IN_NAND 1
//#define CONFIG_ENV_IS_IN_FLASH 1
#define CONFIG_ENV_OFFSET (0X60000 - 0x20000)
#define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */
(3) 由U-boot启动流程可以发现,在Uboot第一阶段的时钟配置需要修改
cpu/arm920t/start.S
/* FCLK:HCLK:PCLK = 1:2:4 */
/* default FCLK is 120 MHz ! */
ldr r0, =CLKDIVN
mov r1, #3
str r1, [r0]
修改为:
cpu/arm920t/start.S
/* FCLK:HCLK:PCLK = 1:4:8 */
ldr r0, =CLKDIVN
mov r1, #5
str r1, [r0]
mrc p15, 0, r1, c1, c0, 0
orr r1, r1, #0xc0000000
mcr p15, 0, r1, c1, c0, 0
mov r1, #CLK_CTL_BASE
mov r2, #MDIV_405
add r2, r2, #PSDIV_405
str r2, [r1, #0x04] /* MPLLCON Config */
编译步骤: make mini2440_config
make all
/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<span style="font-size:14px;">3 用Jlink,地址改为0,把uboot-bin烧到开发板</span>
<span style="font-size:14px;">
</span>
<span style="font-size:14px;">ps1:按上述编写的uboot-bin不能支持usb驱动,好像是不支持上拉电阻上电(……),要使用supervivi-128M.bin</span>