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

imnuts

Well-known member
Oct 18, 2010
100
49
0
Visit site
[WARN]
Android Central and I disclaim all liability for any harm that may befall your device, including, but not limited to: bricked phones, voided manufacturer warranties, exploding batteries, etc.

This is meant primarily for backup purposes and providing system dumps. Flashing via Odin can be a dangerous process that may cause you to brick your device. Use caution when flashing any Odin image and be sure that it was meant for your device.

Also, when restoring to an Odin backup, one should always boot into recovery and perform a factory reset after flashing. If you attempt to use data from a different build than what you are using, it could cause several issues and incompatibilities.

Flashing Odin packages also has the potential to prevent you from receiving further OTA updates. If you mix different system/kernel/modem versions, the OTA update will fail when attempting to apply. This could cause several issues, none of which are likely good.
[/WARN]
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

[TIP]DO NOT INCLUDE THE FOLLOWING IN ANYTHING BUT A PERSONAL BACKUP[/TIP]
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 ">".

[INFO]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.[/INFO]
 
Last edited by a moderator:

rami98

Active member
Dec 5, 2010
32
0
0
Visit site
this may sound stupid but if i dont make it flashable can i still flash it if i need to restore the backup? because my linux computer isnt very good with these things (cr48 ubuntu). i just need to keep it backed up.
 

DroidXcon

Well-known member
Oct 21, 2010
11,102
3,392
0
Visit site
this may sound stupid but if i dont make it flashable can i still flash it if i need to restore the backup? because my linux computer isnt very good with these things (cr48 ubuntu). i just need to keep it backed up.

I'm a little confused at your question. do you mean if you take the images and dont make a tar can you flash them?
 

rami98

Active member
Dec 5, 2010
32
0
0
Visit site
no i mean my cr 48 doesnt have enough space in ubuntu for the files so i cant make a flashable file. is their any way to restore it without that? and if there isnt where are the samsung linux drivers?
 

evrkusd

New member
Dec 4, 2013
1
0
0
Visit site
I'm working on customizing my setup, and then exporting it to an Odin flashable ROM following these instructions

The reason for this, rather than using CWM to more easily make a backup and restoring with a custom bootloader, is that I need to flash my customizations onto a BUNCH of tablets, and don't want to go through the process of unlocking the bootloader for each of them.

What I'm wondering is this:

Which partitions should I be copying to build an Odin flashable rom? The instructionssay that I need zImage, factoryfs.rfs and recovery.bin. I'm using a galaxy tab 2 and I'm not sure which partitions correspond to what. Any ideas on this?

This is what is outputting from my device

1|shell@android:/ # ls -al /dev/block/platform/msm_sdcc.1/by-name
lrwxrwxrwx root root 1970-11-16 22:48 aboot -> /dev/block/mmcblk0p5
lrwxrwxrwx root root 1970-11-16 22:48 backup -> /dev/block/mmcblk0p20
lrwxrwxrwx root root 1970-11-16 22:48 boot -> /dev/block/mmcblk0p7
lrwxrwxrwx root root 1970-11-16 22:48 cache -> /dev/block/mmcblk0p17
lrwxrwxrwx root root 1970-11-16 22:48 efs -> /dev/block/mmcblk0p11
lrwxrwxrwx root root 1970-11-16 22:48 fota -> /dev/block/mmcblk0p19
lrwxrwxrwx root root 1970-11-16 22:48 fsg -> /dev/block/mmcblk0p21
lrwxrwxrwx root root 1970-11-16 22:48 grow -> /dev/block/mmcblk0p23
lrwxrwxrwx root root 1970-11-16 22:48 modem -> /dev/block/mmcblk0p1
lrwxrwxrwx root root 1970-11-16 22:48 modemst1 -> /dev/block/mmcblk0p12
lrwxrwxrwx root root 1970-11-16 22:48 modemst2 -> /dev/block/mmcblk0p13
lrwxrwxrwx root root 1970-11-16 22:48 pad -> /dev/block/mmcblk0p9
lrwxrwxrwx root root 1970-11-16 22:48 param -> /dev/block/mmcblk0p10
lrwxrwxrwx root root 1970-11-16 22:48 persist -> /dev/block/mmcblk0p16
lrwxrwxrwx root root 1970-11-16 22:48 recovery -> /dev/block/mmcblk0p18
lrwxrwxrwx root root 1970-11-16 22:48 rpm -> /dev/block/mmcblk0p6
lrwxrwxrwx root root 1970-11-16 22:48 sbl1 -> /dev/block/mmcblk0p2
lrwxrwxrwx root root 1970-11-16 22:48 sbl2 -> /dev/block/mmcblk0p3
lrwxrwxrwx root root 1970-11-16 22:48 sbl3 -> /dev/block/mmcblk0p4
lrwxrwxrwx root root 1970-11-16 22:48 ssd -> /dev/block/mmcblk0p22
lrwxrwxrwx root root 1970-11-16 22:48 system -> /dev/block/mmcblk0p14
lrwxrwxrwx root root 1970-11-16 22:48 tz -> /dev/block/mmcblk0p8
lrwxrwxrwx root root 1970-11-16 22:48 userdata -> /dev/block/mmcblk0p15

Thanks again for the great thread!
 

Forum statistics

Threads
943,167
Messages
6,917,624
Members
3,158,858
Latest member
AmeliaRodriguez