[UPDATE #1] I've added a zip file with the 2 scripts, with UNIX line endings , as suggested below by AFTVNews. Cheers.
[UPDATE #2] I've added a zip file with the 2 extra scripts to go into /etc/init.d, as requested by Axecaster. These will need the same ownership and permissions as enableotg. They disable SELinux and set the permissions on the recovery directories. Cheers.

Having had a look around the android image on my Fire TV Stick (v1) [FireOS 5.2.1.1 rbox] I found that a script, which doesn't exist, called /system/bin/factoryadb.sh was being run by /init.build.rc on boot.
I was able to create a simple script to run scripts in /etc/init.d on boot.

NOTE: I've only tested this on a 1st generation Fire TV Stick but may work on Fire TV boxes if they also call /system/bin/factoryadb.sh from /init.build.rc

Before you do this please make sure factoryadb.sh is NOT on your FireTV and that it is called from /init.build.rc by connecting to your FireTV via adb and running the following commands

All is working and OTG should be working about 5 seconds after leaving the TWRP screen and long before Android has finished booting.
If you have an ethernet dongle attached it should have an IP address before the launcher starts

Does this enable the use of USB storage ? as ive had this setup for over 6 months now to enable usb pheripal support on boot (with a script booter). If not i guess its still good to do away with the extra apk i had installed to enable my script at boot.

Seems mainly for gen 1 sticks to enable usb peripherals. Each boot requires a command to be re-run to recognize usb keyboards, mice, wired networking port, etc. Someone correct me if I'm wrong, but this configuration could in-theory assign multiple scripts to run on boot without extra apps installed.

Yes Gen2 sticks and the main FireTV's seem to have OTG already enabled but Gen1 sticks don't.
However even though I've only specified enabling OTG in my initial post, as Axecaster mentioned I do in fact have a number of scripts in /etc/init.d that run on boot.

e.g. Set SELinux to Permissive, set full R/W access on the recovery directories, cleanup some temp files on boot etc

I'm currently checking to see if I can set a static IP on the USB Ethernet adapter I use with my Gen1 stick which will most likely result in a new script in /etc/init.d

I also need to investigate the USB storage options more though. Might be the same issue as I'm having with NFS mounts. I can mount an NFS share but currently only root can see it!

XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality.Are you a developer? | Terms of Service