Add your new program to the compiled uClinux system

Source: Internet
Author: User
Add your new program-general Linux technology-Linux programming and kernel information to the compiled uClinux system. The following is a detailed description. After compiling uClinux some time ago, I never took the time to test it. Today I took skyeye out and tried it. It was normal before! The following describes the related steps in detail:

I. First install skyeye
[Root @ localhost root] # wget 192.168.5.89/skyeye.tar.tar
[Root @ localhost root] # tar jxvf skyeye.tar.tar
[Root @ localhost root] # skyeye-v1 cd
[Root @ localhost skyeye-v1] # make

In this way, skyeye is installed, which is very simple. If you have any questions, you can view README
[Root @ localhost skyeye-v1] # cat READ | less

II. Test whether uClinux can run in 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: initi4510b
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 = jx4510b, name = uart0
# Uart: type = maid, name = uart1
# Timer: type = jx4510b, name = timer0
# Timer: type = jx4510b, 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 = 0x0000760.
Not load section. bss: addr = 0x001cb60size = 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 March 13, September 6 18:23:36 CST 2006

Processor: Samsung s34510b 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: 8 MB = 8 MB total

Memory: 6128KB available (1730 K code, 161 K data, 40 K 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 uniix

Linux NET4.0 in Linux 2.4

Based upon Swansea University Computer Society NET3.039

Initializing RT netlink socket

Starting kswapd

Samsung s34510 Serial driver version 0.9 () with no serial options enabled

TtyS00 at 0x3ffd000 (irq = 5) is a 89c4510b

TtyS01 at 0x3ffe000 (irq = 7) is a 89c4510b

Blkmem copyright 1998,1999 D. Jeff Dionne

Blkmem copyright 1998 kenth Albanowski

Blkmem 1 disk images:

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

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

TCP: Hash tables configured (established 512 bind 512)

VFS: Mounted root (romfs filesystem) readonly.

Freeing init memory: 40 K

Shell invoked to run file:/etc/rc
Command: hostname Samsung
Command:/bin/expand/etc/ramfs. img/dev/ram0
Command: mount-t 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
______
/__ | _ |
_ | _________
| _ \ | | \\//
| _ | |__ | _ | /\
| ___ \____ | _ | \____ | \_/\_/
|
| _ |

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)
/>
Okay, you can run it!


3. Add your own program to the system:

[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. c
[Root @ localhost uClinux-dist] # cp./test./romfs/bin/
Run the following command to generate the file system image 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
Then try again
[Root @ localhost uClinux-dist] #./skyeye-e./linux-2.4.x/linux-c skyeye. conf
We can see the entered information:

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 = 0x0000760.
Not load section. bss: addr = 0x001cb60size = 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 March 13, September 6 18:23:36 CST 2006

Processor: Samsung s34510b 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: 8 MB = 8 MB total

Memory: 6128KB available (1730 K code, 161 K data, 40 K 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 uniix

Linux NET4.0 in Linux 2.4

Based upon Swansea University Computer Society NET3.039

Initializing RT netlink socket

Starting kswapd

Samsung s34510 Serial driver version 0.9 () with no serial options enabled

TtyS00 at 0x3ffd000 (irq = 5) is a 89c4510b

TtyS01 at 0x3ffe000 (irq = 7) is a 89c4510b

Blkmem copyright 1998,1999 D. Jeff Dionne

Blkmem copyright 1998 kenth Albanowski

Blkmem 1 disk images:

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

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

TCP: Hash tables configured (established 512 bind 512)

VFS: Mounted root (romfs filesystem) readonly.

Freeing init memory: 40 K

Shell invoked to run file:/etc/rc
Command: hostname Samsung
Command:/bin/expand/etc/ramfs. img/dev/ram0
Command: mount-t 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
______
/__ | _ |
_ | _________
| _ \ | | \\//
| _ | |__ | _ | /\
| ___ \____ | _ | \____ | \_/\_/
|
| _ |

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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.