linux 系统移植uboot

这里使用的版本为:u-boot-2014.04

查看并修改位置如下:
u-boot-2014.04/include/configs/at91sam9x5ek.h
(1)查看一下Linux内核在NandFlash中的烧写位置:默认为:0x200000。

如下为Linux内核启动的参数:在NandFlash里启动。
/* bootstrap + u-boot + env + linux in nandflash */
#define CONFIG_ENV_IS_IN_NAND
#define CONFIG_ENV_OFFSET 0xc0000
#define CONFIG_ENV_OFFSET_REDUND 0x100000
#define CONFIG_ENV_SIZE 0x20000 /* 1 sector = 128 kB */
#define CONFIG_BOOTCOMMAND "nand read " \
"0x22000000 0x200000 0x300000; " \
"bootm 0x22000000"

0x22000000为SDRAM的位置,0x200000为Linux内核在NandFlash的开始地址(如果使用SAM-BA v2.15烧写,烧写地址填0x200000),0x300000为要读取Linux内核的区域大小(读取大小,要超过实际内核的大小,需要为0x20000 的整数倍,保证完整读取到SDRAM里启动。)

(2)修改一下Linux内核的启动参数
#ifdef CONFIG_SYS_USE_MMC
#define CONFIG_BOOTARGS "mem=128M console=ttyS0,115200 " \
"mtdparts=atmel_nand:" \
"8M(bootstrap/uboot/kernel)ro,-(rootfs) " \
"root=/dev/mmcblk0p2 " \
"rw rootfstype=ext4 rootwait"
#else
#define CONFIG_BOOTARGS \
"mem=128M console=ttyS0,115200 " \
"mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) " \
"root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs"
#endif

根据板子的硬件:DDR SDRAM 为128MB ,NandFlash为:256MB ,控制台串口使用DEBUG串口,ttyS0,115200波特率,需要修改一下NandFlash的分区,这里为两个分区,一个bootstrap/uboot/kernel,只读的8M,0x0~0x7FFFFF,注意:十六进制:0x100000为1M。
我使用UBI根文件系统,目前嵌入式文件系统一般采用yaffs2与UBI文件系统。

编译的命令如下:
make distclean
make at91sam9x5ek_nandflash_config (这里采用bootstrap + uboot+kernel+rootfs全烧写在nandflash里,也就是nandflash启动。)
make CROSS_COMPILE=arm-none-linux-gnueabi-

注意:at91sam9x5ek_nandflash_config 这个不是随便取的,由u-boot-2014.04目录下的:boards.cfg文件里的 定义的名称得到。如果是新的开发板,需要添加相应的文件与配置等。

 

 

烧写在Nandflash后,重新上电,串口打印的启动信息如下:


RomBOOT


AT91Bootstrap 3.6.0

NAND: Done to load image


U-Boot 2014.04 (Feb 03 2016 - 16:08:28)

CPU: AT91SAM9X35
Crystal frequency: 12 MHz
CPU clock : 400 MHz
Master clock : 133.333 MHz
DRAM: 128 MiB
WARNING: Caches not enabled
NAND: 256 MiB
MMC: mci: 0
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: macb0
Warning: failed to set MAC address

Hit any key to stop autoboot: 0

NAND read: device 0 offset 0x200000, size 0x300000
Skipping bad block 0x00320000
3145728 bytes read: OK
Wrong Image Format for bootm command
ERROR: can't get kernel image! (这里是没有烧写Linux 内核的原因)
U-Boot>

posted on 2016-08-03 10:56  消消乐  阅读(834)  评论(0编辑  收藏  举报

导航