Oct 13, 2013

How to Backup and Restore System Software Without Custom Recovery on the Amazon Kindle Fire HD

By
Late last month, we brought you news that the unhackable Amazon Kindle Fire HD got rooted. It was a pretty exciting achievement because that’s the first step in any device’s development process. However, users who go for root have had to be careful because there isn’t a custom recovery yet for the Kindle Fire HD and Kindle Fire 2. There is still a way to backup your system, though.
We had written up a method that’ll backup system software so that users can restore it in case things go wrong. As kinfauns explains:
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.
The process isn’t ClockworkMod-Recovery-backup simple, but it is pretty close. Essentially, kinfauns wrote a shell script that creates a backup directory on your SD card, backs up partitions 1-11 (everything except /cache and /data) and makes the files user-readable and -writable. All users need to do is download the script and follow kinfauns’ instructions to get it to work. A word of warning, the process can be dangerous if it isn’t used properly, so be sure you’re following instructions to the letter.

 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)

0 comments:

Post a Comment

Featured Post

Make Money Through Microworkers.com

There are many ways to make our Surf on web to be useful. Apart from our curriculam making ourself  to be relaxed through hearing Music an...

Back to Top