3.uClinux移植
从http://www.uclinux.org/网站上下载比较新的内核包文件,并且解压。
$tar xvzf uClinux-dist-xxxxxxxx.tar.gz
进入生成的uClinux-dist目录
可以使用make xconfig - 图形配置模式,make menuconfig - 菜单模式配置,方式来配置uClinux.
在uClinux-dist目录下执行:
$make xconfig
在Target Platform Selection选项卡中选择:
Vendor/Product: GDB/ARMulator
Kernel Version: linux-2.4.x
Libc Version: uC-libc
然后选择save and exit
完成配置后,可以使用make dep建立内核依赖关系,然后使用make编译内核和文件系统
$make dep; make
经过一段时间的编译后,如果没有出现错误,则在uClinux-dist目录下的images目录里会建立如下几个文件:
image.bin linux.data linux.text. romfs.img
该romfs.img就是我们需要的文件系统映象了
同时,在uClinux-dist/linux-2.4.x/目录下会生成linux,该文件是一个我们需要模拟的内核文件。
接下来我们可以使用skyeye软件来模拟我们编译的uClinux系统了。
我们在uClinux-dist目录下建立一个名为skyeye.conf的配置文件。
内容如下:
cpu: arm7tdmi
mach: at91
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00004000
mem_bank: map=M, type=RW, addr=0x01000000, size=0x00400000
mem_bank: map=M, type=R, addr=0x01400000, size=0x00400000, file=images/romfs.img
mem_bank: map=M, type=RW, addr=0x02000000, size=0x00400000
mem_bank: map=M, type=RW, addr=0x02400000, size=0x00008000
mem_bank: map=M, type=RW, addr=0x04000000, size=0x00400000
mem_bank: map=I, type=RW, addr=0xf0000000, size=0x10000000
lcd: state=on
保存退出
然后在uClinux-dist目录里执行~/download/skyeye-v1/binary/skyeye -e linux-2.4.x/linux
看看uclinux是不是跑起来了?
下面是我的输出
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name at91, mach_init addr 0x80727e0
can't find device module: (null)
SKYEYE: use arm7100 mmu ops
Loaded ROM images/romfs.img
exec file "linux-2.4.x/linux"'s format is elf32-little.
load section .init: addr = 0x01000000 size = 0x0000a000.
load section .text: addr = 0x0100a000 size = 0x000c5ca0.
load section .data: addr = 0x010d0000 size = 0x00008320.
not load section .bss: addr = 0x010d8320 size = 0x00022198 .
not load section .debug_abbrev: addr = 0x00000000 size = 0x00039846 .
not load section .debug_info: addr = 0x00000000 size = 0x016b812f .
not load section .debug_line: addr = 0x00000000 size = 0x00378ef3 .
not load section .debug_pubnames: addr = 0x00000000 size = 0x0000b40d .
not load section .debug_aranges: addr = 0x00000000 size = 0x000022e0 .
start addr is set to 0x01000000 by exec file.
Linux version 2.4.19-uc1 (jelly@localhost.localdomain) (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/)) #1 五 4#1 五 4月 7 23:41:40 CST 2006
Processor: Atmel AT91M40xxx revision 0
Architecture: EB01
On node 0 totalpages: 1024
zone(0): 0 pages.
zone(1): 1024 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/rom0
Calibrating delay loop... 12.97 BogoMIPS
Memory: 4MB = 4MB total
Memory: 3036KB available (791K code, 170K data, 40K init)
Dentry cache hash table entries: 512 (order: 0, 4096 bytes)
Inode cache hash table entries: 512 (order: 0, 4096 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 1024 (order: 0, 4096 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
Atmel USART driver version 0.99
ttyS0 at 0xfffd0000 (irq = 2) is a builtin Atmel APB USART
ttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USART
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: 1400000-145DBFF [VIRTUAL 1400000-145DBFF] (RO)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
VFS: Mounted root (romfs filesystem) readonly.
Shell invoked to run file: /etc/rc
Command: hostname GDB-ARMulator
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram0 /var
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: cat /etc/motd
Welcome to
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/ \
| ___\____|_||_|_| |_|\____|\_/\_/
| |
|_|
GDB/ARMulator support by
For further information check:
http://www.uclinux.org/
Execution Finished, Exiting
Sash command shell (version 1.1.1)
/>
对于skyeye.conf文件的一点说明
对于skyeye-v0.2.5版本之前的skyeye使用的是memmap.conf文件,而之后的是使用skyeye.conf文件
cpu: 指定CPU类型,如arm7tdmi,arm720t等
mach: 开发板类型,如at91, ep7312
mem_bank: 内存块
map=M 指定为rom/ram, map=I 指定为IO空间
type=RW 可读写,type=R 只读
addr=0x00000000 内存块开始地址
size=0x10000000 内存块大小
files=romfs.img 文件系统映象文件
net: 网络配置
state=on 模拟NIC,等于off则不模拟
mac=0:4:3:2:1:f 指定MAC地址
ethmod=tuntap/vnet 使用虚拟驱动
hostip= 指定ip地址
例如:net: state = on, mac=0:4:3:2:1:f, ethmod=tuntap, hostip=10.0.0.1
uart: 串口支持
fd_in= 指定输入文件
fd_out= 指定输出文件
例如:uart: fd_in=/dev/ttyS0, fd_out=/dev/ttyS1
则你可以使用minicon来监听COM1口来进行数据交换
LCD:LCD模拟
state = on/off 打开或者关闭LCD模拟
