现在的位置: 首页 > 综合 > 正文

用u-boot引导uclinux

2013年09月09日 ⁄ 综合 ⁄ 共 4681字 ⁄ 字号 评论关闭
        前段时间准备让u-boot支持NAND Flash,最终无果而终,于是决定先放一放,先让uclinux跑起来,给自己点信心再说。参考了网上一些文章后,终于看到了可爱的提示符!
当前配置:
CPU为BF561,软件为uClinux-dist-2007R1.1-RC3,u-boot已写到Nor Flash且可正常启动。
1、解压uClinux-dist-2007R1.1-RC3,用make menuconfig的默认配置生成一个可用的image。最后在images目录下生成的uImage.ext2有3兆。这是一个带文件头的Image,也相当于u-boot的README中所说的uImage。
2、由于我的板子上不带网络功能,只能从串口用loadb下载,但是下载一次要20多分钟(57600),完全是要考验人的耐心。还好有仿真器,就直接在vdsp中将这个image直接写到0x0300 0000这个位置(Memory -> Fill)。
3、关掉vdsp,reset后启动u-boot,用iminfo 0x0300 0000可以看到如下信息
gtw> iminfo 3000000
 
## Checking Image at 03000000 ...
   Image Name:   uClinux Kernel and ext2
   Image Type:   Blackfin Linux Kernel Image (gzip compressed)
   Data Size:    3000041 Bytes = 2.9 MB
   Load Address: 00001000
   Entry Point: 00001000
   Verifying Checksum ... OK
4、用md 0x0300 0000可看到如下信息:
gtw> md 3000000
03000000: 56190527 e820c44f fa81f846 e9c62d00    '..VO. .F....-..
03000010: 00100000 00100000 a9fdeb65 01021005    ........e.......
03000020: 696c4375 2078756e 6e72654b 61206c65    uClinux Kernel a
03000030: 6520646e 00327478 00000000 00000000    nd ext2.........
这就是此Image的文件头,这64个字节也就是对应着如下数据结构:
 
#define IH_MAGIC   0x27051956    /* Image Magic Number       */
#define IH_NMLEN       32   /* Image Name Length        */
 
/*
 * all data in network byte order (aka natural aka bigendian)
 */
 
typedef struct image_header {
     uint32_t ih_magic; /* Image Header Magic Number     */
     uint32_t ih_hcrc; /* Image Header CRC Checksum     */
     uint32_t ih_time; /* Image Creation Timestamp */
     uint32_t ih_size; /* Image Data Size     */
     uint32_t ih_load; /* Data Load Address         */
     uint32_t ih_ep;        /* Entry Point Address      */
     uint32_t ih_dcrc; /* Image Data CRC Checksum */
     uint8_t       ih_os;        /* Operating System         */
     uint8_t       ih_arch; /* CPU architecture         */
     uint8_t       ih_type; /* Image Type          */
     uint8_t       ih_comp; /* Compression Type         */
     uint8_t       ih_name[IH_NMLEN]; /* Image Name      */
} image_header_t;
用iminfo显示也就是这个结构体的内容。
5、用bootm 3000000引导时出现如下提示:
gtw> bootm 3000000
## Booting image at 03000000 ...
   Image Name:   uClinux Kernel and ext2
   Image Type:   Blackfin Linux Kernel Image (gzip compressed)
   Data Size:    3000041 Bytes = 2.9 MB
   Load Address: 00001000
   Entry Point: 00001000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
Starting Kernel at = 1000
Linux version 2.6.19.3-ADI-2007R1.1-svn (wmz@localhost.localdomain) (gcc 鐗堟湰
 4.1.1 (ADI 07R1)) #2 Tue Sep 25 11:24:43 CST 2007
Warning: limiting memory to 53MB due to hardware anomaly 05000263
Blackfin support (C) 2004-2007 Analog Devices, Inc.
Compiled for ADSP-BF561 Rev 0.3
Blackfin Linux support by http://blackfin.uclinux.org/
Processor Speed: 600 MHz core clock and 60 Mhz System Clock
Board Memory: 64MB
Kernel Managed Memory: 64MB
Memory map:
 text      = 0x00001000-0x000b0db0
 init      = 0x000b1000-0x000bd23c
 data      = 0x000bf1b8-0x000e5588
 stack     = 0x000c0000-0x000c2000
 bss       = 0x000e5590-0x000f14d8
 available = 0x000f14d8-0x03500000
 rootfs    = 0x03500000-0x03f00000
 DMA Zone = 0x03f00000-0x04000000
Instruction Cache Enabled
Data Cache Enabled (write-through)
Hardware Trace Enabled
Built 1 zonelists. Total pages: 13462
Kernel command line: root=/dev/mtdblock0 rw console=ttyBF0,57600 init=/sbin/init
 
Configuring Blackfin Priority Driven Interrupts
PID hash table entries: 256 (order: 8, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Physical pages: 3500
Memory available: 52668k/64771k RAM, (48k init code, 703k kernel code, 47k data,
 1024k dma)
Blackfin Scratchpad data SRAM: 4 KB
Blackfin DATA_A SRAM: 16 KB
Blackfin DATA_B SRAM: 16 KB
Blackfin Instruction SRAM: 16 KB
Security Framework v1.0.0 initialized
Capability LSM initialized
Mount-cache hash table entries: 512
Blackfin GPIO Controller
Blackfin DMA Controller
ezkit_init(): registering device resources
BF561 Core B driver v0.1 initialized.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler cfq registered
Serial: Blackfin serial driver
bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 35) is a BFIN-UART
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
uclinux[mtd]: RAM probe address=0x3500000 size=0xa00000
Creating 1 MTD partitions on "RAM":
0x00000000-0x00a00000 : "ROMfs"
uclinux[mtd]: set ROMfs:EXT2 to be root filesystem
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 48k freed (0xb1000 - 0xbc000)
dma_alloc_init: dma_page @ 0x000b8000 - 256 pages at 0x03f00000
No usable address families found.
socket: Function not implemented
Unable to create socket
Unable to create socket
Unable to create socket
 
Welcome to:
       ____ _ _
      / __| ||_|             _ _
 _   _| | | | _ ____ _   _ / // /
| | | | | | || | _ /| | | | / /
| |_| | |__| || | | | | |_| | / /
| ___/____|_||_|_| |_|/____|/_//_/
|_|
 
For further information see:
http://www.uclinux.org/
http://blackfin.uclinux.org/
 
 
 
BusyBox v1.4.1 (2007-09-25 11:26:44 CST) Built-in shell (msh)
Enter 'help' for a list of built-in commands.
 
root:~> Unable to create socket
Unable to create socket
6、关闭与网络有关的选项后一切OK!
7、最后一步:将uclinux映象写入NorFlash,设置u-boot的环境变量
setenv ramboot bootm 20030000
复位后自动引导进入uclinux的提示符。

 

抱歉!评论已关闭.