自己编译一套Tool-Chain的经历

<script type="text/javascript">function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>  

首先介绍一下要下载的资源和网址:

因为我是在windows下编译一套for arm 的tool chain,所以用到了cygwin这个东东.

cygwin 1.5.19  在http://www.cygwin.com/ 上有下载;

工具链binutils2.17 在http://mirrors.kernel.org/sourceware/binutils/releases/ 有下载;

GCC4.1.1 在http://mirrors.kernel.org/sourceware/gcc/releases/ 有下载;

GDB6.5 ,Insight等等工具在http://mirrors.kernel.org/sourceware/ 上都有下载;

这些工具的介绍在www.sourceware.org 上.

一. 安装cygwin(关于cygwin的介绍在http://www.cygwin.com)

Cygwin 是windows系统下的一个类linux环境. 它包含如下部分:

  • A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality.
  • A collection of tools which provide Linux look and feel.Include the tool chain for i86(IA32)
  •  Cygwin is not a way to run native linux apps on Windows. You have to rebuild your application from source if you want it to run on Windows.这就是为什么要采用源码安装的方法
  • Cygwin is not a way to magically make native Windows apps aware of UNIX ® functionality, like signals, ptys, etc. Again, you need to build your apps from source if you want to take advantage of Cygwin functionality.不能够完全替代linux

    下载的地址在http://www.cygwin.com/ 上可以找得到.

    安装过程完全是GUI,基本没有什么难度,唯一要注意的是选择用户主目录,选择一个你较为熟悉的目录,最好和其他将要安装的包在同一个目录下; 最后安装包的选择也要注意一下,如果是第一次安装这个东东的话最好是全部都选择,如果很熟悉开发组件和库之间的依赖关系的话,可以自由选择需要的组件和库.

    二.在cygwin上用源码安装binutils

    1.binutils的介绍(网上的介绍在http://www.sourceware.org/binutils/)

    binutils 是一套binary utilities,主要包括:

    • ld - the GNU linker.
    • as - the GNU assembler.

    当然也会包含一些分析二进制文件实用工具:

    • addr2line - Converts addresses into filenames and line numbers.
    • ar - A utility for creating, modifying and extracting from archives.
    • c++filt - Filter to demangle encoded C++ symbols.
    • gprof - Displays profiling information.
    • nlmconv - Converts object code into an NLM.
    • nm - Lists symbols from object files.
    • objcopy - Copys and translates object files.
    • objdump - Displays information from object files.
    • ranlib - Generates an index to the contents of an archive.
    • readelf - Displays information from any ELF format object file.
    • size - Lists the section sizes of an object or archive file.
    • strings - Lists printable strings from files.
    • strip - Discards symbols.
    • windres - A compiler for Windows resource files.

    其中大多数工具使用BFD, the Binary File Descriptor library, 做一些低层的操作. 许多工具也直接使用 opcodes library 来汇编和反汇编机器指令.binutils已经移植到很多主流的Unix变种系统上,它们主要是用来给GNU system(GNU/Linux)提供编译和链接程序的工具.

    源代码下载的地址:http://mirrors.kernel.org/sourceware/binutils

    2.在cygwin上安装的简单过程.

        首先将下载的源码安装包拷贝到一个临时目录(我假设是/tmp):

        $ cp 你下载的目录地址 /tmp

        $ cd /tmp

        在这里简单讲一下压缩包最主要的格式及解压缩的方法:

    1. tar : 用tar 命令就可以了                  $ tar -xvf  binutils-2.17.tar
    2. gz : 用tar命令带上z参数                  $ tar -zxvf binutils-2.17.tar.gz
    3. bz2 : 用tar命令带上j参数                $ tar -jxvf binutils-2.17.tar.bz2

        然后进入目录 /tmp/binutils-2.17

         $ cd /tmp/binutils-2.17

         配置要安装的目标系统和目标目录

          --target 指示你将要安装的这套工具作用的文件是在哪个平台下的

          --prefix 安装的目标目录

          $ ./configure --target=arm-elf  --prefix=/选择你要将可执行程序安装到什么目录下

          编译源程序:$ make

          安装程序:$ make install

    三.在cygwin上用源码安装GCC

    四.在cygwin上用源码安装GDB及Insight

    五.开发辅助工具source-navigator以及split的介绍与安装

     
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值