参考: http://www./wiki/ForeignToolchains http:///repos/1.0/sb-toolchain-extras/ sudo apt-get install darcs sudo apt-get install dh-buildinfo //拷贝工具链 sudo cp arm-linux/ -raf /scratchbox/compilers/arm-linux-gcc-3.4.5-glibc-2.3.3 //下载工具 cd /scratchbox darcs get --set-scripts-executable http:///repos/1.0/sb-toolchain-extras //得到配置文件。记得要自己修改一下.conf文件 cd /scratchbox/compilers/arm-linux-gcc-3.4.5-glibc-2.3.3 /scratchbox/sb-toolchain-extras/confhelper/create_toolchain_conf.py > /scratchbox/sb-toolchain-extras/meta/alien-tc/arm-linux-gcc-3.4.5-glibc-2.3.3.conf 比如: ARCH = arm SUB_ARCH = $(ARCH) VENDOR = unknown- TOOLCHAIN_PREFIX_END = gnu- TARGET_END = -gnu 交叉编译工具命名为:arm-unknown-linux-gnu- //进到/scratchbox/sb-toolchain-extras 文件夹之后 //下载东东,主要就是gdb之类的东西,如果下过一遍了,下次做的时候就别下了 :) make CONFIG=meta/alien-tc/arm-linux-gcc-3.4.5-glibc-2.3.3.conf -C meta/alien-tc/ all-sums //一般是不会出错了,如果出错,你就把出错的那个Makefile文件里面的关于gdb的那句话去掉就好了。 make CONFIG=meta/alien-tc/arm-linux-gcc-3.4.5-glibc-2.3.3.conf -C meta/alien-tc //基本上你把工具链添加成功了 进入sb,然后sb-menu,创建你自己的target,让交叉编译见鬼去吧。 说实话,sb相对openembedded是要好控制一些。对于我们作嵌入式的,sb是个好东西。 如果大家有什么问题,可以到官方网站上看他们的邮件列表。如果我可以帮你,我也很乐意 -------------------------------------------------------------------------------------------------------------------------------- 在Ubuntu 10.04和debian/squeeze系统上不能添加外部工具链,在编译步骤 make CONFIG=meta/alien-tc/arm-linux-gcc-3.4.5-glibc-2.3.3.conf -C meta/alien-tc 出现一些奇怪的错误,比如找不到文件,但是指定路径下明明有相应的文件,未解决。 目前,只能在debian/lenny系统上添加外部工具链,之后通过命令打包 make tarbal deb CONFIG=meta/alien-tc/arm-linux-gcc-3.4.5-glibc-2.3.3.conf 拷贝到其他系统使用
Foreign ToolchainsThis page describes how to use foreign toolchains, ie toolchains compiled outside scratchbox, such like [http://www./gnu_toolchains/developers.html CodeSourcery], [http://buildroot./ BuildRoot] or [http:///crosstool/ crosstool].
Finding a suitable toolchain for scratchboxNot all prebuilt toolchains are going to work with sb. For arm, the toolchain should have C library and binutils, support for dynamic libraries, no TLS support (or relatively new qemu and/or 2.6 target kernel).
Installation
UnpackingExtract the prebuilt toolchain to your COMPILER_DIR: eg. /scratchbox/compilers/arm-linux-withmyhacks . The COMPILER_DIR should probably now have subdirectories like bin,your-arch-name and lib. For the alien wrapper to work, you must have Scratchbox version 1.0.3 or newer (Apophis branch) and the compiler must work when invoked directly, eg. /scratchbox/compilers/arm-linux-withmyhacks/bin/your-arch-name-gcc --version
ConfiguringTo actually use the foreign toolchain in the scratchbox compilation environment, some configuration must be done. To be more precise, we need some tools for the target (eg. sbrsh, strace, fakeroot, gdb), some toolchain specific tools to the scratcbox (eg. libtool), a script to setup the target for this toolchain, and some meta-information about the architecture of the target so that scratchbox can provide sane build environment. Fortunately, there are some more tools to aid through the configuration process.
Configuring using the create_toolchain_conf -helper
Configuring manually
Building auxiliary tools
Create new targetNow you can use sb-menu to setup the target as usual. For quick testing, you can use tests/env/run.sh from http:///repos/1.0/scratchbox.
Building packagesFor redistribution, you probably want to build packages when you have working toolchains. Remember to redistribute the sources as well. make tarball deb CONFIG=meta/alien-tc/yourconfig.conf
Former Issues
Target C library is not found at runtime/lib/libc.so and/or /usr/lib/libc.so might contain absolute(and incorrect) pathnames; they should be removed.
The shadow package failsYou might get something like aclocal: configure.in: 12: macro `AM_DISABLE_SHARED' not found in library aclocal: configure.in: 13: macro `AM_ENABLE_STATIC' not found in library aclocal: configure.in: 21: macro `AM_PROG_LIBTOOL' not found in library if the libtool exists, but is misconfigured. Some versions don't install the m4 files to ./share/aclocal.
PerlPerl might not compile, especially when using sbrsh. Most of the issues can be circumvented by compiling miniperl using host-gcc instead of target-gcc. Patch taken and modified from ["MIPS Crocodile"].
Other issuesDepending on your toolchain, you might need some additional compiler-prefixes into your scratchbox.config for some build-systems. Just add those to /targets/links/scratchbox.config, line SBOX_CROSS_GCC_PREFIX_LIST e.g. If you get error like this: make[1]: Entering directory `/home/jussi/crocodile/work/build/zlib-1.2.2/build-tree/zlib-1.2.2' arm-linux-gcc -O3 -g -D_REENTRANT -fPIC -DNO_snprintf -DHAS_sprintf_void -DNO_ERRNO_H -c -o example.o example.c sb_gcc_wrapper (arm-linux-gcc): arm-linux-gcc cannot be recognized Maybe you are trying to run a compiler of a wrong architecture? make[1]: *** [example.o] Error 1 then just add arm-linux- to SBOX_CROSS_GCC_PREFIX_LIST in /targets/links/scratchbox.config. Toolchains |
|