=============================================== HOWTO CREATE OPEN2X TOOLCHAIN TO THE SCRATCHBOX =============================================== Precompiled toolchains for application development * scratchbox-toolchain-arm-open2x-linux_1.0.15_i386.deb * scratchbox-toolchain-arm-open2x-linux-1.0.15-i386.tar.gz Instructions are for application development only. Kernel is so easy to cross compile. You do not need to do it with the Scratchbox. ========= ChangeLog ========= ------------- v0.1 - 090810 ------------- * Created ------------- v0.2 - 090810 ------------- * Fix Scratchbox toolchain configuration part * Remove useless manually symlinking. Problem was with the config * Add how to add release to the package * Add how to remove fix problems with ownership ======= PROBLEM ======= I got problems with compiling SDL with method Open2x is usually compiled. It tries to use headers from /usr/include and those headers are not compatible. Result is that compiling fails. I didn't find nice solution to the problem. Scratchbox is good for this kind of problems. I also tried Scratchbox2. There were problems with installatiion paths. If path is something like /opt it just install apps there and does not try to find headers from path. Probably in the future that works better. Scratchbox2 is a lot lighter than Scratchbox and does not depend so hard on x86. ============ REQUIREMENTS ============ * x86, x86_64 might work * scratchbox: >=1.0.3 (do not try this with Scratchbox2) * darcs, svn and other development tools installed * some time and space on harddisk ================ USED ENVIRONMENT ================ * ubuntu intrepid (x86) * scratchbox 1.0.15 ============================ INSTALL AND SETUP SCRATCHBOX ============================ Instructions: http://www.scratchbox.org/documentation/user/scratchbox-1.0/html/installdoc.html Remember to install sb-toolchain i686-linux-gcc3.3-glibc2.3. It is used to compile open2x toolchain. ---------------------------------------------- SETUP AND SELECT HOST TARGET TO THE SCRATCHBOX ---------------------------------------------- Following list of devkits worked fine: * debian-lenny * perl * doctools ---------------------- BUILD OPEN2X TOOLCHAIN ----------------------- Resources: * http://wiki.open2x.org/open2x/wiki/index.php?title=Toolchain * http://lists.scratchbox.org/pipermail/scratchbox-users/2006-November/000781.html If your GNU/Linux have libc2.3 you can compile Open2x outside of the Scratchbox. Otherwise use host-target in the Scratchbox to compile toolchain. If you compile glibc 2.4 outside you get only problems. Common rule is to compile toolchain same or older version of gcc than version in the toolchain. Crosstool does not compile toolchain if LD_LIBRARY_PATH is setted. For example command: "Export LD_LIBRARY_PATH=" unset the environment variable in bash. Scratchbox host target: mkdir ~/open2x cd ~/open2x svn co https://open2x.svn.sourceforge.net/svnroot/open2x/trunk/toolchain-new cd toolchain-new export LD_LIBRARY_PATH= ./open2x-gp2x-apps.sh /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc\ --version Compiling takes some time. You should not have to do anything else than install missing tools. Toolchain should be ok if there is no errors. Last thing toolchain builder does is little selftest. /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc \ --version Above command should print out something like: " arm-open2x-linux-gcc (GCC) 4.1.1 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. " ============================== CREATE ALIEN/FOREIGN TOOLCHAIN ============================== Resources: http://www.scratchbox.org/wiki/ForeignToolchains ------------------------------------------ COPY TOOLCHAIN TO THE SCRATCHBOX COMPILERS ------------------------------------------ * $USER_NAME is your user * $HOST_TARGET your host targets name. Perform this part outside of the Scratchbox.. Copy just compiled toolchain to /scratchbox/compilers/. This have to do as root. sudo cp -a opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux\ /scratchbox/compilers/ ------------------------------------ SCRATCHBOX TOOLCHAIN GENERATION TOOLS ------------------------------------ Give some permissions from outside scratchbox sudo chown -R $USER_NAME:$USER_NAME /scratchbox/device_tools Next step is to create config to the toolchain. Use Scratchbox host target to perform following commands: cd ~/ darcs get --set-scripts-executable\ http://scratchbox.org/repos/1.0/sb-toolchain-extras cd /scratchbox/compilers/arm-open2x-linux ~/sb-toolchain-extras/confhelper/create_toolchain_conf.py ~/sb-toolchain-extras/confhelper/create_toolchain_conf.py >\ ~/sb-toolchain-extras/meta/alien-tc/arm-open2x-linux.conf cd ~/sb-toolchain-extras/ Just in case take backup from config: cp meta/alien-tc/arm-open2x-linux.conf ~/ Modify meta/alien-tc/arm-open2x-linux.conf (changed lines): COMPILER_PACKAGE = scratchbox-toolchain-arm-open2x-linux ALIEN_TC = yes ... TOOLCHAIN_PREFIX_END = TARGET_END = .... LIBC_FILES_BINS = bin arm-open2x-linux/bin tmp LIBC_FILES_LIBS = lib arm-open2x-linux/lib arm-open2x-linux/lib/libgcc_s.dir\ arm-open2x-linux/lib/libmudflap.dir arm-open2x-linux/lib/libssp.dir\ arm-open2x-linux/lib/libstdc++.dir Generate sums and build toolchain extras. Libtool, gdb etc. make CONFIG=meta/alien-tc/arm-open2x-linux.conf -C meta/alien-tc all-sums make CONFIG=meta/alien-tc/arm-open2x-linux.conf -C meta/alien-tc If everything went ok, at this point toolchain is selectable from sb-menu. Generate tar and debian package to other people: RELEASE=1 make tarball deb CONFIG=meta/alien-tc/arm-open2x-linux.conf You can find deb and tar from your users Scratchbox home directory. RELEASE is optional. It adds VERSION-RELEASE to the tarball and deb name. =========== TEST ROOTFS =========== Toolchain it should be tested. But first have to make target. ------------------------------ SETUP OPEN2X SCRATCHBOX TARGET ------------------------------ Inside scratchbox: sb-menu * Setup * - give some name to the Open2x target * Toolchain selection - arm-open2x-linux * Devkist - example - cputransparency - doctools - git - svn - perl * CPU transparency - qemu-arm-cvs-m * There is no rootstrap at this point (see: 'HOW TO USE ROOTSTRAP') * Yes we want to install files to target * Defaults are ok [X] C-library Install libc and related binaries [ ] C-runtime Install c runtime without libc [X] /etc Install passwd, group, mtab, etc. [X] Devkits Install files needed by devkits [X] Debug links Install debugging symlinks [X] fakeroot Install fakeroot 1.4.2.1 ... or: [X] C-library Install libc and related binaries [ ] C-runtime Install c runtime without libc [X] /etc Install passwd, group, mtab, etc. [X] Devkits Install files needed by devkits [ ] Debug links Install debugging symlinks [X] fakeroot Install fakeroot 1.4.2.1 ... * Hit ok and choose the target Test gcc again: gcc --version " sbox-arm-open2x-linux-gnueabi-gcc (GCC) 4.1.1 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. " =============== GENERATE ROOTFS =============== ----------------- COMPILE LIBRARIES ----------------- Getting svn tree can be done inside or outside of the Scratchbox: This is done inside SB. cd ~/open2x svn co https://open2x.svn.sourceforge.net/svnroot/open2x/libs cd libs Copy files open2x-fixes.sh, open2x-libs-sbox.sh and makefile-sbox.o2x to the libs-directory. There is some fixes and sbox scripts to the libs. Modify PREFIX from the open2x-libs-sbox.sh (default:/usr) to your needs. ...and then run inside Open2x target: ./open2x-fixes.sh ./open2x-libs-sbox.sh After compiling you have basic libraries under your targets /usr directory. ----------------- HOWTO PACK ROOTFS ----------------- USER_NAME = your username TARGET_NAME = open2x Scratchbox target name. Outside Scratchbox: cd /scratchbox/users/$USER_NAME/targets/$TARGET_NAME sudo tar czvf /tmp/open2x-rootstrap-libs.tar.gz . -------------------- HOW TO USE ROOTSTRAP -------------------- * Copy open2x-rootstrap-libs.tar.gz to /scratchbox/packages/. * When creating new target setup asks do you want to extract rootfs. Say yes to this, choose file alternative and choose open2x-rootstrap-libs.tar.gz or what ever you have done. * I didn't have to choose anything from the list of the installable files * Now you have already installed libraries and can just start compile other things There can be some files owned by root for some reason and build fails for that. /scrachbox/device_tools is one of those. Change owner arm-open2x-linux directories from /scratchbox/device_tools path sudo find /scratchbox/device_tools -name arm-open2x-linux -exec chown -R\ $USER_NAME:$USER_NAME {} \; Remove arm-open2x-linux directories from /scratchbox/device_tools path sudo find /scratchbox/device_tools -name arm-open2x-linux -exec rm -rf {} \; - jvaltane at kapsi dot fi