Skip to content

Instantly share code, notes, and snippets.

@hkfuertes
Last active March 28, 2025 17:05
Show Gist options
  • Save hkfuertes/4fbe3ff18e07ea3190be7b726b0d96fd to your computer and use it in GitHub Desktop.
Save hkfuertes/4fbe3ff18e07ea3190be7b726b0d96fd to your computer and use it in GitHub Desktop.
TWRP + SCRCPY Fire Stick TV Configuration for local development

Telegram Channel: t.me/amazon_oss

Install

adb shell twrp wipe 
adb shell twrp cache
adb shell twrp system
adb shell twrp dalvik
adb push ROM.zip /sdcard/
adb shell twrp install /scard/ROM.zip

Enable ADB (insecure)

adb shell mount /system_root
adb shell "sed -i 's|ro.secure=1|ro.secure=0|g' /system_root/system/build.prop"
adb shell "sed -i 's|ro.adb.secure=1|ro.adb.secure=0|g' /system_root/system/build.prop"
adb shell "echo 'persist.sys.usb.config=adb ' >> /system_root/system/build.prop"

Enable UART logs

echo -ne "UART_PLEASE" | dd of=misc-uart.bin bs=1 seek=16 conv=notrunc
# sudo ./boot-fastboot.sh
fastboot flash MISC misc-uart.bin

Skip first wizard

# From live env, no twrp!
adb shell settings put global device_provisioned 1
adb shell settings put secure user_setup_complete 1

Install SCRCPY

It is important that the version is 2.x as it allows for video/audio codecs. Visit SCRCPY github repo for more info, but the steps are the following:

  • First, you need to install the required packages:

    # for Debian/Ubuntu
    sudo apt install ffmpeg libsdl2-2.0-0 adb wget \
                   gcc git pkg-config meson ninja-build libsdl2-dev \
                   libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
                   libswresample-dev libusb-1.0-0 libusb-1.0-0-dev
  • Then clone the repo and execute the installation script:

    git clone https://github.com/Genymobile/scrcpy
    cd scrcpy
    ./install_release.sh

To run the command with acceptable latency, use the following parameters:

# Amazon Fire Stick TV (sheldon/p) w/ Lineage OS 18.1
scrcpy --video-codec=h264 --video-encoder='OMX.google.h264.encoder' --audio-codec=aac --audio-encoder='OMX.google.aac.encoder'

TWRP Enable ADB with Keys

To enable adb debuging from recovery (TWRP):

adb shell

# Data related changes
twrp mount data
mkdir /data/property
echo -n 'mtp,adb' > /data/property/persist.sys.usb.config

# System related changes
twrp remountrw system
# This next command should return empty
grep 'persist.service.adb.enable' /system/build.prop
echo '' >> /system/build.prop
echo '# Enable ADB' >> /system/build.prop
echo 'persist.service.adb.enable=1' >> /system/build.prop 
echo 'persist.service.debuggable=1' >> /system/build.prop
echo 'persist.sys.usb.config=mtp,adb' >> /system/build.prop
# echo 'ro.adb.secure=0' >> /system/build.prop

RSA verification

Generate the public key and push it to device:

adb pubkey ~/.android/adbkey > ~/.android/adbkey.pub
adb push ~/.android/adbkey.pub /data/misc/adb/adb_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment