Setting up a development environment (Linux)
There are several different ways of installing a tool chain for cross-compiling GP2X binaries on a Linux system. Each has advantages and disadvantages, but most people should simply download and install the Open2x tool chain. If you are interested in kernel development or the compilation of kernel modules, You must use a tool chain based off of the GNU Compiler Collection (GCC), Version 3.4.6. In any other case, it is highly recommended you use the GNU Compiler Collection (GCC), Version 4.1.1 or above as GCC has improved much since Version 3.
Open2x, The Open Alternative SDK
Open2x is an open source project which maintains a number of applications, libraries and a firmware for the GP2X. The Open2x tool chain is the most up to date of all the tool chains and is guaranteed to be compatible with the latest libraries. It is recommended that anybody configuring a new tool chain for the GP2X use the Open2x one as it is actively maintained and should compile for any Linux system (and there are binaries available two several GlibC versions).
There are two Open2x tool chains, one for the kernel (since Linux 2.4.x won't compile with anything higher than GCC 3.4.x) and a second for applications. Most users will want the application tool chain as it uses GCC 4.1.1, but kernel developers will, of course, need the kernel tool chain.
For installation instructions, see Installing the Open2x toolchain.
gp2xSDK, The Official SDK
This script builds the official Gamepark Holdings Software Developer's Kit. It is available available from here. Although at one time it was the only option for developing on the GP2X, it is no longer the most powerful tool chain available and does not contain Hardware Accelerated SDL, Which is highly recommended as it will improve the speed and efficiency of your applications. It also uses GCC 3.4.6 and GlibC 2.2.5 which is only useful for kernel development, because the GP2X official kernel and modules for it can not be compiled with any other combination. Use of more up to date versions of GCC and GlibC is highly recommended.
The script will download and compile the tool chain which uses binutils version 2.16.1, GCC version 3.4.6, GlibC version 2.2.5, and additional libraries such as SDL (Although the version included is not hardware accelerated) and FreeType. This means that applications compiled with this tool chain will be able to be dynamically linked run run on the official firmware. However, it is not recommended to use this tool chain due to the old versions of GCC and GlibC as well as the lack of Hardware Accelerated SDL. To use Hardware Accelerated SDL, your only choice is to compile it from source.
This SDK compiles and installs only the most basic of libraries. To do any real development, It is much more plausible to make use of the additional pre-compiled libraries that come along with this tool chain. However, When this package of additional libraries was developed it was not taken into account that the files in the archive would contain references to the paths they used to compile them with. However, It is rather easy to solve this problem.
To correct the .la files, You should use bash:
cd [Location of SDK] for a in lib/*.la; do cp -p “$a” “$a.orig” # Its worth noting that the escaped slashes have completely different meanings from the ones that are not escaped. # 'Escaped' means that the character prior to the 'escaped character' is a 'backslash'. This backslash tells the # command to treat the following character as part of the same string, which is important for what we are doing. # -- # Also, less important, but you should not add a trailing slash. We aren't replacing the existing trailing slash. sed -e ’s/\/usr\/local\/gp2x-library\/image/[Location of SDK with escaped slashes, No trailing slash]/g’ “$a.orig” > “$a” done
Be sure to edit this. You need the locations to be changed as according to your setup.
Use a text editor to hand modify the paths in arm-linux-sdl-config. You will find the string /hd/nk/SDL/image/ here. Use the replace function of your editor to replace all occurrences of that string with the location of your SDK.
For more information on installing this SDK properly, see this blog entry.
If your having compilation issues, see this blog entry. It contains information on many small issues you may have.
devkitGP2X, The devkitPro GP2X SDK
This is a script that builds an unofficial GP2X version of devkitPro. It will download, patch, compile and install binutils version 2.16.1, GCC version 4.0.2, GlibC version 2.3.5 using host's native development tools. No librares are included by default, so you will need to either download a library package (Open2x is the most up to date) or compile your own set of libraries (assuming of course, you wish to use libraries at all). Although devkitGP2X can run on Linux, it is much more commonly used on Windows platforms. It is also slightly outdated now, and not currently under active development.
Get it from, the archive.
Build your own GCC Environment
This is not recommended for beginners as it requires a lot of complicated, unnecessary work. Nearly everybody should opt to use one of the above tool chains. Even for those who do understand how to build their own tool chains, this can be tedious and just plain annoying at times.
If you still wish to build your own tool chain, See Building your own GCC environment.
OpenEmbedded is a multi-platform development kit, which can be made to target the GP2X. It is however, more than just a tool chain but a system designed to compile embedded operating systems. It has some uses (such as for firmware development and some applications can be compiled from its repositories, such as GPE) but for general applications development, it is a poor choice, because it requires a lot of things irrelevant to the GP2X and has no GP2X-specific libraries (though these could be installed). For those who would rather compile the GP2X libraries themselves, this is still a quite viable choice, however.
Scratchbox is yet another multi-platform development kit for embedded devices, much like OpenEmbedded, and it can also target the GP2X. It holds the ability to run ARM code in addition to its abilities as a cross-compilation tool chain.