Creating OE toolchain
build your preferred OE toolchain
vi build/conf/local.conf bitbake task-sdk mkdir -p /scratchbox/compilers/arm-angstrom-linux-gnueabi-4.1/arm-angstrom-linux-gnueabi/libc cp -a tmp/cross/* /scratchbox/compilers/arm-angstrom-linux-gnueabi-4.1/ cp -a tmp/work/armv5te-angstrom-linux-gnueabi/glibc-2.5-r5/install/*/* /scratchbox/compilers/arm-angstrom-linux-gnueabi-4.1/arm-angstrom-linux-gnueabi/libc cd /scratchbox/compilers/arm-angstrom-linux-gnueabi-4.1 mv include include_ ln -s arm-angstrom-linux-gnueabi/include .
If you do not use an Angström toolchain you need to change arm-angstrom-linux-gnueabi to arm-linux in the line above.
Catch: remove fail-fast from org.openembedded.dev/conf/bitbake.conf or your toolchain will not work in scratchbox
TODO: task-sdk-sbox :
- add: fakeroot sbrshd gdb and strace packages
- end result could be a crosstoolchain tarball + rootstrap tarball
Making sbox toolchains with sb-toolchain-extras
This is the normal way how ForeignToolchains are imported to sbox.
get scratchbox toolchain extras darcs get --set-scripts-executable http://scratchbox.org/repos/1.0/sb-toolchain-extras create a proper oe-gcc-4.1.conf
cd /scratchbox/compilers/arm-angstrom-linux-targetname ~/sb-toolchain-extras/confhelper/create_toolchain_conf.py > ~/sb-toolchain-extras/meta/alien-tc/oe-gcc.conf vi oe-gcc.conf
Edit the resulting oe-gcc.conf
For the typical OE-built compilers (except of the Angstrom EABI one) you need to set the package name and change the architecture naming section to read something like this:
ARCH = arm SUB_ARCH = $(ARCH) VENDOR = TOOLCHAIN_PREFIX_END = TARGET_END =
Then cd to ~/sb-toolchain-extras/ and build the remaining bits:
make CONFIG=meta/alien-tc/oe-gcc.conf -C meta/alien-tc all-sums make CONFIG=meta/alien-tc/oe-gcc.conf -C meta/alien-tc
The lightweight build
make CONFIG=meta/alien-tc/oe-gcc.conf -C toolchain/post-install/ install
This will skip building fakeroot, sbrshd, gdb and strace, as well as creating target .deb:s in compiler/packages.
Scratchbox toolchain requirements
Scratchbox needs the following files in the root of
- /scratchbox/compilers/arm-angstrom-linux-gnueabi-4.1/
compiler-name
arm-angstrom-linux-gnueabi-4.1:/scratchbox/compilers/arm-angstrom-linux-gnueabi-4.1:arm:angstrom-linux-gnueabi:glibc:armel
This is generated in toolchain/post-install/Makefile from the following information:
echo "$(COMPILER_NAME):$(COMPILER_DIR):$(SUB_ARCH):$(TARGET_OS):$(LIBC_NAME):$(ARCH)" > $(COMPILER_DIR)/compiler-name
In this case I used ARCH=armel and SUBARCH=arm, which is somewhat wrong, and only relevant for debian targets, so perhaps OE task-sdk-sb could just use ARM/ARM.
target-setup.sh
This script is called when user runs:
sb-conf install -c
Ie. copies c-library and it's support binaries to /lib and /bin. This is also created in toolchain/post-install/Makefile
gcc.specs
*cross_compile: 0 %rename cpp old_cpp *cpp: -isystem /usr/local/include -isystem /usr/include %(old_cpp)
Very straightforward
toolchain symlinks
Now, due to the gcc wrapper, this is the most black magic part of sbox toolchains:
cd /scratchbox/compilers/arm-angstrom-linux-gnueabi-4.1/bin && \ ln -sf arm-angstrom-linux-gnueabi-gcc arm-angstrom-linux-gnueabi-cc && \ ln -sf arm-angstrom-linux-gnueabi-gcc arm-angstrom-linux-gnueabi-gcc-4.1 && \ ln -sf arm-angstrom-linux-gnueabi-g++ arm-angstrom-linux-gnueabi-g++-4.1 && \ for f in arm-angstrom-linux-gnueabi-*; do n=$(echo sbox-$f); ln -sf $f $n; done