[Kindle Fire Android Development] pokey9000:
What it is

Firekit combines all the command line tools for Kindle Fire recovery with the Ubuntu LiveUSB. All you need is a USB stick and a PC that can boot off it. All files stay on the stick, so nothing on your PC is changed.

Firekit is run from the command line, but there are scripts to automate common tasks so the typical restoration involves running just two commands. A fastboot-bootable TWRP and FFF is included as well as the Rekindle USB boot tools so even the most fubared bricks can be restored.

This is only for the first gen Kindle Fire 7" from late 2011. It will not work on any other model.

What can it do

Fix power on problems: If the Fire's screen never seems to turn on, you may have wrecked the bootloaders or the partitioning. Fortunately most of the time this results in the CPU falling into the low level USB boot mode. Use the "usb_fix_parts_and_install_fff_twrp" to rebuild the flash enough to boot TWRP. You don't need to use the USB shorting trick for this one, just power up the Kindle after running the script.

Fix stuck-at-triangle-logo: This can be due to being stuck in fastboot or having a corrupt /system. First try getting into recovery. Press power for a few seconds just after turning on, LED should go orange and the TWRP should show up. If that works, reflash your ROM from TWRP. If not, try the "normal_boot" script to get out of being stuck in fastboot.

Fix stuck-at-Kindle Fire-logo: Similar to the above. First try the "normal_boot" script. If that doesn't work, you need to reflash the stock ROM from TWRP. But you don't have TWRP. So use the "install_fff_twrp_from_stock" script which will force the stock ROM into letting you install fastboot. Then flash a ROM.

-and more

Why

A lot of people seem to be having problems with Windows and ADB drivers needed for fastboot and adb. Linux doesn't seem to have this kind of trouble, so I threw this together. It's not pretty or menu driven, but I find that too much automation gets in the way when things are broken to begin with.

Downloading a ~600MB Ubuntu image is needed, and this has only been tested on one PC so far. Don't complain if you spend hours grabbing this only to not have it fix your problem. I thought about rolling my own USB image with debootstrap for a much smaller image but figured that a prefab Ubuntu Live image is probably best for compatibility.

Using Firekit

Making the LiveUSB

Get the latest 32-bit Ubuntu and follow the directions to make a USB stick. If you want to try this with another distro (not tested) it must be 32-bit or have full 32-bit compatibility libraries.

Then unpack the attached zip to the top of the stick. The easiest way is to open the .zip in Explorer, right-click on "fk" (the only file in the zip), and choose "Send to..."->your USB stick's drive letter. You may have to unplug and replug the stick for Windows to see the drive after Ubuntu's been installed. If you have anything else you want available on the stick (roms, other recovery/bootloader, etc) copy them here as well. When done, eject the drive.

Before Booting

Set your PC's BIOS to boot USB before your internal drive. Each PC is different, so it's up to you to figure out how to set your PC to boot from USB.

Running the tools

Always start with your Kindle turned off and unplugged from USB. These directions assume that your Fire is stuck in fastboot, has FFF installed, or you are using the USB boot shorting trick. The exception is if you're trying to install FFF/TWRP from stock Kindle OS, in which case leave it booted and plugged in.

Now boot the LiveUSB. Once the Ubuntu desktop shows up, click the Ubuntu logo in the top left (or press the Windows key) and type "term". Hit enter to run the terminal.

In the terminal window, type "sudo /cdrom/fk". This unpacks the tools and sets up your environment. You should now have a prompt that says "root@ubuntu:~/firekit#"

A list of the possible scripts should now be showing. Type the name of the script you want and hit enter. Protip: type a few letters and hit tab to autocomplete the rest of the word. If you're using any of the usb_ scripts, short the test point and plug in the Fire. As mentioned before, you should have the Fire already booted when using "install_fff_twrp_from_stock". For all the other commands, just plug the Fire in.

If this keeps you from returning or junking an otherwise good Fire, consider throwing a thanks or a beer my way.

Props to TeamWin & agraben for TWRP, everyone at Canonical

These are the commands as of 1.1:

install_fff_twrp_from_stock: Install FFF and TWRP while in stock Android. Uses fbmode to reboot. Use this to get FFF/TWRP installed on 6.2.1 stock OS.

install_fff_twrp: Install FFF and TWRP while in fastboot. Good if you're stuck in fastboot and you want FFF/TWRP.

fix_parts Restore partition table to stock while in fastboot. Do this if you're in fastboot and your partition table is screwed up.

normal_boot: Set the bootmode to boot android and reboot while in fastboot. Try this if you're stuck at the Kindle Fire logo.

usb_boot_twrp: USB boot TWRP without installing. Boot TWRP if your Kindle black screens when you try to power it on. Needs the USB boot mode trick.

usb_install_fff_twrp: USB boot FFF, install FFF and TWRP. Install / recover the bootloader and recovery if they are broken. Needs the USB boot mode trick.

usb_fix_parts_and_install_fff_twrp: USB boot FFF, restore partition table to stock, install FFF and TWRP. Fix everything if you screwed up the partition table and your Fire's screen no longer turns on. Needs the USB boot mode trick.

Changelog:

1.1:

-Add restore of mmcblk0p1 (x-loader) to the "usb_fix_parts_and_install_fff_twrp" script to recover from total brain damage. Thanks to TyHi for proving this works and may be necessary.

1.0:

-Initial release

(todo: make videos, integrate usb boot mode instructions)