Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,739,414 Members 53,500 Now Online
XDA Developers Android and Mobile Development Forum

[HOW-TO]Create Custom ODIN Images for Backup/Restore

Tip us?
 
imnuts
Old
#1  
imnuts's Avatar
Recognized Developer - OP
Thanks Meter 2968
Posts: 3,405
Join Date: Jul 2007
Location: West Chester

 
DONATE TO ME
Default [HOW-TO]Create Custom ODIN Images for Backup/Restore

I'm sure several people will be wanting this information, so I figured I would post it here for everyone. This will allow you to backup your system and create custom Odin images for restore purposes. For anyone unfamiliar with the Samsung system, they use Odin to flash things to the device, much like HTC has RUU and Moto has SBF. Odin files are either .tar files, or .tar.md5 files.

The .tar.md5 files are .tar files with the md5 checksum added to the end of the file. If you attempt to flash a .tar.md5 file, Odin will automatically check that the contents are what they should be before flashing and proceed with the flash if the md5 is valid, otherwise it will stop.

In Odin, you should use the PDA button for all flashing. The PIT button may be used as well, if we can get a valid .pit file for the device, but for now, PIT won't be used either. Other than PDA, Start/Reset are the only other buttons you need to worry about.

Now, on to creating the backup files. First, you will need your device to be rooted (perm or temp root will work), and you also need to have access to terminal on the phone, either via an emulator or adb shell access. To create the backup files, you won't need a Linux/UNIX system, but you will if you want to create a flashable Odin package. The following will output the files on the root of the SDCard, adjust the "of=" path if you want them somewhere else. It will also create the files for the proper filename for Odin as well. So to create the files, here are the commands you will use from root shell (#):

System:
Code:
Select Code
dd if=/dev/block/stl10 of=/sdcard/factoryfs.rfs bs=4096
Kernel:
Code:
Select Code
dd if=/dev/block/bml8 of=/sdcard/zImage bs=4096
Recovery:
Code:
Select Code
dd if=/dev/block/bml9 of=/sdcard/recovery.bin bs=4096
DO NOT INCLUDE THE FOLLOWING IN ANYTHING BUT A PERSONAL BACKUP
Cache:
Code:
Select Code
dd if=/dev/block/mmcblk0p3 of=/sdcard/cache.rfs bs=4096
DBData:
Code:
Select Code
dd if=/dev/block/stl11 of=/sdcard/dbdata.rfs bs=4096
Data:
Code:
Select Code
dd if=/dev/block/mmcblk0p1 of=/sdcard/movinand.bin bs=4096
The last three files (cache, dbdata, data) may contain personal information, so do not include these 3 files in anything but a personal backup/recovery package.

To create a flashable Odin package, you need to pull all of the files off of the phone/sdcard and onto your computer. From there, you use the following to create the package:
Code:
Select Code
tar -H ustar -c factoryfs.rfs recovery.bin zImage > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
If you want to include cache/dbdata/data in the above for personal use, just add them after the "-c" and before the ">".

There are other files that may be in Odin packages, but they are protected by Samsung and cannot be dumped properly. The files are the bootloader, secondary bootloader, modems, and .lfs partitions. The files would be boot.bin, Sbl.bin, modem.bin (not sure what it would be for the CDMA/LTE dual modem here), and param.lfs. It however isn't that big of an issue that these can't be dumped as the can't really be altered by normal flashing of the device, and are usually only altered via OTA updates.
Setup a Development Environment
Setup and Use the Android SDK
Stock Odin Restore files

You can find the answer to all of your questions right here. If that doesn't work, then try this or this
The Following 24 Users Say Thank You to imnuts For This Useful Post: [ Click to Expand ]
 
jism31
Old
#2  
Member
Thanks Meter 0
Posts: 52
Join Date: Oct 2010
Thanks for this info imnuts! I unfortunately updated to the new update and would like to go back to rooted but cant until I downgrade.
 
wynalazca
Old
#3  
Junior Member
Thanks Meter 47
Posts: 25
Join Date: Apr 2009
Default Thanks!

Thanks for posting this. I'm going to attempt to make a personal backup and then I can factory reset the phone and make a stock version for people to use. I'm haven't installed the update yet either, so I'm hoping this will let people get back to ED1. I've also been playing around with theming using the fascinate community rom theme and ninjamorph to swap files. It'll take a while, but it's currently the only way I feel safe messing with framework-res.
The Following 2 Users Say Thank You to wynalazca For This Useful Post: [ Click to Expand ]
 
droidmark
Old
#4  
Senior Member
Thanks Meter 6
Posts: 102
Join Date: Oct 2010
Quote:
Originally Posted by wynalazca View Post
Thanks for posting this. I'm going to attempt to make a personal backup and then I can factory reset the phone and make a stock version for people to use. I'm haven't installed the update yet either, so I'm hoping this will let people get back to ED1. I've also been playing around with theming using the fascinate community rom theme and ninjamorph to swap files. It'll take a while, but it's currently the only way I feel safe messing with framework-res.
I'm definitely looking forward to having a downgrade ROM image to get back to ED1!
 
rami98
Old
#5  
Senior Member
Thanks Meter 25
Posts: 124
Join Date: Dec 2010
Location: Troy, MI
So how do you add the last personal 3 i just got the droid charge and i am not very familiar with samsung files i had a droid x and a thunderbolt very shortly and am familiar with ruu and sbf but how do you add cache dbdata and the other one. I meab like the actual command not the instruction to put it after c
 
imnuts
Old
#6  
imnuts's Avatar
Recognized Developer - OP
Thanks Meter 2968
Posts: 3,405
Join Date: Jul 2007
Location: West Chester

 
DONATE TO ME
Quote:
Originally Posted by rami98 View Post
So how do you add the last personal 3 i just got the droid charge and i am not very familiar with samsung files i had a droid x and a thunderbolt very shortly and am familiar with ruu and sbf but how do you add cache dbdata and the other one. I meab like the actual command not the instruction to put it after c
The only thing that would change would be the tar command. If you want to include the other files, it would be:
Code:
Select Code
tar -H ustar -c cache.rfs dbdata.rfs factoryfs.rfs movinand.bin recovery.bin zImage > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
You just need to pull the files from your phone and have them in the same directory that you're in in terminal, and have them named appropriately. It also doesn't matter what order they are in (that I know of), I just have them in alphabetical order for ease of reading.
Setup a Development Environment
Setup and Use the Android SDK
Stock Odin Restore files

You can find the answer to all of your questions right here. If that doesn't work, then try this or this
 
MasterRy88
Old
#7  
Senior Member
Thanks Meter 10
Posts: 226
Join Date: Jan 2011
Location: Pomona CA
So im going to try and do the voodoo lagfix for the first time ever but I wanted to make a backup. Im on ED2 and NOT rooted so how would I go about making these backups?
 
mypantsaretorn
Old
#8  
Member
Thanks Meter 14
Posts: 95
Join Date: Oct 2006
Quote:
Originally Posted by imnuts View Post
The only thing that would change would be the tar command. If you want to include the other files, it would be:
Code:
Select Code
tar -H ustar -c cache.rfs dbdata.rfs factoryfs.rfs movinand.bin recovery.bin zImage > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
You just need to pull the files from your phone and have them in the same directory that you're in in terminal, and have them named appropriately. It also doesn't matter what order they are in (that I know of), I just have them in alphabetical order for ease of reading.
I tried the above and I keep getting this error message in the command prompt:

'tar' is not recognized as an internal or external command, operable program or batch file.

(I'm trying this on windows 7 professional)

Any help would be appreciated, thanks!
 
rmanaka
Old
#9  
rmanaka's Avatar
Senior Member
Thanks Meter 36
Posts: 499
Join Date: Jul 2005
Quote:
Originally Posted by mypantsaretorn View Post
I tried the above and I keep getting this error message in the command prompt:

'tar' is not recognized as an internal or external command, operable program or batch file.

(I'm trying this on windows 7 professional)

Any help would be appreciated, thanks!
You wouldn't by any chance be trying the "tar" command at a windows command prompt, would you?

Quote:
Originally Posted by imnuts View Post
To create the backup files, you won't need a Linux/UNIX system, but you will if you want to create a flashable Odin package.

To create a flashable Odin package, you need to pull all of the files off of the phone/sdcard and onto your computer. From there, you use the following to create the package:
Code:
Select Code
tar -H ustar -c factoryfs.rfs recovery.bin zImage > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
If you want to include cache/dbdata/data in the above for personal use, just add them after the "-c" and before the ">".
Course you might be running Linux in a vmware or Hyper-V environment....hint?

HTH
Current Phone: SCH-I545 Galaxy S4 DE
ROM: KOT49H【4.4.2】AOSP Official Google Edition 【Verizon!】05-30-2014
GAPPS: - Included in above
RECOVERY: TWRP v2.7.0.1
RADIO: I545OYUAMDK - I545VRUFNC5 Modem
KERNEL: 3.4.0-g22842f5 (KT)


Wife's Phone: SCH-I545 Galaxy S4
 
RECOVERY: TWRP 2.2.2.0
ROM: TW - Stock - Rooted
RADIO: I545VRUAMDK


Tablets:
 
ASUS Nexus 7 FHD stock
ASUS Nexus 7 rooted with TOOLKIT by mskip!
Kindle Fire - Stock but sideloaded
 
mypantsaretorn
Old
#10  
Member
Thanks Meter 14
Posts: 95
Join Date: Oct 2006
Damn! I didn't pay attention to the second part of that sentence! Lol

Thanks for the "hint"..

Sent from my SCH-I510 using XDA App

Tags
backup, how-to, odin, restore
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes