Firmware Flashing : Possible Fix


Tetedeiench

Still Fresh
Joined
Dec 7, 2005
Messages
73
Hey guys,

While playing around with S-term, i thought of something that might make your unit flash without problems...; without of SD.

Here's the idea : the SD card is mounted on /mnt/sd . Using S-term, it is possible to copy the firmware from the SD card to let's say... /root, unmount the SD card, then copy the firmware to /mnt/sd . So the SD mount point has a file named gp2xkernel.img .

Now, if the unit reboots without SD, it'll probably try to mount the SD.... without luck. Then it MIGHT check for the file /mnt/sd/gp2xkernel.img, which it will find ( we copied it earlier). Flash it, delete it, reboot, done.

No filesystem screwups and such.

However, there are 2 cases where this won't work :
-If the gp2x address the device in a raw fashion, before everything is loaded : won't work
-if the gp2x checks if there's a SD card first, and does not check the gp2xkernel.img file after

As i don't have any tool to debug my gp2x, i probably wait for somebody with a better equipment than me to try it.

Be careful, IT CAN FAIL ! In several fashions. That's why somebody has to try it out.THIS MATY SCREW UP YOUR GP2X !

If this is a dumb idea... nevermind :D But i guess this workaround is worth a try.
 
Sounds viable. I'm looking forward to someone trying this out, since my SD card is on the shitlist...
 
RiX0R posted on Dec 7 2005 at 09:42 AM said:
Sounds viable. I'm looking forward to someone trying this out, since my SD card is on the shitlist...


maybe, someone who knows how to unbrick gotta try and give us a procedure :D (i don't know linux commands enough myself to be sure to make no mistake :p )
 
Last edited by a moderator:
It's u-boot that does the firmware upgrade before linux is loaded, so it's looking for an actual sd card not a folder somewhere (u-boot doesn't even know that the folder exists).
 
this 'might' work for gp2xfile.img, but it won't work for gp2xkernel.img/gp2xboot.img, because both of those files are flashed by u-boot, and u-boot isn't mounting the jffs2 filesystem to check for *.img files, but is instead directly reading the SD device looking for them ..
 
I think that is quite viable. We have the u-boot source available to us, so I am assuming that the flash code is in there. It should be possible to write a utility that can do the flash from files on the SD card while running normally.

I know this would help me because I cannot get my firmware upgrades to work at all.
 
slygamer posted on Dec 7 2005 at 12:30 PM said:
I know this would help me because I cannot get my firmware upgrades to work at all.

i think it would help at least 2/3 of GP2X owners ! :D
we are soooo many to have only one or 2 SDcards, working for everything except flashing :huh:
 
Last edited by a moderator:
woogal posted on Dec 7 2005 at 05:48 AM said:
It's u-boot that does the firmware upgrade before linux is loaded, so it's looking for an actual sd card not a folder somewhere (u-boot doesn't even know that the folder exists).

That's pretty much the end of the story there. This method won't work. What should be possible is to write a program to upgrade U-Boot from Linux, then you'll be able to upgrade Linux from U-Boot using the normal method.
 
Last edited by a moderator:
DijiTao posted on Dec 7 2005 at 02:07 PM said:
What should be possible is to write a program to upgrade U-Boot from Linux, then you'll be able to upgrade Linux from U-Boot using the normal method.



let's stop saying that it should be possible and let's find someone who can DO it :D
 
Last edited by a moderator:
You shouldn't even need a program to flash the firmware - just a shell script to cat a firmware image file to the appropriate /dev/mtd/ device. Someone that knows what they're doing (and actually has a gp2x) should try this first though...
 
BradN posted on Dec 7 2005 at 05:14 PM said:
You shouldn't even need a program to flash the firmware - just a shell script to cat a firmware image file to the appropriate /dev/mtd/ device. Someone that knows what they're doing (and actually has a gp2x) should try this first though...


*.gpu files are shell scripts aren't they ?

but is the firmware mounted?

if there are patchs for the gp2X's software based on a *.GPU, why didn't they directly made a firmware update except if it's simply because it's not in the filesystem ?
 
Last edited by a moderator:
nobody who really knows what they're doing with this sort of thing wants to do it without having a JTAG cable handy to repair their brick. i, for one, brick my machines all the time; if it weren't for the collection of JTAG cables i have at hand, i'd have a lot of bricks.. but thankfully i can recover my machines most of the time, courtesy of JTAG.

when JTAG is out there, i predict we'll see a lot more hacking around with this issue ...
 
Linux represents flash chip based memory as mtd devices (kinda like hda or sda, etc for a hard drive) - linux on the gp2x mounts one of these for its root filesystem.

The cool part is linux already has support to write to the chip if you can write to the NAND in the filesystem (there's probably separate mtd devices for u-boot and the kernel), and updating it is as simple as just copying new images to the mtd device(s).

I'm not sure what format gamepark's firmware files are in - you would want an absolute bare firmware image without any extra shell scripts or anything in the file to update the firmware this way. Updating u-boot and the kernel would probably be possible without any extra messing around, but updating the root filesystem could be tricky because linux still needs it for things (but if you re-mount it read-only before and reboot right after flashing it would probably be ok)

/proc/mtd should give info on the different "partitions" in the flash chip (for example, here's the output from linux on my linksys router):

~ # cat /proc/mtd
dev: size erasesize name
mtd0: 00040000 00010000 "pmon"
mtd1: 003b0000 00010000 "linux"
mtd2: 002cbcc9 00010000 "rootfs"
mtd3: 00010000 00010000 "nvram"
mtd4: 00050000 00010000 "ddwrt"
 
BradN posted on Dec 7 2005 at 07:54 PM said:
Linux represents flash chip based memory as mtd devices (kinda like hda or sda, etc for a hard drive) - linux on the gp2x mounts one of these for its root filesystem.

The cool part is linux already has support to write to the chip if you can write to the NAND in the filesystem (there's probably separate mtd devices for u-boot and the kernel), and updating it is as simple as just copying new images to the mtd device(s).

I'm not sure what format gamepark's firmware files are in - you would want an absolute bare firmware image without any extra shell scripts or anything in the file to update the firmware this way. Updating u-boot and the kernel would probably be possible without any extra messing around, but updating the root filesystem could be tricky because linux still needs it for things (but if you re-mount it read-only before and reboot right after flashing it would probably be ok)

/proc/mtd should give info on the different "partitions" in the flash chip (for example, here's the output from linux on my linksys router):

~ # cat /proc/mtd
dev: size erasesize name
mtd0: 00040000 00010000 "pmon"
mtd1: 003b0000 00010000 "linux"
mtd2: 002cbcc9 00010000 "rootfs"
mtd3: 00010000 00010000 "nvram"
mtd4: 00050000 00010000 "ddwrt"

At least, on gp2x, it's straightforward : ( thanks alot for this info ).

This is on my gp2x (unflashed) :
Code:
dev:    size   erasesize  name
mtd0: 00080000 00004000 "Bootloader"
mtd1: 00020000 00004000 "Param"
mtd2: 00100000 00004000 "Kernel"
mtd3: 01800000 00004000 "Filesystem"
mtd4: 02660000 00004000 "Extend"
mtd5: 04000000 00004000 "NAND 64MiB 3,3V 8-bit"
 
Last edited by a moderator:
I'm going to try something weird : format my SD directly on the gp2x using Sterm... shrug.
 
Tetedeiench posted on Dec 7 2005 at 08:12 PM said:
I'm going to try something weird : format my SD directly on the gp2x using Sterm... shrug.
Of course, said the device was busy, because of sterm.... sigh
 
Last edited by a moderator:
Tetedeiench posted on Dec 7 2005 at 10:19 PM said:
Tetedeiench posted on Dec 7 2005 at 08:12 PM said:
I'm going to try something weird : format my SD directly on the gp2x using Sterm... shrug.
Of course, said the device was busy, because of sterm.... sigh

just copy sterm to the nand and run it from there :p
 
Last edited by a moderator:
efegea posted on Dec 7 2005 at 08:26 PM said:
Tetedeiench posted on Dec 7 2005 at 10:19 PM said:
Tetedeiench posted on Dec 7 2005 at 08:12 PM said:
I'm going to try something weird : format my SD directly on the gp2x using Sterm... shrug.
Of course, said the device was busy, because of sterm.... sigh

just copy sterm to the nand and run it from there :p

Funny thing is, there's no mkfs.msdos there too...

only bfs, ext2, ext3, minix. :D

Funny.

So well... where should i copy Sterm for it to run on the nand, do you know that ?
 
Last edited by a moderator:
Back
Top