yashsingh1/xdaforums huggingface dataset:
[Hero CDMA Android Development] x99percent:
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?
[Hero CDMA Android Development] mrinehart93:
Hmm, this is a very good idea. Maybe it will be incorporated into future CyanogenMOD builds?
[Hero CDMA Android Development] SavvyX4:
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.
[Hero CDMA Android Development] x99percent:
Is it fair to say that, in your case, this workaround is a software fix for a hardware problem?
[Hero CDMA Android Development] SavvyX4:
I would agree, this would certainly qualify as a software fix for a hardware problem.
[Hero CDMA Android Development] Sparticuz:
Even better, this should be incorporated into Clockwork & Amon RA!
[Hero CDMA Android Development] SavvyX4:
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.
[Hero CDMA Android Development] mrinehart93:
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?
[Hero CDMA Android Development] SavvyX4:
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.
[Hero CDMA Android Development] Androidious:
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.
[Hero CDMA Android Development] smartsreenath:
SavvyX4,any way i wiil try........

Uploaded with ImageShack.us
[Hero CDMA Android Development] marken:
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
[Hero CDMA Android Development] langrisser:
this works on all android devices or just Hero?
[Hero CDMA Android Development] SavvyX4:
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.
[Hero CDMA Android Development] SavvyX4:
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.
[Hero CDMA Android Development] Visionikz03:
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!
[Hero CDMA Android Development] langrisser:
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.
[Hero CDMA Android Development] SavvyX4:
Yup, should definitely work with any flashable zip file.
[Hero CDMA Android Development] Philosuffer:
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.

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.

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...
[Hero CDMA Android Development] SavvyX4:
I think why you are seeing 26 files the 2nd time is because the recovery.log that its being parsed out to figure out what was flashed keeps track of everything done since you boot into recovery, which also means that if you flash the same zip twice in the same session, that the files will be in the log twice and FixFlash will check them twice before trying to fix them. This doesn't cause any problem, but it certainly would inflate the numbers on run number 2!

I do find that in my case with my phone, if I flash the same zip I always get the same bad files, but if I flash a different zip I may see different files. I'm assuming this is because the flash procedure ends up writing the same files to the same place in the flash every time for the same zip, and because the bad blocks in my phone's flash are fixed, the same files end up being trouble. That also is backed up by the fact that when i did stumble upon a zip that worked, it would always work when reflashed, even though a day different nightly build, for example, with basically no changes in it might not boot because an important file just happens to land in a bad area of flash.
[Hero CDMA Android Development] rjmjr69:
ok I'm having a blond moment can you please explain in a bit dumber terms what you mean by EXTRACTING Folder of rom to root of SD card? IDU that part. If the rom.zip is there am I just unzipping the whole rom into one folder on the root of sd?
[Hero CDMA Android Development] Philosuffer:
Yes, that's exactly it.

Thanks for the detailed explanation. Definitely gives me a better understanding of what's happening.
[Hero CDMA Android Development] rjmjr69:
Ok one other question what do I name the folder?
[Hero CDMA Android Development] SavvyX4:
If you are flashing super_awesome_rom.zip to your phone, you need the following for FixFlash to work, assuming you are on a PC and your phone's SD card is S: (which I'm sure its not)

Copy rom to SD at the root

S:\super_awesome_rom.zip

Extract the zip to the root of the SD, with the name of the archive as the directory name

S:\super_awesome_rom\[files from zip]

Does that make sense?
[Hero CDMA Android Development] rjmjr69:
Awesome thank you so very much for a great tool. Now to find a way to not have to use a pc and inflate the files!
[Hero CDMA Android Development] Shelnutt2:
I hope you don't mind, but I was thinking that we could use busybox's unzip functionality to unzip the .zip to the sdcard so it could be done more automatically. I have NOT been able to test this yet, I don't have my cable with my right now, but I thought I'd post it up anyone. I've made a patch to your .sh . I'm posting the patch and the complete script. Just rename with the .txt and run adb shell sh /sdcard/FixFlash-unzip.sh instead of /sdcard/FixFlash.sh

I PROVIDE NO WARRANTY! THIS IS AS-IS AND I HAVE NOT TESTED IT!

What I modified was simple, it now gets the name of the zipfile also, then it check to see if the IPATH exists (the folder with the extracted files), if it doesn't, it creates it. If it does then it checks to see if it's empty. If it is empty and it finds busybox on your system then it uses busybox unzip to unzip the .zip file. Then the script proceeds like it did before.

Here are the md5sum's

31c314482c3d532e3311e95f2eee71cf FixFlash.patch.txt
09f4b2a4ee1415de667a8255b5f63d6a FixFlash-unzip.sh.txt
[Hero CDMA Android Development] rjmjr69:
Thank you that's what im talking about a bit more automagic lol i will test asap
[Hero CDMA Android Development] SavvyX4:
I actually tried using the busybox unzip but was unable to extract the zip files for phone roms because it didn't understand the format of the file, presumably due to the extra info that gets put in to make it a valid, flashable zip from recovery. I'm looking into if there is another unzipping util that would run from recovery off the sdcard, but I haven't dug very deep yet.
[Hero CDMA Android Development] bootlooper:
I ran this utility, then immediately re-ran the utility again with no wipes/flashes/whatever inbetween and it claimed to fix the exact same files it had corrected 5 seconds before. So it seems this utility identifies files that are not exactly copied, but is not actually correcting them (pointing to a hardware problem). Anyone else seeing this behavior?
[Hero CDMA Android Development] Shelnutt2:
Interesting, I just tried it on my phone and you are right, it doesn't work. However in gentoo busybox works fine (which is what I used to test my patch).

RA 1.6.2:

BusyBox v1.16.2androidfull (2010-08-01 14:57:25 EDT)

Gentoo:

BusyBox v1.17.1 (2010-08-19 00:58:01 UTC)

Maybe we just need a newer version of busybox? Can we flash that into recovery or would we need to rebundle the recovery image?
[Hero CDMA Android Development] langrisser:
Awesome tool!! Just giving my input, and to verify that this works on the G1. Not sure how or why this happend but i was unable to succesfuly flash most roms on my tmo G1. I tried everything from, new sd card, to trying to unroot my phone, which didnt work btw, i was unable to unroot and get back to donut, it would freeze at bootscreen after applying 1.5 update manually or OTA.

Then FixFlash came like god send! heres my input on one of the roms i was unable to boot before fixflash (htcclays SuperFast1.3.3)

moisess-macbook:tools moy$ ./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: 3
Bad files...
/system/app/IM.apk
/system/framework/services.jar
/system/usr/keylayout/AVRCP.kl
Replacing bad files...
Verifying replacement file integrity...

All hash mismatches repaired!

Thanks so much for your work and all your help SavvyX4!!
[Hero CDMA Android Development] rjmjr69:
I have the latest recovery and busybox installed let me see what happens

Got a syntex error on line 7
[Hero CDMA Android Development] Shelnutt2:
Try again, I edited the files. Also if it works or even if it doesn't, can post the version of busybox? Just in recovery, do adb shell, then busybox, and the first line tells you the version.

Thanks
[Hero CDMA Android Development] SavvyX4:
I just flashed a new ROM to my phone, and wanted to test this as well, so I ran FixFlash twice in a row and did not see this problem. I do show one file as a dupe, which is a known issue with the fact that the recovery flash process is not actually writing this file, so it looks bad to FixFlash because it is only in one of the log files, not both.

Here is my terminal output:

Flash Verify and Fix Tool by SavvyX4

Gathering verification data...
Mounting phone file systems...
Extracting file information from flash log...
Verifying file integrity...
Hash mismatches detected: 3
Bad files...
/system/lib/libandroid_runtime.so
/system/lib/libwebcore.so
/system/usr/keylayout/AVRCP.kl
Replacing bad files...
Verifying replacement file integrity...

All hash mismatches repaired!
computer:dir SavvyX4$ adb shell sh /sdcard/FixFlash.sh
Flash Verify and Fix Tool by SavvyX4

Gathering verification data...
Mounting phone file systems...
Extracting file information from flash log...
Verifying file integrity...
Hash mismatches detected: 1
Bad files...
/system/usr/keylayout/AVRCP.kl
Replacing bad files...
Verifying replacement file integrity...

All hash mismatches repaired!
[Hero CDMA Android Development] TazChris:
Long time lurker, first time poster, I think....

I just wanted to say thank you for creating this utility. My wife's phone's calendar has been FC'ing for months now. Partly due to just not wanting to fix it, and partly due to the fact it was the HTC Sence Calendar, I just did not want to deal with it.

Finally, I decided to take care of her complaining and worked on the phone. She was on DC 2.08.1. I thought about upgrading to 2.9 but there were too many complaints, so I stayed away. I tried reflashing DC 2.08.1, still FC'ing with the calendar.

So, I tried Fresh 2.4.0, wiping, etc, thinking that would work. I was wrong. So, I downloaded this, and reflashed Fresh 2.4.0 and ran the script, and lo and behold it said that /system/app/CalendarSomething.apk was bad.

Once loaded up, I tested the calendar, and it works.

So, thank you for helping the better half not yell at me anymore :)

Chris
[Hero CDMA Android Development] rjmjr69:
1.18.0 going to try again will report back
[Hero CDMA Android Development] SavvyX4:
This makes it worth all the work! :)
[Hero CDMA Android Development] bootlooper:
SavvyX4...this was done on ZenEXP 0.9.7-O. My hero is one of the temperamental ones that does not like (will not boot) most roms. I am using Darchstar's RA 1.7 recovery. I did the fixflash a total of four times, 2 before an adb remount and 2 after.

Any ideas? Sorry I dont know how to make this look nice in the post...

c:\android-sdk-windows\tools>adb shell sh /sdcard/FixFlash.sh

adb server is out of date. killing...

* 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: 8

Bad files...

/system/app/HTC_IME.apk

/system/app/PCSCII.apk

/system/app/RSS.apk

/system/bin/PPST

/system/customize/CID/default.xml

/system/customize/MNS/default.xml

/system/etc/WPDB.zip

/system/usr/keylayout/AVRCP.kl

Replacing bad files...

Verifying replacement file integrity...

All hash mismatches repaired!

c:\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: 8

Bad files...

/system/app/HTC_IME.apk

/system/app/PCSCII.apk

/system/app/RSS.apk

/system/bin/PPST

/system/customize/CID/default.xml

/system/customize/MNS/default.xml

/system/etc/WPDB.zip

/system/usr/keylayout/AVRCP.kl

Replacing bad files...

Verifying replacement file integrity...

All hash mismatches repaired!

c:\android-sdk-windows\tools>adb remount

remount succeeded

c:\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: 8

Bad files...

/system/app/HTC_IME.apk

/system/app/PCSCII.apk

/system/app/RSS.apk

/system/bin/PPST

/system/customize/CID/default.xml

/system/customize/MNS/default.xml

/system/etc/WPDB.zip

/system/usr/keylayout/AVRCP.kl

Replacing bad files...

Verifying replacement file integrity...

All hash mismatches repaired!

c:\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: 8

Bad files...

/system/app/HTC_IME.apk

/system/app/PCSCII.apk

/system/app/RSS.apk

/system/bin/PPST

/system/customize/CID/default.xml

/system/customize/MNS/default.xml

/system/etc/WPDB.zip

/system/usr/keylayout/AVRCP.kl

Replacing bad files...

Verifying replacement file integrity...

All hash mismatches repaired!

c:\android-sdk-windows\tools>
[Hero CDMA Android Development] SavvyX4:
I know of an issue with the current version of FixFlash where files that are in the zip file for the rom but are not actually copied to the phone during the flash process, like AVRCP.kl for example, show up in the list as a hash mismatch and then get copied out of the zip directory on to the phone. I haven't had an problems because of this, but it does have the unfortunate effect of showing those files every time you run FixFlash.

This is what I believe I'm seeing based on your post:

1) That particular rom has several files in the actual zip archive that are not used during the flash process.

2) The issue with your phone isn't a bad storage, but something worse, because if it was bad storage would have seen a longer list of mismatches for the first run of FixFlash and then only the files that don't actually get copied over on subsequent runs.

That being said, I'd still like to review the logs and see if there is a chance of something else being the issue. Can you wipe and reflash your phone, then copy the recovery.log to your SD card (in the Other menu I think in recovery) and then post the text of your recovery.log on pastebin.com so that I can review it?

I'm sure the information I need to see what is actually being flashed is in the zip archive for the rom somewhere, but I wasn't aware of this behavior when I put FixFlash together, which is why it doesn't account for those files. This is something I'd like to correct though, so that it has a more logical and understandable output and doesn't look like its doing more work than is really needed.
[Hero CDMA Android Development] SavvyX4:
Check OP for info on (minor) update.
[Hero CDMA Android Development] rjmjr69:
Thank you will test it out right now.

It created a folder on the sdcard with the name of the rom I installed but after over 30 minutes the only file that was inside was fixer.sh?

Going to test the new script by the op

has anyone noticed that if you mount the usb sdcard via recovery that you can not run anything after that? does it not remount or something to that effect? I'm using the latest armon 1.8.0

Well OP latest version ran very fast and successfully although it did not find any faults. But to its credit I reflashed the same rom 4 times and it did find the mistakes on the first round of tests "2nd flash" and fixed those so I would ASSUME all mismatch's were already fixed so 0 would be the right response? Had it not been updated as you figured out there would have been several REFOUND mismatches that do not get replaced really?
[Hero CDMA Android Development] bootlooper:
After a wipe and reflash of ZenEXP0.9.7-odexed and using the updated utility I get:

c:\android-sdk-windows\tools>adb shell sh /sdcard/FixFlash.sh

FixFlash 1.1 - 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: 0

Done.

c:\android-sdk-windows\tools>\

Looks good to me. I find it interesting there are apparently files in the ROM that are not flashed to the device. Did you happen to find the reason for that behavior?
[Hero CDMA Android Development] SavvyX4:
Turns out I was an idiot, or well, at least I was missing what was staring me in the face when i first ran across the issue of the same files coming up over and over: the case of the file name. For whatever reason, some files are stored in the ROM zips as abc.ext but get written to the phone as ABC.ext, which was causing my comparisons grief, even though the _contents_ of the files were the same. I changed my comparison to be case-insensitive and that took care of the false-positives.
[Hero CDMA Android Development] StreetGuru:
Ok, trying to download and run this script but i find a bit of a problem here: when i download the file i have FixFlash.download, not FixFlash.sh. I've tried renaming it and run the script but i always encounter the error "can't open /sdcard/FixFlash.sh". Can you confirm this is the right file and saved in the right format? Thanks in advance

EDIT: Ok, renamed the file to FixFlash.sh and copied to the sdcard. Cleaned system, cache and userdata and reflashed the ROM (using Biffmod 2.0.1). Then i run FixFlash command and i did got something... but i think something here went wrong. here's my output:

Now, is it me doing something wrong of the script is encountering some errors? I do have the extracted folder of the zip on the sd with the same name as the .zip file... any suggestions?

Thanks
[Hero CDMA Android Development] SavvyX4:
What recovery are you using? Also, can you post your recovery.log (you'll probably need to do the whole wipe and flash again in order to get it, as it isn't saved between reboots if you don't get a copy of it) on pastebin.com so that I can take a look at it?
[Hero CDMA Android Development] StreetGuru:
I'm using Amon_RA's 1.7. The phone is working fine atm but i'll post you the recovery.log on my next flash - should be a couple of days.

EDIT:

Ok, ended up flashing a lot sooner than i expected :)

altough i don't have a huge list like before my output is still not expected:

check out my recovery.log at

http://pastebin.com/2Tc8LMsM

Thanks in advance.