Project Log: Random GP2X hacking

Monday, October 31, 2005

Evil hacky GCC tool-chain buildscripts released.

Well I guess I should do some quick updates on what I am playing with.

These scripts are hardly worth much of a song and dance but they fill the gap while something more refined is worked on (call them alpha-grade) and I fix up some more libaries to go with the tool-chain, like a cleaned up port of SDL etc.

These buildscripts produce a working patched GCC 4.0.2, gLibC 2.3.5, Binutils 2.16 based ARM-Linux tool-chain for the GP2X.

I am popping these currently crude scripts into Open2x’s CVS (check out the tool-chain module from a CVS client), I will clean them, get them working under MinGW (to do a nice Windows build that does not need CygWin) and release some pre-compiled tool-chains via Open2x’s FRS soon.

They have been tested on x86 Linux, x64 Linux, CygWin and a few others boxes I had laying about. Apart from MinGW (symlink and binutils probs) all built executables that work on the real hardware.

You have to statically link EVERYTHING or the executables stand no chance of working on real hardware using -static on compiler calls etc. as the gLibC that GPH give us with the default GP2X build is ancient and many other things are less then idea in the GPH kernel/image.

I have also added a lot of hacks (nasty ABI breaking hacks) to the stock ARM-Linux compiler that really make the resulting tool-chain unsuitable for ARM-Linux development on any platform other then the GP2X/MMSP2 including things like hacking in Nico Pitre's excellent ARM-ELF GCC patches to give you the hand tuned FPU ARM ASM experience people love when using GCC 4 on the GP32 rather then the 2.4 Linux Kernel’s soft FPU driver you normally get with OS bound ARM-Linux tool-chains.

How to use the build scripts:

These scripts are based on the excelent CrossTool by Dan Kegel ( after some less them sympathetic hacking about.

Place the scripts somewhere on the machine you will use to build the tool-chain and run ./buildscripts/ to build the tool-chain and go and get a coffee or something stronger as it takes a little while.

Unless you want the tools installed in /tools/open2x_gcc you will want to edit the to point the output and other folders to somewhere suitable for your environment.

It will WGET all the files it needs for the build unless you place then in the downloads folder that is looking for.

Hint: CygWin users will need to grab a CygWin build of WGET 1st. Such as (

It will ONLY build a working tool-chain based on gcc-4.0.2, glibc-2.3.5 binutils-2.16 etc currently as I have not put the patches for any other CrossTool build combo.

How to use the tool-chain:

Once built you have a full GNU tool-set built for the ARM-Open2x-Linux target so you just call the exe and folder (or path the /bin out) and use arm-open2x-linux-gcc etc. etc.

The build scripts should generate a few hello world apps in install-dir/arm-open2x-linux/tmp, the hello world 'static' exes should work on the real hardware out the box so please copy them to an SD and try them to test your tool-chain before you get stuck into any code.

There is no need to do any elf to executable faffing like we are used to on the GP32 as the compiler will give you an ARM-Linux tagged executable off the bat. You can check this with 'file output-filename' (try it on the hello world examples).

One thing worth noting is that if you do not want any debug, symbols ect. in files you generate to run on the real hardware you want to strip them with 'arm-open2x-linux-strip -o outfile infile'. This will cut the file size down a LOT.

John Willis


  • Thanks, we are waiting for the cross compiler.

    By Anonymous NoobLuck, at 7:16 PM  

  • Developors in www.gp32spain,com are using this toolchain

    By Anonymous Anonymous, at 11:40 AM  

  • Hi John,
    anything I should feed back into
    - Dan

    By Anonymous Anonymous, at 6:37 PM  

Post a Comment

Links to this post:

Create a Link

<< Home

cheap oakley sunglasses mulberry outlet Ugg Coupon Code cheap uggs mulberry outlet