Building your own GCC environment
This shows you how to buid your own GCC environment for GP2X development. This is very complicated and the usage of a prebuild SDK as shown here (Linux) and here (Windows) should be better in almost any case.
You're sure you want to do this? Ok - let's go.
Compiling natively for testing
First you'll want to be able to build and run programs on your PC. This gives you an easy way to develop and test your programs before transferring them to the GP2X.
Cross-compiling for the GP2X
Oddbot's build script:Build your own GCC4
Note that under OSX, you can use the DarwinPorts package to get arm-elf-gcc 4.0 installed .. simply install DarwinPorts, then do ' port install arm-elf-gcc arm-elf-binutils' and you will have arm-elf-gcc/binutils (4.0) installed in /opt/local/bin .. this is quite a bit easier to do than building your own GCC4 under OSX and has the advantage that you can use ports to maintain/administer the toolset. Note that this is only useful for compiling code for the 940t or HH, not to run under Linux.
WinterMute has built a zipped bundle of everything you need for Windows GP2X development here.
Next you'll want to install the SDL libraries on your PC. Any programs you write using SDL can then be built for a number of platforms, including your PC and the GP2X. You may also want other SDL libraries that the GP2X will support such as SDL_image and SDL_mixer
To install SDL and related libraries for your PC see http://libsdl.org.
For SDL libraries for the GP2X see How to install the SDL libraries
For testing your SDL libraries and build system see Writing an SDL Hello World
For information on using SDL to access the joystick and other buttons see SDL Joystick mapping
For GP2X specific information, see the SDL FAQ