免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 909 | 回复: 0
打印 上一主题 下一主题

how to create cross-compile for xscale pxa27x [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-13 15:33 |只看该作者 |倒序浏览

1. download below sources
        ①
binutils-2.18.tar.bz2
        ②
gcc-4.2.1.tar.bz2
        ③
glibc-2.6.1.tar.bz2
        ④
linux-headers-2.6.22.6-09032007.tar.bz2
        ⑤
binutils-2.18-posix-1.patch
        ⑥
gcc-4.2.1-cross_search_paths-1.patch
        ⑦
gcc-4.2.1-posix-1.patch
        ⑧
glibc-ports-2.6.1.tar.bz2
        ⑨
glibc-2.6.1-libgcc_eh-1.patch
        ⑩
glibc-2.6.1-localedef_segfault-1.patch
        ⑪
glibc-2.6.1-cross_hacks-1.patch
        ⑫
glibc-2.6.1-RTLD_SINGLE_THREAD_P-1.patch
2.use the crosstool to create the arm-iwmmx-linux-gnueabi-gcc which support the iwmmx instruction
2.1 download below two files:
crosstool-0.42.tar.gz
crosstool-0.42-mg2.patch
use tar to decompress and patch
  tar xvf crosstool-0.42.tar.gz
  cd crosstool-0.42
  patch -Np1 -i ../crosstool-0.42-mg2.patch
2.2 create own directory for crosstool and copy files from the directory of crosstool-0.42
#assuming $PWD=~/downloads/crosstool-0.42
  mkdir ~/crosstool                #build our own crosstool directory
  cp -v demo-arm-iwmmxt.sh ~/crosstool
  mkdir demo-script
  mv demo* demo-script/       #we do not need other demo-*sh scripts
  cp -av *.sh ~/crosstool     #copy all.sh,crosstool.sh,... to our own directory
  cp -av *.c ~/crosstool      #copy fix-embedded-paths.c,... to our own directory
                              #you can skip this step if you do not need it
  cp config.guess ~/crosstool #we need config.guess to get the value for $BUILD
2.3 change arm-iwmmxt.dat and gcc-4.1.0-glibc-2.3.6.dat
edit arm-iwmmxt.dat and rename arm-iwmmxt-eabi.dat
TARGET=arm-iwmmxt-linux-gnueabi
TARGET_CFLAGS="-O"
GCC_EXTRA_CONFIG="--with-float=soft --with-cpu=iwmmxt --with-arch=iwmmxt --enable-cxx-flags=-msoft-float"
GLIBC_EXTRA_CONFIG="--without-fp --disable-libunwind-exceptions"
GLIBC_EXTRA_CC_ARGS="-finline-limit=10000"
USE_SYSROOT=1
edit gcc-4.1.0-glibc-2.3.6.dat and rename gcc-4.2.1-glibc-2.6.1.dat
BINUTILS_DIR=binutils-2.18
GCC_DIR=gcc-4.2.1
LINUX_SANITIZED_HEADER_DIR=linux-libc-headers-2.6.22.6
GLIBC_DIR=glibc-2.6.1
GLIBCPORTS_FILENAME=glibc-ports-2.6.1
GLIBC_ADDON_OPTIONS=ports,nptl
2.4 modify demo-arm-iwmmx.sh
#!/bin/sh
set -ex
TARBALLS_DIR=$HOME/crosstool/downloads
RESULT_TOP=/opt/crosstool      
GCC_LANGUAGES="c,c++"
export GCC_LANGUAGES
PARALLELMFLAGS=-j3
export PARALLELMFLAGS
# Really, you should do the mkdir before running this,# and chown /opt/crosstool to yourself so you don't need to run as root.
mkdir -p $RESULT_TOP
# Build the toolchain.  Takes a couple hours and a couple gigabytes.
time eval `cat arm-iwmmxt-eabi.dat latest.dat`  sh all.sh --notest
echo Done.
2.5 modify all.sh
(1)notes this part which call getandpatch.sh.Because we manually download the source packages and patching put them into $BUILD_DIR
if test "$opt_no_unpack" = ""; then
   if test "$opt_builduserland" = "1"; then
      # Ah, nobody would want to change this :-)
      PTXDIST_DIR=ptxdist-testing-20031113
      export PTXDIST_DIR
   fi
   # Download and patch##################commented out by aaron###############   if test -d "$BUILD_DIR"; then    # Remove in background#       mv $BUILD_DIR $BUILD_DIR.del.$$#       rm -rf $BUILD_DIR.del.$$ &#   fi#   mkdir -p $BUILD_DIR#   sh getandpatch.sh#######################################################
fi
(2)change PREFIX
# Arbitrary locations for the input and output of the build.# Change or override these to your taste.#################commented out by aaron#########################TARBALLS_DIR=${TARBALLS_DIR-$TOP_DIR/tarballs}#RESULT_TOP=${RESULT_TOP-$TOP_DIR/result}###################################################################################modified by aaron###########################PREFIX=${PREFIX-$RESULT_TOP/$TOOLCOMBO/$TARGET}
PREFIX=$RESULT_TOP
(3)Prohibit directory automatically clean up
if test "$opt_no_build" = ""; then
    # Build###################commented out by aaron#################    if [ -d "$PREFIX" ]; then    # Remove in background for speed#    mv "$PREFIX" "$PREFIX.del.$$"#    rm  -rf  "$PREFIX.del.$$" &#    fi#    mkdir -p $PREFIX#    mkdir -p $BUILD_DIR##########################################################
    cd $BUILD_DIR
(4)note
#    sh testhello.sh      #commented out by aaron
2.6 modify crosstool.sh
(1)Amendment the installation of kernel headers
cp -r include/linux $HEADERDIR
cp -r include/asm-${ARCH} $HEADERDIR/asm
################added by aaron#########################
cp -r include/asm-generic $HEADERDIR/asm-generic
cd $BUILD_DIR
(2) prohibit modifying GCC_HOST
# if host is cygwin and this is not a canadian build, modify GCC_HOST########################commented out by aaron#################################case "$GCC_HOST,$CANADIAN_BUILD," in#*cygwin*,?*,) ;;#*)            GCC_HOST=`echo $GCC_HOST | sed s/-/-host_/` ;;#esac##############################################################################
2.7 manually create the directorys RESULT_TOP=/opt/crosstool(see:arm-iwmmxt-eabi.dat)and BUILD_DIR=`pwd`/build/$TARGET/$TOOLCOMBO
(see all.sh)
= ~/crosstool/build/arm-iwmmxt-linux-gnueabi/gcc-4.2.1-glibc-2.6.1
  mkdir -p ~/crosstool/build/arm-iwmmxt-linux-gnueabi/gcc-4.2.1-glibc-2.6.1
  sudo mkdir /opt/crosstool
  sudo chown -Rv aaronwong /opt/crosstool
2.8 put the source packages into $BUILD_DIR and manually decompress and patch.At last execute "sh demo-arm-iwmmx.sh"
notes:
when compiled the binutils-2.18, we will encourter error--"make[3]: *** [bfd.info] Error 1".we solve this problem as below:
cd binutils-2.18/bfd/doc
touch bfd.texinfo

               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/29191/showart_686620.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP