Unbrick Your GP2X
This excellent and thorough guide was originally created and posted by John "DJ" Willis on his site. It goes through the procedure on how to Unbrick, or fix, badly flashed or otherwise corrupted GP2Xs.
Preface
Some important facts about SD card compatibility - SD card compatibility. General useful information about flashing - Firmware Upgrade.
HOWTO: Unbrick most bricked GP2Xs
Please see DJWillis's website for the latest and greatest version.
IMPORTANT: This will only work if U-BOOT is intact, which means it will boot at least to the black logo screen. If that's not the case, you're out of luck. Unbricking a GP2X with damaged U-BOOT will require a JTAG setup. See the next HOWTO below to see how to do this.
Note: make sure your GP2X is really bricked before you try this. So far only one firmware upgrade included the dangerous u-boot upgrade, so total bricking is very unlikely. If you use a 3V power adapter instead of batteries, turning the console off and immediately on will display a white screen with colored lines, making it look like the console is bricked. But it's not! Turn it off for 20 seconds at least, then turn it on again, et voila! Black logo screen again! --Titousensei 01:05, 29 December 2005 (GMT)
HOWTO: recover the boot manager of a bricked GP2X with JTAG
This little tuto is intended for people that really bricked their GP2X, that is, when the bootloader is damaged (no black greeting at startup). In this extreme case, the last chance to get it up again is by using JTAG. Fortunately, the GP2X has such capability through the EXT Port.
It is possible to unbrick the GP2X with almost all JTAG hardware (the theory remains the same), but in this tuto, we'll focus on the cheapest one (Wiggler).
Hardware needed for recovery with Wiggler style JTAG:
- To get access to the pins of the EXT port, you'll need to purchase a Cradle formerly available for devs as break out box. Or, you will have to get a connector and build your own interface using the pinout.
- for Cradle and BoB you'll also need a straight DB25 (male-male) cable for JTAG and a straight DB9 (female-male) cable for serial (not absolutely mandatory but needed to see what happens... so if something goes wrong...).
- an SD card compatible with firmware 1.
Theory of operation : Some devices that have JTAG ports can give you access both to the CPU (for debugging purpose) and to flash memory (to load your code). The second method would perfectly match our needs but, unfortunately, the GP2X's JTAG port only gives access to the processor. Thus, to write in the flash, we first need to upload a program in memory that in turn will do the job for us. The U-boot fits nicely for this job, but it is usually compiled to run from a region in memory where flash is mapped. We use then a recompiled version that runs at 0x03f00000. We have to load this program at the specified address, and run it to update the boot manager . When the boot manager is ok again, we can recover using the normal update procedure.
Loading U-boot : The JTAG port of the GP2X is in fact exactly the one of the MagicEyes (the main chip of the GP2X). And the JTAG port of the MagicEyes, at boot time, behaves as the one of a classical ARM920T (I read somewhere that the 940 can be accessed in some situations). So, in theory, any JTAG software that can talk to an ARM920T can be used with GP2X. For each software/hardware used, the setup is different. I personally used some free software called openocd that has the advantage to be available to everyone for free and be compatible with Wiggler (the JTAG pinout used by Cradle). I wrote a page on how to do this with openocd and gdb.
Recovery of the boot manager : You'll need to get the U-boot from the firmware of the GP2X, the file gp2xboot.img, and write it on a freshly formated SD. Once our special U-boot has been loaded in memory at 0x03f00000, we connect the serial cable to a PC (and run a serial terminal software, like minicom, with parameters 115200 8N1). This will enable us to see what happens. Insert the SD card in the slot of the GP2X. Then, launch the loaded U-boot (with GDB, you have to issue cont). If everything goes well, the loaded U-boot will find the gp2xboot.img file and update the boot manager. Eject the SD card and turn the GP2X off. Now, if you reboot your GP2X, you should see the black greeting screen of the U-boot and you should be able to recover the rest of the system with the howto linked at the top of this page.
Additional infos :
- it can happen that only your u-boot is damaged, not the kernel image and you want to access u-boot command line. But the loaded u-boot will go and boot. Then, you have 2 choices : 1) restore the u-boot from linux using mtd devices, 2) the dirty one, you can reflash with damaged linux image (by writing damaged gp2xkernel.img to the SD) to prevent u-boot from... booting. Then you'll gain access to u-boot command line.
- flash memory of the GP2X does not contain any index like FIS and U-boot is at offset 0.
- when in u-boot, it is possible to flash by hand the boot manager
GP2X# mmcinit // find the SD card and initialise it GP2X# fatload mmc 0 0x1000000 gp2xboot.img // loads the file at 0x1000000 GP2X# nand erase 0 0x80000 // prepare the flash for write GP2X# nand write 0x1000000 0x80000 0x0 // writes 0X80000 bytes from RAM 0x1000000 to flash 0x0 (this can fail, you have to try erase/write until it works)