您的位置:首页 > 运维架构 > Linux

在nuc950上使用u-boot

2013-09-27 10:41 239 查看
在nuc950上使用u-boot

 

一.使用说明

 本文主要介绍nuc900平台在nand flash 引导下u-boot的使用.适用于nuc910、nuc950、nuc951等。主要特性:

    1 只支持2k+64Page的nand flash。

    2 支持TFTP下载。

    3 支持Cramfs文件系统、支持yaffs2文件系统

    4 使用usb烧写时,需要使用专用的turbowriter工具。turbonandwriter(uboot)。

tftp下载

使用TFTP下载时需要设置evb的ip和下载server ip

在u-boot命令行下通过下面的命令修改

set ipaddr 192.168.1.2 
( evb板的ip)

set serverip  192.168.1.3(运行TFTPd32的pc机的ip)

set netmask 255.255.255.0

sa (保存环境变量到flash)

 关于tftp下的方法可参照,u-boot的手册。

另外为了便于下载,在源码有个menu菜单可以使用。

U-Boot> menu

######## Tanshi TFTP DownLoad for NUC900 ########

[1] 下载 u-boot-nand.bin       写入 Nand Flash

[2] 下载 Linux(vmlinux.img)    内核镜像写入 Nand Flash

[3] 下载 cramfs(nfs.cramfs)    文件系统镜像写入 Nand Flash

[4] 下载 yaffs2(nfs.yaffs2)    文件系统镜像写入 Nand Flash

[5] 下载 Linux(vmlinux.img)    内核镜像到内存并运行

[6] 设置 Load cramfs文件系统   from mtdblock2

[7] 设置 Load yaffs2文件系统   from mtdblock3

[8] 设置 Load nfs文件系统      from 192.168.1.20

[9] 重启设备

[a] 下载 u-boot.bin            写入 nor Flash

[q] 退出菜单

输入选择:

 

二. 编译命令

1. make O=../build/nuc900_nand distclean

2. make O=../build/nuc900_nand nuc910_nand_config

3. make O=../build/nuc900_nand all

 

三. kernel制作

 根据u-boot的使用要求,需要mkimge对kernel进行制作后,u-boot才能使用识别,制作命令如下: 

 mkimage -n "Kernel 2.6.35" -A arm -O linux -T kernel -C none -a 00007fc0 -e 00008000 -d ./arch/arm/boot/zImage vmlinux.img

 

四. 文件系统制作

1 在linux下通过mkcramfs命令制作

./mkcramfs rootfs nfs.cramfs

另外,需要注意的是linuxkernel对cramfs的支持中没有考虑nandflash的坏块问题,故使用中遇到会块时会有问题,网上有相关针对此问题的讨论,不过我没有测试过,感兴趣的可以自己试试看。

 2 yaffs2文件系统制作

./mkyaffs2imge  rootfs rootfs1.yaffs2

注意:这里的mkyaffs2imge 必须使用是自己编译的与kernel的patch相一致的,而不是从网上随便下载。

kernelpatch为:yaffs2-52df965.tar.gz

可以下面下载:

http://download.csdn.net/detail/tanshi_li/6327997

五.启动参数设置

1.挂载nfs文件系统

set bootargs console=ttyS0,115200n8 ip=dhcp mem=32M root=/dev/nfs rw nfsroot=10.130.249.125:/extend/cjli/rootfs ip=10.130.249.120:::255.255.0.0::eth0:off

set bootcmd nand read 7fc0 100000 200000\;bootm 7fc0

 

2.挂载cramfs文件系统

set bootargs root=/dev/mtdblock2 console=tty0 console=ttyS0,115200 rootfstype=cramfs

set bootcmd nand read 7fc0 100000 200000\;bootm 7fc0

sa

 3 挂载yaffs2文件系统

set bootargs root=/dev/mtdblock2 console=tty0 console=ttyS0,115200 rootfstype=yaffs2

set bootcmd nand read 7fc0 100000 200000\;bootm 7fc0

sa

 

六 启动log

U-Boot 2011.12 (Jun 14 2013 - 17:26:46)

CPU: NUC910

DRAM:  64 MiB

Flash: 0 Bytes

NAND:  128 MiB

*** Warning - bad CRC, using default environment

In:    serial

Out:   serial

Err:   serial

Net:   emac

Hit any key to stop autoboot:  0

NAND read: device 0 offset 0x100000, size 0x200000

 2097152 bytes read: OK

## Booting kernel from Legacy Image at 00007fc0 ...

   Image Name:   Kernel 2.6.35

   Image Type:   ARM Linux Kernel Image (uncompressed)

   Data Size:    1885084 Bytes = 1.8 MiB

   Load Address: 00007fc0

   Entry Point:  00008000

   Verifying Checksum ... OK

   XIP Kernel Image ... OK

OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

Linux version 2.6.35.4+ (cjli@localhost.localdomain) (gcc version 4.3.4 (GCC) ) #47 PREEMPT Mon Sep 30 11:29:43 CST 2013

CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177

CPU: VIVT data cache, VIVT instruction cache

Machine: W90P950EVB

Memory policy: ECC disabled, Data cache writeback

CPU type 0x02900910 is NUC910

Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256

Kernel command line: root=/dev/mtdblock2 console=ttyS0,115200 rootfstype=yaffs2

PID hash table entries: 256 (order: -2, 1024 bytes)

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

er: 2, 16384 bytes)

 

 

 

 

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nuc951 linux u-boot