[Fire TV Android Development] Sus_i:
:good:

You can take the scripts from this post, but you have to edit your paths in there (case sensitive) and of course also change the path to the locked bootloader, boot.img

Don't forget to install pv and set propper permissions to the scripts (look in the link).

Script should look like this one:

#!/bin/sh

# This is my shared folder where I put backups and the zip files, i.e. usb stick...
UNLOCKED="no"
SHARED="/home/ubuntu/Desktop/Shared"

# Unzip rbox's prerooted zips to your $SHARED folder then set this to the location of that folder
# Get those here: https://xdaforums.com/fire-tv/development/prerooted-stock-images-t2882337
ZIP="${SHARED}/bueller-5.2.7.0-rooted_r1"

# Location where the backups of the CURRENT image on the fire tv will go before it's overwritten
BACKUP="${SHARED}/backup"

# Download here https://github.com/xpirt/sdat2img
# Then change this to the location of the python script
SDAT2IMG=~/Desktop/sdat2img/sdat2img.py

# This should be the same on most linux systems (tested on Kali linux)
DEVDIR="/dev/disk/by-partlabel"

# Where to mount the mmc partitions
MNT="/mnt/emmc"
SYSTEM=$MNT/system

# WORKING
# Extract the image from the ZIP
if [ ! -e "${ZIP}/system_sdat2img.img" ]
then
echo -n "Converting system.new.dat to img format... "
$SDAT2IMG $ZIP/system.transfer.list $ZIP/system.new.dat $ZIP/system_sdat2img.img
echo "Done!"
else
echo "sdat2img already exists."
fi

If that works, you have a new extracted system now and you can try to run that:

#!/bin/sh

# This is my shared folder where I put backups and the zip files, i.e. usb stick...
UNLOCKED="no"
SHARED="/home/ubuntu/Desktop/Shared"

# Unzip rbox's prerooted zips to your $SHARED folder then set this to the location of that folder
# Get those here: https://xdaforums.com/fire-tv/development/prerooted-stock-images-t2882337
ZIP="${SHARED}/bueller-5.2.7.0-rooted_r1"

# Location where the backups of the CURRENT image on the fire tv will go before it's overwritten
BACKUP="${SHARED}/backup"

# Download here https://github.com/xpirt/sdat2img
# Then change this to the location of the python script
SDAT2IMG=~/Desktop/sdat2img/sdat2img.py

# This should be the same on most linux systems (tested on Kali linux)
DEVDIR="/dev/disk/by-partlabel"

# Where to mount the mmc partitions
MNT="/mnt/emmc"
SYSTEM=$MNT/system

# Back everything up JUST IN CASE...

DATE=`date +"%Y-%m-%d-%H%M"`

# echo "Backing up... "
mkdir -p $BACKUP/$DATE
echo -n "Unmounting system..."
umount $DEVDIR/system
echo "Done."
dd if=$DEVDIR/system | pv -s 805306368 | dd of=$BACKUP/$DATE/system.img
echo "Done."
echo -n "Unmounting recovery..."
umount $DEVDIR/recovery
echo "Done."
dd if=$DEVDIR/recovery | pv -s 9773056 | dd of=$BACKUP/$DATE/recovery.img
echo "Done."
echo -n "Unmounting boot..."
umount $DEVDIR/boot
echo "Done."
dd if=$DEVDIR/boot | pv -s 6627328 | dd of=$BACKUP/$DATE/boot.img
echo "Done."

echo -n "Clearing cache..."
umount $DEVDIR/cache
mkfs.ext4 $DEVDIR/cache
echo "Done."

# Write the images
# WORKING - Don't use bs=1024 ?? Stalled at 507mb
dd if=$ZIP/system_sdat2img.img | pv -s 805306368 | dd of=$DEVDIR/system || exit 1
dd if=$ZIP/boot.img | pv -s 6627328 | dd of=$DEVDIR/boot
dd if=$ZIP/recovery/recovery.img | pv -s 9773056 | dd of=$DEVDIR/recovery

# Mount system

echo "Mounting system..."
mkdir -p $SYSTEM
mount -o rw $DEVDIR/system $SYSTEM || exit 1
if [ ! -e "${SYSTEM}/xbin" ]; then
echo "ERROR: couldn't find /system/xbin - is the mount point correct?"
exit 1
fi

# Now copy stuff and root it

echo "Installing TWRP..."
cp -r $ZIP/recovery $SYSTEM
rm -f $SYSTEM/recovery/recovery.img
echo "Chmodding and chconing RECOVERY..."
chown -R 0:0 $SYSTEM/recovery
chmod -R 0755 $SYSTEM/recovery
chcon -R --reference=$SYSTEM/bin $SYSTEM/recovery

# Backing up e2fsck and symlinking it to 2ndinitstub...
mv -i $SYSTEM/bin/e2fsck $SYSTEM/bin/e2fsck.real
echo "Symlink e2fsck to 2ndinitstub..."
ln -sf ../recovery/2ndinitstub $SYSTEM/bin/e2fsck
chcon --reference=$SYSTEM/bin/e2fsck.real -h $SYSTEM/bin/e2fsck

echo "Installing SU..."

cp -f $ZIP/su/su $ZIP/su/supolicy $SYSTEM/xbin/
chown 0:2000 $SYSTEM/xbin/su $SYSTEM/xbin/supolicy
chmod 0755 $SYSTEM/xbin/su $SYSTEM/xbin/supolicy
chcon --reference=$SYSTEM/xbin/trapz $SYSTEM/xbin/su $SYSTEM/xbin/supolicy
ln -sf su $SYSTEM/xbin/daemonsu
chcon --reference=$SYSTEM/xbin/trapz -h $SYSTEM/xbin/daemonsu

cp $ZIP/su/libsupol.so $SYSTEM/lib/
chmod 0644 $SYSTEM/lib/libsupol.so
chown 0:0 $SYSTEM/lib/libsupol.so
chcon --reference=$SYSTEM/lib/libsuspend.so $SYSTEM/lib/libsupol.so

cp -r $ZIP/su/SuperSU $SYSTEM/app/
chown -R 0:0 $SYSTEM/app/SuperSU
chmod -R 0755 $SYSTEM/app/SuperSU
chcon --reference=$SYSTEM/app/Bluetooth -R $SYSTEM/app/SuperSU

echo "Unmounting system..."
umount $SYSTEM

echo "Done"

Thats it ;)

----------

Edit: If you work with a live ubuntu system (without persistent storage), all files that you copy to desktop, goes into RAM. Maybe you get problems, i.e. running out of space, idk. If you haven't much RAM, best is to set your working folder (for the ROM and the extracted system) to a USB stick and paste only the scripts on desktop.