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.
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
1. Extract the cygwin archive and run the setup file
2. Choose Install from Local Directory
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
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
md5sum -t PDA_JS5.tar >> PDA_JS5.tar
mv PDA_JS5.tar PDA_JS5.tar.md5
Creating a Phone.tar.md5:
Creating a Phone.tar
tar -c modem.bin >> PHONE_JPY.tar
md5sum -t PHONE_JPY.tar >> PHONE_JPY.tar
mv PHONE_JPY.tar PHONE_JPY.tar.md5
Creating a CSC.tar.md5
tar -c cache.rfs >> CSC_XENJS3.tar
md5sum -t CSC_XENJS3.tar >> CSC_XENJS3.tar
mv CSC_XENJS3.tar CSC_XENJS3.tar.md5
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:
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
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..
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: