How to downgrade, root, and install CM 12.1 on 5th gen Kindle Fire I just got an Amazon Kindle Fire 5th generation 7 inch tablet. I want to install CyanogenMod but during setup the tablet updated to 5.1.4 and root methods and therefore flash methods are not working.
If you plan on rooting a new Fire, it is advisable to not connect to the internet during setup to avoid forced updates. 5.1.2 is required to install CM. Note that 5.1.2.1 does not work but is displayed as just 5.1.2 in settings.

Enable debugging

From the Settings app open Device Options. Enable developer options by tapping on the serial number several times.
In Developer Options turn "Enable ADB" on.

Your tablet should ask to authorize your computer when it is plugged into the computer.

Downgrading

5.1.4 can be downgraded to 5.1.2. Needs Android platform-tools (adb) and the 5.1.2 firmware.

I retrieved the SuperTool and 5.1.2 firmware from http://rootjunkysdl.com/files/?dir=Amazon%20Fire%205th%20gen. ADB is also hosted there though I used my copy from the Android SDK.

Power off the Fire and connect it to your computer.
Hold volume down and power for about 10 seconds. A menu should appear.
Select "apply update from adb". (press volume up then power)
Run adb sideload fire-OS-5.1.2-update-kindle-global-37.5.4.2_user_542168620.bin
Wait for this to finish. The tablet will return to the boot menu.
Unplug and then press the power button to select the reboot option.
You should now be on firmware 5.1.2.

From here I connected to the internet and was not prompted to update my Fire.

Rooting

I used the RootJunky SuperTool to assist in rooting.

Choose option 6, "Root your Amazon Fire 5th gen" and follow the prompts. This will install RootKing. I had the most trouble here. RootKing may fail several times to gain root. You may want to manually reboot between attempts. When you get root, continue with the SuperTool prompts to install SuperSu.

Prevent 5.1.4 Update

Choose option 3 from SuperTool, "Block OTA Updates from Amazon" and follow the prompts.

Flashing CyanogenMod 12.1

Download from http://forum.xda-developers.com/amazon-fire/orig-development/rom-cm-12-1-2015-11-15-t3249416 CM 12.1.
From http://opengapps.org/ download the ARM-5.1-nano package.
Place both these zips on a micro sd card and insert it into your Fire.

With the SuperTool select option 2, "Install Google Play store". Use Google Play to install FlashFire.

Use FlashFire to prepare your device. In the bottom right corner is a red "+" to add actions. The defaults for the commands are fine. You may swipe away the hints in the command queue. 

Add "Wipe".
Add "Flash ZIP/OTA" and select the CyanogenMod zip.
Add "Flash ZIP/OTA" and select the Open Gapps zip.
Move "Wipe" to the top of the command list.
Press the "Flash" button.  

You should reboot into the CyanogenMod setup.

Extra Notes

CyanogenMod lets you enable root from developer options. 

I had to install Google Play Games from APKMirror because the Play Store kept giving me error 505.

Kindle Fire specifications can be found on Amazon.