專注電子技術(shù)學習與研究
當前位置:單片機教程網(wǎng) >> MCU設(shè)計實例 >> 瀏覽文章

做9260的交叉工具遇到的問題

作者:萬致遠   來源:本站原創(chuàng)   點擊數(shù):  更新時間:2012年10月16日   【字體:

編譯過程相當?shù)穆闊�。而且出錯相當多。搞的我把工具鏈砍掉重練了好幾次~

編譯過程:

環(huán)境設(shè)置:

sudo groupadd arm
sudo useradd arm -g arm
sudo passwd arm #設(shè)置密碼
su - arm #切換帳戶
export CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
export CLFS_TARGET="arm-at91-linux"
echo export CLFS_HOST=\""${CLFS_HOST}\"" >> ~/.bashrc
echo export CLFS_TARGET=\""${CLFS_TARGET}\"" >> ~/.bashrc

內(nèi)核頭文件(2.6.35):

make mrproper
make headers_check
make INSTALL_HDR_PATH=dest headers_install
mkdir -p $CLFS/usr/include
cp -rv dest/include/* $CLFS/usr/include

Binutils(2.20):

mkdir -v ../binutils-build
cd ../binutils-build
../binutils-2.20.1/configure --prefix=${CLFS}/cross-tools \
--host=${CLFS_HOST} --target=${CLFS_TARGET} --with-sysroot=${CLFS} \
--disable-nls --enable-shared --disable-multilib
ln -sv /usr/bin/ar $CLFS/cross-tools/bin/${CLFS_HOST)-ar
make configure-host
make
make install
cp -v ../binutils-2.17/include/libiberty.h ${CLFS}/usr/include

Glibc-Headers(2.11):

tar -xf ../glibc-ports-2.11.tar.bz2
mv glibc-ports-2.11 ports #重要,沒它就會說the arm is unsupport
mkdir -v ../glibc-build
cd ../glibc-build
echo "libc_cv_forced_unwind=yes" > config.cache
echo "libc_cv_c_cleanup=yes" >> config.cache
echo "libc_cv_arm_tls=yes" >> config.cache
echo "libc_cv_arm32_tls=yes" >> config.cache
echo "libc_cv_arm_machine=yes" > config.cache
echo "libc_cv_mlong_double_128=yes" >> config.cache
echo "libc_cv_mlong_double_128ibm=yes" >> config.cache
echo "install_root=${CLFS}" > configparms
CC=gcc ../glibc-2.11/configure --prefix=/usr \
--host=${CLFS_TARGET} --build=${CLFS_HOST} \
--with-headers=${CLFS}/usr/include --cache-file=config.cache
make install-headers
install -dv ${CLFS}/usr/include/bits
cp -v bits/stdio_lim.h ${CLFS}/usr/include/bits
touch ${CLFS}/usr/include/gnu/stubs.h

Gcc-4.5.1 Pass1:

patch -Np1 -i ../gcc-4.5.1-startfiles_fix-1.patch
tar -xf ../gmp-5.0.1.tar.bz2
tar -xf ../mpc-0.8.2.tar.gz
tar -xf ../mpfr-3.0.0.tar.bz2
mv gmp-5.0.1 gmp
mv mpc-0.8.2.tar.gz mpc
mv mpfr-3.0.0 mpfr
mkdir -v ../gcc-build
cd ../gcc-build
../gcc-4.5.1/configure --prefix=${CLFS}/cross-tools \
--host=${CLFS_HOST} --target=${CLFS_TARGET} --disable-multilib \
--with-sysroot=${CLFS} --disable-nls --disable-shared \
--enable-languages=c \
--with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs #相當重要!
make all-gcc
make install-gcc
ln -sv $CLFS/cross-tools/bin/arm-at91-linux-gcc FS/cross-tools/bin/arm-at91-linux-cc
rm $CLFS/cross-tools/bin/i486-cross-linux-gnu-ar
ln -vs libgcc.a `$CLFS_TARGET-gcc -print-libgcc-file-name | \
    sed 's/libgcc/&_eh/'` #相當重要,沒有這個符號連接就別想編譯glibc

Glibc 2.11 Pass2

tar -xf ../glibc-ports-2.11.tar.bz2
mv glibc-ports-2.11 ports
mkdir -v ../glibc-build
cd ../glibc-build
echo "libc_cv_forced_unwind=yes" > config.cache
echo "libc_cv_c_cleanup=yes" >> config.cache
echo "install_root=${CLFS}" > configparms
BUILD_CC="gcc" CC="${CLFS_TARGET}-gcc" \
AR="${CLFS_TARGET}-ar" RANLIB="${CLFS_TARGET}-ranlib" \
../glibc-2.4/configure --prefix=/usr --libexecdir=/usr/lib/glibc \
--host=${CLFS_TARGET} --build=${CLFS_HOST} \
--disable-profile --enable-add-ons \
--with-tls --enable-kernel=2.6.0 --with-__thread \
--with-binutils=${CLFS}/cross-tools/bin --with-headers=${CLFS}/usr/include \
--cache-file=config.cache
make
make install
cat > ${CLFS}/etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
# End /etc/nsswitch.conf
EOF
TZDIR="${CLFS}/usr/share/zoneinfo" ${CLFS}/usr/bin/tzselect
cp -v --remove-destination ${CLFS}/usr/share/zoneinfo/[xxx] \
${CLFS}/etc/localtime
cat > ${CLFS}/etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf
/usr/local/lib
/opt/lib
# End /etc/ld.so.conf
EOF

GCC-Pass3

patch -Np1 -i ../gcc-4.5.1-startfiles_fix-1.patch
tar -xf ../gmp-5.0.1.tar.bz2
tar -xf ../mpc-0.8.2.tar.gz
tar -xf ../mpfr-3.0.0.tar.bz2
mv gmp-5.0.1 gmp
mv mpc-0.8.2.tar.gz mpc
mv mpfr-3.0.0 mpfr
mkdir -v ../gcc-build
cd ../gcc-build
../gcc-4.5.1/configure --prefix=${CLFS}/cross-tools \
--host=${CLFS_HOST} --target=${CLFS_TARGET} --disable-multilib \
--with-sysroot=${CLFS} --disable-nls --enable-shared \
--enable-languages=c,c++ --enable-__cxa_atexit \
--enable-c99 --enable-long-long --enable-threads=posix
make all-gcc
make install-gcc #重要!
make
make install
ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | \
    sed 's/libgcc/&_eh/'` #相當重要,沒有這個符號連接就別想編譯glibc

如果一步一步按著這個作的,那么告訴你:工具鏈完成了!

關(guān)閉窗口

相關(guān)文章