×
嵌入式 > 技术百科 > 详情

做9260的交叉工具遇到的问题

发布时间:2020-10-14 发布时间:
|
编译过程相当的麻烦。而且出错相当多。搞的我把工具链砍掉重练了好几次~

编译过程:

环境设置:

sudo groupadd arm
sudo useradd arm -g arm
sudo passwd arm #设置密码
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

内核头文件(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

如果一步一步按着这个作的,那么告诉你:工具链完成了!

 

『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
VR十大误区:眼睛离屏幕太近真的会瞎吗?