Project Log: Random GP2X hacking

Tuesday, November 29, 2005

HOWTO: Unbrick 'most' bricked GP2X's

Update: 7th August 2006

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.

I am working on a cross-platform JTAG guide to go with this (and trying to make FW 2.0 files for this guide) so expect that in a few days.

Update: 23rd July 2006

I just thought I would quickly put this note at the beginning of the guide to let people know why I have been slow replying to mails and comments about bricked GP2X's (and in some cases, not replying at all I am sorry to say). I have read all the mails and thanks for all the feedback.

Some time ago my GP2X died (not bricked, board fault) about 2 weeks after I broke my jTAG setup. This combined with no small about of personal shenanigans :( has had several effects on my GP2X stuff, it has meant that I am not able to offer to unbrick peoples GP2X's with broken bootloaders at the moment (I do apologise) and secondly as I don't have a working GP2X doing the long overdue update of this guide to firmware 2.0 has been somewhat on hold, oh and of course as some people have noticed my other projects (i.e. ScummVM) have slowed up somewhat.

All being well I will have enough saved up next month to get another GP2X and grab a BoB at the same time and I plan on updating all this guide for the latest firmware (and adding a detailed jTAG guide) as soon as I get a new unit (I have worked most of it out, just need to test it all).
At that point I will be happy to offer to unbrick GP2X's again the same way I used to (for postage and a small donation to the charity of your choice).

Regards John

---------
Original Guide
---------

If you wish to mirror this article please let me know and leave credits.
If this guide looks a little scary contact me, I am happy to unbrick peoples GP2Xs (for now).

---------

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.

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).

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.

Note: http://www.toyz4boyz.co.uk/ will be selling the serial leads for the GP2X very soon if you need one, see http://www.toyz4boyz.co.uk/gp2x/hardware/serial/. Toyz4Boyz are great for GP32 bits and bobs and I know they have some cool GP2X stuff planned ;-).

Firstly: Identity 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.

  • 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)
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.
This is the RAMFS image of the Linux kernel used by the GP2X.
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…

“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.

That’s all for now, please leave comments and updates.

John Willis

43 Comments:

  • Excellent guide! Kudo's This is what I was hoping for would arrive. A way to restore the file system, unbrick a 'bricked' unit. Not that I intend to brick my gp2x ;)

    Mark1970

    By Anonymous Anonymous, at 8:59 pm  

  • Bounce! Many many thanks. Great to hear unbricking is possible without serial too.

    Mark

    By Anonymous Anonymous, at 10:11 pm  

  • And it DOES work :)
    I just unbricked a unit with corrupt NAND :)

    Very nice.

    EvilDragon.

    By Anonymous Anonymous, at 12:50 am  

  • So, the question is do I need the cable, and what harm can it cause without it?

    By Anonymous Anonymous, at 3:09 am  

  • It looks like I'm screwed. I bricked mine when I tried to install the firmware upgrade & it looks like U-BOOT is damaged, since I don't even get the black logo screen. All unbricking attempts fail. Any other ideas?

    By Blogger Mike, at 4:42 pm  

  • I only get the colored lines, this is on a set of 2500mAh energizers I charged overnight. They were working previously.

    Any word on a JTAG program using the GP32 Jtag interface?

    By Anonymous Anonymous, at 5:09 pm  

  • when i turn on i get a multicoloured screen of vertical bars.ive changed batteries and used mains adaptor but still wont boot.Any ideas whats happened.

    Thanks,

    By Anonymous Anonymous, at 5:26 pm  

  • I get the same multicoloured lines when I boot, looks like its a common problem... any ideas?

    By Anonymous Anonymous, at 10:05 pm  

  • After figuring that the lines problem was a fault with the power switch: if you slide it about 3/4 of the way down, it works! I re-flashed my GP2X back to version 1.0 from this very site! The I put version 1.4 on there and it doesn't work! Nor does re-flashing to version 1.0 now!

    By Anonymous Anonymous, at 8:48 pm  

  • very much thanks lord, i have flashed with 1.4 and this have bricked.. then i unbrick with your manual and it works very well, now i have my gp2x and not a "ladrillo"

    By Anonymous Anonymous, at 9:48 pm  

  • Thanks a lot :)

    By Anonymous Anonymous, at 12:42 pm  

  • I unbricked mine too, from common alcaline battery (Yeah I know this is a bad idea, but PSU aren't cheap), reflashing the whole file system took less than one hour.

    By Anonymous Anonymous, at 5:55 am  

  • So what do I do with the gp2x that only switches on to multicoloured lines? It doesn't even start upgrade or downgrade procedures, much o my dismay, and I switched it off after 1.4 upgrade took ages, tried to reflash using the above, won't even get to the boot screen... help me!

    By Anonymous Anonymous, at 8:33 pm  

  • thanks thanks thanks thanks thanks
    thanks thanks thanks thanks thanks thanks for the unbrick guide thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks

    By Anonymous Anonymous, at 8:48 pm  

  • Does anyone have an .elf format file of the bootloader? I'm attempting to execute the official bootloader via the OCDemon program over the JTAG interface. Unfortunately, I can only find the .bin file, while OCDemon will only upload .elf files.

    Alternatively, can anyone point me to a place where I can easily download the official bootloader source?

    Thanks.

    By Anonymous Anonymous, at 7:28 am  

  • there is a jtag kit for gp2x i haven't tested it but some people reported it working, following link has some info about it http://www.gp32x.com/board/index.php?showtopic=25615&st=15

    By Anonymous Anonymous, at 6:28 pm  

  • I was having trouble but then realized my sd card wasn't formated for fat32. reformating cured this problem. Thanks for the tutorial!

    By Blogger chickenrob, at 3:17 am  

  • I've successfully flashed my firmware many times with no hitches, but it only takes once to ruin a winning streak. Thanks to you my recently "bricked" unit is working again. Your help is very much appreciated. Thank you so much.

    Pariah

    By Anonymous Anonymous, at 1:08 am  

  • I just managed to brick my unit. I was doing the 2.0 update. I shut it off and turned it back on and voilah... colored lines. Nothing is working. !!@#$%^&*(), Can anyone help me. I don't know any thing about jTag or whatever that is, I'm on a Mac OS X. I'm willing to pay to get this thing fixed... ANYONE PLEASE!
    My email is juliodm@earthlink.net. PLEASE!

    By Anonymous Anonymous, at 9:30 pm  

  • I just managed to brick my unit. I was doing the 2.0 update. I shut it off and turned it back on and voilah... colored lines. Nothing is working. !!@#$%^&*(), Can anyone help me. I don't know any thing about jTag or whatever that is, I'm on a Mac OS X. I'm willing to pay to get this thing fixed... ANYONE PLEASE!
    My email is juliodm@earthlink.net. PLEASE!

    By Anonymous Anonymous, at 9:31 pm  

  • I just managed to brick my unit. I was doing the 2.0 update. I shut it off and turned it back on and voilah... colored lines. Nothing is working. !!@#$%^&*(), Can anyone help me. I don't know any thing about jTag or whatever that is, I'm on a Mac OS X. I'm willing to pay to get this thing fixed... ANYONE PLEASE!
    My email is juliodm@earthlink.net. PLEASE!

    By Anonymous Anonymous, at 9:31 pm  

  • Same problem here (only collored lines). Does anyone know if somebody has any succes of fixing this problem. Thank you in advance.
    (I discoverd that shouting to the gp2x doesn't work, I'am considering torture )

    By Anonymous Anonymous, at 11:53 am  

  • This guide mentions a terminal. What is this terminal. Is it a program, a windows thing? I'm on a Mac G4, I have no idea what terminal the author is speaking about. Can someone please clarify?

    By Anonymous Anonymous, at 1:22 am  

  • Ok, I found this program for the mac called zterm that lets you monitor a serial device plugged into a unit. In my case on the mac, using a serial to usb cable. I'm not seeing anything in the port. The only time I get anything is when I shut off the GP2X. It shows:

    By Anonymous Anonymous, at 1:59 am  

  • Very Good Guide! Thanks. Now how do I connect a my COM port to the GP2X? Do I plug into the connector on the bottom (labeled EXT)? What would such a cable be called and where might one be purchased? Thanks!

    By Anonymous Anonymous, at 9:34 pm  

  • Very Good Guide! Thanks. Now how do I connect a my COM port to the GP2X? Do I plug into the connector on the bottom (labeled EXT)? What would such a cable be called and where might one be purchased? Thanks!

    By Anonymous Anonymous, at 9:37 pm  

  • It's too bad I found this page after installing the GP2x "upgrade". The corporate website says use fresh batteries or an AC adapter. Since the adapter isn't something that comes with the unit, I used fresh batteries.

    30 minutes after starting the install, the initial screen (upgrading firmware) was still there. I left the room and came back hours later, and the screen was black. I turned it on, and got the vertical colored stripes of doom.

    This is unacceptable! Based on other comments here, it would appear I have a $200 piece of trash. I've never heard of such a poorly engineered firmware upgrade.

    By Anonymous Anonymous, at 5:01 pm  

  • I have bricked my gp2x i think and happy i am not,i tried this file called selector v11 and now when i turn it on i get the gp2x screen then the linux boot screen and insted of my icons i get a message saying NO SHORTCUTS FOUND OR NO SD CARD MOUNTED... what do i do i want my gp2x working again-jrapocalypse@yahoo.com HELP HELP !!

    By Anonymous Anonymous, at 10:40 pm  

  • Honestly,

    How can HACKING, altering, installing software on, and generally screwing with a PSP actually be easier than this.

    What a miserably designed piece of hardware. God. With a 100% bricked device, I now have a 4GB card that I have nothing to do with. This sucks hard.

    By Anonymous Anonymous, at 3:17 am  

  • I want Th GP2x soo bad (as my PSP i lame, dropped and broke £90 replacement, 4 faulty replacements later i have a psp with to high a version to break out of. hear theres a lot of problems with this and i'm a native windows user, im sure if i get one this info will be handy

    By Anonymous Anonymous, at 9:47 pm  

  • Hey there, My power supply failed during the flashing from 2.0.0 ---> 2.1.1 (it broke :( )

    Anyway.... The system showed "Firmware upgrading image" for about 15 minutes.... not the "60 seconds" that the guide states in the wiki.

    I got fresh batteries, powered on and it stays at the boot screen.

    I powered off and powered on with select and start pressed... the Firmware Upgrading image appears again... still showing after 10 minutes.

    Is the system bricked? how long should I wait before I give up?

    The Power supply no lon

    By Anonymous Anonymous, at 8:46 pm  

  • I was upgrading from 2.1.0-->2.1.1 and the system crashed. Now it gets as far as the green "loading" screen, and then a black screen. I tried to put gp2xfile.img in the SD card, but nothing seems to happen (I don't have the serial cable, but it stays in a black screen for hours). Do I need any keypress for this file to be upgraded? Do I need the 1.0.1 kernel for it to work? Help, please!

    By Blogger Steve Max, at 1:05 pm  

  • Looks like a good guide, but I'm not too sure where to start with mine.
    The power light comes on, but that's all. The screen stays black & there's not even any sound :(

    Any idea what can cause this. Is it the Nand that's crapped out or the boot loader, or something else?

    Any help that you can give me would be cool Thanks :)

    By Anonymous Anonymous, at 3:15 am  

  • Great guide! Many thanks.

    I just got a GP2X with firmware v2.0.0 and immediately tried to upgrade to v2.1.1 on batteries...big mistake. The unit booted as normal afterwards until it got past the green 'Loading' screen, then the screen went black and was unresponsive.

    After following this guide (with a PSU) the unit would only boot to the 'Loading' screen before freezing. However, after many hours of re-flashing and faffing around, I tried upgrading back to v2. Success! Give that a try if you have a similar problem.

    By Anonymous Anonymous, at 2:47 pm  

  • Beautiful Guide, I changed teh batteries because it was bricking after the black screen and It booted right up. Props to you. Thanks

    By Anonymous Anonymous, at 4:58 am  

  • What is the procedure under linux to put the serial input into a file, or parallel input ? I have both cables and am using a BOB unit.

    Thank you in advance.

    By Anonymous Anonymous, at 8:13 am  

  • Thank you :D you saved me :D I played around with my kernell and whoops after many attempt so make it better it finaly broke totaly but you saved me :)

    //som99

    By Anonymous Anonymous, at 4:18 pm  

  • It was nice to find this blog.....gave me a few ideas that eventually bore fruit.

    I had carefully upgraded from firmware version 2.1.1 to 2.1.2 and observed hanging on firmware-load forever. Power off/on to affect normal boot didn't help .. it also hung. But, my boot loader was intact (music and display cues were there).

    My "un-brick" recipe was as follows:

    (1) Hardware Prep :: My PC mobo has two USB 2 headers (9-pin). I had an old "internal" USB 1 card reader so it doesn't fit. But, it has a USB printer interface. So, I opened my case for power connection and plugged the USB printer cable into the card reader and an external USB connector.

    (2) Powered up the PC and I can access the SD memory through the card reader -- no worries. Lucky me, eh?

    (3) I downloaded my old GP2X firmware (2.1.1) and re-applied it to the SD memory root.

    (4) Inserted the SD memory into the GP2X and then holding down SELECT and START, I powered up.

    (5) The firmware took a few seconds to update and I was automatically into normal operations.

    Yay!

    Thanks again for the tips and ideas.

    By Anonymous Anonymous, at 9:47 pm  

  • Looks scary...

    Luckily my UBOOT is intact, although I have not been brave enough to follow this tutorial yet for fear of making things worse...

    By Anonymous Anonymous, at 1:21 pm  

  • I don't know if my gp2x is bricked
    It turns on fine and everything works except it can't open files. When I go to open my sd card or nand, I don't see any files. Is it truly bricked or is it a something else

    By Anonymous Anonymous, at 2:00 am  

  • Man, thanks for this you realluy got me out of the preverbial, thought I had bricked a mates 2x with a bad update and your files have saved me :)

    By Anonymous Anonymous, at 6:48 am  

  • Managed to sort it only for the unit to fail 5 mins later, biggest pile of Korean crap

    By Anonymous Anonymous, at 1:28 pm  

  • This may be a stupid question, but where do you connect a serial cable?

    Is it in the same port as you connect the Breakout Box?

    By Anonymous Anonymous, at 8:44 pm  

Post a Comment

<< Home