编写hello.c程序,代码如下:
#include
int main()
{
int i;
for(i=0;i<6;i++)
{
printf("i=%d\n",i);
printf("Hello,embedded linux\n");
}
return 0;
}
编译hello.c
linux-dist$">stuyou@UBUNTU:/usr/local/src/uClinux-dist$ sudo arm-elf-gcc -elf2flt -o hello hello.c
生成hello,hello.gdb
挂载romfs
stuyou@UBUNTU:/usr/local/src/uClinux-dist/images$ mkdir romfs_dir
stuyou@UBUNTU:/usr/local/src/uClinux-dist/images$ sudo mount -o loop romfs.img romfs_dir
拷贝hello
stuyou@UBUNTU:/usr/local/src/uClinux-dist/images$ sudo cp ../hello ./romfs_dir
出错
cp: cannot create regular file `romfs_dir/bin/hello': Read-only file system
复制根文件系统到一个新到目录中
stuyou@UBUNTU:/usr/local/src/uClinux-dist/images$ sudo mkdir new_romfs
stuyou@UBUNTU:/usr/local/src/uClinux-dist/images$ sudo cp -r romfs_dir/* new_romfs
拷贝hello
stuyou@UBUNTU:/usr/local/src/uClinux-dist/images$ sudo cp ../hello new_romfs/bin
生成新的romfs映像
stuyou@UBUNTU:/usr/local/src/uClinux-dist/images$ sudo genromfs -f romfs_new.img -d new_romfs/
修改skyeye.conf,使之使用新的映像
#skyeye config file sample
arch:arm
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=./romfs_new.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
#set nic info
#net: type=cs8900a, base=0xfffa0000, size=0x20,int=16, mac=0:4:3:2:1:f, ethmod=tuntap, hostip=10.0.0.1
net: type=cs8900a, ethmod=tuntap, hostip=10.0.0.1
uart: mod = term
#dbct: state=on
在skyeye上启动uClinux
stuyou@UBUNTU:/usr/local/src/uClinux-dist/images$ skyeye -c skyeye.conf -e linux
得到如下启动信息:
Your elf file is little endian.
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name at91, mach_init addr 0x80605a0
ethmod num=1, mac addr=0:0:0:0:0:0, hostip=10.0.0.1
failed to setup_module (name:net, type:cs8900a)
tapif_init: icotl TUNSETIFF erroruart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm7100 mmu ops
Loaded ROM ./romfs_new.img
exec file "linux"'s format is elf32-little.
load section .init: addr = 0x01000000 size = 0x0000a000.
load section .text: addr = 0x0100a000 size = 0x000dccd0.
load section .data: addr = 0x010e8000 size = 0x00009ce4.
not load section .bss: addr = 0x010f1d00 size = 0x000220a0 .
not load section .debug_abbrev: addr = 0x00000000 size = 0x0003d30e .
not load section .debug_info: addr = 0x00000000 size = 0x0186c1ff .
not load section .debug_line: addr = 0x00000000 size = 0x00304551 .
not load section .debug_pubnames: addr = 0x00000000 size = 0x0000c30b .
not load section .debug_aranges: addr = 0x00000000 size = 0x00002438 .
call armul_InitSymTable,kernel filename is linux.
start addr is set to 0x01000000 by exec file.
Linux version 2.4.31-uc0 (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/)) #1 Thu May 13 15:02:46 CST 2010
Processor: Atmel AT91M40xxx revision 0
Architecture: EB01
On node 0 totalpages: 1024
zone(0): 0 pages.
zone(1): 1024 pages.
zone(2): 0 pages.
[1] [2] 下一页