LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
12
返回列表 发新帖
楼主: kiron

昨晚建立交叉编译环境失败,是否有兄台能写个完整的教程,我的问题内详

[复制链接]
 楼主| 发表于 2004-5-17 13:57:53 | 显示全部楼层
最初由 macarthor 发表
有些交叉编译工具提供了.sh包,比如uClinux
你用的是什么?


直接下载源码包安装

兄弟有好的法子吗?
发表于 2004-5-18 19:53:58 | 显示全部楼层
as to uClinux, which i'm using, it provides such file as uClinux-dist-20040408.sh

u can run ./uC..... to install it, and it's intellectual process

then u can get the whole cross-compiling environment
发表于 2004-5-18 21:38:17 | 显示全部楼层
最初由 kiron 发表
直接下载源码包安装

兄弟有好的法子吗?


到这儿,全是uClinux的工具链
http://www.snapgear.org/snapgear/downloads.html

手动编译不能成功,我觉得咱们用的源码包的版本是不是太新的过
发表于 2005-11-2 15:51:04 | 显示全部楼层
按照上面帖中给出的附件中的步骤进行,但吧step2和step3中的substep1交换一下进行的顺序,即先完成step3中的substep1,再进行step2,这样就能顺利通过!
回复 支持 反对

使用道具 举报

发表于 2005-11-3 08:40:40 | 显示全部楼层
直接下一个toolchain吧,比较省事儿
回复 支持 反对

使用道具 举报

发表于 2007-1-8 11:51:37 | 显示全部楼层
kiron 兄弟搞定了没有?
我也遇到了同样的问题。
大家回复很精彩,今晚回去再奋斗奋斗。
回复 支持 反对

使用道具 举报

发表于 2007-3-7 09:46:31 | 显示全部楼层

头文件位置不用变量,直接用目录代替试试,我是通过了

我在GCC-3.4.6下通过了。kernel-2.6.19
回复 支持 反对

使用道具 举报

发表于 2007-6-21 16:16:50 | 显示全部楼层

交叉编译gcc第一阶段时出现如下错误,高手帮忙解决下

/tmp/cclmWXr1.s: Assembler messages:
/tmp/cclmWXr1.s:33: Error: junk at end of line, first unrecognized character is `@'
/tmp/cclmWXr1.s:34: Error: junk at end of line, first unrecognized character is `@'
/tmp/cclmWXr1.s:35: Error: no such instruction: `stmfd sp!,{r4,r5,lr}'
/tmp/cclmWXr1.s:36: Error: no such instruction: `ldr r5,.L11'
/tmp/cclmWXr1.s:37: Error: no such instruction: `ldrb r3,[r5,'
/tmp/cclmWXr1.s:38: Error: expecting operand after ','; got nothing
/tmp/cclmWXr1.s:39: Error: no such instruction: `ldmnefd sp!,{r4,r5,pc}'
/tmp/cclmWXr1.s:40: Error: no such instruction: `ldr r4,.L11+4'
/tmp/cclmWXr1.s:41: Error: no such instruction: `b .L8'
/tmp/cclmWXr1.s:43: Error: no such instruction: `ldr r3,[r4,'
/tmp/cclmWXr1.s:44: Error: too many memory references for `add'
/tmp/cclmWXr1.s:45: Error: invalid char '[' beginning operand 2 `[r4'
/tmp/cclmWXr1.s:46: Error: too many memory references for `mov'
/tmp/cclmWXr1.s:47: Error: too many memory references for `mov'
/tmp/cclmWXr1.s:49: Error: no such instruction: `ldr r3,[r4,'
/tmp/cclmWXr1.s:50: Error: no such instruction: `ldr r2,[r3,'
/tmp/cclmWXr1.s:51: Error: expecting operand after ','; got nothing
/tmp/cclmWXr1.s:52: Error: no such instruction: `bne .L10'
/tmp/cclmWXr1.s:53: Error: expecting operand after ','; got nothing
/tmp/cclmWXr1.s:54: Error: invalid char '[' beginning operand 2 `[r5'
/tmp/cclmWXr1.s:55: Error: no such instruction: `ldmfd sp!,{r4,r5,pc}'
/tmp/cclmWXr1.s:64: Error: junk at end of line, first unrecognized character is `@'
/tmp/cclmWXr1.s:65: Error: junk at end of line, first unrecognized character is `@'
/tmp/cclmWXr1.s:66: Error: invalid char '[' beginning operand 2 `[sp'
/tmp/cclmWXr1.s:69: Error: no such instruction: `bl __do_global_dtors_aux'
/tmp/cclmWXr1.s:72: Error: no such instruction: `ldr pc,[sp],'
/tmp/cclmWXr1.s:76: Error: junk at end of line, first unrecognized character is `@'
/tmp/cclmWXr1.s:77: Error: junk at end of line, first unrecognized character is `@'
/tmp/cclmWXr1.s:78: Error: junk at end of line, first unrecognized character is `@'
/tmp/cclmWXr1.s:79: Error: no such instruction: `ldr r0,.L16'
/tmp/cclmWXr1.s:80: Error: no such instruction: `ldr r3,[r0,'
/tmp/cclmWXr1.s:81: Error: expecting operand after ','; got nothing
/tmp/cclmWXr1.s:82: Error: junk at end of line, first unrecognized character is `@'
/tmp/cclmWXr1.s:83: Error: no such instruction: `moveq pc,lr'
/tmp/cclmWXr1.s:84: Error: no such instruction: `ldr r3,.L16+4'
/tmp/cclmWXr1.s:85: Error: expecting operand after ','; got nothing
/tmp/cclmWXr1.s:86: Error: no such instruction: `moveq pc,lr'
/tmp/cclmWXr1.s:87: Error: no such instruction: `b _Jv_RegisterClasses'
/tmp/cclmWXr1.s:96: Error: junk at end of line, first unrecognized character is `@'
/tmp/cclmWXr1.s:97: Error: junk at end of line, first unrecognized character is `@'
/tmp/cclmWXr1.s:98: Error: invalid char '[' beginning operand 2 `[sp'
/tmp/cclmWXr1.s:101: Error: no such instruction: `bl frame_dummy'
/tmp/cclmWXr1.s:104: Error: no such instruction: `ldr pc,[sp],'
make[1]: *** [crtbegin.o] 错误 1
make[1]: Leaving directory `/home/arm/dev_home/btools/tchain3.4.4/BUILD/gcc-3.4.4-stage1/gcc'
make: *** [all-gcc] 错误 2
回复 支持 反对

使用道具 举报

发表于 2007-6-27 20:48:51 | 显示全部楼层
我根据网上的资料改了一个脚本。成功编译了自己的交叉编译器。由于经过了那个痛苦的过程,所以深感资料的不详细和不具体的困惑。不多说了,拿出来和大家分享一下。请根据自己的具体情况更改脚本里的变量和路径。我已经用自己的cross compile 移植了u-boot-1.2.0, kernel-2.6.10,不过还有很多问题没搞定。还请各位同好以后多多帮忙!

上传脚本附件失败,直接贴了:

#!/bin/bash

# Setup

PROJECT=usg
USER=david
PRJDIR=/home/${USER}/${PROJECT}
BUILD_DIR=${PRJDIR}/build-tools
PREFIX=${PRJDIR}/tools/arm
TARGET=arm-pc-linux-gnu
SYSROOT=${PREFIX}/sysroot
export ARCH=arm
export CROSS_COMPILE=${TARGET}-
export PATH=$PATH{PREFIX}/bin

mkdir -p ${BUILD_DIR}/src

# Get the sources

cd ${BUILD_DIR}
for URL in \
http://ftp.gnu.org/gnu/binutils/binutils-2.16.tar.gz \
http://ftp.gnu.org/gnu/gcc/gcc-3.4.4/gcc-3.4.4.tar.bz2 \
"http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/flow.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.563.4.2&r2=1.563.4.3" \
http://frank.harvard.edu/~coldwell/toolchain/t-linux.diff \
http://ftp.gnu.org/gnu/glibc/glibc-2.3.5.tar.bz2 \
http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.3.5.tar.gz \
http://frank.harvard.edu/~coldwell/toolchain/ioperm.c.diff \
http://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.10.tar.gz
do
    FILE=${URL##*/}
    FILE=${FILE%%\?*}
    [ -f ${FILE} ] || wget -O ${FILE} ${URL}
done

# GNU binutils

cd ${BUILD_DIR}/src
tar xvfz ../binutils-2.16.tar.gz
mkdir -p ../BUILD/binutils-2.16
cd ../BUILD/binutils-2.16
../../src/binutils-2.16/configure --prefix=${PREFIX} --target=${TARGET} --with-sysroot=${SYSROOT} 2>&1 | tee configure.out
make 2>&1 | tee make.out
make install 2>&1 | tee -a make.out

# Linux Kernel Headers

cd ${BUILD_DIR}/src
tar xvfz ../linux-2.6.10.tar.gz
ln -s linux-2.6.10 linux
#zcat 2.6.10-at91.patch.gz | patch -d linux -p1
#zcat 26_at91_serial.c.gz >linux/drivers/serial/at91_serial.c
cd linux
make lubbock_defconfig
make include/linux/version.h
mkdir -p ${SYSROOT}/usr/include
cp -a ${BUILD_DIR}/src/linux/include/linux ${SYSROOT}/usr/include/linux
cp -a ${BUILD_DIR}/src/linux/include/asm-arm ${SYSROOT}/usr/include/asm
cp -a ${BUILD_DIR}/src/linux/include/asm-generic ${SYSROOT}/usr/include/asm-generic

# Glibc headers

cd ${BUILD_DIR}/src
tar xvfj ../glibc-2.3.5.tar.bz2
patch -d glibc-2.3.5 -p1 <../ioperm.c.diff
cd glibc-2.3.5
tar xvfz ../../glibc-linuxthreads-2.3.5.tar.gz
cd ../..
mkdir BUILD/glibc-2.3.5-headers
cd BUILD/glibc-2.3.5-headers
../../src/glibc-2.3.5/configure --prefix=/usr --host=${TARGET} --enable-add-ons=linuxthreads --with-headers=${SYSROOT}/usr/include 2>&1 | tee configure.out
make cross-compiling=yes install_root=${SYSROOT} install-headers 2>&1 | tee make.out
touch ${SYSROOT}/usr/include/gnu/stubs.h
touch ${SYSROOT}/usr/include/bits/stdio_lim.h

# Step 4: stage 1 gcc

cd ${BUILD_DIR}/src
bunzip2 -c ../gcc-3.4.4.tar.bz2 | tar xvf -
patch -d gcc-3.4.4 -p1 < ../flow.c.diff
patch -d gcc-3.4.4 -p1 < ../t-linux.diff
mkdir -p ../BUILD/gcc-3.4.4-stage1
cd ../BUILD/gcc-3.4.4-stage1
../../src/gcc-3.4.4/configure --prefix=${PREFIX} --target=${TARGET} --enable-languages=c --with-sysroot=${SYSROOT} 2>&1 | tee configure.out
make 2>&1 | tee make.out
make install 2>&1 | tee -a make.out

# Step 5: glibc

cd ${BUILD_DIR}
mkdir BUILD/glibc-2.3.5
cd BUILD/glibc-2.3.5
BUILD_CC=gcc CC=${CROSS_COMPILE}gcc AR=${CROSS_COMPILE}ar RANLIB=${CROSS_COMPILE}ranlib AS=${CROSS_COMPILE}as LD=${CROSS_COMPILE}ld ../../src/glibc-2.3.5/configure --prefix=/usr --build=i386-redhat-linux --host=arm-pc-linux-gnu --target=arm-pc-linux-gnu --without-__thread --enable-add-ons=linuxthreads --with-headers=${SYSROOT}/usr/include 2>&1 | tee configure.out
make 2>&1 | tee make.out
make install_root=${SYSROOT} install

# Step 6: stage 2 gcc

cd ${BUILD_DIR}
mkdir BUILD/gcc-3.4.4
cd BUILD/gcc-3.4.4
../../src/gcc-3.4.4/configure --prefix=${PREFIX} --target=${TARGET} --enable-languages=c,c++ --with-sysroot=${SYSROOT} 2>&1 | tee configure.out
make 2>&1 | tee make.out
make install 2>&1 | tee -a make.out
cd ../..

# Step 7: Linux kernel

cd ${BUILD_DIR}/src/linux
make zImage
make modules
make INSTALL_MOD_PATH=${SYSROOT} modules_install
回复 支持 反对

使用道具 举报

发表于 2008-5-3 17:26:22 | 显示全部楼层
我也碰到相同的问题,回答还是没有找到这个问题的原因啊?期待中
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表