GCC 原始碼可從 https://gcc.gnu.org/mirrors.html 表列中網站下載. LD 與 AS 在 GNU Binutils 中.

GCC - GNU Compiler Collection
LD - GNU Linker
AS - GNU Assembler

<< 安装必要套件 >>

~$ sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev

<< 下載 GCC 4.9.2 原始碼 >>

~$ wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.bz2

<< 编譯並安裝 GCC - x86 64 位元 >>

~$ tar vxpf gcc-4.9.2.tar.bz2
~$ mkdir build-gcc-4.9.2-x86_64-elf
~$ cd build-gcc-4.9.2-x86_64-elf/
~/build-gcc-x86_64-elf$ ../gcc-4.9.2/configure --target=x86_64-elf --prefix=/usr/local/gcc-4.9.2-x86_64-elf/
~/build-gcc-x86_64-elf$ make all-gcc
~/build-gcc-x86_64-elf$ sudo make install-gcc

<< 下載 Binutils 2.24 原始碼 >>

~$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.bz2

<< 编譯並安裝 Binutils - x86 64 位元 >>

~$ tar vxpf binutils-2.24.tar.bz2
~$ cd binutils-2.24/
~/binutils-2.24$ mkdir obj-avr
~/binutils-2.24$ cd obj-avr/
~/binutils-2.24/obj-avr$  ../configure --prefix=/usr/local/gcc-4.9.2-x86_64-elf/ --target=x86_64-elf
~/binutils-2.24/obj-avr$ make
~/binutils-2.24/obj-avr$ sudo make install

<< 確認 GCC 與 Binutils 執行檔 >>

~$ ls -l /usr/local/gcc-4.9.2-x86_64-elf/bin/
total 94364
-rwxr-xr-x 1 root root 4097530 2月 25 14:49 x86_64-elf-addr2line
-rwxr-xr-x 2 root root 4269305 2月 25 14:49 x86_64-elf-ar
-rwxr-xr-x 2 root root 6191162 2月 25 14:49 x86_64-elf-as
-rwxr-xr-x 2 root root 3023569 2月 25 14:21 x86_64-elf-c++
-rwxr-xr-x 1 root root 4055438 2月 25 14:49 x86_64-elf-c++filt
-rwxr-xr-x 1 root root 3020827 2月 25 14:21 x86_64-elf-cpp
-rwxr-xr-x 1 root root 107942 2月 25 14:49 x86_64-elf-elfedit
-rwxr-xr-x 2 root root 3023569 2月 25 14:21 x86_64-elf-g++
-rwxr-xr-x 2 root root 3005279 2月 25 14:21 x86_64-elf-gcc
-rwxr-xr-x 2 root root 3005279 2月 25 14:21 x86_64-elf-gcc-4.9.2
-rwxr-xr-x 1 root root 144467 2月 25 14:21 x86_64-elf-gcc-ar
-rwxr-xr-x 1 root root 144395 2月 25 14:21 x86_64-elf-gcc-nm
-rwxr-xr-x 1 root root 144407 2月 25 14:21 x86_64-elf-gcc-ranlib
-rwxr-xr-x 1 root root 3068311 2月 25 14:21 x86_64-elf-gcj
-rwxr-xr-x 1 root root 1995368 2月 25 14:21 x86_64-elf-gcov
-rwxr-xr-x 1 root root 3024131 2月 25 14:21 x86_64-elf-gfortran
-rwxr-xr-x 1 root root 4651264 2月 25 14:49 x86_64-elf-gprof
-rwxr-xr-x 1 root root 2306363 2月 25 14:21 x86_64-elf-jcf-dump
-rwxr-xr-x 4 root root 6196781 2月 25 14:49 x86_64-elf-ld
-rwxr-xr-x 4 root root 6196781 2月 25 14:49 x86_64-elf-ld.bfd
-rwxr-xr-x 2 root root 4137135 2月 25 14:49 x86_64-elf-nm
-rwxr-xr-x 2 root root 5114886 2月 25 14:49 x86_64-elf-objcopy
-rwxr-xr-x 2 root root 6639060 2月 25 14:49 x86_64-elf-objdump
-rwxr-xr-x 2 root root 4269296 2月 25 14:49 x86_64-elf-ranlib
-rwxr-xr-x 1 root root 1416452 2月 25 14:49 x86_64-elf-readelf
-rwxr-xr-x 1 root root 4114480 2月 25 14:49 x86_64-elf-size
-rwxr-xr-x 1 root root 4085352 2月 25 14:49 x86_64-elf-strings
-rwxr-xr-x 2 root root 5114917 2月 25 14:49 x86_64-elf-strip

(完成)

 

 

文章標籤
創作者介紹
創作者 版大 的頭像
版大

嵌入式系統

版大 發表在 痞客邦 留言(0) 人氣()