Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP imnuts

16th May 2011, 10:29 PM   |  #1  
imnuts's Avatar
OP Recognized Developer
Flag West Chester
Thanks Meter: 3,011
 
3,462 posts
Join Date:Joined: Jul 2007
Donate to Me
More
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:
dd if=/dev/block/stl10 of=/sdcard/factoryfs.rfs bs=4096
Kernel:
Code:
dd if=/dev/block/bml8 of=/sdcard/zImage bs=4096
Recovery:
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:
dd if=/dev/block/mmcblk0p3 of=/sdcard/cache.rfs bs=4096
DBData:
Code:
dd if=/dev/block/stl11 of=/sdcard/dbdata.rfs bs=4096
Data:
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:
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.
The Following 24 Users Say Thank You to imnuts For This Useful Post: [ View ]
16th May 2011, 10:39 PM   |  #2  
Member
Thanks Meter: 0
 
52 posts
Join Date:Joined: 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.
17th May 2011, 04:33 AM   |  #3  
Junior Member
Thanks Meter: 48
 
26 posts
Join Date:Joined: Apr 2009
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: [ View ]
17th May 2011, 12:27 PM   |  #4  
Senior Member
Thanks Meter: 6
 
104 posts
Join Date:Joined: Oct 2010
Quote:
Originally Posted by wynalazca

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!
23rd May 2011, 11:49 PM   |  #5  
Senior Member
Flag Troy, MI
Thanks Meter: 25
 
124 posts
Join Date:Joined: Dec 2010
More
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
24th May 2011, 12:08 AM   |  #6  
imnuts's Avatar
OP Recognized Developer
Flag West Chester
Thanks Meter: 3,011
 
3,462 posts
Join Date:Joined: Jul 2007
Donate to Me
More
Quote:
Originally Posted by rami98

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:
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.
25th May 2011, 08:32 PM   |  #7  
Senior Member
Flag Pomona CA
Thanks Meter: 10
 
226 posts
Join Date:Joined: Jan 2011
More
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?
26th May 2011, 07:13 AM   |  #8  
Senior Member
Thanks Meter: 17
 
102 posts
Join Date:Joined: Oct 2006
More
Quote:
Originally Posted by imnuts

The only thing that would change would be the tar command. If you want to include the other files, it would be:

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!
26th May 2011, 09:49 AM   |  #9  
rmanaka's Avatar
Senior Member
Thanks Meter: 36
 
510 posts
Join Date:Joined: Jul 2005
More
Quote:
Originally Posted by mypantsaretorn

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

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:
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
26th May 2011, 10:06 AM   |  #10  
Senior Member
Thanks Meter: 17
 
102 posts
Join Date:Joined: Oct 2006
More
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

Post Reply Subscribe to Thread

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

Advanced Search
Display Modes