• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

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

Search This thread

[Ramad]

Senior Member
Sep 18, 2010
1,162
1,682
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.

Before you read any further:

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.


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

Empty dbdata.rfs file: Download MD5: bc7a6eff20660a5f2e6ba76f6653f54b

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


Installing cygwin:

1. Extract the cygwin archive and run the setup file

2. Choose Install from Local Directory
29wkac7.jpg

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

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

5. You will be greeted by warning, hit OK
6. Click on the arrows as shown below until all packages change status to Install and hit Next

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

Re-packaging the firmware:

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.

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

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.


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

Changing to the extracted firmware directory:


Creating a PDA.tar.md5:

Creating a PDA.tar file (Please read the note regarding this command at the end of this guide)*
tar -c param.lfs zImage factoryfs.rfs dbdata.rfs >> PDA_JS5.tar

Creating an MD5 hash
md5sum -t PDA_JS5.tar >> PDA_JS5.tar

Moving the MD5 hash information to the tar file
mv PDA_JS5.tar PDA_JS5.tar.md5


Creating a Phone.tar.md5:

Creating a Phone.tar
tar -c modem.bin >> PHONE_JPY.tar

Creating an MD5 hash
md5sum -t PHONE_JPY.tar >> PHONE_JPY.tar

Moving the MD5 hash information to the tar file
mv PHONE_JPY.tar PHONE_JPY.tar.md5


Creating a CSC.tar.md5

Creating CSC.tar
tar -c cache.rfs >> CSC_XENJS3.tar

Creating an MD5 hash
md5sum -t CSC_XENJS3.tar >> CSC_XENJS3.tar

Moving the MD5 hash information to the tar file
mv CSC_XENJS3.tar CSC_XENJS3.tar.md5


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:
[B]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[/B]
and so on..

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.

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.



Testing the tar.md5 files (Windows):

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.



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:

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

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





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..:)


*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
 
Last edited:

g00ndu

Retired Recognized Developer
Apr 22, 2008
2,781
273
I believe 7zip can make tar files, but NOT able to use when flashing.

Sent from my GT-I9000 using XDA App
 
Last edited by a moderator:

Bandis710

Senior Member
Mar 26, 2008
1,361
73
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 ..
 

g00ndu

Retired Recognized Developer
Apr 22, 2008
2,781
273
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
 

[Ramad]

Senior Member
Sep 18, 2010
1,162
1,682
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/showthread.php?p=11585682#post11585682 . That took a lot time to write, the whole process may wait till I have more time in the future.
 
  • Like
Reactions: crazyio

DamianGto

Senior Member
Sep 17, 2010
2,022
420
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**
 
Last edited by a moderator:

ock

Senior Member
Mar 9, 2010
1,007
1,382
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.
 

ragin

Senior Member
Dec 17, 2007
1,743
158
Hubli
.
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
 
Last edited by a moderator:
  • Like
Reactions: nimms

ragin

Senior Member
Dec 17, 2007
1,743
158
Hubli
@Ramad,

You can add a reference about adding costum kernels into the PDA made. You just have to find the correct zImage & replace it in the PDA.
 

BlockbusterF

Senior Member
Jan 31, 2008
102
10
A very good guide! Thank you very much Ramad. Would be just nice if there were such a guide some weeks ago :)

Now I found out myself to create my own ROMs and packages. And...I also do it with cygwin. It the only way for me it worked without any errors.

I wish more people here at xda would share there knownledge. Since a while more and more people start to make secrets of their work.

Thank you very much! :D
 

ragin

Senior Member
Dec 17, 2007
1,743
158
Hubli
A very good guide! Thank you very much Ramad. Would be just nice if there were such a guide some weeks ago :)

Now I found out myself to create my own ROMs and packages. And...I also do it with cygwin. It the only way for me it worked without any errors.

I wish more people here at xda would share there knownledge. Since a while more and more people start to make secrets of their work.

Thank you very much! :D

My few PDAs were done with peazip. Wonderful tar application under Windows.
 

bdl1969

Senior Member
Sep 27, 2010
184
46
Chelmsford
Guys, this is a very helpful post. Personally I've been using Cygwin to tar up ROMs for a while now and although I don't agree with all the steps Ramad has included (eg. you don't really need to MD5 the files in my opinion for one), or all the information (eg. I agree with DamianGTOs comment about what low level packages include), the instructions do work and it's the first time I've seen someone trying to provide instructions on this so thanks go to Ramad for that. This is the second thread I've come across recently that's been a battlefield between Ramad and DamianGTO and with respect guys, it really puts people off a thread if it turns into a battleground like this. For the sake of the community is there any chance you could tone it down a bit please?
 

[Ramad]

Senior Member
Sep 18, 2010
1,162
1,682
@bdl1969
You don't have to use checksum option, I would like to advice using it.
I did not see anyone raise there hands against md5 checksum, like here : http://forum.xda-developers.com/showpost.php?p=7940762&postcount=1
And here: http://forum.xda-developers.com/showthread.php?t=802909/QUOTE
And many other many other firmware releases leaked by Richthofen, because it's Richthofen writting...

Usually Odin3 images are provided in a single integrated .tar package which contain all of the necessary files. This way the CSC cannot be selected separately.

That is why I splitted the release in three different parts (CODE, MODEM, CSC).
Since Odin3 has flashfile checksum support I also added md5 hash tail to the .tar files. This way is more secure because Odin will not allow flashing corrupted images. Flashing takes a bit longer thou because the checksums are checked in the beginning of the update process.

I did not call the packages High package, Medium package or Low package, but Low Level...was referring to format, however, as it appears to me that we have a problem with the guy calling a bird..."birdie" not with the word it self, and how a word is that is going to effect taring and flashing firmwares is yet not obvious to me!! But I Have removed these words as Low Level, because I have no desire to have these irrelevant discussions.
 
Last edited:

DamianGto

Senior Member
Sep 17, 2010
2,022
420
Maby i spell weird sometimes. I blame my phone and English is not my native language.

But fact still remains.
I have asked him to make the guide more clear what user he is targeting.
I also give advice to make some steep easier for the novice users.
I also sad that this could be a very good guide. But if you put up your work you must understand that people can correct things thats wrong or make a suggestion to make it better.
But op have from the start decided that all thing a say is wrong.
That's why i say this guide is not good and has errors and lie in it.

It has been very easy to correct the part that's wrong and add a little notice that tell people they can use a simpler way.


**DamianGTO Ultimate kernel. 350MB Ram. 600HZ. all ext2. Steam Rom. Js5**
 
Last edited by a moderator:

overground

Retired Senior Moderator / Inactive Recognized Dev
@ DamianGTO: After reading the thread over, it seems the steps laid out by the OP are working for many people. I believe it is your intention to streamline / update the guide. This is the wrong place. If you have suggestions for the OP, please do it via PM and no longer in this thread. The language barrier may have made things worse here than they really need to be. I think if you could clearly delineate to the OP (via a well constructed PM to him), I'm sure he would appreciate the help, and credit you for your suggestions.

To sum up. Please move your discussion to PM. If the OP chooses not to respond, please leave him and this thread alone. The guide seems to work for many as it stands.


Thank you for your consideration and cooperation on this matter.
 
Last edited:
  • Like
Reactions: bdl1969 and [Ramad]

mab71

Senior Member
Jan 18, 2011
1,460
178
Kay El
@ damiangto: After reading the thread over, it seems the steps laid out by the op are working for many people. I believe it is your intention to streamline / update the guide. This is the wrong place. If you have suggestions for the op, please do it via pm and no longer in this thread. The language barrier may have made things worse here than they really need to be. I think if you could clearly delineate to the op (via a well constructed pm to him), i'm sure he would appreciate the help, and credit you for your suggestions.

To sum up. Please move your discussion to pm. If the op chooses not to respond, please leave him and this thread alone. The guide seems to work for many as it stands.


Thank you for your consideration and cooperation on this matter.

+1000000000
 

Widget21

Senior Member
Dec 15, 2010
301
38
London
Great guide and tutorial! Exactly what I was looking for! Now can anyone advise on the steps to create a flashable zip file on CWM instead of Odin? Any tips would be greatly appreciated.
 

Top Liked Posts