FORUMS

[GUIDE] How to re-package firmwares for Odin [Windows and Linux]

1,162 posts
Thanks Meter: 1,693
 
By [Ramad], Senior Member on 23rd February 2011, 12:18 AM
Post Reply Email Thread
Quote:

Quote:

This will demonstrate repackaging a 1 file firmware to a 3 files firmware.

By following this guide, any firmware can be repackaged as re-partition ready firmware that can be used directly with any pit file.

Any boot.bin and Sbl.bin can be removed/deleted/excluded during firmware repackaging.

Quote:

Before you read any further:

Quote:

1: By following this guide, you agree that you are following it on your own risk.
2: If the firmware(s) you have repackaged is/are not working, then it's because you did not follow the very simple and easy steps as you should.

If you can't live with the above then please don't follow this guide, but if it's no problem for you then follow me to see how easy it can be.


Quote:

Tools:

Quote:

Customized cygwin (Windows users): Download MD5: 0e63785289d8fedaa3719e4ac615fd63 (Thanks to dsixda).

Empty dbdata.rfs file: Download MD5: bc7a6eff20660a5f2e6ba76f6653f54b

Quote:

Note:

If you are a Linux user then you only need to download the empty dbdata.rfs archive and can move directly to Re-packaging the firmware


Quote:

Installing cygwin:

Quote:

1. Extract the cygwin archive and run the setup file

Quote:

2. Choose Install from Local Directory

Quote:

Quote:

3. Choose where to install cygwin, to make it easy for you then let it be installed on C-drive

Quote:

Quote:

4. Brows to the Local Package Directory, it's under cygwin packages in the extracted archive directory, as shown below

Quote:

Quote:

5. You will be greeted by warning, hit OK

Quote:

Quote:

6. Click on the arrows as shown below until all packages change status to Install and hit Next

Quote:

Quote:

7. Complete the installation, no more changes are required and you might get a Windows error when installation is complete, just hit Cancel

Quote:

Quote:

Re-packaging the firmware:

Quote:

1. Make a and rename a folder/directory and extract the firmware tar package to that folder or simply open using a compression utility like 7zip or winrar then highlight and drag the files to the new folder. It's easier to make the directory on drive C if you are a windows user.

Quote:

Quote:

2. Extract the Empty_dbdata.rfs_file archive and copy the extracted dbdata.rfs to the same folder

Quote:

Quote:

Note:
I have created a directory on drive C which I called ROM and in the same example I'm repackaging a JS5 firmware, so if you have created a directory with different name, path/location or firmware name then you need to change the following commands to suit your changes.


Quote:

3. Start cygwin from the shortcut on your Desktop, Linux users can use the terminal and change to the firmware directory.

Quote:

Changing to the extracted firmware directory:

Quote:

cd c:/ROM


Quote:

Creating a PDA.tar.md5:

Creating a PDA.tar file (Please read the note regarding this command at the end of this guide)*

Quote:

tar -c param.lfs zImage factoryfs.rfs dbdata.rfs >> PDA_JS5.tar

Creating an MD5 hash
Quote:

md5sum -t PDA_JS5.tar >> PDA_JS5.tar

Moving the MD5 hash information to the tar file
Quote:

mv PDA_JS5.tar PDA_JS5.tar.md5


Quote:

Creating a Phone.tar.md5:

Creating a Phone.tar

Quote:

tar -c modem.bin >> PHONE_JPY.tar

Creating an MD5 hash
Quote:

md5sum -t PHONE_JPY.tar >> PHONE_JPY.tar

Moving the MD5 hash information to the tar file
Quote:

mv PHONE_JPY.tar PHONE_JPY.tar.md5


Quote:

Creating a CSC.tar.md5

Creating CSC.tar

Quote:

tar -c cache.rfs >> CSC_XENJS3.tar

Creating an MD5 hash
Quote:

md5sum -t CSC_XENJS3.tar >> CSC_XENJS3.tar

Moving the MD5 hash information to the tar file
Quote:

mv CSC_XENJS3.tar CSC_XENJS3.tar.md5


Quote:

Note:
All command for packaging and creating a single tar.md5 file(3 commands) can be executed as one single command as follows with PDA as example:

Code:
tar -c param.lfs zImage factoryfs.rfs dbdata.rfs >> PDA_JS5.tar ; md5sum -t PDA_JS5.tar >> PDA_JS5.tar ; mv PDA_JS5.tar PDA_JS5.tar.md5
and so on..
Quote:

We have by now repackaged a firmware of 1 tar file to 3 tar.md5 files, these files are now ready to be tested before flashing or sharing.

Quote:

Note:
One reason for a failing MD5 checksum of a file is renaming it after it has been repackaged as a tar.md5, so don't rename the repackaged files.



Quote:

Testing the tar.md5 files (Windows):

Quote:

Start Odin and load PDA, PHONE and the CSC files without connecting the phone to any USB port and hit Start and look at the massage panel of Odin and see if your packages are valid, if they are not then you haven't repackaged the files right, and you need to start over.

Quote:



Quote:

Sharing the repackaged firmware:

I have many times seen our members upload and share firmwares that are not compressed, this is not good for two reasons:

Quote:

1. The file could be corrupt when downloaded, and there is no fun in flashing a corrupt firmware, this can be avoided when extracting a compressed firmware. A corrupt archive cannot be extracted, and thereby you will know that your downloaded firmware is corrupt.

2. A tar file is not a compressed file, it's only a package that contains file(s). Please take a look and see how all the extracted files are almost equal in size to the tar.md5 files

Quote:

Quote:

If you compress your files before uploading them, then file(s) size, upload time for you and the download time for them you are sharing your file(s) with will be cut in half, take a look to see what I mean

Quote:




Quote:

Quote:

Conclusion:



We have by now learned how to repackage firmware(s), use them and share them without worrying about re-partitioning.

We can now repackage and remove boot.bin and Sbl.bin in any leaked or official firmware that is already split in 3 files, that may disable Download and Recovery modes of our devices.

Good luck repackaging, flashing and sharing your firmwares..


Quote:

Quote:

*Note:
The first file in the command will be the first file to be added to the tar file and the first to be flashed. I'm using this command in this particular order according to the pit files and the device partitions which are:

START
boot.bin
.pit
efs.rfs
sbl.bin
sbl.bin
param.lfs
zImage
zImage
factoryfs.rfs
dbdata.rfs
cache.rfs
modem.bin
END

The Following 43 Users Say Thank You to [Ramad] For This Useful Post: [ View ] Gift [Ramad] Ad-Free
23rd February 2011, 12:18 AM |#2  
[Ramad]'s Avatar
OP Senior Member
Thanks Meter: 1,693
 
More
reserved...
The Following User Says Thank You to [Ramad] For This Useful Post: [ View ] Gift [Ramad] Ad-Free
23rd February 2011, 03:52 AM |#3  
Retired Recognized Developer
Thanks Meter: 273
 
Donate to Me
More
I believe 7zip can make tar files, but NOT able to use when flashing.

Sent from my GT-I9000 using XDA App
23rd February 2011, 10:29 AM |#4  
ragin's Avatar
Senior Member
Flag Hubli
Thanks Meter: 159
 
More
Quote:
Originally Posted by DamianGto

True.
You take any random tar file and open it and put the file in it you want.
Then it works.
I did it alot before i setup a linux system.


**DamianGTO Ultimate kernel. 350MB Ram. 600HZ. all ext2. Steam Rom. Js5**

I use peazip or IZarc to create tar files in windows.
23rd February 2011, 11:03 AM |#5  
Account currently disabled
Thanks Meter: 422
 
Donate to Me
More
Quote:
Originally Posted by ragin

I use peazip or IZarc to create tar files in windows.

nice.
never tryed them.
But we can say now there is zero reason to install cygwin just to pack tar files.
23rd February 2011, 01:20 PM |#6  
Bandis710's Avatar
Senior Member
Thanks Meter: 77
 
More
Ramad, thank you for the guide .. Interesting to read and will definitely try it.

Could you maybe also make a guide how to deodex and zip align a rom ? I saw you posted quite a few deodexed and zipaligned roms ( i am using your xwjs5 deodexed rom).

I would like to be able to deodex/zipalign / add root my self .. I have asked this question before , but the only answer I get is : google is your friend :( ..I have x-ultimate 2.2.2 , but that clearly isn't enough ..
23rd February 2011, 01:39 PM |#7  
Retired Recognized Developer
Thanks Meter: 273
 
Donate to Me
More
Quote:
Originally Posted by Bandis710

Ramad, thank you for the guide .. Interesting to read and will definitely try it.

Could you maybe also make a guide how to deodex and zip align a rom ? I saw you posted quite a few deodexed and zipaligned roms ( i am using your xwjs5 deodexed rom).

I would like to be able to deodex/zipalign / add root my self .. I have asked this question before , but the only answer I get is : google is your friend :( ..I have x-ultimate 2.2.2 , but that clearly isn't enough ..

xUltimate is to deodex, apk manager can be used for zipaligned. Both can be run in batch mode.

Sent from my GT-I9000 using XDA App
23rd February 2011, 08:15 PM |#8  
[Ramad]'s Avatar
OP Senior Member
Thanks Meter: 1,693
 
More
Quote:
Originally Posted by Bandis710

Ramad, thank you for the guide .. Interesting to read and will definitely try it.

Could you maybe also make a guide how to deodex and zip align a rom ? I saw you posted quite a few deodexed and zipaligned roms ( i am using your xwjs5 deodexed rom).

I would like to be able to deodex/zipalign / add root my self .. I have asked this question before , but the only answer I get is : google is your friend :( ..I have x-ultimate 2.2.2 , but that clearly isn't enough ..

I have answered a part of your question here at post #43: http://forum.xda-developers.com/show...2#post11585682 . That took a lot time to write, the whole process may wait till I have more time in the future.
The Following User Says Thank You to [Ramad] For This Useful Post: [ View ] Gift [Ramad] Ad-Free
24th February 2011, 12:49 PM |#9  
Account currently disabled
Thanks Meter: 422
 
Donate to Me
More
Quote:
Originally Posted by ragin

I think most people really don't completely understand what you mean when you say something. I think that's the problem here.

Like in the post quoted, you have asked people to read in other places to get a better understanding of things. But you don't specify any links. How & where should I search in order to better understand things?

This guide could be a very good.
I do like the pictures to show the steep.
But some of them is unneeded and you can make it better and use a faster and simpler way that works good.
Some that read this Maby think Im to hard and hate this guide and the person that wrote it. You cant be more wrong.
But if you make a guide or program do have some development pride and make it with high quality. If op do change things so the steep is better and all errors in the text is fixed then i have no problem to recomend this guide to people that ask this kind of questions.



**DamianGTO Ultimate kernel. 350MB Ram. 600HZ. all ext2. Steam Rom. Js5**
24th February 2011, 01:03 PM |#10  
Senior Member
Thanks Meter: 1,392
 
More
Thanks for this, had been looking for something like this

There's always more than one way to skin a cat, some more troublesome etc. But let's not dampen the sharing spirit of fellow xda members

Now let's concentrate on making this guide better for everyone.
24th February 2011, 01:34 PM |#11  
ragin's Avatar
Senior Member
Flag Hubli
Thanks Meter: 159
 
More
Quote:
Originally Posted by DamianGto

.
This guide could be a very good.
I do like the pictures to show the steep.
But some of them is unneeded and you can make it better and use a faster and simpler way that works good.
Some that read this Maby think Im to hard and hate this guide and the person that wrote it. You cant be more wrong.
But if you make a guide or program do have some development pride and make it with high quality. If op do change things so the steep is better and all errors in the text is fixed then i have no problem to recomend this guide to people that ask this kind of questions.



**DamianGTO Ultimate kernel. 350MB Ram. 600HZ. all ext2. Steam Rom. Js5**

Everything OP says in the first post is correct & working. I have been using a similar method myself when I started making ROMs for my ConvergeROM. Well, there is a simpler way available that does all this using a script. You can find it HERE - http://forum.xda-developers.com/showthread.php?t=943588
The Following User Says Thank You to ragin For This Useful Post: [ View ] Gift ragin Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes