noabody said:
I thought there was more to it than the screen since the MK1 u-boot is incompatible with the MK2. And yes, I arbitrarily used MK1 and MK2 to designate the F-200 versions. Perhaps F-200 and F-200( B ) would have been more appropriate but since all of the models say F-200( B ) I'd suggest owners make a mental note or relabel the sticker on the back or something.
In the absence of other identifiers, it may be better to find out at which serial number they started issuing the new screens. It's likely they are in a serial "run" of numbers from a certain starting point. Or to provide a utility that can probe the Linux /proc directories to find out what LCD it is using.
noabody said:
Really, if you think about it, the GP2X is one of the few devices out there without a thorough software crosscheck to ensure the flashing process will be successful. Most manufacturers build in a great deal of safety into the process because they don't want to have to deal with it as a customer service issue. From what I can tell GPH has no customer service or return procedures.
There's a certain truth to these statements. I wouldn't say that the GP2X was "one of a few", there are MANY devices that you can firmware-flash without any protection (The BT HomeHub comes to mind because people are doing drive-by flash attacks on it so that they can sniff all your traffic). But firmware updates are NOT to be taken lightly. People still just assume that they "have to" update. They don't. Any firmware can mess up ANY machine (your DSL router, your GP2X, your PC, your Sky digibox, your Wii, your printer, anything that uses firmware - I have personally witnessed at least one example of each of the above dying due to a firmware update) and then you're on your own. Support contracts won't cover BIOS-flashing generally, whether they "allow" it or not. Some manufacturers (a minority in the embedded area, actually) provide safety features such as double-ROM's and recovery processes but you are ALWAYS upgrading firmware at your own risk. Even those manufacturers will be reluctant to take back a bad-Flash'ed board.
And even on the best board, Flash CAN die halfway through a flashing process, or the power can go, or any number of problems.
noabody said:
Certainly u-boot, or more generically firmware upgrade code, should be safeguarded. The firmware upgrade code and recovery should be very low level, no hardware other than that required should be initialized. A specialized keystroke combination should be used to initiate the process and format/test NAND as required. Obviously u-boot should be stored in a protected NAND partition or space.
I believe all of these ideas are present in the Pandora, the GP2X's "successor-in-spirit". Basically, U-boot is made completely read-only and there is NO way to change it without interfacing directly with the hardware (JTAG etc.) The OS, no matter what it does, has no physical way to update the bootloader part of the firmware - at least that's the idea. That means that if someone finds a bug in U-boot (like, say, the ones that caused problems for people switching between new and old GP2X firmwares), then you're stuck with it. It's a good thing, overall, but it has it's pains not only in use but in development, support, repair etc.
noabody said:
Maybe the difference is that this is a linux based system. The proprietary nature of the AMI bios allowed them to protect the boot region of the flash as a separate entity from the program region but you could override that and erase everything.
The OS makes absolutely no difference whatsoever. BIOS functions are BIOS functions and no operating system should be playing with them. Updating firmware is done through hardware-level access no matter what OS you use, or what you boot from. You can flash under Windows, under Linux, under MacOS, under DRDOS/PCDOS (which I believe is what some BIOS update floppies use), or just have a bare "no-OS" floppy that just updates the BIOS. You can flash from anything given the right instructions -which normally consist of just throwing some data to a particular place on a particular bus, a place which is NEVER normally touched - OS's should not write to ANYTHING that they don't know.
If you can overwrite the BIOS in one OS, you can do it in all of them. It's as simple as that. Protected regions are protected in all OS but BIOS upgrades are usually not "protected", they are just a particular place for storage of data that nothing except BIOS update utilities will bother to write to. They might have certain "keys" (e.g. you have to enter your BIOS password), they might need certain sequences but they are all eraseable no matter what the OS. In fact, it's MUCH, MUCH harder to write to a BIOS in a non-mainstream OS because if a vendor-supplied utility isn't ported, it's very difficult to figure out how it's done.
noabody said:
Does the linux kernel even come into play with u-boot?
No. U-boot is a boot loader. It loads before any OS does (the BIOS "hands-off" to U-Boot) and then it lets you select which OS to boot. It's the equivalent of LILO, GRUB, the Windows MBR (boot menu) and similar - they all work BEFORE the OS and can theoretically boot any OS available. The main "bricking" problems come when U-boot is broken. Then NOTHING works, except a JTAG recovery.
noabody said:
I would think the kernel could panic with an incorrect device driver and prevent getting to the point where the firmware could be reflashed.
The GP2X flash process, as far as I can tell, is a little tiny bit shoddy, but not that much different to most BIOS practices on cheap computers. It's just done (by default) in Linux userland, but there's nothing stopping someone booting any compatible OS and repeating the same steps with the same result. It consists of writing some files with "disk images" to the NAND chip. There's no protection.
Basically, the machine starts U-Boot, which boots Linux. As part of the GP2X's Linux normal startup procedure (think AUTOEXEC.BAT) it looks on the SD card for specifically-named files. If it finds them, it copies them over the ones in NAND. There's a file for the kernel, one for U-Boot, one for the filesystem. There is no NAND protection whatsoever, it's just seen as an MTD (memory technology device, think "USB key" if you need an analogy), no matter what the OS. Therefore anything could do this same step at any time with any data but there is only ONE bit of code actually present in the GP2X that writes to this area (the boot scripts) - hence your NAND is only ever written to when you TRY to update the firmware or, theoretically, if someone performs the same step in their flash-new-GP2X-game-that-you've-run-without-checking-what-it-does - the same as ANY other modern computer or mainstream embedded system. Yes, a virus with admin access could potentially re-flash your machine and break it. This isn't news.
However, there seem to be very few integrity checks in the GP2X (which is the same for most embedded systems firmware update procedures that I've seen - everything from HP Laserjet's, Samsung network printers, expensive network switches, DSL and wireless routers etc.) and therefore there's not much you can do to check that the disk you are flashing from is intact. And if you fail halfway through (power failure, broken NAND, bad data from the SD etc.) - you can't get through the corrupt U-Boot to boot the corrupt Linux kernel from it's corrupt Linux filesystem in order to update the firmware. The same as most things that use firmware.
It's not a good design, no. But it's for a very rarely-used function (most people WON'T be updating their firmware), which is quite technical and says it's dangerous, that isn't supported anyway, and that can be recovered from with the right knowledge/hardware.
The only way to "stop" this potential corruption is to make one piece of the chain uncorruptable - the bootloader, U-Boot. (in the same way that your motherboard manufacturer has made their "recovery bootloader" uncorruptable). Which is how the Pandora safeguards it's firmware, I believe, but it means that it's then almost impossible (without doing complicated JTAG interfacing direct to the chips "below" the OS level) to change the actual real bootloader. That may or may not be a problem depending on how well you design the bootloader in the first place and what your users want to do.
In that same way, if you were to run an arbitrary program on your PC, it could update your BIOS as simply as running the "official" BIOS manufacturers restore disks... it's incredibly simple. Some BIOS have certain safeguards (e.g. you must supply the BIOS password etc.) but most of them don't and most of those that do never have the options switched on (I switch them on in the schools I work for - kids love to brick printers and computers if they can). And even with the safeguards, any user DELIBERATELY updating their BIOS is still susceptible to things going wrong - power failures, NAND failures, data being corrupted as it comes over the SD interface.
There are ways to stop it, yes, but even the early Wii's had a firmware problem which wiped out a small minority of the systems on one of the first firmware updates. The XBox did too. You name it, if it has firmware you can make it go wrong and each time you flash you cannot guarantee it will be succesful. All you can (hopefully) guarantee is that there's a good chance you'll get another shot at upgrading the firmware without having to take the thing apart. Even that isn't a guarantee that you'll still be able to apply a full, working firmware to the machine from that point onwards (i.e. if your NAND chip is totally broken then it won't take the new firmware and you're machine will never boot anything other than the bootloader itself).
noabody said:
It's really a shame that GPH didn't do a better job safeguarding the GP2X. I guess the "user" should inherently know not to do things that are going to brick their device.
We got to the crux of the matter eventually, then.