FixFlash - Flash Verify and Repair Tool by SavvyX4 (Updated 9/9/10)

Search This thread

SavvyX4

Member
Mar 5, 2010
26
1
FixFlash - Flash Verify and Repair Tool by SavvyX4

I was always running into problems getting my Hero CDMA to boot custom ROMs. After eventually getting frustrated enough with what seemed like inexplicable errors, I finally determined that on my phone, I would occasionally end up with corrupt files after the flash process was done. If I was lucky, it would be an unimportant file or two that would end up corrupt, but sometimes it would be a critical framework, which is why I was having trouble booting.

Enter FixFlash, a shell script that runs on the phone after flashing a new ROM image from recovery. FixFlash will verify the integrity of the files copied to the phone during the flash process and in the event of a problem, automatically make a fresh copy of the corrupt file in an effort to resolve the problem.

I developed this tool because of my own problems, but I think that I may be able to help some other people who's phones are giving them them same sorts of problems that mine does me. I am open to any suggestions on improvements, and welcome any feedback!

FixFlash is very easy to use, and only requires that you do the following:

1. Copy FixFlash.sh to the root of your sdcard
2. Extract the zip of the ROM you want to flash to your phone on your computer. This is necessary for the verification process.
3. Copy both the original .zip file and the extracted folder of the .zip to the root of your sdcard
4. Boot into recovery and follow your normal flash procedure.
5. Once the flash has finished, but before doing anything else in Recovery, run this command from your computer's terminal/command prompt:

adb shell sh /sdcard/FixFlash.sh

You should see output in your terminal/command prompt indicating if there were any corrupted files encountered, and whether or not they were repaired. The whole process is fairly quick, and should only take a minute or so, depending on your sdcard speed.
6. Reboot your phone and enjoy!

At this point you can remove the extracted copy of the zip from your sdcard, its job is done!

** Updated Script available ** Download from link below and replace existing copies with that file to update.
Sep 9 2010 - 1.1 - Fixed problem with files like AVRCP.kl showing as bad because of case change of filename between phone and zip


More information (including full changelog) is available here:
http://notepad.cc/fixflash

Direct Download Link:
http://db.tt/GPssIoe

If you have any problems with FixFlash PLEASE post your recovery.log to PasteBin along with a description of the issue so that I may look into whatever is causing the problem. Thanks!
 
Last edited:
  • Like
Reactions: Manok98

SavvyX4

Member
Mar 5, 2010
26
1
I have always wondered what people might be doing wrong, because I have *never* had an issue booting a known good ROM.

Perhaps the internet connection or SD card is to blame?

I always verify hashes on downloaded ROMs, and as the files are extracted to the sdcard they are verified by Recovery. The problem is that they aren't verified after they are copied to the phone's internal storage, which is where with my phone I'm seeing corruption. I have been dealing with this problem for a long time, and tried numerous different combinations before finally catching a break with a flash that corrupted one of the frameworks that gets called immediately when booting. that narrowed down the number of files to check manually and once I found a bad hash on my phone's internal storage, I knew for sure what was wrong and set about automating a workaround.
 

SavvyX4

Member
Mar 5, 2010
26
1
I would agree, having the recovery automatically verify the flashed files in a similar manner to what I've done with this script would be ideal. Even though I believe that FixFlash is easy to use, not having to do anything other than a normal flash would be easier and possibly save people who may not be aware of a lurking issue with their phones a lot of grief.

Sent from my HERO200 using XDA App
 

mrinehart93

Senior Member
Oct 11, 2009
1,853
308
Chicago
Savvy, you should contact Koush and have him add this into ClockwordMOD... you would help SO many people out with this. Quick question just so I can learn something: How does the script know how to repair the framework files? I mean how can it tell what ROM it is, and know the correct file to repair?
 

SavvyX4

Member
Mar 5, 2010
26
1
I am using the recovery.log that is generated during the flash process to figure out which files belong where. Inside the zip for the rom the files are in the same directory structure so it ended up only requiring some minor work to get it to locate everything. And the same log identifies what is being flashed which is how it knows which directory to work with.



Sent from my HERO200 using XDA App
 
I am using the recovery.log that is generated during the flash process to figure out which files belong where. Inside the zip for the rom the files are in the same directory structure so it ended up only requiring some minor work to get it to locate everything. And the same log identifies what is being flashed which is how it knows which directory to work with.



Sent from my HERO200 using XDA App

This is really nice Savy, good work. I hope I never have to use u'r script tho, lol (in a completely non-offensive way) :)
But, if that day ever comes, I have to say, it's great to know that someone like u'r self has been able to locate and work around the issue.
 

marken

Senior Member
hey Savvyx
man please you have any other method for repair without adb??
my desire bricked lost adb, lost root, radio, completely stock again but with usb bricked and sd card but sd working now but my usb is over, do you have any idea what i have to do to restore my usb??
thanks
 

SavvyX4

Member
Mar 5, 2010
26
1
I only have my Hero to test it on but I don't know of any reason why it wouldn't work on any phone. I'm not doing anything specific to the device.

Sent from my HERO200 using XDA App
 

SavvyX4

Member
Mar 5, 2010
26
1
hey Savvyx
man please you have any other method for repair without adb??
my desire bricked lost adb, lost root, radio, completely stock again but with usb bricked and sd card but sd working now but my usb is over, do you have any idea what i have to do to restore my usb??
thanks

Unfortunately what I've put together here completely relies on having access to a shell with all the utilities that come with it. If you've lost your root and can't get adb to work then this tool isn't what you need.

I have heard of people who have been having trouble with adb getting it back by turning off usb debugging, rebooting their phone and then turning usb debugging back on but I don't know if that would help you with all the troubles you described.

Sent from my HERO200 using XDA App
 

Visionikz03

Senior Member
Dec 3, 2008
912
189
H-Town
Worked like a charm Savvy!!! It found two bad files nd replaced them no problem. Hey will this work on any type of flashable zip for example if u want to flash a new kernel or theme could i extract the zip to the sd card flash thru recovery nd then run FixFlash to verify the it flashed correctly? This is awesome bro!!! Should definitely be incorporated into both Clockwork and Amon Ra recoveries!
 

langrisser

Member
Jul 23, 2010
44
0
I only have my Hero to test it on but I don't know of any reason why it wouldn't work on any phone. I'm not doing anything specific to the device.

Sent from my HERO200 using XDA App

Ok imma test it tonight my G1. I've been having problems loading 90% of the roms, already tried pretty much everything so i'll give this a try. Will post my results later.
 

Philosuffer

Senior Member
Jun 14, 2010
332
24
Thanks for this great utility. Evo owner here and just wanted to give my input.

Just flashed a new ROM and ran FixFlash. Here's my output.
Code:
E:\aEVO\android-sdk-windows\tools>adb shell sh /sdcard/FixFlash.sh
* daemon not running. starting it now *
* daemon started successfully *
FixFlash - Flash Verify and Repair Tool by SavvyX4

Gathering verification data...
Mounting phone file systems...
Extracting file information from flash log...
Verifying file integrity...
Hash mismatches detected: 13
Bad files...
   /system/app/EPST.apk
   /system/app/HTC_IME.apk
   /system/app/IQRD.apk
   /system/app/PCSCII.apk
   /system/app/RSS.apk
   /system/customize/CID/cidProfile1.xml
   /system/customize/CID/cidProfile2.xml
   /system/customize/CID/default.xml
   /system/customize/COMMON.xml
   /system/customize/MNS/default.xml
   /system/etc/TPA2018.csv
   /system/etc/WPDB.zip
   /system/usr/keylayout/AVRCP.kl
Replacing bad files...
Verifying replacement file integrity...

All hash mismatches repaired!

So, it definitely does work for other phones. I then immediately Wiped Data/Cache/Dalvik, Flashed the same ROM again, and then ran FixFlash again.

Lo and behold, different results (meaning that FixFlash is a very valuable tool, and should definitely be used after flashing any ROM or .zip for that matter.) In my eye, it is a must use tool now.
Code:
E:\aEVO\android-sdk-windows\tools>adb shell sh /sdcard/FixFlash.sh
FixFlash - Flash Verify and Repair Tool by SavvyX4

Gathering verification data...
Mounting phone file systems...
Extracting file information from flash log...
Verifying file integrity...
Hash mismatches detected: 26
Bad files...
   /system/app/EPST.apk
   /system/app/HTC_IME.apk
   /system/app/IQRD.apk
   /system/app/PCSCII.apk
   /system/app/RSS.apk
   /system/customize/CID/cidProfile1.xml
   /system/customize/CID/cidProfile2.xml
   /system/customize/CID/default.xml
   /system/customize/COMMON.xml
   /system/customize/MNS/default.xml
   /system/etc/TPA2018.csv
   /system/etc/WPDB.zip
   /system/usr/keylayout/AVRCP.kl
   /system/app/EPST.apk
   /system/app/HTC_IME.apk
   /system/app/IQRD.apk
   /system/app/PCSCII.apk
   /system/app/RSS.apk
   /system/customize/CID/cidProfile1.xml
   /system/customize/CID/cidProfile2.xml
   /system/customize/CID/default.xml
   /system/customize/COMMON.xml
   /system/customize/MNS/default.xml
   /system/etc/TPA2018.csv
   /system/etc/WPDB.zip
   /system/usr/keylayout/AVRCP.kl
Replacing bad files...
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    FixFlash - Flash Verify and Repair Tool by SavvyX4

    I was always running into problems getting my Hero CDMA to boot custom ROMs. After eventually getting frustrated enough with what seemed like inexplicable errors, I finally determined that on my phone, I would occasionally end up with corrupt files after the flash process was done. If I was lucky, it would be an unimportant file or two that would end up corrupt, but sometimes it would be a critical framework, which is why I was having trouble booting.

    Enter FixFlash, a shell script that runs on the phone after flashing a new ROM image from recovery. FixFlash will verify the integrity of the files copied to the phone during the flash process and in the event of a problem, automatically make a fresh copy of the corrupt file in an effort to resolve the problem.

    I developed this tool because of my own problems, but I think that I may be able to help some other people who's phones are giving them them same sorts of problems that mine does me. I am open to any suggestions on improvements, and welcome any feedback!

    FixFlash is very easy to use, and only requires that you do the following:

    1. Copy FixFlash.sh to the root of your sdcard
    2. Extract the zip of the ROM you want to flash to your phone on your computer. This is necessary for the verification process.
    3. Copy both the original .zip file and the extracted folder of the .zip to the root of your sdcard
    4. Boot into recovery and follow your normal flash procedure.
    5. Once the flash has finished, but before doing anything else in Recovery, run this command from your computer's terminal/command prompt:

    adb shell sh /sdcard/FixFlash.sh

    You should see output in your terminal/command prompt indicating if there were any corrupted files encountered, and whether or not they were repaired. The whole process is fairly quick, and should only take a minute or so, depending on your sdcard speed.
    6. Reboot your phone and enjoy!

    At this point you can remove the extracted copy of the zip from your sdcard, its job is done!

    ** Updated Script available ** Download from link below and replace existing copies with that file to update.
    Sep 9 2010 - 1.1 - Fixed problem with files like AVRCP.kl showing as bad because of case change of filename between phone and zip


    More information (including full changelog) is available here:
    http://notepad.cc/fixflash

    Direct Download Link:
    http://db.tt/GPssIoe

    If you have any problems with FixFlash PLEASE post your recovery.log to PasteBin along with a description of the issue so that I may look into whatever is causing the problem. Thanks!