在uClinux文件系统中增加应用程序
编写hello.c程序,代码如下: #include <stdio.h> 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 .d |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |