How to make valid md5 file for odin?

  • Thread starter Thread starter Android Central Question
  • Start date Start date
A

Android Central Question

I have following files for my Samsung device:
- AP_...tar.md5
- BL_...tar.md5
- CP_...tar.md5
- CSC_...tar.md5
- HOME_...tar.md5

I can flash these files successfully on my device using Odin3 v3.13.

My goal is to modify the init.rc file of AP_...tar.md5->system.img to test whether my changes can be flashed on the device or not.

For this, firstly, I have just extracted AP_...tar.md5 by `tar -xf AP….tar.md5` command. Then, I have re-compressed it using `tar -cvf AP_...tar AP_..` command. I have tried to flash this tar file but the Odin gets crashed.
Then I have tried to make it md5 file using `md5sum -t AP_...tar AP_...tar` and `mv AP_...tar AP_...tar.md5` commands but again the odin gets crashed without giving any error.

Any suggestion?
 
1. The ND5 in the file is no longer valid if you change something in the file. You have to remove the MD5, make an MD5 hash from the file, add that to the changed file and add .md5 to the end.

2. If you're changing anything but an app that's included in the flash, it's probably going to fail the booloader's test for authenticity. You have to get Samsung's code for creating files, and they don't give it out, so the only changes you can make are to things that aren't part of Android or the kernel - changing init.rc would probably cause it to fail. Since init.rc is loading everything within the /{system,vendor,odm}/etc/init/ directories, any change would probably cause a crash at some level.
 
1. The ND5 in the file is no longer valid if you change something in the file. You have to remove the MD5, make an MD5 hash from the file, add that to the changed file and add .md5 to the end.

2. If you're changing anything but an app that's included in the flash, it's probably going to fail the booloader's test for authenticity. You have to get Samsung's code for creating files, and they don't give it out, so the only changes you can make are to things that aren't part of Android or the kernel - changing init.rc would probably cause it to fail. Since init.rc is loading everything within the /{system,vendor,odm}/etc/init/ directories, any change would probably cause a crash at some level.
Exactly, better to change something with root after the flash
 
You are right that MD5 will no longer be valid if I will change anything in the file but with tar extraction the md5 is already removed and I haven't change anything in the file yet. For clarity, I have followed following steps:
1. Run `tar -xf AP….tar.md5` : It will extract the files of AP….tar.md5 file to a folder with the same name(AP...). My understanding is when tar is extracting the md5 file then it ignores the md5 checksum of the file and extract everything else in a folder. The result is a folder containing several img.lz4, img.ext4.lz4 files and a metadata folder.
2. Run `tar -cvf AP_...tar AP_..` : It will make the tar file with the folder that we get in the previous step.
Please note: I haven't change anything in the folder because I just want to try flash it without modification. If I will get success here then I will try to make changes in the init.rc file and flash it.
3. Run `md5sum -t AP_...tar AP_...tar` : It will add new checksum at the end of AP_...tar file.
4. `mv AP_...tar AP_...tar.md5` : Renaming the tar file to tar.md5 because it contains a md5 checksum.

I have also tried above thing with only `system.img`(Extracted this system.img from the AP file) and this results the md5 checksum verification success but another error. Following are the logs of this try:
<ID:0/005> Added!!
<OSM> Enter CS for MD5..
<OSM> Check MD5.. Do not unplug the cable..
<OSM> Please wait..
<OSM> Checking MD5 finished Sucessfully..
<OSM> Leave CS..
<ID:0/005> Odin engine v(ID:3.1301)..
<ID:0/005> File analysis..
<ID:0/005> Total Binary size: 5190 M
<ID:0/005> SetupConnection..
<ID:0/005> Initialzation..
<ID:0/005> Get PIT for mapping..
<ID:0/005> Firmware update start..
<ID:0/005> NAND Write Start!!
<ID:0/005> SingleDownload.
<ID:0/005> system.img
<ID:0/005> Complete(Write) operation failed.
<ID:0/005>
<ID:0/005> Complete(Write) operation failed.
<OSM> All threads completed. (succeed 0 / failed 1)

I may failed in flashing only the system.img but atlease the MD5 finished successfully. So, I am confused why the same method not atleaset verifying the MD5 of my AP_...tar.md5?
 
The MD5 hash is only to verify that there haven't been any errors in downloading, there are other authentication methods implemented, some may not have a name to the general public as they are internal to the OEM.

As stated above: you cannot modify stock firmware and still have it work.

See the attached image, any single bit of information will result in an invalid hash, and that's only for the download verification, there are other methods implemented on the device itself to reject the file even if you get the whole file to pass MD5 checksum with a different hash.

As stated above: you cannot modify stock firmware and still have it work.

350px-CPT-Hashing-File-Transmission.svg.png
 

Attachments

  • 800px-CPT-Hashing-File-Transmission.svg.png
    800px-CPT-Hashing-File-Transmission.svg.png
    93.9 KB · Views: 1

Latest posts

Trending Posts

Members online

Forum statistics

Threads
958,550
Messages
6,977,010
Members
3,164,088
Latest member
SebastianJack