Building Firmware 2.0.0 modules

From wiki.gp2x.org

This set of notes will show you how to cross-compile kernel modules for a stock Firmware 2.0.0 kernel from a Linux machine

It is assumed that you're already familiar with compiling and configuring the Linux kernel.

Contents

Gather the right tools and sources

Download Kernel Sources

You can either get these straight from Game Park Holdings using svn:

svn co http://svn.gp2x.com/gp2x/tag/kernel/2.0.0/

Or alternatively it can be downloaded as an archive from [archive.gp2x.de]

Get the right Cross-Compiler

The usual compilers from ooPo or GPH don't seem to be any good for this. Instead you should install GCC version 2.9.5 which can be found [archive.gp2x.de].

Extract this to /usr/local/arm-dev (it HAS to go here! it is pre-compiled and won't work anywhere else)

Build Kernel

Change directory to the root of your kernel sources.

Set environment variables for cross compiling

You need to set the following environment variables:

$export PATH=/usr/local/arm-dev/bin:"$PATH"
$export CROSS_COMPILE=arm-linux-

Configure kernel

Then configure the new modules you want by runing:

$make menuconfig

It is beyond the scope of this article to go into this.

Build the kernel

Run the following

$make dep
$make modules
$make INSTALL_MOD_PATH=`pwd`/modules modules_install 

Your modules will now be in a directory modules/lib/...

NOTE: the INSTALL_MOD_PATH part is important, if you don't set this the makefile will try to install them on your build machine which is NOT what you want!

Test the modules

I recommend you copy the modules to the root of the SD card, telnet to the gp2x and use insmod to install the modules manually and give them a good test before committing them to the actual /lib/modules directory. (Less chance of bricking!)

Personal tools