View Single Post
Old 09-21-2008, 03:14 AM   #1
ericshliao
Guru
ericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enough
 
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
Integration of ScratchBox and iRex Official SDK

I want to integrate iRex Official SDK with ScratchBox, instead of crosstool. After some trial and error, I can setup a Target in ScratchBox with the Official SDK.

Reference: http://www.scratchbox.org/wiki/ForeignToolchains

I have succeeded in compiling a "Hello World" app with SDK in ScratchBox and its running in iLiad. So, the following steps are working.

*System Requirement: Debian 4. I don't know if the following steps work for system other than Debian 4.

*Required or packages:
darcs
fakeroot
debhelper

*In Synaptic Package Manager, add a line "deb http://scratchbox.org/debian/ apophis main" in Repositories setup. You can also add that line in /etc/apt/sources.list. Then you can install required ScratchBox with Synaptic Package Manager.

*Required ScratchBox Package (version number omitted):
scratchbox-core
scratchbox-devkit-cputransp
scratchbox-devkit-debian
scratchbox-devkit-doctools
scratchbox-devkit-perl
scratchbox-libs
scratchbox-toolchain-host-gcc

*Create a user in Linux. In my case, "iliaddev".
*Login as iliaddev.
IMPORTANT: Formally, the following steps should be done inside scratchbox, but I found it also works for outside scratchbox.

*Unpack official SDK in /
Code:
sudo tar jxf *.bz2
*
Code:
sudo mv /usr/local/arm/oe /scratchbox/compilers
*
Code:
cd /scratchbox
*
Code:
sudo darcs get --set-scripts-executable http://scratchbox.org/repos/1.0/sb-toolchain-extras
. Wait for download and install.
*
Code:
sudo chmod --recursive 777 /scratchbox/
*
Code:
cd /scratchbox/compilers/oe
*before going to next step, temporarily remove /scratchbox/compilers/oe/arm-linux/include/mozilla-minimo/system_wrappers/linux/version.h. After the next step finished, restore it.

*
Code:
/scratchbox/sb-toolchain-extras/confhelper/create_toolchain_conf.py > /scratchbox/sb-toolchain-extras/meta/alien-tc/arm-linux-iliad.conf
*Edit "/scratchbox/sb-toolchain-extras/meta/alien-tc/arm-linux-iliad.conf". Make it contain the following lines (exactly the same) and leave other lines unmodified:

Code:
COMPILER_PACKAGE = oesdk
VENDOR =
TOOLCHAIN_PREFIX_END =
TARGET_END =

*
Code:
cd /scratchbox/sb-toolchain-extras
*
Code:
make CONFIG=meta/alien-tc/arm-linux-iliad.conf -C meta/alien-tc all-sums
*
Code:
make CONFIG=meta/alien-tc/arm-linux-iliad.conf -C meta/alien-tc
. Ignore error messages.

*the next step might not be needed. I am not sure.
*
Code:
make CONFIG=meta/alien-tc/arm-linux-iliad.conf -C toolchain/post-install/ install
*
Code:
sudo /scratchbox/sbin/sbox_adduser iliaddev
*
Code:
/scratchbox/login
. You will be switched to ScratchBox environment.
If unable to login because of ERROR: '/scratchbox/sbin/chroot-uid' is not suid ROOT, execute "sudo chmod u+s /scratchbox/sbin/chroot-uid".

*
Code:
sb-menu
You will enter SB setup menu.

*Choose "Setup". Enter a name for your iLiad development environment. Choose "oe cross". In select devkits, choose "cputransp" and "qemu-arm-0.8.2-sb". Check everything to install. Select it as your Target.

*Done.

In ScratchBox:
*If pkg-config is needed when compiling, "export PKG_CONFIG_PATH=/scratchbox/compilers/oe/arm-linux/lib/pkgconfig". Or sbox$ echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig" >> .bash_profile & sbox$ source .bash_profile to make it permanent.

*make a link in /usr/local/arm/oe/arm-linux for /scratchbox/compilers/oe/arm-linux/lib and /scratchbox/compilers/oe/arm-linux/include
*If c++ header files is needed, they are in /scratchbox/compilers/oe/include/c++/3.4.4. use ./configure CPPFLAGS=-I to make gcc search for c++ headers there.

Last edited by ericshliao; 11-25-2008 at 02:52 PM.
ericshliao is offline   Reply With Quote