CSSU-thumb toolchain setup (gcc4.7.2-linaro)

(Categories)
(-Development; Scratchbox is already in Development, so Duplicating is not needed)
Line 85: Line 85:
-
[[Category:Development]]
 
[[Category:Documentation]]
[[Category:Documentation]]
[[Category:Fremantle]]
[[Category:Fremantle]]
[[Category:Scratchbox]]
[[Category:Scratchbox]]

Revision as of 02:44, 16 December 2014

This document describes how to setup the CSSU-thumb toolchain (gcc4.7.2-linaro) in scratchbox.


GCC 4.7.2 does not produce thumb binaries by default, you should pass -mthumb if you want thumb resulting executables! without -mthumb it produces regular ARM ELFs


1. You need to have ScratchBox environment already set up.

2. Download gcc-4.7.2-linaro toolchain and extract it under /scratchbox/compilers (may need root privileges for extracting there)

tar xvf linaro-4.7-2012.07-fremantle-armv7a.tar.bz2

3. Create new ScratchBox target FREMANTLE_ARMEL_GCC472

- Login to ScratchBox

$ /scratchbox/login

- Create new ScratchBox target

[sbox->:~]sb-conf st FREMANTLE_ARMEL_GCC472 -c linaro-4.7-2012.07-fremantle-armv7a -d qemu:perl:debian-etch:doctools:svn:git -t qemu-arm-sb

replace debian-etch with debian-squeeze if you use ScratchBox Hathor release

[sbox->:~]sb-conf se FREMANTLE_ARMEL_GCC472
[sbox-FREMANTLE_ARMEL_GCC472: ~] > sb-conf rs maemo-sdk-rootstrap_5.0_20.2010.36-2_armel.tgz
[sbox-FREMANTLE_ARMEL_GCC472: ~] > sb-conf in -edL
[sbox-FREMANTLE_ARMEL_GCC472: ~] > dpkg -i /scratchbox/compilers/linaro-4.7-2012.07-fremantle-armv7a/packages/libfakeroot_1.14.4-0+sb1_armel.deb
[sbox-FREMANTLE_ARMEL_GCC472: ~] > apt-get update
[sbox-FREMANTLE_ARMEL_GCC472: ~] > fakeroot apt-get install maemo-sdk-debug

- Accept Maemo5 SDK EULA and copy the URL. Add nokia-binaries repository URL to /etc/apt/sources.list

[sbox-FREMANTLE_ARMEL_GCC472: ~] >apt-get update
[sbox-FREMANTLE_ARMEL_GCC472: ~] >fakeroot apt-get install nokia-binaries nokia-apps
[sbox-FREMANTLE_ARMEL_GCC472: ~] >rm -rf /targets/FREMANTLE_ARMEL_GCC472/opt
[sbox-FREMANTLE_ARMEL_GCC472: ~] >mkdir /targets/FREMANTLE_ARMEL_GCC472/opt

- Download ScratchBox errata dependency provider package sb-thumb-errata-provider_0.1-1_armel.deb and install it

dpkg -i sb-thumb-errata-provider_0.1-1_armel.deb

- Add CSSU-testing and CSSU-thumb repos to your /etc/apt/sources.list

echo "deb http://repository.maemo.org/community-testing/ fremantle free non-free" >> /etc/apt/sources.list
echo "deb-src http://repository.maemo.org/community-testing/ fremantle free" >> /etc/apt/sources.list
echo "deb http://maemo.merlin1991.at/cssu/community-thumb/ fremantle free non-free" >> /etc/apt/sources.list
echo "deb-src http://maemo.merlin1991.at/cssu/community-thumb/ fremantle free" >> /etc/apt/sources.list

Remove unneeded package maemo-core-debug

apt-get remove maemo-core-debug

Upgrade your target to latest CSSU-thumb

[sbox-FREMANTLE_ARMEL_GCC472: ~] >apt-get update
[sbox-FREMANTLE_ARMEL_GCC472: ~] >fakeroot apt-get upgrade

Download and install libstdc++6-dev_4.7.2-0+cssu0_armel.deb

dpkg -i libstdc++6-dev_4.7.2-0+cssu0_armel.deb

It can complain about libstdc++6 on system is 4.2.1-4maemo13+0m5.

apt-get -f install

can fix that by installing the proper libstdc++6 afterwards.


Create FREMANTLE_ARMEL_GCC472.environment in your /targets directory

echo "export DEB_BUILD_OPTIONS=maemo-launcher,thumb,vfp" > /targets/FREMANTLE_ARMEL_GCC472.environment

Your target should be ok at that point. Make sure to reenter the target, so updated FREMANTLE_ARMEL_GCC472.environment to take effect


Interesting new flags can be: -mfpu=neon -ftree-vectorize -fgraphite -lto

The compiler will give the following warning:

/scratchbox/compilers/linaro-4.7-2012.07-fremantle-armv7a/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/../../../../arm-none-linux-gnueabi/bin/ld: BFD (GNU Binutils) 2.22 assertion fail ../../../sources/binutils-2.22/bfd/elf32-arm.c:11467

These warnings can be ignored. For some reason, the linker thinks that the object is hardfp, but as it is softfp the assertion fails.