Chinaunix首页 | 论坛 | 博客
  • 博客访问: 590741
  • 博文数量: 201
  • 博客积分: 3076
  • 博客等级: 中校
  • 技术积分: 2333
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-02 19:44
文章分类

全部博文(201)

文章存档

2010年(118)

2009年(83)

我的朋友

分类:

2010-02-03 22:06:02

http://hi.baidu.com/zhaojingda/blog/item/75b044fce52995f8fd037feb.html


说明:
<1>经尝试,arm-elf-tools-20040427无法完成对uClinx-dist-20070130的编译,推荐用arm- uclinux-tools尝试,或者用arm-elf-tools-20040427对uClinux-dist-20040408进行编译。
<2>另外arm-linux-gcc与arm-elf-gcc的区别:arm-linux-gcc是针对arm+linux的开发环境 的,kernel使用的是linux,不是uclinux,arm是有硬件MMU的,而arm-elf-gcc是针对没有MMU的arm+uclinux 的开发环境,kernel使用的是uclinux,硬件是廉价的无MMU的arm芯片

1.系统环境:
    ubuntu8.04
2.准备工作:
    <1>arm-linux-gcc
    下载地址:ARM Linux
                arm-linux-gcc版本2.95.3, 3.0和3.2
        Handhelds.org
                arm-linux-gcc 版本3.3.2和3.4.1
        ELDK 4.1
                arm-linux-gcc版本4.0.0
    <2>arm-elf-tools(arm-elf-tools-20030314.sh/arm-elf-tools-20040427.sh)
    下载地址:   

    <3>arm-uclinux-tools
    下载地址:       

    <4>uClinux-dist(20040408.tar.gz)
    下载地址:    

    <5>skyeye,skyeye-testsuits,skyeye-with-gdb
    下载地址:    

3.搭建过程:
    以下操作均在root用户下进行
    (1)首先安装交叉编译工具链arm-elf-tools-20040427.sh
    #./arm-elf-tools-20040427.sh
    即可安装成功
    如出现错误提示如下:
    tail: 无法打开 “+43” 读取数据: 没有那个文件或目录
    gunzip: stdin: not in gzip format
    按如下步骤操作:
    #tail -n+43 arm-elf-tools-20040427.sh >> arm-elf-tools.tar.gz
    #tar vxzf arm-elf-tools.tar.gz
    即可得到文件夹usr,然后复制或移动它到/目录下
    #cp -r usr /
    如出现提示无法覆盖/local/man,如下操作:
    #cp -r usr/local/man /usr/share/
    (2)测试交叉编译是否安装成功
    创建Hello.c内容如下:
    #include
    int main()
    {
    printf("Hello!This is Embedded Linux!");
    return 0;
    }
    编译如下:
    #arm-elf-gcc -Wl,-elf2flt -o Hello Hello.c
    #ls
    Hello Hello.c Hello.gdb
    可以看到编译生成BFLT格式的Hello(可用file Hello命令查看)和Hello.gdb表示编译成功
    (3)安装skyeye
    <1>一个简单的方法是在ubuntu8.04的新立得软件包管理器中搜索skyeye,可以看到有skyeye-1.2.3,安装即可
    <3>或者用命令#sudo apt-get install skyeye
    <2>当然也可以安装下载的源包,如下:
    首先安装依赖的软件包binutils,在新立得中安装或者用命令
    #sudo apt-get install binutils-dev
    解压skyeye-1.2.4_Rel.tar.gz
    #tar vxzf skyeye-1.2.4_Rel.tar.gz
    生成文件夹skyeye-1.2.4,编译
    #cd skyeye-1.2.4
    #./configure --target=arm-elf --prefix=/usr/local
    #make
    如果有警告,可添加编译参数如下:
    不允许DBCT
    make NO_DBCT=1
    不支持LCD
    make NO_LCD=1
    不支持BFD库
    make NO_BFD=1
    不支持网络设备
    make NO_NET=1
    例如我在编译的时候就根据提示添加了两个参数才编译成功
    #make NO_DBCT=1 NO_BFD=1
    编译成功后会在skyeye-1.2.4/binary下生成可执行文件skyeye
    (4)测试skyeye是否安装成功
    #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.
    ***********************************************************************

    big_endian is false.
    Failed to open skyeye config file skyeye.conf in the same directory
    error: No such file or directory
    ------------------------- SkyEye -V1.2 ---------------------------
    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
    lpc2210
    ps7500
    integrator
    -------- BlackFin architectures ----
    bf533
   
    出现如上即安装成功
    如果没有出现上述情形,可检查一下环境变量
    (5)测试skyeye-testsuite-2.3.tar.bz2
    #tar vxjf skyeye-testsuite-2.3.tar.bz2
    #cd skyeye-testsuite-2.3
    #ls
    linux rtems u-boot uClinux
    #cd uClinux
    #ls
    at91       bf533          exec_skyeye_dbct.sh s3c3410x s3c4510
    auto_test coldfire-5249 exec_skyeye.sh       s3c44b0x test_report_2007-11-15
    #cd at91
    #ls
    at91_with_framebuffer_touchscreen uclinux_cs8900a
    linux-2.6.x                        uclinux_rtl8019
    找一个测试一下吧
    #cd uclinux_cs8900a
    #ls
    linux romfs.img skyeye.conf skyeye_dbct.conf
    #skyeye -e linux
    big_endian is false.
    arch: arm
    cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
    mach info: name at91, mach_init addr 0x8057550
    ethmod num=1, mac addr=0:0:0:0:0:0, hostip=10.0.0.1
    uart_mod:0, desc_in:, desc_out:, converter:
    SKYEYE: use arm7100 mmu ops
    Loaded ROM   ./romfs.img
    start addr is set to 0x01000000 by exec file.
    Linux version 2.4.27-uc1 (skyeyeuser@debian) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318     from )(uClinux XIP and shared lib patches from )) #3 Tue Aug 9     18:57:29 CST 2005
    Processor: Atmel AT91M40xxx revision 0
    Architecture: EB01
    On node 0 totalpages: 1024
    zone(0): 0 pages.
    zone(1): 1024 pages.
    zone(2): 0 pages.
    Kernel command line: root=/dev/rom0
    Calibrating delay loop... 15.82 BogoMIPS
    Memory: 4MB = 4MB total
    Memory: 2916KB available (903K code, 178K data, 40K init)
    Dentry cache hash table entries: 512 (order: 0, 4096 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: 1024 (order: 0, 4096 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
    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
    Blkmem copyright 1998,1999 D. Jeff Dionne
    Blkmem copyright 1998 Kenneth Albanowski
    Blkmem 1 disk images:
    0: 1400000-1512BFF [VIRTUAL 1400000-1512BFF] (RO)
    RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
    Cirrus Logic CS8900A driver for Linux (V0.02)
    eth0: CS8900A rev D detected
    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)
    NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
    VFS: Mounted root (romfs filesystem) readonly.
    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
    mount: /etc/mtab: Read-only file system
    Command: mount -t ext2 /dev/ram0 /var
    mount: /etc/mtab: Read-only file system
    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
    For further information check:
   

    Command: /bin/ifconfig eth0 up 10.0.0.2
    Execution Finished, Exiting

    Sash command shell (version 1.1.1)
    />
    看到如上情形,运行成功
    ctrl+c退出到#
    (6)编译uClinux内核
    #tar vxzf uClinux-dist-20040408.tar.gz
    生成文件夹uClinux-dist,将其移动到/usr/src/
    #mv uClinux-dist /usr/src/
    然后进入uClinux-dist下
    #cd /usr/src/uClinux-dist/
    <1>菜单界面配置
    #make menuconfig
    选择如下:   
    --- Select the Vendor you wish to target
             (GDB) Vendor
     --- Select the Product you wish to target
              (ARMulator) GDB Products  
    (linux-2.4.x) Kernel Version
    (uClibc) Libc Version        
    [ ] Default all settings (lose changes)
    [ ] Customize Kernel Settings        
    [ ] Customize Vendor/User Settings
    [ ] Update Default Vendor Settings
    然后Esc退出
    Do you wish to save your new kernel configuration?
                   < Yes >      < No >  
    选择yes
    如果在make menuconfig后出现错误提示,则需安装libncurses5,在新立得里安装或者
    #sudo apt-get install libncurses5-dev
    安装完后再make menuconfig
    <2>图形界面配置
    #make xconfig
    选择同上
    如果出现错误提示,则需安装tck,tk两个包,在新立得中安装,也可自己下载后安装,下载地址:

    
    将两个包解压后得到tcl8.5.2,tk8.5.2
    #cd tcl8.5.2
    #cd unix
    #./configure --prefix=/usr/
    #make install
    同样的方法将tk装上,在/usr/bin下会看到wish8.5,因为make xconfig调用的是wish,所以我们做一个链接
    # ln /usr/bin/wish8.5 /usr/bin/wish
    然后可以make xconfig
    无论你用菜单界面还是图形界面配置成功了,我们就可以编译uClinux的内核了
    命令进入uClinux-dist
    建立内核依赖关系,只在第一次编译内核时使用
    #make dep
    ~
    ~
    ~
    经过一段时间,如果没有错,可以进行下一步了,编译内核
    #make
    完成后可以在/images中看到这么几个文件
    image.bin linux.data linux.text romfs.img
    用romfs.img生成boot.rom文件系统
    #ln -s images/romfs.img boot.rom
    在/uClinux-dist就可以得到一个boot.rom
    编写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=./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

    完成这一步就可以在skyeye中运行我们编译的内核了
    #skyeye -e linux-2.4.x/linux
   
    big_endian is false.
    arch: arm
    cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
    mach info: name at91, mach_init addr 0x8057550
    uart_mod:0, desc_in:, desc_out:, converter:
    SKYEYE: use arm7100 mmu ops
    Loaded ROM   ./boot.rom
    start addr is set to 0x01000000 by exec file.
    Linux version 2.4.24-uc0 (wenwu@wenwu-desktop) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318         from )(uClinux XIP and shared lib patches from )) #2 2008年 5月        11日 星期日 9:10:23 CST
    Processor: Atmel AT91M40xxx revision 0
    Architecture: EB01
    On node 0 totalpages: 1024
    zone(0): 0 pages.
    zone(1): 1024 pages.
    zone(2): 0 pages.
    Kernel command line: root=/dev/rom0
    Calibrating delay loop... 15.82 BogoMIPS
    Memory: 4MB = 4MB total
    Memory: 2968KB available (850K code, 180K data, 40K init)
    Dentry cache hash table entries: 512 (order: 0, 4096 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: 1024 (order: 0, 4096 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
    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
    Blkmem copyright 1998,1999 D. Jeff Dionne
    Blkmem copyright 1998 Kenneth Albanowski
    Blkmem 1 disk images:
    0: 1400000-14AC3FF [VIRTUAL 1400000-14AC3FF] (RO)
    RAMDISK driver initialized: 16 RAM disks of 4096K 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)
    NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
    VFS: Mounted root (romfs filesystem) readonly.
    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
    For further information check:
   

    Execution Finished, Exiting

    Sash command shell (version 1.1.1)
    />
    出现如上情形,运行成功
    (7)模拟运行自己的应用程序
    找到前面曾编译的程序Hello.c,将编译生成的BFLT格式的Hello移动到/uClinux-dist/romfs/bin中(注意在shell中用root)
    然后重新编译内核
    #make
    运行
    #skyeye -e linux-2.4.x/linux
    ```
    ```
    ```
    (省略)
    Sash command shell(version 1.1.1)
    />cd bin
    /bin>./Hello
    Hello!This is Embedded Linux!
    /bin>
    至此在ubuntu8.04上搭建uClinux编译开发环境并用skyeye进行仿真已经告一段落。

阅读(738) | 评论(0) | 转发(0) |
0

上一篇:install

下一篇:uClinux

给主人留下些什么吧!~~