ARM-Linux-CrossToolchain構築 備考録


2008/1/14、2008/1/15 改訂

環境 : ATDE (atde2-20071018) (debian etch+VMware)

(1) atmark-technoのサポート頁から以下toolchainのソース、debian patchをダウンロード。

binutils_2.17.orig.tar.gz, binutils_2.17-3.diff.gz, gcc-4.1_4.1.1ds2.orig.tar.gz, gcc-4.1_*.diff.gz, glibc_2.3.6.ds1.orgi.tar.gz, glibc_2.3.6.ds1-13.diff.gz

(2) (1)を全部解凍。~/toolchainと~/toolchain/patchに置く。

> ls
binutils-2.17 gcc-4.1.1 glibc-2.3.6 patch

(3) 既存のクロスツールチェーンを待避

# mv /usr/arm-linux-gnu /usr/arm-linux-gnu.orig
# rm /usr/arm-linux
# mv /usr/lib/gcc/arm-linux-gnu /usr/lib/gcc/arm-linux-gnu.orig
# rm /usr/lib/gcc/arm-linux

(4) Linuxカーネルヘッダをコピー

# mkdir /usr/arm-linux
# cp -r /usr/arm-linux-gnu.orig/include /usr/arm-linux

(5) debian差分パッチを当てる。

> cd ~/toolchain/binutils-2.17
> patch -p1 < ../patch/binutils_2.17-3.diff
> cd ~/toolchain/gcc-4.1.1
> patch -p1 <../patch/gcc-4.1_4.1.1ds2-21.diff
> patch -p1 <../patch/gcc-4.1_4.1.1ds2-21_armfpu.diff
> patch -p1 <../patch/gcc-4.1_4.1.1ds2-21_cross.diff
> cd ~/toolchain/glibc-2.3.6
> patch -p1 < ../patch/glibc_2.3.6.ds1-13.diff

(6) debian/patchsのパッチ実体を当てる。とりあえず以下とarm関係。

> cd ~/toolchain/binutils-2.17
> patch -p1 < debian/patchs/000_print_debian_version.dpatch
> patch -p1 < debian/patchs/001_ld_makefile_patch.dpatch
> patch -p1 < debian/patchs/002_gprof_profile_arcs.dpatch
> patch -p1 < debian/patchs/003_gprof_see_also_monito.dpatch
> patch -p1 < debian/patchs/006_better_file_error.dpatch
> patch -p1 < debian/patchs/012_check_ldrunpath_length.dpatch
> patch -p1 < debian/patchs/121_i386_x86_64_biarch.dpatch
> patch -p1 < debian/patchs/127_x86_64_i386_biarch.dpatch
> cd ~/toolchain/gcc-4.1.1
> patch -p1 < debian/patches/arm-gij.dpatch
> patch -p1 < debian/patches/arm-libffi.dpatch
> patch -p1 < debian/patches/arm-nolibfloat-patch.dpatch
> patch -p0 < debian/patches/arm-pragma-pack.dpatch
> patch -p0 < debian/patches/config-ml.dpatch
> cd ~/toolchain/glibc-2.3.6
> patch -p0 < debian/patches/arm/cvs-float-byteorder.diff
> patch -p1 < debian/patches/arm/cvs-gcc4-inline.diff
> patch -p1 < debian/patches/arm/cvs-gcc4.1-raise.diff
> patch -p0 < debian/patches/arm/cvs-socket-weakalias.diff
> patch -p0 < debian/patches/arm/local-dwarf2-buildfix.diff
> patch -p0 < debian/patches/arm/local-ioperm.diff
> patch -p0 < debian/patches/arm/local-no-hwcap.diff
> patch -p0 < debian/patches/arm/local-softfloat.diff
> patch -p1 < debian/patches/all/local-remove-manual.diff

(7) 作業ディレクトリ作成

> cd ~/toolchain; mkdir build-binutils build-boot-gcc build-gcc build-glibc

(8) binutils構築

> cd ~/toolchain/build-binutils
> ../binutils-2.17/configure --target=arm-linux --prefix=/usr
> make
# make install

(9) boot-gcc構築

> cd ~/toolchain/build-boot-gcc
> ../gcc-4.1.1/configure --target=arm-linux --prefix=/usr --without-headers \
--with-newlib --enable-languages=c --disable-threads --disable-shared
> make all-gcc
# make install-gcc

(10) glibc構築

> cd ~/toolchain/glibc-2.3.6
> vi Makeconfig (内容修正)
L510: gnulib := -lgcc $(libgcc_eh) -> gnulib := -lgcc
L511: static-gnulib := -lgcc -lgcc_eh $(libunwind) -> static-gnulib := -lgcc $(libunwind)
> cd ~/toolchain/build-glibc
>CC=arm-linux-gcc ac_cv_type_long_double=no ../glibc-2.3.6/configure \
--host=arm-linux --prefix=/usr --enable-add-ons=linuxthreads \
--with-headers=/usr/arm-linux/include
> make
# make install_root=/usr/arm-linux prefix="" install -i

(11) gcc構築

> cd ~/toolchain/build-gcc
> ../gcc-4.1.1/configure --target=arm-linux --prefix=/usr
> make all
# make install