| || |
[HOW-TO]Create Custom ODIN Images for Backup/Restore
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. [/WARN]
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.
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 (#):
dd if=/dev/block/stl10 of=/sdcard/factoryfs.rfs bs=4096
dd if=/dev/block/bml8 of=/sdcard/zImage bs=4096
[TIP]DO NOT INCLUDE THE FOLLOWING IN ANYTHING BUT A PERSONAL BACKUP[/TIP]
dd if=/dev/block/bml9 of=/sdcard/recovery.bin bs=4096
dd if=/dev/block/mmcblk0p3 of=/sdcard/cache.rfs bs=4096
dd if=/dev/block/stl11 of=/sdcard/dbdata.rfs 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.
dd if=/dev/block/mmcblk0p1 of=/sdcard/movinand.bin bs=4096
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:
If you want to include cache/dbdata/data in the above for personal use, just add them after the "-c" and before the ">".
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
[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]