[Fire TV Android Development] LocoMexican:
I edited flash.sh script as suggested and flashed. Here are the results.

locomex12@locomex12-Presario-C700-Notebook-PC:~/Desktop/Folder-5.2.7.0$ sudo apt update

[sudo] password for locomex12:

Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease

Hit:2 http://us.archive.ubuntu.com/ubuntu xenial InRelease

Hit:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease

Hit:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease

Reading package lists... Done

Building dependency tree

Reading state information... Done

92 packages can be upgraded. Run 'apt list --upgradable' to see them.

locomex12@locomex12-Presario-C700-Notebook-PC:~/Desktop/Folder-5.2.7.0$ sudo apt install dos2unix

Reading package lists... Done

Building dependency tree

Reading state information... Done

dos2unix is already the newest version (6.0.4-1).

The following packages were automatically installed and are no longer required:

libllvm5.0 snapd-login-service

Use 'sudo apt autoremove' to remove them.

0 upgraded, 0 newly installed, 0 to remove and 92 not upgraded.

locomex12@locomex12-Presario-C700-Notebook-PC:~/Desktop/Folder-5.2.7.0$ sudo apt install pv

Reading package lists... Done

Building dependency tree

Reading state information... Done

pv is already the newest version (1.6.0-1).

The following packages were automatically installed and are no longer required:

libllvm5.0 snapd-login-service

Use 'sudo apt autoremove' to remove them.

0 upgraded, 0 newly installed, 0 to remove and 92 not upgraded.

locomex12@locomex12-Presario-C700-Notebook-PC:~/Desktop/Folder-5.2.7.0$ sudo dos2unix sdat2img.sh

dos2unix: converting file sdat2img.sh to Unix format ...

locomex12@locomex12-Presario-C700-Notebook-PC:~/Desktop/Folder-5.2.7.0$ sudo chmod u+x sdat2img.sh

locomex12@locomex12-Presario-C700-Notebook-PC:~/Desktop/Folder-5.2.7.0$ sudo chmod u+x sdat2img.py

locomex12@locomex12-Presario-C700-Notebook-PC:~/Desktop/Folder-5.2.7.0$ sudo ./flash.sh

Unmounting system...umount: /dev/disk/by-partlabel/system: not mounted

Done.

1572864+0 records in2MiB/s] [================================> ] 99% ETA 0:00:00

1572864+0 records out

805306368 bytes (805 MB, 768 MiB) copied, 159.23 s, 5.1 MB/s

768MiB 0:02:39 [4.82MiB/s] [================================>] 100%

1572864+0 records in

1572864+0 records out

805306368 bytes (805 MB, 768 MiB) copied, 159.231 s, 5.1 MB/s

Done.

Unmounting recovery...umount: /dev/disk/by-partlabel/recovery: not mounted

Done.

20480+0 records in5.9MiB/s] [====================> ] 64% ETA 0:00:00

20480+0 records out

10485760 bytes (10 MB, 10 MiB) copied, 1.6776 s, 6.3 MB/s

10MiB 0:00:01 [5.96MiB/s] [=================================] 107%

20480+0 records in

20480+0 records out

10485760 bytes (10 MB, 10 MiB) copied, 1.67747 s, 6.3 MB/s

Done.

Unmounting boot...umount: /dev/disk/by-partlabel/boot: not mounted

Done.

20480+0 records in5.9MiB/s] [==============================> ] 94% ETA 0:00:00

20480+0 records out

10MiB 0:00:01 [5.67MiB/s] [=================================] 158%

10485760 bytes (10 MB, 10 MiB) copied, 1.7653 s, 5.9 MB/s

20480+0 records in

20480+0 records out

10485760 bytes (10 MB, 10 MiB) copied, 1.76562 s, 5.9 MB/s

Done.

Clearing cache...umount: /dev/disk/by-partlabel/cache: not mounted

mke2fs 1.42.13 (17-May-2015)

Creating filesystem with 196608 4k blocks and 49152 inodes

Filesystem UUID: bf110489-ace9-4660-b992-dd6786c4d183

Superblock backups stored on blocks:

32768, 98304, 163840

Allocating group tables: done

Writing inode tables: done

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

Done.

Clearing data...mke2fs 1.42.13 (17-May-2015)

/dev/disk/by-partlabel/userdata contains a ext4 file system

last mounted on Fri Oct 11 08:53:13 2019

Proceed anyway? (y,n) y

Creating filesystem with 1490469 4k blocks and 373152 inodes

Filesystem UUID: a9b0273e-154a-4dd0-9dd9-27e87753dc96

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

Done.

1572864+0 records in6MiB/s] [================================> ] 99% ETA 0:00:00

1572864+0 records out

805306368 bytes (805 MB, 768 MiB) copied, 396.858 s, 2.0 MB/s

768MiB 0:06:36 [1.94MiB/s] [================================>] 100%

1572864+0 records in

1572864+0 records out

805306368 bytes (805 MB, 768 MiB) copied, 415.107 s, 1.9 MB/s

12928+0 records in.09MiB/s] [===============================> ] 97% ETA 0:00:00

12928+0 records out

6619136 bytes (6.6 MB, 6.3 MiB) copied, 2.09119 s, 3.2 MB/s

6.31MiB 0:00:02 [3.08MiB/s] [================================> ] 99%

12928+0 records in

12928+0 records out

6619136 bytes (6.6 MB, 6.3 MiB) copied, 3.21854 s, 2.1 MB/s

19088+0 records in.09MiB/s] [===============================> ] 97% ETA 0:00:00

19088+0 records out

9773056 bytes (9.8 MB, 9.3 MiB) copied, 3.03375 s, 3.2 MB/s

9.32MiB 0:00:03 [3.02MiB/s] [================================>] 100%

19088+0 records in

19088+0 records out

9773056 bytes (9.8 MB, 9.3 MiB) copied, 4.7004 s, 2.1 MB/s

Mounting system...

Installing TWRP...

Chmodding and chconing RECOVERY...

Symlink e2fsck to 2ndinitstub...

Installing SU...

Unmounting system...

Done

locomex12@locomex12-Presario-C700-Notebook-PC:~/Desktop/Folder-5.2.7.0$

I disconnected emmc adapter and ran on tv. It boots into twrp, goes to black screen, displays white amazon logo for a few moments, goes to black screen and then boots into twrp. In twrp, I tried to follow your instructions regarding repair of partition.

data "failed to mount '/data' (Invalid argument)

Repairing data

/dev/block/mmcblk0p20 process ended withERROR 8

unable to repair data

Repairing Cache

Done

Repairing System

/dev/block/mmcblk0p18 process ended with ERROR 12

unable to repair system

It then tries to repair data two more time with the same result as above.

Resizing partition to 2 and then back to 4 with both data and Cache fails because of ERROR 8

Resizing system to 2 and then back to 4 fails with ERROR 12

If I try to do a factory reset in twrp, it fails to mount data and cache because of (invalid argument) and therefore it fails to format.