Chinaunix首页 | 论坛 | 博客
  • 博客访问: 294208
  • 博文数量: 77
  • 博客积分: 1422
  • 博客等级: 上尉
  • 技术积分: 932
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-21 12:39
文章分类
文章存档

2011年(1)

2009年(3)

2008年(73)

我的朋友

分类:

2008-07-24 11:20:25

说明: 本小节内容是演示 uClinux Kernel Image 如何在 lumit4510 真实开发板和 SkyEye 模拟环境中运行
------------------------------------------------------------------------------------------------------------------------------------------

关于几个文件之间的关系(预备知识):

[admin@localhost release]$ ls -l 
total 13832
-rw-rw-rw-    1 admin    admin     1809372  9月 14 17:52 image.ram
-rw-rw-rw-    1 admin    admin     1842436  9月 14 17:36 linux
-rw-rw-rw-    1 admin    admin          77  9月 14 17:51 Makefile
-rwxr-xr-x    1 admin    admin    10476890  9月 14 17:27 skyeye
-rw-rw-rw-    1 admin    admin         177  9月 14 17:29 skyeye.conf
[admin@localhost release]$

其中 skyeye 是可在 RedHat9.0 下执行的 SkyEye 模拟器;
     skyeye.conf 是 skyeye 执行需要的配置文件,主要是指定 cpu 类型;
     linux 是 uClinux Kernel Source 编译之后得到的 linux-2.4.x/linux 文件
     image.ram 是 uClinux Kernel Source 编译之后得到的 image/image.ram 文件
     Makefile 是一个简单说明 linux 和 image.ram 之间关系的文件,
     即 linux 通过 arm-elf-objcopy 得到 image.ram

【注意】
     下载 skyeye 或者 解压 rar 压缩文件包之后,需要通过 chmod 命令改变 skyeye 的属性。
     chmod 755 skyeye   (这样 skyeye 就可以在 redhat9.0 以上版本中执行了)
      否则,直接执行 ./skyeye 会报错:
     -bash: ./skyeye: Permission denied


【Demo 1】:  
在 SkyEye 模拟环境中运行 linux 的输出显示


[admin@localhost release]$ ./skyeye linux
***************************************************************
****                                                       ****
****   SkyEye  Simulator Ver 0.8.0 with  GDB 5.3 Interface ****
****                                                       ****
***************************************************************
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This SkyEye was configured as "--host=i686-pc-linux-gnu --target=arm-elf"...(no debugging symbols found)...
(SkyEye) target sim
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name s3c4510b, mach_init addr 0x813e884
SKYEYE: use arm7100 mmu ops
Connected to the simulator.
(SkyEye) load
Loading section .init, size 0xa000 vma 0x8000
Loading section .text, size 0x1a60b8 vma 0x12000
Loading section .data, size 0x7bdc vma 0x1ba000
Start address 0x8000
Transfer rate: 14410912 bits in <1 sec.
(SkyEye) r
Starting program: /home/admin/skyeye/skyeye-binary-testutils-1.0.7/s3c4510b/release/linux
Linux version 2.4.24-uc0 (root@Venus) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from )(uClinux XIP and shared lib patches from )) #10 Thu Sep 9 10:54:12 CST 2004
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: 6168KB available (1688K code, 163K 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: C64B8-1B80B7 [VIRTUAL C64B8-1B80B7] (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:


Command: ifconfig lo 127.0.0.1
Command: route add -net 127.0.0.0 netmask 255.255.255.0 lo
Command: #dhcpcd &
Execution Finished, Exiting

Sash command shell (version 1.1.1)
/> ls
bin
dev
etc
home
lib
mnt
proc
sbin
tmp
usr
var
/> cd bin
/bin> ls     
arp
basename
boa
busybox
date
dhcpcd
dmesg
du
expand
ftp
hostname
ifconfig
inetd
init
kill
killall
login
mount
ping
route
sh
telnet
telnetd
umount
uptime
/bin> hostname
Samsung
/bin>
Program received signal SIGINT, Interrupt.
0x00015dec in ?? ()
(SkyEye) quit
The program is running.  Exit anyway? (y or n) y
[admin@localhost release]$

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
从 linux (elf 格式文件) 得到 image.ram (bin 格式文件)
执行命令 :
arm-elf-objcopy -O binary -R .note -R .comment -S linux image.ram
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


[Demo 2]:  
下载 image.ram 到 lumit4510 开发板执行的输出显示


/*************************************************************/
Bios for download and program.
Author Jerry
Build date : Jun 16 2004 Time : 17:11:45
Type help for help.
/*************************************************************/
\>
\>load
No begin address for download, use default address 0x8000
Mini TFTP Server 1.0 (IP : 192.168.168.101 PORT: 69)
Load image file from host
Type tftp -i 192.168.168.101 put filename at the host PC
Press ESC key to exit
Starting the TFTP download...
......................................................
Received 1b9bdc Bytes, END...
Boot Image? (y/n) yLinux version 2.4.24-uc0 (root@Venus) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from )(uClinux XIP and shared lib patches from )) #10 Thu Sep 9 10:54:12 CST 2004
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... 49.76 BogoMIPS
Memory: 8MB = 8MB total
Memory: 6168KB available (1688K code, 163K 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: C64B8-1B80B7 [VIRTUAL C64B8-1B80B7] (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:


Command: ifconfig lo 127.0.0.1
Command: route add -net 127.0.0.0 netmask 255.255.255.0 lo
Command: #dhcpcd &
Execution Finished, Exiting

Sash command shell (version 1.1.1)
/> ls
bin
dev
etc
home
lib
mnt
proc
sbin
tmp
usr
var
/> cd bin
/bin> ls
arp
basename
boa
busybox
date
dhcpcd
dmesg
du
expand
ftp
hostname
ifconfig
inetd
init
kill
killall
login
mount
ping
route
sh
telnet
telnetd
umount
uptime
/bin> hostname
Samsung
/bin>


可以看到,uClinux Kernel 在 lumit4510 和 SkyEye 中的输出是完全一致的。
这样我们就可以在 SkyEye 模拟环境中(无需开发板)事先学习如何在 uclinux 上开发应用程序,建立一个自己的 app demo 程序
有关这方面的内容,可参考:
首页 -> 资料下载 -> 相关文档 -> add App on uClinux (添加 uClinux 应用步骤说明)


【Demo 3】
添加 myapp 应用后,在 SkyEye 上的输出为:


[admin@localhost new-release]$ ./skyeye linux
***************************************************************
****                                                       ****
****   SkyEye  Simulator Ver 0.8.0 with  GDB 5.3 Interface ****
****                                                       ****
***************************************************************
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This SkyEye was configured as "--host=i686-pc-linux-gnu --target=arm-elf"...
(SkyEye) tar s
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name s3c4510b, mach_init addr 0x813e884
SKYEYE: use arm7100 mmu ops
Connected to the simulator.
(SkyEye) load
Loading section .init, size 0xa000 vma 0x8000
Loading section .text, size 0x1ac768 vma 0x12000
rLoading section .data, size 0x7bdc vma 0x1c0000
Start address 0x8000
Transfer rate: 14621216 bits in <1 sec.
(SkyEye) r
Starting program: /home/admin/skyeye/skyeye-binary-testutils-1.0.7/s3c4510b/new-release/linux3
Linux version 2.4.24-uc0 (liming@hpclab) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from )(uClinux XIP and shared lib patches from )) #9 Wed Sep 15 20:16:34 HKT 2004
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: 6144KB available (1713K 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: C5F68-1BE767 [VIRTUAL C5F68-1BE767] (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:


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)
/> cd bin
ls/bin>
arp
basename
boa
busybox
date
demo
dhcpcd
dmesg
du
expand
ftp
hostname
ifconfig
inetd
init
kill
killall
login
mount
ping
route
sh
telnet
telnetd
umount
uuptimeShell 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:


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)
/> cd bin
ls/bin>
arp
basename
boa
busybox
date
demo
dhcpcd
dmesg
du
expand
ftp
hostname
ifconfig
inetd
init
kill
killall
login
mount
ping
route
sh
telnet
telnetd
umount
uptime/bin> ./demo
Hello world!
[lumit] - let us make it together
--------------------

/bin> ./demo
Hello world!
[lumit] - let us make it together
--------------------

/bin> ls
arp
basename
boa
busybox
date
demo
dhcpcd
dmesg
du
expand
ftp
hostname
ifconfig
inetd
init
kill
killall
login
mount
ping
route
sh
telnet
telnetd
umount
uptime
/bin> ./demo
Hello world!
[lumit] - let us make it together
--------------------

/bin>
Program received signal SIGINT, Interrupt.
arch_idle () at /tmp/liming/uClinux-dist/linux-2.4.x/include/asm/arch/system.h:11
11      /tmp/liming/uClinux-dist/linux-2.4.x/include/asm/arch/system.h: No such file or directory.
        in /tmp/liming/uClinux-dist/linux-2.4.x/include/asm/arch/system.h
(SkyEye) q
The program is running.  Exit anyway? (y or n) y
[admin@localhost new-release]$


【Demo 4】
添加 myapp 应用后,在 lumit4510 上的输出为:


\>load
No begin address for download, use default address 0x8000
Mini TFTP Server 1.0 (IP : 192.168.168.101 PORT: 69)
Load image file from host
Type tftp -i 192.168.168.101 put filename at the host PC
Press ESC key to exit
Starting the TFTP download...
.......................................................
Received 1bfbdc Bytes, END...
Boot Image? (y/n) yLinux version 2.4.24-uc0 (liming@hpclab) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from )(uClinux XIP and shared lib patches from )) #9 Wed Sep 15 20:16:34 HKT 2004
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... 49.76 BogoMIPS
Memory: 8MB = 8MB total
Memory: 6144KB available (1713K 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: C5F68-1BE767 [VIRTUAL C5F68-1BE767] (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:


Command: ifconfig lo 127.0.0.1
Command: route add -net 127.0.0.0 netmask 255.255.255.0 lo
Command: dhcpcd &
[14]
Execution Finished, Exiting

Sash command shell (version 1.1.1)
/> Jan  1 00:00:00 dhcpcd[14]: dhcpStart: ioctl SIOCGIFHWADDR: No such device



/> ls
bin
dev
etc
home
lib
mnt
proc
sbin
tmp
usr
var
/> cd bin
/bin> ls
arp
basename
boa
busybox
date
demo
dhcpcd
dmesg
du
expand
ftp
hostname
ifconfig
inetd
init
kill
killall
login
mount
ping
route
sh
telnet
telnetd
umount
uptime
/bin> ./demo
Hello world!
[lumit] - let us make it together 
阅读(795) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~