Unbricking a GP2X

From wiki.gp2x.org

HOWTO: Unbrick 'most' bricked GP2X's

This guide aims to help people recover one way or another a broken GP2X and return it to the land of the living. It has been copied over from DJWillis's wiki on Oct. 22.

Contents

Want your GP2X fixed for you?

I got my Wiggler JTAG setup fixed and now have a working GP2X again (thanks to Jr2Swiss for the salvaged GP2X bits :)).

As I now have everything up and working again I am more then happy to offer to try and unbrick peoples GP2X's if you get stuck yourself the same way I used to (for postage and a small donation to the charity of your choice).

Mail me at DeadGP2X @ Distant-earth.com

Preface

If you wish to mirror this article other then on this site (Open2x/Distant-Earth WiKi) please let me know and leave credits in tact.

General Guide

Strong Warning: (In case you don’t want to read the whole article)

Do not EVER try and flash your unit with batteries (Even with GPH updates).

I have had several reports of people making things worse as there batteries gave out half way through a flash. A full flash of the file system (gp2x_file.img) can completely drain a set of good high capacity batteries before the flash completes and just the kernel update can drain an average set.

Has your shiny GP2X been subject to some abuse that it was not to happy about? Have you been messing about with the NAND, shared libraries or some other dark area and watched it all go wrong?

Well if you have and your unit now refuses to reboot into the launcher then this guide may help you out.

Before we start: Warnings!

  • Put a good hour aside to do this, leaving things half done is not really very clever.
  • You WILL need a good working SD card that the GP2X can see. FAT32 formatting on the card seems most reliable in tests.
Note: I used a 256MB SanDisk regular SD card without issues throughout. My 1GB Viking SD card also worked. MMC cards are a no-go for this task. Slower SD cards seem on the whole more reliable for this task.
  • You WILL need a PSU capable of running the GP2X, using batteries when flashing something as delicate as your whole NAND is a VERY bad idea. The flashing really eats batteries and they could well go flat long before a flash is done.
  • A serial adaptor for the GP2X is very desirable so you can monitor progress of the reflash – I would almost say essential unless you are particularly frivolous.
Note: If you have one, plug it in now and connect to your GP2X via whatever serial port you have it connected to. I use 115200, 8, n, 1, XON XOFF to connect. You will see output to your serial console as soon as your turn the unit on. If you have no serial port on your PC anymore get a cheap USB<>Serial adaptor and use that with the serial lead.

Firstly: Identify how seriously your GP2X is bricked

  • Does the unit boot into the GPH launcher and play movies, games, music etc.?
Yes: It’s not bricked then, why are you reading this.
No: Carry on ;-).
  • Turn the unit off. Remove any batteries.
Note: Some suspect brickings are in fact caused by low batteries.
  • Turn on the unit running it from a suitable PSU.
  • Do you get a black screen with a GP2X logo in the middle of it?

Yes: Good, your boot loader (U-Boot) is still intact. This guide may be able to help you.

No: Drop me an e-mail or pop into #GP2XDEV on EfNet IRC and I see if I can help you further.

Firmware 2.0 and 2.1

Being updated for 2.1 release.

Older Firmware < 2.0

All the files used in this guide are based around the GPH 1.0.1 firmware with all the updates as of 29th November 2005 applied, tested and working as well as they normally do. (I.e. eBook reader, mplayer, Music player etc.)

You probably want to keep the kernel and ROOT file system in sync with each other so future updates get applied in a consistent manor. (I.e. if you are using a firmware newer or older then 1.01 then reflash both the kernel and ROOT file system then upgrade again using GPH updates).

  • Do you get a ‘loading’ screen? These are green with a GP2X logo on them and hang around while Linux is being booted?
Yes: Ok, it looks like your Linux kernel is intact. Flash the ROOT file system 1st (See: Reflashing the file system) and then only flash the kernel if you need it (i.e. your GP2X was not running 1.0.1, things are still broke etc.)
No: It looks like something may have damaged your kernel image. Try flashing this 1st (See: Reflashing the kernel) and then only flash the ROOT file system if needed.

The art of reflashing.

The GP2X’s automated SD based reflashing from the boot loader consists of 3 files that contain 3 distinct parts of the system. The combinations of these on the SD effect what happens when U-Boot tries to kick off the flash.

These are… (Linked to zipped downloads)

  • gp2xboot.img – U-Boot boot loader image

This will update U-Boot, don’t use it unless you’re directed to. If U-Boot dies your GP2X is bricked well beyond what this guide will help you with and jTAG or a very friendly supplier is your only real option.

  • gp2xkernel.img – The Linux kernel image

This is the RAMFS image of the Linux kernel used by the GP2X.

  • gp2xfile.img – The JFFS2 ROOT file system.

This is the bulk of your NAND. This contains all the files to get the launcher going, play videos, music, games etc. – Corruption of this is by far the most common cause of bricking.

  • 101files.zip – The updates to the file system from the 1.0.1 upgrade.

This is needed to restore your newly flashed ROOT file system to a fully working state. It includes updates to mplayer and some parts of the GPH launcher. The files are also in the 1.0.1 GPH upgrade but I have repackaged them to work with this guide (and more consistently work on GP2X's generally).

Reflashing the file system.

99% of brickings seem to be caused by the root file system becoming corrupt. It is hard to tell exactly what went wrong without the benefit of serial console output.

Anyway, onto restoring the file system.

  • Get yourself a copy of gp2xfile.img and extract the zip to the root of an empty freshly formatted, working, SD card. Check the MD5 hash if you want to be sure the image is valid.
  • Make sure your PSU and serial leads are connected and working well.
Note: Logging the serial output to a text file is a REALLY good idea.
  • Turn off the GP2X if it was on and put the SD card into the GP2X.
  • Turn on the GP2X and if all is well you should see output like the following on the serial port after the U-Boot initialisation strings.
“FILE UPDATE ----------------------------
reading gp2xfile.img
READ START 25165824”
Note: If you see “SD Initialize fail..” then go and start again with another SD card, U-Boot does not like your current one. (You did put the SD in the GP2X didn’t you, not an MMC card).

The unit may then seem to stop for a few secs then showing something similar to that below.

“Why block_cnt == 0??
Why block_cnt == 0??

25165824 bytes read
3 : g_filesize 1800000
gp2xfile.img Update 25165824 0x1804000”

* The LCD on your GP2X should now show a graphic showing a chip and indicating that the firmware is being upgraded. You are now 100% committed to seeing this to its conclusion.

* The next thing you will see on the serial console is…

<pre>
“NAND write: device 0 offset 0x240000, size 0x1804000”

This is good, it tells us that the image is valid and being written to the NAND.

  • Next, things get interesting. The GPH flash code is setup to keep retrying the flash until it completes successfully. This is a good thing as you are going to get lots of errors written to the serial port like these below.
“nand_write_page: Failed write, page 0x000043b4, 6275072 bytes written: ERROR

NAND write: device 0 offset 0x240000, size 0x1804000 ... nand_write_page: Failed write, page 0x00006e53, 11550720 bytes written: ERROR

NAND write: device 0 offset 0x240000, size 0x1804000 ... nand_write_page: Failed write, page 0x00006fb6, 11730944 bytes written: ERROR”

These can be safely ignored. This is normal on the GP2X and it should all reflash successfully given time.

  • Go and get a coffee and settle down to watch the screen. This could take up to an hour depending on the retry rate.
  • Once the flash completes successfully you will see something similar to
“NAND write: device 0 offset 0x240000, size 0x1804000 ... 25182208 bytes written: OK”
  • The unit will now reboot and if all is well load Linux and then load the launcher and your back up and running.
  • There is one step you really must do now unless you want to keep reflashing your GP2X and that is REMOVE the gp2xfile.img from your SD card, and do not reboot the unit with it on your SD in it, unless you want to reflash again.
  • Lastly, if you are back into the GPH launcher get your SD card and extract the contents of 101files.zip to the root of the SD card and run '101patch.gpu' from the Utilites menu in the GPH launcher to restore the ability to play Music and Videos.

Congratulations on having hopefully unbricked your GP2X. Please test it and report back.

To view a complete serial log from a successful reflash of the ROOT file system click here. If you get a SEGFAULT in GP2XMENU when you reboot the GP2X try flashing again. I had this happen once and I can only put it down to a bad flash.

If you still have problems continue to Reflashing the kernel.

Reflashing the kernel

Reflashing the kernel is actually a fairly simple affair. If you follow the above guide for the file system but substitute gp2xfile.img (and zip) for gp2xkernel.img (and zip) you won’t go far wrong.

The kernel takes almost no time to flash, a few minutes in the worst case. Unlike the file system reflashing the gp2xkernel.img file is also deleted from the SD card as soon as Linux boots to prevent the unit being reflashed on the next reboot.

Reflashing the boot loader

I am sure you can work out how to do it but my advice is don’t unless you know what you’re doing and have a good reason to do so. You can really badly brick your GP2X with this.

JTAG Guide

GP2X Wikipedia.jpg
This page is a mess. Please improve it.

Excerpt taken from geocities.com/joshuabissot

You will need :

  • A JTAG/EXT adapter, breakout box or cradle, and a power supply unit.
  • A db 25 pin 'straight through' cable - like an old printer cable, but make sure that all the pins are included.
Note:You can get one from Staples for ~$9
  • Your replacement firmware, from gp2x.co.kr or the archive. It is recommended to start with FWv2.0.0 and then to upgrade to a 2.*.* version of your choice.

Steps

  1. Copy the firmware to the root of a sd card and insert the card into the gp2x.
  2. Hook the JTAG up to your db25 cable. Power on the gp2x and insert it quickly into the cradle.
  3. Execute the 'run me' bat file.
  4. After about 2 minutes the software should report as complete. Remove the unit from the cradle, power it down, and take a 3 minute break, leaving the unit powered down.
  5. After 3 minutes have passed re-power on the unit with start and select depressed and you should see the firmware updating screen.
  6. When everything is finished you will see the default menu screen.
  7. Now turn off your gp2x and remove the SD card, reboot the unit and you should have a working gp2x.

Links

Credits

John Willis - Guide, JTAG information and research. GP2XDev on EFNet - Loads of checking, support etc.

That’s all for now, please leave comments and updates on the talk page.

John Willis

Personal tools