如何在44B0板子的RAM中运行uclinux

 

1、将编译好的uclinux_rom.bin放在tftpd32的默认传输目录下,在uboot中输入命令 tftp 0x0c 208000 ,镜像被自动下载到RAM中的0x0c 208000位置,然后执行bootm 0x0c 208000 命令,看到如下信息就表示启动成功了:

## Booting image at 0c208000 ...
   Image Name:   uClinux_hfrk_www.21spacetime.net
   Created:      2009-01-15   6:56:28 UTC
   Image Type:   ARM Linux Kernel Image (gzip compressed)
   Data Size:    1432456 Bytes =  1.4 MB
   Load Address: 0c008000
   Entry Point:  0c008000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

(后面是uclinux的启动信息,省略……)

 

也可以通过串口传送的方式将文件uclinux_rom.bin放到RAM中,不过此方式速度较慢,需要耐心等待了。

上面之所要将 uclinux_rom.bin文件放在RAM的 0x0c 208000 位置处,是因为uclinux_rom.bin是压缩文件 ,在用bootm启动时需要将原始文件解压缩到0x0c008000 位置(此地址在编译时就确定了),然后跳转到这里开始执行。所以必须使得uclinux_rom.bin的存放位置避开程序解压缩后的存储区域,否则二者冲突将导致启动失败。

2、编译uclinux后还会生成uclinux_ram.bin.gz,此文件就是专为在RAM中运行产生的。

使用命令 gunzip uclinux_ram.bin.gz 解压缩后得到 uclinux_ram.bin,将此文件放到tftpd32的传输目录下,修改文件名为 uclinux_rom.bin(也可以不修改此文件的名称,而将uboot中ttfp下载文件的名称修改为 uclinux_ram.bin,无论如何只要使得二者保持一致就可以了 )。

使用命令 tftp 0x0c008000 将文件传输到RAM中,然后输入命令go 0x0c008000 就可以启动uclinux了。注意,这里 uclinux_ram.bin文件在RAM中的位置必须是 0x0c008000,而且不需要使用bootm来启动,因为此文件本来就是非压缩文件,直接让CPU从此处运行即可。如果 uclinux_ram.bin在RAM中的位置不是 0x0c008000,那么使用go命令是无法启动kernel的,因为程序在编译时就已经确定了其运行的地址空间的,所以必须把镜像放在正确的地址上才能成功启动kernel。

看到的输出信息如下:

## Starting application at 0x0C008000 ...
Linux version 2.6.9-hsc0 (root@ubuntu) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #535 Mon Oct 18 05:09:26 PDT 2010
CPU: Samsung-S3C44B0x [44b07700] revision 0 (ARMv4T)
Machine: S3C44B0X Development Board
Built 1 zonelists
Kernel command line: root=/dev/ram0 initrd=0x0c192fb4,1293k keepinitrd
PID hash table entries: 64 (order: 6, 1024 bytes)
drivers/serial/serial_s3c44b0.c:627 __s3c44b0_console_init
drivers/serial/serial_s3c44b0.c:595 __s3c44b0_console_setup
this is in drivers/serial/serial_s3c44b0.c:336 __s3c44b0_initdivisor=32
divisor=32
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 8MB = 8MB total
Memory: 5032KB available (2812K code, 174K data, 60K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
checking if image is initramfs...it isn't (ungzip failed); looks like an initrd
NET: Registered protocol family 16
Samsung S3C44B0 Rtl8019as driver version 0.1 (2002-02-20)
eth0: 00:49:34:00:00:00
the ioaddr is :6000600
NetWinder Floating Point Emulator V0.97 (double precision)
Initializing Cryptographic API
gpio: init OK
s3c44b0-adc get major number
rtc: init OK
test ch375->name txch375 test ch375->cmd_io 167772161Probing txch375 ...
CH375_CMD_CHECK_EXIST = 0xa8
Probing txch375 ... found
Reset controller ...done
tx-ch3575: init OK
txps2misc: init OK
ttyS0 at I/O 0x1d00000 (irq = 3) is a Samsung S3C44B0X Internal UART
ttyS1 at I/O 0x1d04000 (irq = 2) is a Samsung S3C44B0X Internal UART
RAMDISK driver initialized: 16 RAM disks of 1024K size 1024 blocksize
loop: loaded (max 8 devices)
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 26
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
IPv4 over IPv4 tunneling driver
GRE over IPv4 tunneling driver
Initializing IPsec netlink socket
NET: Registered protocol family 1
NET: Registered protocol family 17
NET: Registered protocol family 15
NET4: DECnet for Linux: V.2.5.68s (C) 1995-2003 Linux DECnet Project Team
DECnet: Routing cache hash table of 512 buckets, 4Kbytes
NET: Registered protocol family 12
802.1Q VLAN Support v1.8 Ben Greear <[email protected]>
All bugs added by David S. Miller <[email protected]>
RAMDISK: romfs filesystem found at block 0
RAMDISK: image too big! (1293KiB/1024KiB)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)

上面uclinux的程序已经开始运行了,但是启动到加载RAMDISK时后来出错了(红色部分),这个问题就与启动方法无关了,而是编译出的镜像的问题。目前,我还没有找到解决上述问题的方法,如果有高手知道,请指点!

你可能感兴趣的:(如何在44B0板子的RAM中运行uclinux)