This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question on building cross tool chain


Hi Zhu,
I'm not so familiar with uclibc, and would have some trouble debugging
your (rather impressively documented) procedure, especially without
it being expressed as an automated shell script.   A few questions, though:
1. why such an old binutils?
2. would you consider using crosstool plus the recently posted uclibc support patch
   as an alternate build procedure for comparison?

Also, please don't email me directly.  Instead, email questions like
this to the crossgcc or etux mailing lists; I can read them there as well.
There are more experts there, so if I can't answer, they might.
- Dan

zhupengfeicn wrote:
Dear Dan:
I need your help. I am compliling cross tool chain for ARM7TDMI, I choose binutils-2.10.1, gcc-2.95.3 and uClibc-0.9.26, the Linux kernel I use is Linux-2.4.20 and I patched with uClinux patch for this kernel.
My steps are as following:

1.	set up workspace
1.1	create subdirectory in /home/zpf/haimai:
$ mkdir bootldr build-tools debug doc images kernel project rootfs sysapps tmp tools
bootldr: The bootloader or bootloaders for the target
build-tools The packages and directories needed to build the cross-platform development toolchain
debug: The debugging tools and all related packages
doc: All the documentation need for the project
images: The binary images of the bootloader, the kernel, and the root filesystem ready to be used on the target
kernel: The different kernel versions for the target
project: My own source code for this project
rootfs: The root filesystem as seen by the target's kernel at runtime
sysapps: The system applications required for the target
tmp: A temporary directory to experiment and store transient files
tools: The complete cross-platform development toolchain and C library
all packages downloaded are put in build-tools directory.
1.2	Write a shellscript haimai.sh to export environment variables:
export PROJECT=haimai
export PRJROOT=/home/zpf/${PROJECT}
export TARGET=arm-linux
export PREFIX=${PRJROOT}/tools
export TARGET_PREFIX=${PREFIX}/${TARGET}
export PATH=${PREFIX}/bin:${PATH}
cd $PRJROOT


2. kernel headers set up
download Linux kernel 2.4.20 from:
http://www.kernel.org/pub/linux/kernel/v2.4/


download kernel patch for uClinux from: http://www.uClinux.org/pub/uClinux/uClinux-2.0.x/ unpack the kernel and patch to ${PRJROOT}/kernel, patch the kernel:
$ patch -p1 < uClinux-2.4.20-uc1.diff
then begin to configure the kernel, run make menuconfig: $ make ARCH=armnommu CROSS_COMPILE=arm-linux- menuconfig
$ make dep
only select the CPU type during this step.


after this, copy the kernel head to ${TARGET_PREFIX}
$ mkdir -p ${TARGET_PREFIX}/include
$ cp -r include/linux/ ${TARGET_PREFIX}/include
$ cp -r include/asm-armnommu/ ${TARGET_PREFIX}/include/asm
$ cp -r include/asm-generic/ ${TARGET_PREFIX}/include


3. build binutils
$ ../binutils-2.10.1/configure --target=$TARGET --prefix=${PREFIX} $ make
$ make install
after this step, binutils can be seen in ${PREFIX}/bin:
$ ls ${PREFIX}/bin
arm-linux-addr2line arm-linux-ld arm-linux-readelf
arm-linux-ar arm-linux-nm arm-linux-size
arm-linux-as arm-linux-objcopy arm-linux-strings
arm-linux-c++filt arm-linux-objdump arm-linux-strip
arm-linux-gasp arm-linux-ranlib
A copy of some of the utilities without the prepended target name is also installed in the ${PREFIX}/${TARGET}/bin directory.



4. build bootstrap gcc $ ../gcc-2.95.3/configure --target=$TARGET --prefix=${PREFIX} --without-headers --with-newlib --enable-languages=c

this step seemed to have missed to copy some files to ${PREFIX}/${TARGET}/sys-include
so the next step go wrong:
$ make all ¨Cgcc
error: something about pthread.h
To solve this problem, Edit gcc/config/arm/t-linux
and add
-Dinhibit_libc and -D__gthr_posix_h
to:
TARGET_LIBGCC2_CFLAGS.

After edition of the file ,run configure with disable-threads option:
$ ../gcc-2.95.3/configure --target=$TARGET --prefix=${PREFIX}  --without-headers --with-newlib --enable-languages=c --disable-threads
then run:
$ make all-gcc
no error message this time.

With the compilation complete, install gcc:
$ make install-gcc
Check ${PREFIX}/bin, we can find arm-linux-gcc is there.


5. build uClibc $ make CROSS=i386-linux- menuconfig In Target Architecture option, I select arm; In Target Architecture Features and Options: In Target Process Type, I choose generic arm; Disable MMU and Float Point Number Support; The Linux kernel header location is set to ${PRJROOT}/kernel/linux-2.4.20; In Library Installation Options: shared library loader path is set to /lib uClibc runtime library directory is set to /home/zhupf/haimai/tools/RTLib uClibc development environment directory (DEVEL_PREFIX) is set to ${PRJROOT}/tools/DevEnv

after menuconfig, then:
$ make CROSS=arm-linux-
$ make CROSS=arm-linux- PREFIX="" install


6. build complete gcc first edit the file gcc/config/arm/t-linux $ cd ${PRJROOT}/build-tools/build-gcc $ ../gcc-2.95.3/configure --target=$TARGET --prefix=${PREFIX} --enable-languages=c,c++ $ make all

In step6, some error message appear (I append the result of make all below), so could anybody tell me what is wrong? and what should I do?


---------------------------------------------------------------- make[1]: Entering directory `/home/zhupf/haimai/build-tools/build-gcc/libiberty'make[2]: Entering directory `/home/zhupf/haimai/build-tools/build-gcc/libiberty/testsuite' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/zhupf/haimai/build-tools/build-gcc/libiberty/testsuite' make[1]: Leaving directory `/home/zhupf/haimai/build-tools/build-gcc/libiberty' make[1]: Entering directory `/home/zhupf/haimai/build-tools/build-gcc/texinfo' make all-recursive make[2]: Entering directory `/home/zhupf/haimai/build-tools/build-gcc/texinfo' Making all in intl make[3]: Entering directory `/home/zhupf/haimai/build-tools/build-gcc/texinfo/intl' make[3]: Nothing to be done for `all'. make[3]: Leaving directory `/home/zhupf/haimai/build-tools/build-gcc/texinfo/intl' Making all in lib make[3]: Entering directory `/home/zhupf/haimai/build-tools/build-gcc/texinfo/lib' make[3]: Nothing to be done for `all'. make[3]: Leaving directory `/home/zhupf/haimai/build-tools/build-gcc/texinfo/lib' Making all in makeinfo make[3]: Entering directory `/home/zhupf/haimai/build-tools/build-gcc/texinfo/makeinfo' make[3]: Nothing to be done for `all'. make[3]: Leaving directory `/home/zhupf/haimai/build-tools/build-gcc/texinfo/makeinfo' make[2]: Leaving directory `/home/zhupf/haimai/build-tools/build-gcc/texinfo' make[1]: Leaving directory `/home/zhupf/haimai/build-tools/build-gcc/texinfo' make[1]: Entering directory `/home/zhupf/haimai/build-tools/build-gcc/etc' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/home/zhupf/haimai/build-tools/build-gcc/etc' make[1]: Entering directory `/home/zhupf/haimai/build-tools/build-gcc/gcc' (cd intl && make all) make[2]: Entering directory `/home/zhupf/haimai/build-tools/build-gcc/gcc/intl' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/zhupf/haimai/build-tools/build-gcc/gcc/intl' if [ -f libgcc2.ready ] ; then \ true; \ else \ touch libgcc2.ready; \ fi make[1]: Leaving directory `/home/zhupf/haimai/build-tools/build-gcc/gcc' Configuring in arm-linux/libiberty loading cache ./config.cache checking host system type... arm-unknown-linux-gnu checking build system type... i686-pc-linux-gnu checking for arm-linux-ar... arm-linux-ar checking for arm-linux-ranlib... arm-linux-ranlib checking for gcc... /home/zhupf/haimai/build-tools/build-gcc/gcc/xgcc -B/home/zhupf/haimai/build-tools/build-gcc/gcc/ -B/home/zhupf/haimai/tools/arm-linux/bin/ checking whether we are using GNU C... yes checking whether /home/zhupf/haimai/build-tools/build-gcc/gcc/xgcc -B/home/zhupf/haimai/build-tools/build-gcc/gcc/ -B/home/zhupf/haimai/tools/arm-linux/bin/ accepts -g... yes checking for POSIXized ISC... no checking for a BSD compatible install... /usr/bin/install -c xhost-mkfrag is unchanged checking how to run the C preprocessor... /home/zhupf/haimai/build-tools/build-gcc/gcc/xgcc -B/home/zhupf/haimai/build-tools/build-gcc/gcc/ -B/home/zhupf/haimai/tools/arm-linux/bin/ -E checking for sys/file.h... yes checking for sys/param.h... yes checking for stdlib.h... yes checking for string.h... yes checking for unistd.h... yes checking for strings.h... yes checking for sys/time.h... yes checking for sys/resource.h... yes checking for sys/wait.h that is POSIX.1 compatible... yes checking whether the C compiler (/home/zhupf/haimai/build-tools/build-gcc/gcc/xgcc -B/home/zhupf/haimai/build-tools/build-gcc/gcc/ -B/home/zhupf/haimai/tools/arm-linux/bin/ -g -O2 ) works... no configure: error: installation or configuration problem: C compiler cannot create executables. make[1]: Entering directory `/home/zhupf/haimai/build-tools/build-gcc/arm-linux/libio' test x"no" != xyes ||\ /home/zhupf/haimai/build-tools/build-gcc/gcc/xgcc -B/home/zhupf/haimai/build-tools/build-gcc/gcc/ -B/home/zhupf/haimai/tools/arm-linux/bin/ -c -g -O2 -I. -I../../../gcc-2.95.3/libio -D_IO_MTSAFE_IO ../../../gcc-2.95.3/libio/iogetline.c -o pic/iogetline.o /home/zhupf/haimai/build-tools/build-gcc/gcc/xgcc -B/home/zhupf/haimai/build-tools/build-gcc/gcc/ -B/home/zhupf/haimai/tools/arm-linux/bin/ -c -g -O2 -I. -I../../../gcc-2.95.3/libio -D_IO_MTSAFE_IO ../../../gcc-2.95.3/libio/iogetline.c In file included from ../../../gcc-2.95.3/libio/iogetline.c:26: ../../../gcc-2.95.3/libio/libioP.h:38: bits/libc-lock.h: No such file or directory In file included from ../../../gcc-2.95.3/libio/iolibio.h:1, from ../../../gcc-2.95.3/libio/libioP.h:47, from ../../../gcc-2.95.3/libio/iogetline.c:26: ../../../gcc-2.95.3/libio/libio.h:30: _G_config.h: No such file or directory ../../../gcc-2.95.3/libio/libio.h:167: bits/stdio-lock.h: No such file or directory make[1]: *** [iogetline.o] Error 1 make[1]: Leaving directory `/home/zhupf/haimai/build-tools/build-gcc/arm-linux/libio' make: *** [all-target-libio] Error 2

______________________________________

×¢²áÐÂÀË30Õ×Ãâ·ÑÓÊÏ䣨 http://mail.sina.com.cn/chooseMode.html £©

===================================================================
×¢²áÓн±,Ë«ÖؾªÏ²!JOIN NOW! (http://ad4.sina.com.cn/wx/ads/zhuiyu_hprefresh1.html)





--
My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]