Building a Custom Kernel


This guide is designed to help you build a custom kernel using DignSys’s kernel and u-boot source.

If you want a tutorial on how to build kernel modules for use with a stock firmware 2.0.0 kernel try Building Firmware 2.0.0 modules


Building the kernel

  1. Back up the /lib/modules/2.4.25/ folder in your GP2X.
cp -r /lib/modules/* /mnt/sd
  1. Extract u-boot and the kernel source.
tar xvfz u-boot-mmsp2.tar.gz
tar xvf linux-gp2x-2.4.25-0511.tar
  1. The following steps are required to undo DignSys’s crippling/removal of the USB gadget modules.(not required if you are not going to build them)
    1. Extract RE051014-gad24-2272.tgz from the PLX drivers in linux-gp2x/drivers/usb/
    2. Add usb/usb/gadget to the mod-subdirs in linux-gp2x/drivers/Makefile. It should look like
mod-subdirs :=  dio hil mtd sbus video macintosh usb input telephony ide \
               message/i2o message/fusion scsi md ieee1394 pnp isdn atm \
               fc4 net/hamradio i2c l3 acpi bluetooth serial usb/gadget
    1. Add subdir-$(CONFIG_USB_GADGET) += usb/gadget to linux-gp2x/drivers/Makefile.
    2. Add source drivers/usb/gadget/ linux-gp2x/drivers/usb/
    3. Add the following lines at the top in linux-gp2x/drives/usb/gadget/net2272.h
/* no checker support, so we unconditionally define this as (null) */
#define __user
#define __iomem
    1. Comment the follwing line in the linux-gp2x/drives/usb/gadget/net2272.c
//#define PLX_PCI_RDK             /* Using the PLX 2272 PCI bus RDK board for development */
  1. Copy gp2x from linux-gp2x/arch/arm/def-configs/gp2x to linux-gp2x/.config
  2. If you are not in the linux-gp2x folder cd to it.
  3. Run make menuconfig.
  4. Select the options you want to add/remove.
  5. Run make dep.
  6. Run make modules(if you added any modules).
  7. Run make bzImage.
  8. gzip the kernel zImage from linux-gp2x/arch/arm/boot/zImage to zImage.gz
  9. cd into the u-boot folder.
  10. Run make mrproper
  11. Run make mmsp2dtk_config
  12. Run make (it should halt in an error, it is fine)
  13. cd into tools.
  14. Run the following command
./mkimage -A arm -O linux -T kernel -C gzip -a 00008000 -e 00008000 -n "My Custom Kernel" -d <path_to>/zImage.gz gp2xkernel.img

Now you should be able to use your SD card to flash the GP2X with your custom gp2xkernel.img.


  • The current kernel source is something like a 1.0.1 from GPH without the new boot screen.(DrMD works great in it)
  • You can ask me(BBTroll/WikiTroll) in the gp32x board or PLX gadget drivers until I find some place to host it.
  • Flashing a custom u-boot is a bad idea. As long u-boot is working, you can brick and unbrick you gp2x as many times as you want.
  • The net2272 code is missing the irq and base address for the chip. The irq is 222, if anyone knows the base address please feel free to edit this page or send it to me. Until then, you are going to have to use GPH's net2272.o, but you can use any of the other modules with it.(ie. g_ether.o, etc.) [Note from hannes: in net2272.c from the 1.4.0 source tree, I found definitions for BASE_USB to be 0x88000000 and for IRQ_USB_INT to be IRQ_GPIO_J(14), which resolves to 222] [Another note from hannes: I just found the line net2272: irq 222, mapped mem c288a000, chip rev 0011 in /var/tmp/dmesg - which memory location is correct?].
  • If you have any questions feel free to pm me(BBTroll/WikiTroll) in the gp32x board.
Personal tools