ARM交叉编译工具制作V2

此篇是《Ubuntu ARM交叉编译工具链制作过程》的升级版本。

本文主机环境为Ubuntu10.04.4桌面版

内核:2.6.32

GCC:4.4.3

---------------------------------------------------转载请注明:xiaobin_hlj80----

Z.前期准备(使用root权限)

安装系统补丁258个(2014-11-24)

一、主机环境

1. 更改shell为bash

如果运行

ls -la /bin/sh

看到是 dash ,则请运行以下命令

sudo dpkg-reconfigure dash

选择 no 以删除 dash

2. 更改awk为gawk

#sudo update-alternatives --config awk

3. 安装samba

文件共享用

二、软件环境

安装如下软件(apt-get install)

1. gperf

2. bison

3. flex

4. texinfo

如不安装错误提示:Missingrequired tool: makeinfo

5. patch

6. libtool

如不安装错误提示:Couldnot find GNU libtool >= 1.5.26

7. automake

如不安装错误提示:Could not find GNU automake >=1.10

8. libncurses5-dev

如不安装错误提示:Could not find curses header, requiredfor the kconfig frontends

以下为build时需要的

9. build-essential

g++

10. libexpat-dev

Cross-gdb

以下为可选

11. cvs

12. subversion

svn

13. zlib1g-dev

Y. 安装crosstool-ng

1. 解压缩

tar jxvf crosstool-ng-1.19.0.tar.bz2

2. 配置

./configure --prefix=/usr/local/ctng

3. 生成

make

4. 安装

sudo make install

X. 配置crosstool-ng

1. 增加安装路径到系统路径中

exportPATH=$PATH:/usr/local/ctng/bin

2. 建立一个临时目录

# cd ~

# mkdir toolchain-build

3. 拷贝预配置文件到临时目录

# cd /usr/local/ctng/lib/ct-ng.1.19.0/samples

/usr/local/ctng/lib/ct-ng.1.19.0/samples#cp arm-unknown-linux-gnueabi/* ~/toolchain-build/

# cd ~

# cd toolchain-build

~/toolchain-build# mv crosstool.config .config

4. 执行菜单配置(menuconfig)

~/toolchain-build# ct-ngmenuconfig

修改默认选项,以适应目标板。

a. Paths and misc options

1)crosstool-NG behavior

2)Paths

3)Downloading

4)Extracting

5)Build behavior

(2) Number of parallel jobs

6)Logging

b.Target options

Target Architecture (arm)

1)Generic target options

2)Target optimizations

(1) Floating point (softfp(FPU))

3)arm other options

c.Toolchain options

1)General toolchain options

2)Tuple completion and aliasing

(1) softfp

3)Toolchain type

4)Build system

5)Misc options

d.Operating System

Linux kernel version (2.6.32.61)

1)Common kernel options

2)linux other options

e.Binary utilities

Binuary format: (ELF)

Binutils version (2.19.1a)

f.C Compiler

CCompiler (gcc)

gcc version (4.3.2)

1)Additional supported languages

2)gcc other options

(1) Use system zlib

3)Optimisation features

4)Settings for libraries running on target

5)Misc. obscure options

g.C-library

Clibrary (glibc)

glibc version (2.9)

h.Debug facilities

i.Companion libraries

GMP version (4.3.2)

MPFR version (2.4.2)

1)libelf version needed to build for target

libelf version (0.8.13)

2)Companion libraries common options

5. 下载文件

把较大的安装文件(bz2)拷贝到$HOME/src(默认目录)下。

(1) binutils-2.19.1a.tar.bz2

(2) gcc-4.3.2.tar.bz2

(3) gdb-6.8a.tar.bz2

(4) glibc-2.9.tar.bz2

(5) linux-2.6.32.61.tar.bz2

6. 生成交叉编译环境

# ct-ng build

附:

安装过程

[email protected]:~/toolchain-build$ ct-ng build
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20141130.230825
[INFO ]  Building environment variables
[EXTRA]  Preparing working directories
[EXTRA]  Installing user-supplied crosstool-NG configuration
[EXTRA]  =================================================================
[EXTRA]  Dumping internal crosstool-NG configuration
[EXTRA]    Building a toolchain for:
[EXTRA]      build  = i686-pc-linux-gnu
[EXTRA]      host   = i686-pc-linux-gnu
[EXTRA]      target = arm-softfp-linux-gnueabi
[EXTRA]  Dumping internal crosstool-NG configuration: done in 0.08s (at 00:01)
[INFO ]  =================================================================
[INFO ]  Retrieving needed toolchain components' tarballs
[EXTRA]    Retrieving 'gmp-4.3.2'
[EXTRA]    Saving 'gmp-4.3.2.tar.bz2' to local storage
[EXTRA]    Retrieving 'mpfr-2.4.2'
[EXTRA]    Saving 'mpfr-2.4.2.tar.xz' to local storage
[EXTRA]    Retrieving 'libelf-0.8.13'
[EXTRA]    Saving 'libelf-0.8.13.tar.gz' to local storage
[EXTRA]    Retrieving 'glibc-ports-2.9'
[EXTRA]    Saving 'glibc-ports-2.9.tar.bz2' to local storage
[EXTRA]    Retrieving 'dmalloc-5.5.2'
[EXTRA]    Saving 'dmalloc-5.5.2.tgz' to local storage
[EXTRA]    Retrieving 'duma_2_5_15'
[EXTRA]    Saving 'duma_2_5_15.tar.gz' to local storage
[EXTRA]    Retrieving 'ncurses-5.9'
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Retrieving needed toolchain components' tarballs'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: do_debug_gdb_get[scripts/build/debug/[email protected]]
[ERROR]  >>        called from: do_debug_get[scripts/build/[email protected]]
[ERROR]  >>        called from: main[scripts/[email protected]]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      '/usr/local/ctng/share/doc/crosstool-ng/ct-ng.1.19.0/B - Known issues.txt'
[ERROR]
[ERROR]  (elapsed: 19:34.11)
[19:35] / make: *** [build] Error 1
[email protected]:~/toolchain-build$ ct-ng build
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20141130.232953
[INFO ]  Building environment variables
[EXTRA]  Preparing working directories
[EXTRA]  Installing user-supplied crosstool-NG configuration
[EXTRA]  =================================================================
[EXTRA]  Dumping internal crosstool-NG configuration
[EXTRA]    Building a toolchain for:
[EXTRA]      build  = i686-pc-linux-gnu
[EXTRA]      host   = i686-pc-linux-gnu
[EXTRA]      target = arm-softfp-linux-gnueabi
[EXTRA]  Dumping internal crosstool-NG configuration: done in 0.07s (at 00:01)
[INFO ]  =================================================================
[INFO ]  Retrieving needed toolchain components' tarballs
[EXTRA]    Retrieving 'ncurses-5.9'
[EXTRA]    Saving 'ncurses-5.9.tar.gz' to local storage
[EXTRA]    Retrieving 'expat-2.1.0'
[EXTRA]    Saving 'expat-2.1.0.tar.gz' to local storage
[EXTRA]    Retrieving 'ltrace_0.5.3.orig'
[EXTRA]    Saving 'ltrace_0.5.3.orig.tar.gz' to local storage
[EXTRA]    Retrieving 'strace-4.5.19'
[EXTRA]    Saving 'strace-4.5.19.tar.bz2' to local storage
[INFO ]  Retrieving needed toolchain components' tarballs: done in 363.91s (at 06:05)
[INFO ]  =================================================================
[INFO ]  Extracting and patching toolchain components
[EXTRA]    Extracting 'linux-2.6.32.61'
[EXTRA]    Patching 'linux-2.6.32.61'
[EXTRA]    Extracting 'gmp-4.3.2'
[EXTRA]    Patching 'gmp-4.3.2'
[EXTRA]    Extracting 'mpfr-2.4.2'
[EXTRA]    Patching 'mpfr-2.4.2'
[EXTRA]    Extracting 'libelf-0.8.13'
[EXTRA]    Patching 'libelf-0.8.13'
[EXTRA]    Extracting 'binutils-2.19.1a'
[EXTRA]    Patching 'binutils-2.19.1a'
[EXTRA]    Extracting 'gcc-4.3.2'
[EXTRA]    Patching 'gcc-4.3.2'
[EXTRA]    Extracting 'glibc-2.9'
[EXTRA]    Patching 'glibc-2.9'
[EXTRA]    Extracting 'glibc-ports-2.9'
[EXTRA]    Patching 'glibc-ports-2.9'
[EXTRA]    Extracting 'dmalloc-5.5.2'
[EXTRA]    Patching 'dmalloc-5.5.2'
[EXTRA]    Extracting 'duma_2_5_15'
[EXTRA]    Patching 'duma-2_5_15'
[EXTRA]    Extracting 'gdb-6.8a'
[EXTRA]    Patching 'gdb-6.8a'
[EXTRA]    Extracting 'ncurses-5.9'
[EXTRA]    Patching 'ncurses-5.9'
[EXTRA]    Extracting 'expat-2.1.0'
[EXTRA]    Patching 'expat-2.1.0'
[EXTRA]    Extracting 'ltrace-0.5.3'
[EXTRA]    Patching 'ltrace-0.5.3'
[EXTRA]    Extracting 'strace-4.5.19'
[EXTRA]    Patching 'strace-4.5.19'
[INFO ]  Extracting and patching toolchain components: done in 122.16s (at 08:07)
[INFO ]  =================================================================
[INFO ]  Installing GMP for host
[EXTRA]    Configuring GMP
[EXTRA]    Building GMP
[EXTRA]    Installing GMP
[INFO ]  Installing GMP for host: done in 92.38s (at 09:39)
[INFO ]  =================================================================
[INFO ]  Installing MPFR for host
[EXTRA]    Configuring MPFR
[EXTRA]    Building MPFR
[EXTRA]    Installing MPFR
[INFO ]  Installing MPFR for host: done in 29.47s (at 10:09)
[INFO ]  =================================================================
[INFO ]  Installing binutils for host
[EXTRA]    Configuring binutils
[EXTRA]    Building binutils
[EXTRA]    Installing binutils
[INFO ]  Installing binutils for host: done in 106.15s (at 11:55)
[INFO ]  =================================================================
[INFO ]  Installing pass-1 core C compiler
[EXTRA]    Configuring gcc
[EXTRA]    Building gcc
[EXTRA]    Installing gcc
[INFO ]  Installing pass-1 core C compiler: done in 342.05s (at 17:37)
[INFO ]  =================================================================
[INFO ]  Installing kernel headers
[EXTRA]    Installing kernel headers
[EXTRA]    Checking installed headers
[INFO ]  Installing kernel headers: done in 4.34s (at 17:42)
[INFO ]  =================================================================
[INFO ]  Installing C library headers & start files
[EXTRA]    Configuring C library
[EXTRA]    Installing C library headers
[EXTRA]    Installing C library start files
[INFO ]  Installing C library headers & start files: done in 29.92s (at 18:11)
[INFO ]  =================================================================
[INFO ]  Installing pass-2 core C compiler
[EXTRA]    Configuring gcc
[EXTRA]    Building gcc
[EXTRA]    Installing gcc
[INFO ]  Installing pass-2 core C compiler: done in 351.52s (at 24:03)
[INFO ]  =================================================================
[INFO ]  Installing C library
[EXTRA]    Configuring C library
[EXTRA]    Building C library
[EXTRA]    Installing C library
[INFO ]  Installing C library: done in 522.75s (at 32:46)
[INFO ]  =================================================================
[INFO ]  Installing final compiler
[EXTRA]    Configuring gcc
[EXTRA]    Building gcc
[EXTRA]    Installing gcc
[INFO ]  Installing final compiler: done in 335.12s (at 38:21)
[INFO ]  =================================================================
[INFO ]  Installing libelf for the target
[EXTRA]    Configuring libelf
[EXTRA]    Building libelf
[EXTRA]    Installing libelf
[INFO ]  Installing libelf for the target: done in 4.16s (at 38:25)
[INFO ]  =================================================================
[INFO ]  Installing binutils for target
[EXTRA]    Configuring binutils for target
[EXTRA]    Building binutils' libraries (libiberty bfd) for target
[EXTRA]    Installing binutils' libraries (libiberty bfd) for target
[INFO ]  Installing binutils for target: done in 60.76s (at 39:26)
[INFO ]  =================================================================
[INFO ]  Installing dmalloc
[EXTRA]    Configuring dmalloc
[EXTRA]    Building dmalloc
[EXTRA]    Installing dmalloc
[INFO ]  Installing dmalloc: done in 6.45s (at 39:32)
[INFO ]  =================================================================
[INFO ]  Installing D.U.M.A.
[EXTRA]    Copying sources
[EXTRA]    Building libraries 'libduma.a libduma.so.0.0.0'
[EXTRA]    Installing libraries 'libduma.a libduma.so.0.0.0'
[EXTRA]    Installing shared library link
[EXTRA]    Installing wrapper script
[INFO ]  Installing D.U.M.A.: done in 1.28s (at 39:34)
[INFO ]  =================================================================
[INFO ]  Installing cross-gdb
[EXTRA]    Configuring cross-gdb
[EXTRA]    Building cross-gdb
[EXTRA]    Installing cross-gdb
[INFO ]  Installing cross-gdb: done in 146.34s (at 42:00)
[INFO ]  =================================================================
[INFO ]  Installing native gdb
[EXTRA]    Building static target ncurses
[EXTRA]    Building static target expat
[EXTRA]    Configuring native gdb
[EXTRA]    Building native gdb
[EXTRA]    Installing native gdb
[INFO ]  Installing native gdb: done in 210.00s (at 45:30)
[INFO ]  =================================================================
[INFO ]  Installing gdbserver
[EXTRA]    Configuring gdbserver
[EXTRA]    Building gdbserver
[EXTRA]    Installing gdbserver
[INFO ]  Installing gdbserver: done in 5.76s (at 45:36)
[INFO ]  =================================================================
[INFO ]  Installing ltrace
[EXTRA]    Copying sources to build dir
[EXTRA]    Configuring ltrace
[EXTRA]    Building ltrace
[EXTRA]    Installing ltrace
[INFO ]  Installing ltrace: done in 2.56s (at 45:38)
[INFO ]  =================================================================
[INFO ]  Installing strace
[EXTRA]    Configuring strace
[EXTRA]    Building strace
[EXTRA]    Installing strace
[INFO ]  Installing strace: done in 9.81s (at 45:48)
[INFO ]  =================================================================
[INFO ]  Cleaning-up the toolchain's directory
[INFO ]    Stripping all toolchain executables
[EXTRA]    Installing the populate helper
[EXTRA]    Installing a cross-ldd helper
[EXTRA]    Creating toolchain aliases
[EXTRA]    Removing access to the build system tools
[INFO ]  Cleaning-up the toolchain's directory: done in 1.42s (at 45:50)
[INFO ]  Build completed at 20141201.001543
[INFO ]  (elapsed: 45:49.64)
[INFO ]  Finishing installation (may take a few seconds)...
[45:50] / [email protected]:~/toolchain-build$
时间: 2024-10-02 00:08:35

ARM交叉编译工具制作V2的相关文章

ARM交叉编译工具链分类说明

转载整理自:http://www.veryarm.com/cross-tools 从授权上,ARM交叉编译工具链分为免费授权版和付费授权版. 免费版目前有三大主流工具商提供,第一是GNU(提供源码,自行编译制作),第二是 Codesourcery,第三是Linora. 收费版有ARM原厂提供的armcc.IAR提供的编译器等等,因为这些价格都比较昂贵,不适合学习用户使用,所以不做讲述. ·        arm-none-linux-gnueabi-gcc:是 Codesourcery 公司(目

【转】ARM交叉编译工具链

原文网址:http://www.veryarm.com/cross-tools 为什么要用交叉编译器? 交叉编译通俗地讲就是在一种平台上编译出能运行在体系结构不同的另一种平台上的程序,比如在PC平台(X86 CPU)上编译出能运行在以ARM为内核的CPU平台上的程序,编译得到的程序在X86 CPU平台上是不能运行的,必须放到ARM CPU平台上才能运行,虽然两个平台用的都是Linux系统. 交叉编译工具链是一个由编译器.连接器和解释器组成的综合开发环境,交叉编译工具链主要由binutils.gc

浅析 Linux 下的 arm 交叉编译工具

什么是交叉编译工具 http://elinux.org/Toolchains 要解释交叉编译工具,我们首先要理解三个基本概念: 编译平台:是指该编译器是在哪个平台编译出来的 编译主机:编译器运行在哪个平台 目标平台:编译器为哪个平台产生代码 比如我们在 Ubuntu(Linux) 下编译 arm 开发板的程序,那么: 编译平台就是 X86,该编译器在 x86上运行 编译主机就是这台运行 Ubuntu Linux 的电脑 目标平台就是 arm 开发板 所以通常所指的交叉编译,就是在该平台编译生成在

使用crosstool制作ARM交叉编译工具链

本文主机环境为Ubuntu6.06-1桌面版 内核:2.6.15-26 GCC:4.0.3 ---------------------------------------------------转载请注明:xiaobin_hlj80---- Z.前期准备 1. 建立虚拟机 使用iso文件安装 (1)   安装Live系统 选择文字安装选项,"Start or install ubuntu"即可. (2)   安装到本地 进入Live的桌面后,点击"Install"即

Linux下获取arm的交叉编译工具链

转载请注明文章:Linux下获取arm的交叉编译工具链 出处:多客博图 这里介绍,Linux下获取arm的交叉编译工具链,比如arm-linux-gnueabihf-gcc.arm-linux-gneabihf-gcc等. 前言 这里有一个专门的说法: “arm-linux-gnueabihf-gcc是由 Linaro 公司基于GCC推出的的ARM交叉编译工具.可用于交叉编译ARM系统中所有环节的代码,包括裸机程序.u-boot.Linux kernel.filesystem和App应用程序.使

arm嵌入式交叉编译工具链

1.arm-linux-gcc 常用的参数:-o[制定输出文件名] -c[只到编译停止,不连接] -g[键入调试信息] -xO[优化级别] -w/W(警告等级) arm-linux-gcc -o dest source,直接编译出可执行文件elf格式 arm-linux-gcc -o dest source -c 只编译不连接,生成.o格式的库文件,用来提供给连接器连接成elf 其他的参数可以在GCC的手册中了解所有信息. 2.arm-linux-ld 如果GCC中使用的-c,需要arm-lin

嵌入式Linux之旅——环境搭建篇之交叉编译工具的安装

在正式开始学习裸机程序的编写之前,我们还需要安装一下交叉编译工具.何为交叉编译工具?其实就是在x86的ubuntu主机上编译程序,并且可以运行在arm环境的编译工具.而gcc是本地编译工具,这个在我们本篇刚开始就已经安装了.现在我们需要安装交叉编译工具arm-linux-gcc.我现在是直接使用厂家制作好的工具,只需解压后增加到环境变量即可: sudo tar xzf arm-linux-gcc-4.3.2.tgz -C / 然后修改“/etc/environment”,在PATH中增加交叉编译

交叉编译工具链

1.嵌入式开发模型-交叉开发 在嵌入式开发过程中有宿主机和目标机的角色之分:宿主机是执行编译.链接嵌入式软件的计算机:目标机是运行嵌入式软件的硬件平台. 在宿主机执行编译的流程如下: 2.交叉编译工具链详解 参考: http://www.crifan.com/files/doc/docbook/cross_compile/release/html/cross_compile.html 3.制作交叉编译工具 参考: http://www.crifan.com/files/doc/docbook/c

交叉编译工具链介绍《Building Embedded Linux Systems》

1.前言 配置和编译一个合适的GNU工具链是相对复杂的并且需要很精细的操作,包括你需要对不同软件库之间的依赖关系.它们的各自的任务,不同软件库版本情况都有比较好的了解,编译工具链是一个乏味的工作. 2.制作之前需要了解的一些术语与名称 1)build:你编译你的工具链时所使用的编译系统. 2)host:交叉编译工具链运行在的主机系统. 3)target:你的交叉编译工具链所生成的可执行文件所要运行的目标系统. 在一些通用非嵌入式的使用,以上三个必须是一样的.但是大部分嵌入式开发中,build跟h