GP2X Building Kernel Modules


gfoot

Member
Joined
Nov 15, 2005
Messages
218
DJWillis said in IRC that some people have successfully built and loaded kernel modules, and I see BBTroll posted here that he'd done it. Is there anything special you need to do, e.g. use the same compiler that GPH built the kernel with? Is the kernel configuration in linux-gp2x in the open2x CVS repository good for this?

There are a couple of things I'd like to try in modules, so I'd appreciate any pointers here!
 
It can be done. You need GPH's SDK http://wiki.gp2x.org/wiki/Setting_up_a_dev...ent_%28Linux%29 and the linux-gp2x kernel source.

The main problem you are going to run into is GPH's kernel not supporting networking, other than that it has worked for me.

You can make your work custom kernel builds if you want, u-boot-mmsp2 is required if you want to make the gp32kernel.img. You need to gzip the zImage file from arch/arm/boot/ then run.

Code:
mkimage -A arm -O linux -T kernel -C gzip -a 00008000 -e 00008000 -n "My Custom Kernel Image" -d zImage.gz gp2xkernel.img

If support is on the kernel, you don't need to rebuild it.

If you are going to rebuild your kernel, backup the /lib/modules in the NAND. Since you can use them with your custom kernel if you used the GCC from GPH's SDK.

Good luck. :D
 
Cool, thanks for the hints. :) Lack of networking support isn't a problem for what I want to do.

I'm also not brave enough to upload a custom kernel to the nand - I don't have a flashable SD card, so that's a bit risky. For testing custom kernels though I guess Rob's method of soft-resetting the system would be good. Still, everything I need should be doable from a module!

Luckily I kept hold of GPH's compiler, even after ditching it. It seemed to have serious problems reading hardware registers - a short read compiles to two single byte reads, and reading single bytes from hardware registers seems to just give you the low 8 bits of the register twice. I guess register reading needs to be hand-coded. :(
 
I had the same problem. cured it by reading/writing long's instead of shorts and doing the conversion myself. I now use GCC4 which doesn't seem to have the problem, so I use shorts directly again.

I've created a user-land application that accesses the usb chip directly and seems to work "ok". I need to shove it in a module to be more reliable, as interrupts in user-apps don't exist, so I currently use up 100% cpu polling the usb chip. Once I've done that however, you'll be able to get a remote terminal via usb hopefully.
 
Back
Top