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
- SD card that can flash a GP2X.
- A working GCC environment using GPHâs SDK(gcc 2.95.3 is required, gcc 4.0.2 will not work).
- DignSysâs kernel source.
- DignSysâs u-boot source.
- PLXâs net2272 gadget driver.(Only required if you want to build the USB Gadget modules)
Building the kernel
- Back up the /lib/modules/2.4.25/ folder in your GP2X.
cp -r /lib/modules/* /mnt/sd
- Extract u-boot and the kernel source.
tar xvfz u-boot-mmsp2.tar.gz tar xvf linux-gp2x-2.4.25-0511.tar
- 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)
- Extract RE051014-gad24-2272.tgz from the PLX drivers in linux-gp2x/drivers/usb/
- 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
- Add subdir-$(CONFIG_USB_GADGET) += usb/gadget to linux-gp2x/drivers/Makefile.
- Add source drivers/usb/gadget/Config.in linux-gp2x/drivers/usb/Config.in
- 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
- 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 */
- Copy gp2x from linux-gp2x/arch/arm/def-configs/gp2x to linux-gp2x/.config
- If you are not in the linux-gp2x folder cd to it.
- Run make menuconfig.
- Select the options you want to add/remove.
- Run make dep.
- Run make modules(if you added any modules).
- Run make bzImage.
- gzip the kernel zImage from linux-gp2x/arch/arm/boot/zImage to zImage.gz
- cd into the u-boot folder.
- Run make mrproper
- Run make mmsp2dtk_config
- Run make (it should halt in an error, it is fine)
- cd into tools.
- 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.