QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

楼主: jmcar

有没有建立了ARM交叉编译环境的朋友

[复制链接]
发表于 2003-7-12 05:03:03 | 显示全部楼层
this is the script for gcc 3.2.3
--------------------------------------------
#!/bin/sh -e
# a script get from ARM Linux to build a cross compile toolchain
# should modify the PREFIX, KERNEL, HOST base on your needs

PREFIX=/usr/local/arm
KERNEL=/tmp/cross/linux-2.4.19
HOST=
BINVER=2.14
GCCVER=3.2.3

mkdir -p $PREFIX
if [ "$KERNEL" = "" -o ! -f "$KERNEL/Documentation/arm/README" ]; then
  echo "You haven't changed KERNEL to point at a valid kernel tree"
  exit 1
fi
if [ ! -f binutils-$BINVER.tar.gz ]; then
  echo Binutils $BINVER seems to be missing
  exit 1
fi
if [ ! -f gcc-$GCCVER.tar.gz ]; then
  echo GCC $GCCVER seems to be missing
  exit 1
fi

tar zxf binutils-$BINVER.tar.gz
pushd binutils-$BINVER
./configure --target=arm-linux --prefix=$PREFIX
make
make install
popd
rm -rf binutils-$BINVER

PATH=$PATH:$PREFIX/bin

rm -rf gcc-$GCCVER
tar zxf gcc-$GCCVER.tar.gz
pushd gcc-$GCCVER
perl -pi -e 's/^(TARGET_LIBGCC2_CFLAGS.*)/$1 -Dinhibit_libc -D__gthr_posix_h/' gcc/config/arm/t-linux
echo 'T_CFLAGS = -Dinhibit_libc -D__gthr_posix_h' >> gcc/config/arm/t-linux
./configure --target=arm-linux --prefix=$PREFIX $HOST --with-headers=$KERNEL/include --disable-shared --disable-threads --enable-languages="c"
make
make install
popd
rm -rf gcc-$GCCVER

#rm -rf glibc-2.2.5
#tar zxf glibc-2.2.5.tar.gz
#tar -C glibc-2.2.5 -zxf glibc-linuxthreads-2.2.5.tar.gz
#pushd glibc-2.2.5
#perl -pi -e 's/i386/arm*)\n\tlibc_cv_gcc_unwind_find_fde=yes\n\tarch_minimum_kernel=2.0.10\n\t;;\n   i386/' sysdeps/unix/sysv/linux/configure
#perl -pi -e 's/weak_alias \(__old_sys_nerr/\/\/ $&/' sysdeps/unix/sysv/linux/arm/errlist.c
#./configure arm-linux --build=i686-pc-linux-gnu --with-headers=$KERNEL/include --enable-add-ons --enable-shared --prefix=$PREFIX
#make
#make install
#popd
#pushd $PREFIX/arm-linux/lib
#ln -s $PREFIX/lib/* .
#popd
#rm -rf glibc-2.2.5
#tar zxf gcc-3.2.tar.gz
#pushd gcc-3.2
#./configure --target=arm-linux --prefix=$PREFIX $HOST --with-headers=$KERNEL/include
#perl -pi -e 's/int namelen/unsigned int namelen/' libjava/java/net/natInetAddress.cc
#make
#make install
#popd
#rm -rf gcc-3.2
回复

使用道具 举报

发表于 2003-7-12 05:05:08 | 显示全部楼层
and for gcc 3.3, i can use upper script to get a toolchain by change the GCCVER to 3.3. but when i compile the kernel, it fails.

i will check the reason later.

and i will check glibc later.

good luck.
回复

使用道具 举报

发表于 2003-7-12 08:57:15 | 显示全部楼层
a useful link

http://www.linux-france.org/~dmentre/doc/en/ixp2400-linux-toolchain-howto.txt
回复

使用道具 举报

发表于 2003-7-12 08:59:23 | 显示全部楼层
gcc arm page

http://gcc.rgai.hu/gnats.php
回复

使用道具 举报

发表于 2003-7-12 11:10:58 | 显示全部楼层
for the gcc 3.3 compile kernel error. i already find a bug report on web. so i will track that to see whether we can get a solution.
  
回复

使用道具 举报

 楼主| 发表于 2003-7-13 19:24:55 | 显示全部楼层
thank you very much
:-)
回复

使用道具 举报

发表于 2003-7-13 22:39:25 | 显示全部楼层
welcome. i do not have time to try the glibc. but the script i commented should work for u. if u can succ compile a gdb with u cross toolchain. it should works.

btw, sb suggest add CC=arm-linux-gcc during comparing glibc, i am not sure, and i have no time to try. u can try both and see what happens.

good  luck.
    
回复

使用道具 举报

 楼主| 发表于 2003-7-14 17:29:48 | 显示全部楼层
好的,不管成功失败我都会把结果贴出来给大家共享
回复

使用道具 举报

发表于 2003-7-14 21:18:06 | 显示全部楼层
good luck.
回复

使用道具 举报

发表于 2003-7-15 09:49:16 | 显示全部楼层
this is two discussion on arm linux mailing list. i will keep tracing.
--------------------------------------------------
Re: cross compiler gcc3.3 kernel compilation error

From:
Nicolas Pitre <[email protected]>


To:
John K Luebs <[email protected]>


CC:
mingz <[email protected]>, <[email protected]>


Date:
Today 21:21:11


On Mon, 14 Jul 2003, John K Luebs wrote:

> On Fri, Jul 11, 2003 at 10:56:52PM -0400, mingz wrote:
> > Hi, recently I tried to build out a gcc3.3 cross-compile toolchain.
> > When I use it to compile 2.4.19-rmk7-ds2 It reports error:
> >
> > blkpg.c: In function `blk_ioctl':
> > blkpg.c:252: error: asm-specifier for variable `__r1' conflicts with asm
> > clobber list
> > blkpg.c:252: confused by earlier errors, bailing out
> > make[3]: *** [blkpg.o] Error 1
> > make[3]: Leaving directory `/tmp/cross/linux-2.4.19/drivers/block'
> > make[2]: *** [first_rule] Error 2
> > make[2]: Leaving directory `/tmp/cross/linux-2.4.19/drivers/block'
> > make[1]: *** [_subdir_block] Error 2
> > make[1]: Leaving directory `/tmp/cross/linux-2.4.19/drivers'
> > make: *** [_dir_drivers] Error 2
>
> I think this is probably because of some buggy inline asm that gcc
> is now simply being anal about. It is nonsensical to put a register
> in both an input or output and the clobber list for a block of
> inline asm.
> I bet there is an explicit r1 reg variable that is then
> being used in the output of some inline assembly. r1 is in the clobbers
> list as well.
>
> If this is the case, you need to remove "r1" listed after the third colon
> (the clobbers list) in the inline assembly block at the line referenced
> in the error. You should not have to touch the assembly code itself.

... and then watch your kernel corrupt your filesystem, exhibit strange
behavior, crash in strange ways, or eat your pizza and drink your cofee.  In
other words, don't just remove r1 from the clobber list without
understanding _why_ it was there in the first place.  And no, you can't go
away without actually modifying the assembly to fix this problem.

Hint: http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=1540/1
(this is for 2.5 but the same thing must be done to 2.4)


Nicolas
---------------------------------
On Sat, 12 Jul 2003, Griego, David A wrote:

> Unless you have a need for gcc3.3 I would build gcc-3.2.3.  I had the
> same problem as you and decised just to use 3.2.3

Note that gcc-3.2.3 is known to miscompile kernels and probably other ARM
stuff.  The only gcc version >= 3 that seems to be OK for ARM out of the box
so far is gcc 3.3.


Nicolas
-----------------------------------


so i think u had better use that 2.95.3 still. after i try the patch for 3.3. i will report the results here.
回复

使用道具 举报

发表于 2003-7-16 02:17:17 | 显示全部楼层
this maybe helpful

http://kegel.com/crosstool/

i am still trying the gcc 3.3.

回复

使用道具 举报

发表于 2003-7-16 10:59:09 | 显示全部楼层
after some hacks, the gcc3.3 can be used to compile the kernel. at least i use it to compile and boot on board.
i will keep tracing and summary when it is stable.
回复

使用道具 举报

 楼主| 发表于 2003-7-16 16:55:23 | 显示全部楼层
checking for long double... yes
checking size of long double... configure: error: cannot compute sizeof (long double), 77
See `config.log' for more details.

我在编译glibc时出现了如上问题,我用的是2.3.2版本.
操作命令如下:
[root@jmcar glibc]# /tars/SourceDir/glibc-2.3.2/configure --target=arm-linux --prefix=/armtools/arm-linux --enable-add-ons --with-headers=/armtools/arm-linux/include
回复

使用道具 举报

 楼主| 发表于 2003-7-16 17:01:46 | 显示全部楼层
在编译GCC-3.2.3时出现下列问题
HEADERS="auto-host.h ansidecl.h  dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h defaults.h" DEFINES="POSIX" \
TARGET_CPU_DEFAULT="TARGET_CPU_generic" \
/bin/sh ./mkconfig.sh config.h
config.h is unchanged
HEADERS="auto-host.h ansidecl.h  dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h defaults.h" DEFINES="POSIX" \
TARGET_CPU_DEFAULT="TARGET_CPU_generic" \
/bin/sh ./mkconfig.sh hconfig.h
hconfig.h is unchanged
make: *** No rule to make target `../libiberty/libiberty.a', needed by `gengenrtl'.  Stop.
操作命令如下:
[root@jmcar gcc]# ./configure --target=arm-linux --prefix=/armtools -without-headers --enable-languages=c --with-local-prefix=/armtools/arm-linux --with-newlib --disable-shared
最后提示说auto-host.h is unchanged
然后我
[root@jmcar gcc]# make all install
结果就如上问题出现了
回复

使用道具 举报

发表于 2003-7-16 21:33:15 | 显示全部楼层
wait a while for glibc. we are still discussing the glibc problem online. i will give a solution later. try gcc first.
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-5-22 10:58 , Processed in 0.145752 second(s), 12 queries .

© 2021 Powered by Discuz! X3.5.

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