歡迎您光臨本站 註冊首頁

向已經編譯好的uClinux系統里加入自己的新程序

←手機掃碼閱讀     火星人 @ 2014-03-26 , reply:0

前段時間編譯了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

[火星人 ] 向已經編譯好的uClinux系統里加入自己的新程序已經有599次圍觀

http://coctec.com/docs/linux/show-post-189528.html