Toolchain
From Open2x
| Toolchains for software development | |
| Main SVN Module | /trunk/toolchain-new |
| Active Developers | DJWillis |
Warning: Please ensure you always use the TOOLCHAIN-NEW SVN tree and not the outdated TOOLCHAIN one - it exists only to provide some compatibility with older Open2x 'makefile' style toolchains. It is unsupported and will not build a working recent compiler or work with the library packs.
There are 2 main toolchains that we use for kernel and application hackery in Open2x (and the GP2X in general).
Both of these toolchains are ideal for all manner of GP2X development; they are not specific to the Open2x firmware effort and will generate optimised binaries for use on any GP2X if required.
At the moment these toolchains ship 'bare' without any supporting development libraries other than the ones built as part of the toolchain. This is to ensure you can always add the latest prebuilt library package for your needs.
You can get instructions on adding development libraries (i.e. SDL, zLib etc.) from the libraries page once you have set up your toolchain.
You can also just install a prebuilt library package on top of your toolchain if you install it to the default directories.
Note: Only install the kernel toolchain if you are looking to work with the Open2x kernel or firmware directly. For general application development we recommend use the static applications toolchain with the newest prebuilt library package.
Contents |
[edit] Ready built toolchains
[edit] Linux users
- If you are using Linux DO NOT install the toolchain as ROOT.
You can find pre-made versions of the toolchains for Linux (built on Ubuntu Edgy) that I have uploaded to the Open2x site.
Warning: These toolchains need gLibC 2.4 on the host PC (i.e. your desktop), will be updated to fix this soon.
- GCC 3.4.4/gLibC 2.3.6 Open2x Kernel Toolchain here.
- GCC 4.1.1/gLibC 2.3.6 Open2x Applications Toolchain here.
Once you have downloaded a toolchain just read setup below.
[edit] Windows users
Note: GNU tools are currently broken on Windows Vista so we are sorry to say that the Windows toolchain will not currently work with Vista.
You can find pre-made versions of the toolchains for CygWin (built on Win32/CygWin 1.5.24-cr-0x5f1) that I have uploaded to the Open2x site.
- GCC 3.4.4/gLibC 2.3.6 Open2x Kernel Toolchain here.
- GCC 4.1.1/gLibC 2.3.6 Open2x Applications Toolchain here.
Once you have built a toolchain just read "Setup" below.
[edit] Installing
These should end up installed to /opt/open2x/ (paths are in the archive/build scripts).
These setup notes are the same for Linux and CygWin.
Note: Due to a 'feature' of the Open2x host, .BZ2 files are treated as invalid so you will need to remove the .ZIP from the end of the filename after you download a toolchain before you can extract it.
Once you have renamed your toolchain download, extract it with the following command (or your favourite archive tool).
cd / && tar jxvf ./+ PATHTOARCHIVE +/arm-open2x-linux-+ RESTOFFILENAME +.tar.bz2
That will install the toolchain to /opt/open2x/ + TOOLCHAINNAME +/
Once you have downloaded and installed the toolchain just read "Setup" below.
Alternatively we provide a complete CoLinux Image prepared for working with the Kit without further preparation. Download links and usage instructions are being prepared.
[edit] Building from scripts
If none of the above pre-made kits are of use you can always build your own ;).
You can grab the scripts by checking out /trunk/toolchain-new with SVN.
Note: Make sure your user has permission to write to /opt and create dirs there before starting to build from scripts.
There are 2 very simple shell scripts that should be of interest.
- open2x-gp2x-kernel-3.sh -- The kernel chain is based on GCC 3.4.4, gLibC 2.3.6, BinUtils 2.16.1 and can be used to build the current 2.4.26 kernel straight from Open2x's SVN (The one in \trunk\kernel\linux-open2x-2.4.26_FW2-3).
- open2x-gp2x-apps.sh -- The application chain is based on GCC 4.1.1 (with various ARM patches for things like strut alignment), gLibC 2.3.6, BinUtils 2.16.1.
Assuming your have a working native (or CygWin hosted if using Windows) build environment on your PC then all you need to do is run the scripts and wait a few hours while everything needed is downloaded, built and installed for you.
Note: Make sure your user has permission to write to /opt and create dirs there.
Once you have built a toolchain just read "Setup" below.
[edit] Cygwin notes
Please make sure you have the following packages installed in addition to the base install:
Archive -> tar 1.15.1-2+ Devel -> bison Devel -> flex 2.5.4a-3+ Devel -> gcc-core 3.4.4-1+ Devel -> binutils 20050610-1+ Devel -> libiconv 1.9.2-1+ Devel -> libncurses 5.4.2+ Devel -> make 3.80-1+ Devel -> patchutils 0.2.30-1+ Interpret -> perl 5.8.7-4+ Lib -> libbz2_1 1.0.3-1+ Lib -> libcharset 1.9.2-1+ Lib -> libiconv 1.9.2-1+ Lib -> libiconv2 1.9.2-1+ Lib -> zlib 1.2.3-1+ Shell -> ash 20040127-3+ Shell -> bash 3.0-11+ Utils -> bzip2 1.0.3-1+ Utils -> cygutils 1.2.9-1+ Utils -> patch 2.5.8-8+ Web -> wget 1.9.1-2+
[edit] Setup
Note: You need to statically link with both of the above toolchains if you want your binaries to work on a stock GPH firmware GP2X. This is 'normal' as we are using a much newer version of gLibC as a basis for the Open2x firmware and toolchains than GPH ships with the stock firmware (2.3.6 V 2.2.5).
[edit] Using the toolchain
You can use the tools by adding /opt/open2x/ + TOOLCHAINNAME + /bin to your OS path or just point directly to the tools in your makefile/scripts.
i.e. CPP = /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-g++
All tools feature 'correct' canonical tool names (arm-open2x-linux-*) so you should have no problem using this tool-chain with autotools for cross-compiling (provided the scripts are cross-compiler aware of course.
Don't forget to install the newest prebuilt library package on your toolchain unless you have your own preferred libraries.
This is really just a starter for 10 in this Wiki but as they say something is better then nothing. Feel free to edit and improve (please).