zoukankan      html  css  js  c++  java
  • 使用scratchbox2建立交叉编译环境

    使用scratchbox2建立交叉编译环境,使交叉编译不再烦人。。。。。

    os:ubuntu 12.04.4 x64

    1. 安装相关工具
    sudo apt-get install debootstrap scratchbox2
    sudo apt-get install qemu-user-static

    mkdir rootfs  
    cd rootfs

    2. 下载debian 文件系统并安装
    sudo debootstrap --verbose --arch mipsel --foreign stable `pwd` http://ftp.at.debian.org/debian

    cp /usr/bin/qemu-mipsel-static  usr/bin

    chroot . /bin/bash
    /debootstrap/debootstrap --second-stage   

    3. 建立交叉编译用环境
    sb2-init ls1c /opt/CodeSourcery/mipsel-none-linux-gnueabi/bin/mipsel-none-linux-gnueabi-gcc
    sudo sb2 或 sudo sb2 -t ls1c 

    4. 例子
    [SB2 simple ls1c ] root@vm ~ $ gcc hello.c
    [SB2 simple ls1c ] root@vm ~ $ file a.out 
    a.out: ELF 32-bit LSB executable, MIPSEL, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, BuildID[sha1]=0xd18141915ced466188d07dfd1a862a5d82d9de73, not stripped
    [SB2 simple ls1c ] root@vm ~ $ ./a.out 
    hello, world

    5. 说明 
    其中rootfs为目标板文件系统的目录,debootstrap会在里面安装相关的文件。
    ls1c为自己取的名字,可以自己命名。gcc参数需填整完整的路径。
    更详细的参数说明见sb2-init 帮助
    如果觉得文件系统过大可以考虑用debian embedded 系统。

    6. 参考文档:
    http://www.cnblogs.com/qiaoqiao2003/p/3738552.html
    http://blog.csdn.net/dotmonkey/article/details/6952460

    http://bbs.loongnix.org/forum.php?mod=viewthread&tid=74477&extra=page%3D1

  • 相关阅读:
    函数的对称性及其图像变换
    KMP 字符串匹配
    15 保护模式中的特权级(上)
    每日总结
    每日总结
    每日总结
    每日总结
    每日总结
    每日总结
    2-26安卓自学
  • 原文地址:https://www.cnblogs.com/findumars/p/6809734.html
Copyright © 2011-2022 走看看