5,593,587 Members 38,326 Now Online
XDA Developers Android and Mobile Development Forum

[HOWTO] Backup and Restore the System Software

Tip us?
 
kinfauns
Old
(Last edited by kinfauns; 10th October 2012 at 10:05 PM.)
#1  
kinfauns's Avatar
Developer Committee / Senior Moderator - OP
Thanks Meter 2871
Posts: 1,642
Join Date: Jan 2012
Default [HOWTO] Backup and Restore the System Software

The recently posted rooting method for the KFHD has been great for owners to get started on modifying the device to suit their own tastes. However, I've been a little concerned about everybody jumping in without a safety net in place. There are numerous ways that this device can get bricked. Not to put all of you into a panic, but just getting an eventual OTA update from Amazon might put some of these rooted KFHDs in jeopardy. With no custom recovery on the horizon, I think it's important to have some backup/restore plan to get these devices booting again.

Overview

This backup plan involves making raw data clones of all critical storage partitions required to boot the device. These backup archives can then be stored somewhere off the device. In case of some critical failure that prevents the device from booting normally, these archives can be used to get the device booting normally again. The restore procedure requires the use of fastboot to write the backup archives back to their proper partitions. The use of fastboot requires a working bootloader, so the device will need to boot to the bootloader's bootlogo at a minimum. If the device has a broken bootloader, this guide will not be helpful. There's currently no working procedure for repairing a broken bootloader on the 2nd generation Kindle Fire devices.

To be clear, this guide is not a backup/restore plan for your data. This is strictly for backing up the system software while in a bootable state and recovering it if some modification bricks the device. This procedure has been tested on a KFHD with system software version 7.1.1. Although I have not tested it, I'm nearly certain it will work just fine on version 7.1.5. If the KF2 has the same partition layout as the KFHD, there's no reason why it shouldn't work for that device as well. Check the post on KFHD partitions for details.

Warning: Everything below is inherently dangerous and can potentially brick your device if they are not executed properly. I have tested various aspects to the best of my ability, but you assume all responsibility for performing any of these steps.

Backup

Attached is a small shell script written to do the following…
  • Make a "kindlebackups" directory in /sdcard (if necessary) and make it user read/writeable.
  • Create gzipped backup archives of partitions 1 through 11. This includes all partitions except /cache and /data.
  • Make all archive files user read/writeable.

The entire backup (stock) takes up approximately 550 MB, so be sure to have at least that much available in /sdcard. Root privileges are required for the script to run properly. The best time to use this script is after step two of the published rooting procedure. That's after the second reboot of the process when the device boots up in emulation mode and allows root access for the first time. At this point, the system partition is completely stock and has not been exposed to any modifications. Even if you are past this point, the backups will still be useful for any bootable state that allows root privileges.

Download the script, unzip and place it into your current working directory where you still have access to adb, then run the following adb commands to copy the script to the Kindle Fire and prepare it to be executed...

Code:
adb push backup.sh /data/local/backup.sh
adb shell chmod 777 /data/local/backup.sh
If the device is in the process of being rooted and it has just finished rebooting for the second time...

Code:
adb shell /data/local/backup.sh
If the device has already been rooted and the su binary is available on the system...
Code:
adb shell su -c "/data/local/backup.sh"
The entire process should take approximately 5 minutes. Once the script has completed the backup, access the Kindle Fire's storage area from your computer, then copy the contents of the "kindlebackups" folder to it. The "kindlebackups" folder may be deleted after transferring to your computer.

Restore

To begin the restore procedure, the device must be put into fastboot mode. My factory cable did the job for me, so I have not explored the possibility of changing bootmodes. I developed this guide on a borrowed KFHD and I do not intend to risk the device more than necessary. Unless someone comes forward with a procedure to change bootmodes into and out of fastboot mode, I'm going to say that a factory cable is required for the time being. Besides, based on my experience with the original Kindle Fire, a broken system almost always means there is no way to change the bootmode through it. Since this procedure will very likely be used on a device that cannot boot completely or otherwise has a bad system, a factory cable will probably be the only way into fastboot mode. If you plan to root or modify your system software, invest in a factory cable.
  • Use the factory cable (with the device turned off, plug into the device, then the computer) to get to fastboot mode. If successful, a "fastboot" logo will take the place of the original "kindle fire" logo.
  • Decompress the gzipped archive to be flashed… Linux users have gunzip, Mac OS X users also have gunzip and a built-in GUI utility, and Windows users can use 7-zip. The archive must be decompressed before flashing. Skipping this step will brick your device.
  • Flash the image file(s) back to the device. In most cases, the device will just have to get a working system partition flashed back to it, but the others are available if they are needed. To flash the system partition...

Code:
fastboot -i 0x1949 flash system system.img
- Optionally erase the cache and/or userdata partitions if the contents of either interfere with the operation of the system software. The system will rebuild them on reboot…

Code:
fastboot -i 0x1949 erase cache
fastboot -i 0x1949 erase userdata
Once the process is complete, long-press the power button (~20 seconds) until it powers down, unplug the factory cable, and power the device back up.

Good luck.
Attached Files
File Type: zip backup.sh.zip - [Click for QR Code] (1.1 KB, 1301 views)
XDA Developers - Developer Committee / Senior Moderator
The Following 19 Users Say Thank You to kinfauns For This Useful Post: [ Click to Expand ]
 
Kira
Old
#2  
Kira's Avatar
Senior Member
Thanks Meter 950
Posts: 9,896
Join Date: May 2012
Location: Ohio
Thanks kinfauns. I appreciate everything you did for the original kindle fire. This should help a lot of people.

Sent from my Kindle Fire
Follow me on Instagram.
 
bodi524
Old
#3  
Senior Member
Thanks Meter 337
Posts: 335
Join Date: Apr 2010
My kindles /system directory is already screwed. Do you have a system.img file I can use?

Sent from my Galaxy Nexus using xda app-developers app
The Following User Says Thank You to bodi524 For This Useful Post: [ Click to Expand ]
 
vuhai6
Old
#4  
Junior Member
Thanks Meter 0
Posts: 17
Join Date: Sep 2006
When i boot my kindle fire hd to fastboot (by factory cable) and connect it to pc, pc can't recognize kindle, it don't have driver for it.
 
Yuretz
Old
#5  
Member
Thanks Meter 4
Posts: 54
Join Date: Nov 2005
Could anybody post his clean backup here? Screwed my kindle, want go back to stock. Backup is only way.
 
ceebu
Old
#6  
Junior Member
Thanks Meter 1
Posts: 7
Join Date: Oct 2012
Default Copying kindlebackup folder

Thanks for the script - the backup procedure was smooth -

I couldnt find the kindlebackups folder while browsing through my PC and for others like me who wonder how to take these out of your KFHD, here is a simple way - I used a program called Wondershare MObilego (Manage SDcard option under more tools) Backing up was a cakewalk.

I have no affiliation to this tool maker - Just sharing a way that helped a n00b like me. (First rooting experience)
The Following User Says Thank You to ceebu For This Useful Post: [ Click to Expand ]
 
dreamcryer
Old
#7  
dreamcryer's Avatar
Junior Member
Thanks Meter 0
Posts: 22
Join Date: Nov 2008
Thanks for the efforts!
BTW, will a backup from a clean device work for other devices instead of the same one which the backup was created from? Just wondering if people who have already fiddled around their root devices can get a fresh start.
 
kinfauns
Old
(Last edited by kinfauns; 11th October 2012 at 10:54 PM.)
#8  
kinfauns's Avatar
Developer Committee / Senior Moderator - OP
Thanks Meter 2871
Posts: 1,642
Join Date: Jan 2012
Quote:
Originally Posted by vuhai6 View Post
When i boot my kindle fire hd to fastboot (by factory cable) and connect it to pc, pc can't recognize kindle, it don't have driver for it.
I don't know if anybody has packaged the device drivers set up for this device. If nothing else, you can get the device driver installer in the "Kindle Fire Utility" for the original KF and use that. You just have to change the PID from 0006 to 0007 before installing it and should work. Refer to this post if you still have problems...

http://forum.xda-developers.com/show...71&postcount=2

for device driver information. Again, written for the original KF, but the process for installing device drivers is the same. Only the PID is slightly different and that should get edited in the INF before installation.

Quote:
Originally Posted by ceebu View Post
Thanks for the script - the backup procedure was smooth -

I couldnt find the kindlebackups folder while browsing through my PC and for others like me who wonder how to take these out of your KFHD, here is a simple way - I used a program called Wondershare MObilego (Manage SDcard option under more tools) Backing up was a cakewalk.

I have no affiliation to this tool maker - Just sharing a way that helped a n00b like me. (First rooting experience)
Glad to hear it worked out for you. I am not familiar with that program, but the KFHD should connect automatically to a Windows device as external storage... does it not?

Quote:
Originally Posted by dreamcryer View Post
Thanks for the efforts!
BTW, will a backup from a clean device work for other devices instead of the same one which the backup was created from? Just wondering if people who have already fiddled around their root devices can get a fresh start.
I have not tested this and don't have a way to do so. I have some concerns about it, but I'm sure someone desperate enough will jump in and try it out. I know it's too late for some, but my suggestion is for everybody to make a backup if you can and not rely on someone else to give you archives after the fact. It's better to have your own backups.
XDA Developers - Developer Committee / Senior Moderator
The Following User Says Thank You to kinfauns For This Useful Post: [ Click to Expand ]
 
cesdev89
Old
#9  
Junior Member
Thanks Meter 0
Posts: 9
Join Date: Oct 2012
Thumbs down Not recognized

My kindle is also not recognized when plugged in
 
vuhai6
Old
#10  
Junior Member
Thanks Meter 0
Posts: 17
Join Date: Sep 2006
Quote:
Originally Posted by kinfauns View Post
I don't know if anybody has packaged the device drivers set up for this device. If nothing else, you can get the device driver installer in the "Kindle Fire Utility" for the original KF and use that. You just have to change the PID from 0006 to 0007 before installing it and should work. Refer to this post if you still have problems...

http://forum.xda-developers.com/show...71&postcount=2

But pc don't recognize as Kindle, it as Tate-PVT-08 (sorry, i use mac cho screenshot, but windows too)
Attached Thumbnails
Click image for larger version

Name:	vuhai6 2012-10-08 at 8.47.22 PM.png
Views:	858
Size:	49.2 KB
ID:	1394697  

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes