Packaging an Odin ROM for size and consistancy

Search This thread

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,827
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Hey guys.. Odin3 version3 and higher has gz support. I've been working with this for a bit and tonight I found that Odin will accept tar.md5.gz files. This is important for GNote2 users as the stock ROM is 1.2Gigs! You can get an extra 10-40% compression and 100% gaurantee that the files arrive to your users computer in the condition that you packaged them using this method. I have not found a guide on using the gz format so I thought I would write one up.

You will need:
A Linux computer
Your rom (we will call it MyROM)

How to package for Odin on Windows
I will cover packing into a single file, adding an MD5, and compressing the file down. For the purposes of this, we are working with "MyROM". You will want to call your ROM whatever you like. Just make sure to add version information to the file name so users don't get confused. Also note, the name MUST be consistent throughout the process. If you change the name, Odin can fail.

Another good tip is to put a model number in the name so there is no confusion as to what device your Odin package goes to. Several users, myself included, have 20+ Odin packages on their computer.


So first you want to turn the ROM into a single tar file and then make sure changes are written to the disk.
Code:
tar -H ustar -c boot.img hidden.img modem.bin param.bin recovery.img system.img tz.img sboot.bin>./MyROM.tar;sync;

Next we want to add an MD5 to the file so Odin can check its consistancy.
Code:
md5sum MyROM.tar >> MyROM.tar;

Now we will change it into a tar.md5 file so Odin knows it has an MD5 attached to it.
Code:
mv MyROM.tar MyROM.tar.md5; sync;

Finally we will compress it with GZip. GZip is the only compression method supported by Odin.
Code:
gzip MyROM.tar.md5 -c -v > MyROM.tar.md5.gz;

You will now have a file called MyROM.tar.md5.gz.


Conclusion
The first time the file is flashed, Odin will uncompress it into MyROM.tar.md5, then check its consistancy, then flash the file. Using this method you will be transferring the smallest file possible and adding integrity checks.


notes
Note to Verizon GNote2 users: Stay away from using Odin after IROM unlock as flashing a package intended for another device will perma-lock your device into another carrier's bootloaders. Especially stay away from GS3 as the displays are not compatible.
 
Last edited:

garwynn

Retired Forum Mod / Inactive Recognized Developer
Jul 30, 2011
5,179
8,589
NE Ohio
www.extra-life.org
Awesome news! Any test results with the older versions? If not one click solutions may not benefit.. but servers and users will by cutting the downloads even more!

Sent from my SPH-L900 using Tapatalk 2
 

broodplank1337

Inactive Recognized Developer
Nov 24, 2011
4,992
10,155
Nijmegen
www.broodplank.net
Interesting adam, I always compressed the whole odin package into a rar file (same effect but one step extra). Also I made an article about odin a while ago:
http://broodplank.net/?p=496


Btw, did you know that you can put cwm backups (ext4.tar) inside an odin package? It's the first odin image I ever saw, filled with a CWM backup, and yes it works XD
But it's not an 1:1 copy of course, Also I wonder how nandroid backups actually store their permissions, I mean dd is a 1:1 dump, which is logical, cwm has the updater-script. but the nandroid backups which are actually just tar files packed with the contents, how do they store it?

Last thing, Odin packages can be a last resort fix, believe me, many users reported that flashing my rom broodROM_RC5.tar.md5 (which contains about 13 files, you can imagine how many partitions it includes) fixed their phone when nothing else worked.

So thank you Samsung for leaking your tool, A world with Samsung Kies only would be a very sad "softbricky" world
 

mrRobinson

Senior Member
Dec 20, 2010
2,669
12,253
I still like making a 7z out of the final .tar.md5 file.
The info in OP is great to know as it does save a step for the end user but I'd rather them take a couple steps to vet out the incompetent ones. Could prevent a brick ;)
 

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,827
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
I still like making a 7z out of the final .tar.md5 file.
The info in OP is great to know as it does save a step for the end user but I'd rather them take a couple steps to vet out the incompetent ones. Could prevent a brick ;)

Only on the Verizon Galaxy Note. All others are IROM locked. The IROM lock prevents flashing of an improper SBOOT. An unlocked VZWGNote 2 can flash any SBOOT.

Other than this specific case, adding third party tools other than ZIP compression means your user must download special tools.
 

soba49

Senior Member
Nov 6, 2010
303
34
boston, ma
Extra files?

If I were to pack an extra README.txt file into the tar before prepping it for Odin, would Odin then ignore it during the flash? Obviously there's no entry for what to do with an extraneous text file in the pit, so hopefully Odin would just disregard it.


I happened to find out today that heimdall has support for "Heimdall Firmware Packages." You can read and write them from the heimdall frontend (the 1.3 FE binary is forward compatible with my source built 1.4 heimdall). What's interesting, is that the format is almost identical to odin's format. It is still packaged in a tar file, and it contains the same system.img, boot.bin, recovery.bin etc. files you'd find in the Odin tar. By default it's format is Package.tar.gz. The only significant difference is the addition of a firmware.xml file that identifies the proper partition for each image file, as well as the target platform, the author, and other details like that.

So I got curious. I took a Package.tar.gz file generated by heimdall, and repackaged it as a Package.tar.MD5.gz file. Heimdall has no problem reading this! So the upshot is, Odin now handles the .gz, so as long as Odin isn't bothered by an extra firmware.xml file inside the tar, the same format would be compatible with either tool.


PS> Don't flame me about flash counters or bricked phones. I do understand that Odin/Heimdall are only particularly relevant for returning a phone to stock, but that's still a very important functionality and it would be great to have a unified format.
 
  • Like
Reactions: AdamOutler

Top Liked Posts

  • There are no posts matching your filters.
  • 18
    Hey guys.. Odin3 version3 and higher has gz support. I've been working with this for a bit and tonight I found that Odin will accept tar.md5.gz files. This is important for GNote2 users as the stock ROM is 1.2Gigs! You can get an extra 10-40% compression and 100% gaurantee that the files arrive to your users computer in the condition that you packaged them using this method. I have not found a guide on using the gz format so I thought I would write one up.

    You will need:
    A Linux computer
    Your rom (we will call it MyROM)

    How to package for Odin on Windows
    I will cover packing into a single file, adding an MD5, and compressing the file down. For the purposes of this, we are working with "MyROM". You will want to call your ROM whatever you like. Just make sure to add version information to the file name so users don't get confused. Also note, the name MUST be consistent throughout the process. If you change the name, Odin can fail.

    Another good tip is to put a model number in the name so there is no confusion as to what device your Odin package goes to. Several users, myself included, have 20+ Odin packages on their computer.


    So first you want to turn the ROM into a single tar file and then make sure changes are written to the disk.
    Code:
    tar -H ustar -c boot.img hidden.img modem.bin param.bin recovery.img system.img tz.img sboot.bin>./MyROM.tar;sync;

    Next we want to add an MD5 to the file so Odin can check its consistancy.
    Code:
    md5sum MyROM.tar >> MyROM.tar;

    Now we will change it into a tar.md5 file so Odin knows it has an MD5 attached to it.
    Code:
    mv MyROM.tar MyROM.tar.md5; sync;

    Finally we will compress it with GZip. GZip is the only compression method supported by Odin.
    Code:
    gzip MyROM.tar.md5 -c -v > MyROM.tar.md5.gz;

    You will now have a file called MyROM.tar.md5.gz.


    Conclusion
    The first time the file is flashed, Odin will uncompress it into MyROM.tar.md5, then check its consistancy, then flash the file. Using this method you will be transferring the smallest file possible and adding integrity checks.


    notes
    Note to Verizon GNote2 users: Stay away from using Odin after IROM unlock as flashing a package intended for another device will perma-lock your device into another carrier's bootloaders. Especially stay away from GS3 as the displays are not compatible.
    2
    cygwin.

    Mine all work :p
    1
    good ****! this is def useful :)
    1
    How can I do it on a Windows computer?

    Install Virtual Box and a Linux distribution. I haven't seen any tools for Windows that work properly to make tar archives that work with Odin.
    1
    Extra files?

    If I were to pack an extra README.txt file into the tar before prepping it for Odin, would Odin then ignore it during the flash? Obviously there's no entry for what to do with an extraneous text file in the pit, so hopefully Odin would just disregard it.


    I happened to find out today that heimdall has support for "Heimdall Firmware Packages." You can read and write them from the heimdall frontend (the 1.3 FE binary is forward compatible with my source built 1.4 heimdall). What's interesting, is that the format is almost identical to odin's format. It is still packaged in a tar file, and it contains the same system.img, boot.bin, recovery.bin etc. files you'd find in the Odin tar. By default it's format is Package.tar.gz. The only significant difference is the addition of a firmware.xml file that identifies the proper partition for each image file, as well as the target platform, the author, and other details like that.

    So I got curious. I took a Package.tar.gz file generated by heimdall, and repackaged it as a Package.tar.MD5.gz file. Heimdall has no problem reading this! So the upshot is, Odin now handles the .gz, so as long as Odin isn't bothered by an extra firmware.xml file inside the tar, the same format would be compatible with either tool.


    PS> Don't flame me about flash counters or bricked phones. I do understand that Odin/Heimdall are only particularly relevant for returning a phone to stock, but that's still a very important functionality and it would be great to have a unified format.