歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Ubuntu ARM交叉編譯工具鏈制作過程

Ubuntu ARM交叉編譯工具鏈制作過程

日期:2017/3/1 10:08:47   编辑:Linux編程

本文主機環境為Ubuntu 10.04.4桌面版

內核:2.6.32

GCC:4.4.3

Z.前期准備(使用root權限)

一、安裝系統補丁

1. 安裝更新189個(2012-10-8)

二、網絡

1. 安裝ssh,apt-get install ssh

遠程控制用

2. 安裝samba

文件共享用

三、軟件環境

安裝如下軟件(apt-get install)

1. bison

2. flex

3. libncurses5-dev

4. build-essential(g++)

5. gperf

6. texinfo

7. automake

8. libtool

9. gawk

update-alternatives –config awk

10. cvs

11.subversion(svn)

12. zlib1g-dev

13.libexpat-dev(cross-gdb)

Y. 安裝crosstool-ng

1.解壓縮

# tar jxvf crosstool-ng-1.16.0.tar.bz2

2.配置

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

3.生成

# make

4.安裝

# make install

X. 配置crosstool-ng

1. 增加安裝路徑到系統路徑中

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

2. 建立一個臨時目錄

# cd ~

root@xiaobin-pc:~# mkdir toolchain-build

3. 拷貝預配置文件到臨時目錄

root@xiaobin-pc:/# cd /usr/local/ctng/lib/ct-ng.1.16.0/samples

root@xiaobin-pc:/usr/local/ctng/lib/ct-ng.1.16.0/samples# cp arm-unknown-linux-gnueabi/* ~/toolchain-build/

# cd ~

root@xiaobin-pc:~# cd crosstool-build

root@xiaobin-pc:~/toolchain-build# mvcrosstool.config .config

4. 執行菜單配置(menuconfig)

此步為修改默認選項,以適應我們的目標板。

(1) 更改shell為bash

如果運行

# ls -la /bin/sh

看到鏈接的是 dash ,則請運行以下命令

sudo dpkg-reconfigure dash

選擇 no 以刪除 dash

(2)root@xiaobin-pc:~/toolchain-build#ct-ng menuconfig

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

3)arm other options

c. Toolchain options

1)General toolchain options

2)Tuple completion and aliasing

3)Toolchain type

4)Build system

5)Misc options

d. Operating System

Linux kernel version (2.6.32.59)

1)Common kernel options

2)linux other options

e. Binary utilities

Binuary format: (ELF)

1)GNU binutils

Binutils version (2.19.1a)

2)elf2flt

f. C compiler

C compiler (gcc)

gcc version (4.4.3)

1)Additional supported languages

2)gcc other options

3)Optimisation features

4)Settings for libraries running on target

5)Misc. obscure options

g. C-library

C library (glibc)

glibc version (2.9)

h. Debug facilities

i. Companion libraries

GMP version (4.3.2)

MPFR version (2.4.2)

PPL version (0.10.2)

CLooG/ppl version (0.15.9)

1)libelf version needed to build for target

libelf version (0.8.13)

2)Companion libraries common options

j. Companion tools

k. Test suite

5. 下載文件

此步是為了節省下載時間,我們使用下載工具把文件(bz2)下載下來,然後拷貝到$HOME/src(默認目錄)下。

(1) linux-2.6.32.59.tar.bz2

(2) gcc-4.4.3.tar.bz2

(3) binutils-2.19.1a.tar.bz2

(4) mpfr-2.4.2.tar.bz2

(5) gmp-4.3.2.tar.bz2

(6) ppl-0.10.2.tar.bz2

(7) gdb-6.8a.tar.bz2

(8) expat-2.0.1.tar.gz

(9) strace-4.5.19.tar.bz2

(10) cloog-ppl-0.15.9.tar.gz

(11) dmalloc-5.5.2.tgz

(12) libelf-0.8.13

(13) duma-2_5_15

(14) ltrace_0.5.3.orig.tar.gz

(15)ncurses-5.9.tar.gz

(16) elf2flt-cvs-head.tar.gz

(17)glibc-2.9.tar.bz2

(18)glibc-ports-2.9.tar.bz2

6. 生成交叉編譯環境

root@xiaobin-pc:~/toolchain-build# ct-ngbuild

Copyright © Linux教程網 All Rights Reserved