红联Linux门户
Linux帮助

向已经编译好的uClinux系统里加入自己的新程序

发布时间:2006-09-16 00:26:49来源:红联作者:samblue
前段时间编译了uClinux后,一直没有抽出时间来测试,今天把skyeye拿出来实验了一下,以前正常!下面详细的说一说相关的步骤:

一。首先安装skyeye
[root@localhost root]#wget 192.168.5.89/skyeye.tar.tar
[root@localhost root]#tar jxvf skyeye.tar.tar
[root@localhost root]#cd skyeye-v1
[root@localhost skyeye-v1]#make

这样skyeye就安装完了,很简单,如果有什么不懂的地方,可以查看README
[root@localhost skyeye-v1]#cat READ | less

二。测试uClinux能否在skyeye下运行。
[root@localhost skyeye-v1]#cp ./binary/skyeye /root/uClinux-dist/
[root@localhost skyeye-v1]#cd /root/uClinux-dist
[root@localhost uClinux-dist]#vi skyeye.conf
#skyeye config file sample
cpu: arm7tdmi
mach: s3c4510b
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00800000
mem_bank: map=M, type=R, addr=0x01000000, size=0x00200000, file=images/romfs.img
#mem_bank: map=M, type=R, addr=0x01000000, size=0x00200000
mem_bank: map=I, type=RW, addr=0x03ff0000, size=0x00100000 #uart:type=s3c4510b,name=uart0
#uart:type=s3c4510b,name=uart1
#timer:type=s3c4510b,name=timer0
#timer:type=s3c4510b,name=timer1
#net: state=off, hostip=10.0.0.2, ethmod=tuntap, mac=b0:c4:20:00:00:00
[root@localhost uClinux-dist]#./skyeye -e ./linux-2.4.x/linux -c skyeye.conf

Loaded ROM images/romfs.img
exec file "./linux-2.4.x/linux"'s format is elf32-little.
load section .init: addr = 0x00008000 size = 0x0000a000.
load section .text: addr = 0x00012000 size = 0x001b0aa8.
load section .data: addr = 0x001c4000 size = 0x00007c60.
not load section .bss: addr = 0x001cbc60 size = 0x0001f3a0 .
not load section .debug_abbrev: addr = 0x00000000 size = 0x00032084 .
not load section .debug_info: addr = 0x00000000 size = 0x0141b225 .
not load section .debug_line: addr = 0x00000000 size = 0x00241819 .
not load section .debug_pubnames: addr = 0x00000000 size = 0x0000a6d7 .
not load section .debug_aranges: addr = 0x00000000 size = 0x00001e88 .
start addr is set to 0x00008000 by exec file.
Linux version 2.4.27-uc1 (root@localhost) (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/)) #4 三 9月 6 18:23:36 CST 2006

Processor: Samsung S3C4510B revision 6

Architecture: SNDS100

On node 0 totalpages: 2048

zone(0): 0 pages.

zone(1): 2048 pages.

zone(2): 0 pages.

Kernel command line: root=/dev/rom0

Calibrating delay loop... 20.78 BogoMIPS

Memory: 8MB = 8MB total

Memory: 6128KB available (1730K code, 161K data, 40K init)

Dentry cache hash table entries: 1024 (order: 1, 8192 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: 2048 (order: 1, 8192 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

Samsung S3C4510 Serial driver version 0.9 (2001-12-27) with no serial options enabled

ttyS00 at 0x3ffd000 (irq = 5) is a S3C4510B

ttyS01 at 0x3ffe000 (irq = 7) is a S3C4510B

Blkmem copyright 1998,1999 D. Jeff Dionne

Blkmem copyright 1998 Kenneth Albanowski

Blkmem 1 disk images:

0: C9EA8-1C2AA7 [VIRTUAL C9EA8-1C2AA7] (RO)

RAMDISK driver initialized: 16 RAM disks of 1024K 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)

VFS: Mounted root (romfs filesystem) readonly.

Freeing init memory: 40K

Shell invoked to run file: /etc/rc
Command: hostname Samsung
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram0 /var
Command: mkdir /var/config
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: mkdir /var/empty
Command: cat /etc/motd
Welcome to
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/ \
| ___\____|_||_|_| |_|\____|\_/\_/
| |
|_|

For further information check:
http://www.uclinux.org/

Command: ifconfig lo 127.0.0.1
Command: route add -net 127.0.0.0 netmask 255.255.255.0 lo
Command: dhcpcd &
Jan 1 00:00:00 dhcpcd[14]: dhcpStart: ioctl SIOCGIFHWADDR: No such device



sh 7: Child 14 died
[14]
Execution Finished, Exiting

Sash command shell (version 1.1.1)
/>
还好,可以运行!


三。向系统里加入自己的程序:

[root@localhost uClinux-dist]#vi test.c
#include
int main()
{
printf("this is an test program\n");
printf("written by 1jjk\n");
printf("Email:lingjiujianke@gmail.com")
printf("blog: http://1jjk.cublog.cn");
return 0;
}

:wq

[root@localhost uClinux-dist]#arm-elf-gcc -Wall -elf2flt -o test test.c
[root@localhost uClinux-dist]#cp ./test ./romfs/bin/
生成文件系统映像 直接执行下面的命令生成文件系统映像romfs.img:
[root@localhost uClinux-dist]#genromfs -v -V "ROMdisk" -f ./images/romfs.img -d ./romfs
[root@localhost uClinux-dist]#make image
[root@localhost uClinux-dist]#make
这时再重新
[root@localhost uClinux-dist]#./skyeye -e ./linux-2.4.x/linux -c skyeye.conf
就可以看到我们输入的信息了:

Loaded ROM images/romfs.img
exec file "./linux-2.4.x/linux"'s format is elf32-little.
load section .init: addr = 0x00008000 size = 0x0000a000.
load section .text: addr = 0x00012000 size = 0x001b0aa8.
load section .data: addr = 0x001c4000 size = 0x00007c60.
not load section .bss: addr = 0x001cbc60 size = 0x0001f3a0 .
not load section .debug_abbrev: addr = 0x00000000 size = 0x00032084 .
not load section .debug_info: addr = 0x00000000 size = 0x0141b225 .
not load section .debug_line: addr = 0x00000000 size = 0x00241819 .
not load section .debug_pubnames: addr = 0x00000000 size = 0x0000a6d7 .
not load section .debug_aranges: addr = 0x00000000 size = 0x00001e88 .
start addr is set to 0x00008000 by exec file.
Linux version 2.4.27-uc1 (root@localhost) (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/)) #4 三 9月 6 18:23:36 CST 2006

Processor: Samsung S3C4510B revision 6

Architecture: SNDS100

On node 0 totalpages: 2048

zone(0): 0 pages.

zone(1): 2048 pages.

zone(2): 0 pages.

Kernel command line: root=/dev/rom0

Calibrating delay loop... 20.78 BogoMIPS

Memory: 8MB = 8MB total

Memory: 6128KB available (1730K code, 161K data, 40K init)

Dentry cache hash table entries: 1024 (order: 1, 8192 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: 2048 (order: 1, 8192 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

Samsung S3C4510 Serial driver version 0.9 (2001-12-27) with no serial options enabled

ttyS00 at 0x3ffd000 (irq = 5) is a S3C4510B

ttyS01 at 0x3ffe000 (irq = 7) is a S3C4510B

Blkmem copyright 1998,1999 D. Jeff Dionne

Blkmem copyright 1998 Kenneth Albanowski

Blkmem 1 disk images:

0: C9EA8-1C2AA7 [VIRTUAL C9EA8-1C2AA7] (RO)

RAMDISK driver initialized: 16 RAM disks of 1024K 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)

VFS: Mounted root (romfs filesystem) readonly.

Freeing init memory: 40K

Shell invoked to run file: /etc/rc
Command: hostname Samsung
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram0 /var
Command: mkdir /var/config
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: mkdir /var/empty
Command: cat /etc/motd
Welcome to
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/ \
| ___\____|_||_|_| |_|\____|\_/\_/
| |
|_|

For further information check:
http://www.uclinux.org/

Command: ifconfig lo 127.0.0.1
Command: route add -net 127.0.0.0 netmask 255.255.255.0 lo
Command: dhcpcd &
Jan 1 00:00:00 dhcpcd[14]: dhcpStart: ioctl SIOCGIFHWADDR: No such device



sh 7: Child 14 died
[14]
Execution Finished, Exiting

Sash command shell (version 1.1.1)
/> test

this is an test program
written by 1jjk
Email:lingjiujianke@gmail.com
blog: http://1jjk.cublog.cn
文章评论

共有 0 条评论