个人工具

内核交叉编译工具链

来自Ubuntu中文

Manbuzhe讨论 | 贡献2013年1月18日 (五) 10:35的版本 (以内容'== 内核交叉编译工具链 == 内核交叉编译工具链的制作 === 编译binutils === <pre> #!/bin/sh export CROSS_HOST="x86_64-unknown-linux-gnu" export CROSS_TA…'创建新页面)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索

内核交叉编译工具链

内核交叉编译工具链的制作

编译binutils

#!/bin/sh
export CROSS_HOST="x86_64-unknown-linux-gnu"
export CROSS_TARGET="x86_64-regulus-linux-gnu"

CROSS-TOOLS="/cross-tools"

mkdir -pv ${CROSS-TOOLS}                                            &&
wget http://mirrors.ustc.edu.cn/gnu/binutils/binutils-2.23.1.tar.gz && 
tar -xvpf binutils-2.23.1.tar.gz                                    && 
cd binutils-2.23.1                                                  && 
mkdir build-binutils                                                && 
cd build-binutils

AR=ar AS=as ../configure --prefix=/cross-tools --build=${CROSS_HOST} --host=${CROSS_HOST} --target=${CROSS_TARGET} --disable-nls --enable-shared --disable-static --enable-64-bit-bfd --disable-multilib
make configure-host
make -j32
make install

gmp

wget http://ftp.gnu.org/gnu/gmp/gmp-5.0.5.tar.bz2
tar -xvpf gmp-5.0.5.tar.bz2
cd gmp-5.0.5
CPPFLAGS=-fexceptions ./configure --prefix=/cross-tools --enable-cxx --disable-static
make && make install

mpfr

wget http://www.mpfr.org/mpfr-3.1.1/mpfr-3.1.1.tar.xz
tar -xvpf mpfr-3.1.1.tar.xz
cd mpfr-3.1.1
LDFLAGS="-Wl,-rpath,/cross-tools/lib" ./configure --prefix=/cross-tools --enable-shared --disable-static --with-gmp=/cross-tools
make && make install

mpc

wget http://www.multiprecision.org/mpc/download/mpc-1.0.1.tar.gz
tar -xvpf mpc-1.0.1.tar.gz
cd mpc-1.0.1
LDFLAGS="-Wl,-rpath,/cross-tools/lib" ./configure --prefix=/cross-tools --disable-static --with-gmp=/cross-tools --with-mpfr=/cross-tools
make && make install

编译gcc

# export PATH=/cross-tools/bin:$PATH

mkdir -pv ./build-gcc
cd ./build-gcc
../configure --prefix=/cross-tools --build=${CROSS_HOST} --host=${CROSS_HOST} --target=${CROSS_TARGET} \
--with-mpfr=/cross-tools --with-gmp=/cross-tools  \
--with-newlib \
--disable-nls \
--disable-shared \
--disable-static \
--disable-threads \
--disable-multilib \
--enable-languages=c \

make all-gcc
make install-gcc

export PATH=/cross-tools/bin:$PATH
export LD_LIBRARY_PATH=/cross-tools/lib
make CROSS_COMPILE=/cross-tools/bin/mips64el-neokylin-linux-gnu- ARCH=mips

可选项 --with-abi=64 make all-target-libgcc make install-all-target-libgcc --with-ppl=/cross-tools --with-cloog=/cross-tools