# How to unbrick an Amazon Kindle Paperwhiteâ„¢ 0. Pry open Kindle using a prying tool 1. Unscrew the screen and remove it from the base. Note that there's a screw hidden under the adhesive at the top in the middle 1. Solder tin wire to serial ports on the bottom 2. Attach tin wire to USB TTY device (order is ground, RX, TX, from the kindle's perspective, where GND is the smallest pad) 3. Reboot kindle 4. When the kindle is booting, immediately mash enter to get to bootloader 5. Run 'bist fastboot' to put your Kindle into fastboot mode 6. On your Mac, build https://github.com/TobiasWooldridge/Fastboot-Kindle 7. Download Paperwhite images from http://ixtab.tk/kindle-touch-images/PaperWhite/ ``` wget http://ixtab.tk/kindle-touch-images/PaperWhite/pw_5.2.0-diags_kernel.img.gz wget http://ixtab.tk/kindle-touch-images/PaperWhite/pw_5.2.0-main_kernel.img.gz wget http://ixtab.tk/kindle-touch-images/PaperWhite/pw_5.2.0-mmcblk0p1.img.gz wget http://ixtab.tk/kindle-touch-images/PaperWhite/pw_5.2.0-mmcblk0p2.img.gz gunzip pw_5.2.0-*.img.gz ``` 8. *Modify the pw_5.2.0-mmcblk0p2.img on something which can mount ext3 using the guide below* 9. In bist, run 'fastboot' (if it isn't running already) 10. Make sure Kindle Paperwhite is plugged in to your Mac by USB as well 11. On your Mac, run `./fastboot` (Be careful not to run `fastboot`, as that may use an installed Android fastboot binary). This will list the paritions on your Kindle Paperwhite 12. We want to overwrite diags_kernel, main_kernel, system and diags 13. We now want to run ``` ./fastboot flash system pw_5.2.0-mmcblk0p1.img ./fastboot flash kernel pw_5.2.0-main_kernel.img ./fastboot flash diags pw_5.2.0-mmcblk0p2.img ``` to flash all of our images to the Kindle Paperwhite EXCEPT for the main system image 13. Run the following to reboot your Kindle and get into Diags mode ``` ./fastboot setvar bootmode diags ./fastboot reboot ``` 14. Once your kindle's booted to diags mode, start USB mode 15. Rename pw_5.2.0-mmcblk0p1.img to mmcblk0p1.img and copy it to your kindle 16. Safely unmount your kindle 17. Reboot your kindle into diagnostics mode again from the "Exit, Reboot or Disable Diags" menu 18. If you're watching your Kindle's serial output as it boots, you should see something like ``` /dev/loop/0: 84 files, 44940/174079 clusters info filesystems:installdata:KINDLEFIX looking for /mnt/us/mmcblk0p1.img ...: info filesystems:installdata:KINDLEFIX found mmcblk0p1.img, trying to install:I ``` 19. This indicates that it's flashing the system partition. It will take a while, during which the Kindle will only show the Amazon Kindle screen 20. Once diags mode has booted, open "Exit, Reboot or Disable Diags", hit disable diagnostics, then hit continue. This will reboot your kindle. 21. Hooray! Your kindle is now unbricked. 22. Optionally delete the mmcblk0p1.img on your Kindle over USB. If you leave it there, every time the diags tool is run, it'll flash it to the system partition. ## How to modify pw_5.2.0-mmcblk0p2 to automatically dd pw_5.2.0-mmcblk0p1 to the system partition Unfortunately pw_5.2.0-mmcblk0p1 is too big for fastboot (or, fastboot doesn't like it for some reason). This causes us a little bit of grief because we need to use some other means to get it onto our kindle We'd usually use the 'dd' tool on the kindle over ssh to copy this file to its respective partition; however, Amazon has removed the diagnostic partition's ssh application, so we can't use that to copy the file to the kindle and dd it. Instead, we'll just mangle the diagnostic image to 'dd' the file after it's done initializing filesystems. To do this, 1. Back up then mount the diagnostic image to some directory ``` cp pw_5.2.0-mmcblk0p2.img pw_5.2.0-mmcblk0p2.img.bak mkdir mmcblk0p2 root@debian:~# mount -t ext3 pw_5.2.0-mmcblk0p2.img mmcblk0p2/ ``` 2. Open its /etc/upstart/diags file (the diagnostics boot script) ``` vim mmcblk0p2/etc/upstart/diags ``` 3. At the end of init_filesystems function, before the "#end script" comment, add ```bash # INSTALL MAIN PARTITION FROM USERSTORE f_log I filesystems installdata "KINDLEFIX looking for /mnt/us/mmcblk0p1.img ..." if [ -e /mnt/us/mmcblk0p1.img ] ; then f_log I filesystems installdata "KINDLEFIX found mmcblk0p1.img, trying to install" I dd if=/mnt/us/mmcblk0p1.img of=/dev/mmcblk0p1 bs=4K f_log I filesystems installdata "KINDLEFIX Install successful" I fi ``` 4. Unmount mmcblk0p2 ``` umount mmcblk0p2/ ``` 5. Now when we flash pw_5.2.0-mmcblk0p2.img, it'll automatically check the userstore directory for a file named 'mmcblk0p1.img' and flash it to the system partition