RHEL5.2中架设skyeye+uClinux环境

RHEL5.2中架设skyeye+uClinux环境

刚开始学习linux嵌入式开发,经过2天的尝试,今天终于把skyeye+uClinux配置成功了,特记下我配置的过程,希望对你有用!!

       说下我的系统平台:我用的是在linux下的VMare+RHEL5.2(2.6.18-92.el5)

首先下载如下版本的文件:
skyeye:         skyeye-1.2.5_REL.tar.gz
   
下载地址:http://download.gro.clinux.org/skyeye/skyeye-1.2.5_REL.tar.gz

arm-elf-tools:        arm-elf-tools-20040427.sh     

下载地址:http://www.lumit.org/download/tools/arm-elf-tools-20040427.sh

arm-linux-tools:  arm-linux-tools-20070808.tar.gz
下载地址:http://ftp.snapgear.org/pub/snap ... ols-20070808.tar.gz

uClinux:  uClinux-dist-20080808.tar.bz2     

下载地址:http://mirror.lzu.edu.cn/softwar ... st-20080808.tar.bz2



安装步骤:

1、安装arm-elf-tools交叉编译环境:

   chmod a+x arm-elf-tools-20030314.sh

   ./arm-elf-tools-20030314.sh

   [root@work ~]#  which arm-elf-gcc
   /usr/local/bin/arm-elf-gcc   

   说明 arm-elf-gcc 已经安装
如果提示错误:
tail: 。。。。“+43”。。。。。

gunzip: stdin: not in gzip format


解决方法如下:

这是由于脚本中的tail没写对,必须加一个 -n 参数

用vi打开 arm-elf-tools-20030314.sh

将第39行的代码:

tail +${SKIP} ${SCRIPT} | gunzip | tar xvf -

改成如下:

tail -n +${SKIP} ${SCRIPT} | gunzip | tar xvf -
       
2、安装arm-linux-tools交叉编译环境:
       
        tar zxvf arm-linux-tools-20070808.tar.gz
        就好在本目录下产生一个usr目录,比如我的就是/root/usr/这时要把它链接到/usr/local/下
        ln -n /root/usr/local /usr/local/arm
        编辑.bash_profile添加一行export PATH=$PATH:/usr/local/arm/bin
        保存重启系统

3、安装skyeye:
   tar zxvf skyeye-1.2.5_REL.tar.gz
   进入解压后的skyeye目录,接下来执行:
   make
   make install
   如果一切正常,运行
   skyeye
   会出现一下信息:
[root@work ~]# skyeye

**************************** WARNING **********************************
If you want to run ELF image, you should use -e option to indicate
your elf-format image filename. Or you only want to run binary image,
you need to set the filename of the image and its entry in skyeye.conf.
***********************************************************************

Your elf file is little endian.
Failed to open skyeye config file skyeye.conf in the same directory
error: No such file or directory
SkyEye 1.2.5
Bug report: skyeye-developer@lists.gro.clinux.org
Usage: skyeye [options] -e program [program args]
Default mode is STANDALONE mode
------------------------------------------------------------------
Options:
-e exec-file        the (ELF executable format)kernel file name.
-l load_address,load_address_mask
                    Load ELF file to another address, not its entry.
-b                  specify the data type is big endian when non "-e" option.
-d                  in GDB Server mode (can be connected by GDB).
-c config-file      the skyeye configure file name.
-h                  The SkyEye command options, and ARCHs and CPUs simulated.
------------------------------------------------------------------
----------- Architectures and CPUs simulated by SkyEye-------------
-------- ARM architectures ---------
at91
lpc
s3c4510b
s3c44b0x
s3c44b0
s3c3410x
ep7312
lh79520
ep9312
cs89712
sa1100
pxa_lubbock
pxa_mainstone
at91rm92
s3c2410x
s3c2440
sharp_lh7a400
ns9750
-------- BlackFin architectures ----
bf533
bf537


3、编译uClinux:
   #tar jxvf uClinux-dist-20080808.tar.bz2
   #cd uClinux-dist
   #make menuconfig
   选择
   Vendor/Product: GDB/Skyeye
   Kernel Version: linux-2.6.x
   Libc Version: uClibc  
   保存退出
   
   在 uclinux-dist 目录下建立仿真AT91的skyeye配置文件 skyeye.conf,内容如下:
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=images/boot.rom
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
lcd: state=on
    然后执行:
    make dep
   
    make
   

4、在skyeye下运行uClinux

   这个时候就可以用skyeye来调试运行kernel了,在uclinux-dist执行如下命令:

   skyeye -e linux-2.6.x/linux
需要注意的是我已经在/usr/bin目录中建立了一个skyeye的符号连接,所以上面才不需要输入skyeye的完整路径。另外,由于skyeye.conf就在当前目录下,所以也就不用在skyeye命令中使用-c参数指定了
下面是uClinux跑起来的界面显示:

[root@work uClinux-dist]# skyeye -e linux-2.6.x/linux
Your elf file is little endian.
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name at91, mach_init addr 0x805eb60
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm7100 mmu ops
Loaded ROM   images/boot.rom
start addr is set to 0x01008000 by exec file.
Linux version 2.6.25-uc0 (root@work) (gcc version 4.2.1) #1 Wed Oct 15 14:30:09 CST 2008
CPU: Atmel-AT91M40xxx [14000040] revision 0 (ARMvundefined/unknown), cr=00000000
Machine: Atmel AT91 EB01
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 4064
Kernel command line:
PID hash table entries: 64 (order: 6, 256 bytes)
console [ttyS0] enabled
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 16MB = 16MB total
Memory: 15284KB available (820K code, 74K data, 60K init)
Mount-cache hash table entries: 512
io scheduler noop registered (default)
Atmel USART driver version 0.99
ttyS0 at 0xfffd0000 (irq = 2) is a builtin Atmel APB USART
ttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USART
brd: module loaded
uclinux[mtd]: RAM probe address=0x1400000 size=0xff000
Creating 1 MTD partitions on "ROM":
0x00000000-0x000ff000 : "ROMfs"
uclinux[mtd]: set ROMfs to be root filesystem
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 60K
Shell invoked to run file: /etc/rc
Command: hostname GDB-ARMulator
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram0 /var
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
          ____ _  _
         /  __| ||_|                 
    _   _| |  | | _ ____  _   _  _  _
   | | | | |  | || |  _ \| | | |\ \/ /
   | |_| | |__| || | | | | |_| |/    \
   |  ___\____|_||_|_| |_|\____|\_/\_/
   | |
   |_|

GDB/ARMulator support by <davidm@snapgear.com>
For further information check:
http://www.uclinux.org/

Execution Finished, Exiting

Sash command shell (version 1.1.1)
/>
   
注意:要在 skyeye.conf 所在目录下执行skyeye。

如果你是按网上的教程配置可能会有很多错误,比如:
arm-linux-ld: ERROR: /opt/project/arm-linux/arm-linux/bin/../lib/gcc/arm-linux/3.4.3/libgcc.a(_divsi3.oS) uses VFP instructions, whereas u-boot does not
File in wrong format: failed to merge target specific data of file /opt/project/arm-linux/arm-linux/bin/../lib/gcc/arm-linux/3.4.3/libgcc.a(_divsi3.oS)
arm-linux-ld: ERROR: /opt/project/arm-linux/arm-linux/bin/../lib/gcc/arm-linux/3.4.3/libgcc.a(_umodsi3.oS) uses VFP instructions, whereas u-boot does not
File in wrong format: failed to merge target specific data of file /opt/project/arm-linux/arm-linux/bin/../lib/gcc/arm-linux/3.4.3/libgcc.a(_umodsi3.oS)
arm-linux-ld: ERROR: /opt/project/arm-linux/arm-linux/bin/../lib/gcc/arm-linux/3.4.3/libgcc.a(_modsi3.oS) uses VFP instructions, whereas u-boot does not
File in wrong format: failed to merge target specific data of file /opt/project/arm-linux/arm-linux/bin/../lib/gcc/arm-linux/3.4.3/libgcc.a(_modsi3.oS)
make: *** [u-boot] Error 1
这时典型的浮点问题,你可能要降低你的编译工具版本,
或者修改arm-linux-gcc配置文件,或者在内核目录下找相应架构的配置文件,去除软浮点运算
或者选择本文提到的arm-linux-tools版本的工具,并选择linux 2.6.x内核,可顺利完成
学习了