yashsingh1/xdaforums huggingface dataset:
[Fire TV Android Development] Sus_i:
The force_recovery.img is an (almost empty) image file with only one file in it... ;)

Can't remember in detail, but I think it was something like this: /cache/bootmenu_recovery

That file will switch the bootmenu to TWRP at every boot, as long the file is there.

You need to use the one from sloanes amonet... (via dd command to cache) or you can create the file by hand...

Both should work fine :good:

Edit: You can run something like this:

adb shell
su
dd if=/sdcard/force_recovery.img of=/dev/block/platform/mtk-msdc.0/by-name/cache
exit
exit
[Fire TV Android Development] Bertonumber1:
[MENTION=5213625]Sus_i[/MENTION] thanks again my friend you're a diamond :good:

Updated Sloane to 5.2.7.1 r1 hopefully if its possible it will update USB driver, don't know why my keyboard/air mouse ain't showing up, shows up in twrp but not on boot menu screen.

Edit ## updated SU with 2.79 SR3 ZIP as it was old version, what's difference between flashing the supersu zip and magisk? Cos the supersu is already bound into ramdisk?
[Fire TV Android Development] Sus_i:
No, there isn't any update for usb. ;)

The mouse won't work at all at the 'bootmenu', most of the keyboard won't work too, except (or only) the two arrow keys (left/right) are working.

Maybe try pressing two times the 'left arrow' key, should do the trick.

You can update chainfires SuperSU, the latest version is SR5-SuperSU-v2.82-SR5-20171001224502.zip, grab it from here. It is normal that the SuperSU App won't open, it's somehow blocked by the fireOS. Just ignore the update messages...

Magisk won't work on the locked bootloader. Roger needs a new development box ;)
[Fire TV Android Development] Bertonumber1:
Haha sound advice m8. Was wondering wtf was happening, been round everyone stealing their keyboards n mouse today and wondering if it was fire os needing update,

I can't even get any to work on Sloane once he boots up to homescreen, at least the sdcard is expandable eh?..

As for supersu yeah I noticed it didn't do anything when I flashed it. So I'll update to 2.82 and get rid of some bloat, job done.

Wouldnt mind magisk though would be better :good:

Cheers again Sus_i
[Fire TV Android Development] Sus_i:
Have you tried an usb stick or keyboard in fireOS? You have to disable usb debugging in order to use it...
[Fire TV Android Development] Bertonumber1:
Ah well [MENTION=5213625]Sus_i[/MENTION] everyday is a schoolday mate (except a saturday and sunday) :laugh: i neverr knew adb had to be switched off .

Will try it out shortly when i finish using keyboard on pi . :good:

Yeah it's working with USb debugging off

Ta much :good:
[Fire TV Android Development] ldeveraux:
How did you fix this? I tried upgrading my rom in twrp, wiped cache, and it hung. I foolishly rebooted and now it only boots to twrp and won't mount cache.
[Fire TV Android Development] Rortiz2:
I don't really know, that was long time ago and now my box it's hard bricked.

I'd recommend you to manually format cache with make_ext4fs as the op says in the first post.

Regards.
[Fire TV Android Development] ldeveraux:
That was 7 months ago! I manually created the cache partition like you did and it worked. whew!
[Fire TV Android Development] Rortiz2:
Good to hear that
[Fire TV Android Development] FlippytheN00B:
Can anyone tell me the block size for the data partition? I corrupted the data partition and I cant seem to recreate it to fix it because I dont know the block size. I took a picture of the gpt awhile back but I no longer have it as I've switched 3 phones since then.

Edit:used wipe inside twrp to switch the file system to another format than reformatted back to ext4
[Fire TV Android Development] ccf801:
the hardware exploit that unbricks the fire tv 2 is probably the best way ,

however it takes time, learning , experimentation , trial and error.

you have to gain the feel for it , as it is much more than just running a set of files.

however , once you master that method , you will never have a bricked fire tv again.
[Fire TV Android Development] Daimonion777:
Hallo Leute,

can you help me downgrade a Fire TV 2? My Fire TV 2 has a rooted ROM version 5.2.6.7 installed. Would now like to install version 5.2.6.0.

Is the rom simply installed with TWRP or does a wipe have to be done first?

Thanks in advance

Many greetings,

Thomas
[Fire TV Android Development] Sus_i:
Why?

There is a full bootloader unlock out, no need to use old prerooted roms...

https://xdaforums.com/t/unlock-root-twrp-unbrick-firetv-2-sloane.4222331/

Flashing the amonet-1.1 zip via twrp is enough to unlock your box, then you can use any stock rom you like together with magisk for su.
[Fire TV Android Development] Daimonion777:
Hi Sus_i!

I want to remove the bloatware and use a different launcher. As far as I know, this only works up to version 5.2.6.0.

Have I understood that correctly, I only have to flash the firmware 5.2.6.0 in twrp?
[Fire TV Android Development] Sus_i:
Yes, usually thats it. If you see issues you can wipe anytime later.

Edit: It may be that 5.2.6.7 updated some images (a downgrade will work but maybe you see DRM / streaming issues). See the green note in the prerooted thread and the note at the 5267 rom: This ROM contains updated DRM firmware.
[Fire TV Android Development] doomsboygaming:
I understand that my request may seem ambitious, but I am inquiring about the feasibility of updating the current version of TWRP (Team Win Recovery Project). Presently, TWRP 3.0 is officially supported only up to Android 6.0. However, I have come across a user who is developing an Android 9.0 ROM, and I am curious if there exists any potential for updating TWRP to be compatible with this newer Android version.

If there are any resources, instructions, or guidelines available to assist me in updating or building a more recent version of TWRP, I would greatly appreciate your guidance in this matter.
[Fire TV Android Development] aboshi:
-rwxr-xr-x root shell 5744 2016-02-06 20:39 ext4_resize
-rw------- root root 166568 2016-02-06 20:39 2ndinit
-rw------- root root 11192576 2016-02-06 20:40 ramdisk-recovery.cpio

one sec ill post md5 also

ext4_resize - 269ef2171b2d14b5857d864f4134eb69

2ndinit - 95d08159960b2586d15d3dc058cb88f5

ramdisk-recovery.cpio - 1623b4a88a355301416de07aeba09e6c
[Fire TV Android Development] rbox:
Duh... sorry.

mount -o remount,rw /system
chmod 755 /system/recovery/2ndinit
mount -o remount,ro /system

Make sure you run each line individually, don't copy/paste the whole thing.
[Fire TV Android Development] retyre:
-rwxr-xr-x root shell u:object_r:system_file:s0 ext4_resize
-rw-r--r-- root root u:object_r:system_file:s0 2ndinit
-rw-r--r-- root root u:object_r:system_file:s0 ramdisk-recovery.cpio

Update: Changed permissions on 2ndinit; boot menu shows up now.
[Fire TV Android Development] dk1keith:
thanks I wasn't in root.
[Fire TV Android Development] rbox:
I just added the chmod command to the OP.
[Fire TV Android Development] aboshi:
chmod 755 did the trick ;)

Amazing work as usual ;)

Also love the new look of the recovery, super clean!
[Fire TV Android Development] dk1keith:
I entered all the original commands, can I simply go to root and enter the three commands above?
[Fire TV Android Development] bula1ca:
Hi rbox,

I am getting error: cp /sdcard/2ndinitstub : no such file or directory when I run cp /sdcard/2ndinitstub /system/bin/ext4_resize.

I do not see ext4_resize dir in system/bin. Should I create it?
[Fire TV Android Development] Aobeta:
I am not able to mount r/w. I get this...

shell@sloane:/ $ su
su
root@sloane:/ # mount -o remount,rw /system
mount -o remount,rw /system
mount: Invalid argument
255|root@sloane:/ # mkdir /system/recovery
mkdir /system/recovery
mkdir failed for /system/recovery, Read-only file system

I rooted with the original root method released a couple months ago, and I haven't really touched it since. Could never figure out how to mount r/w
[Fire TV Android Development] zeroepoch:
Some people early on had issues with adbfire making some changes that broke mount. You might want to just use the stock restore here. Then use the new recovery installer here.
[Fire TV Android Development] aboshi:
I'll post a script in a few mins. to make it one command. [MENTION=3991724]rbox[/MENTION] if you want post it on the OP
[Fire TV Android Development] rbox:
Please run this:

ls -l /sdcard/2ndinit* /system/bin/ext4_resize
[Fire TV Android Development] bula1ca:
Now I am getting the same error for cp /sdcard/2ndinit /system/recovery/

Thank you
[Fire TV Android Development] bula1ca:
This is what I get when I am running; ls -l /sdcard/2ndinit* /system/bin/ext4_resize
[Fire TV Android Development] rbox:
Looks like you missed step 1 that said to copy the contents of the zip to /sdcard.
[Fire TV Android Development] bula1ca:
Yes, sir. read it wrong, I copied them to the exterior sdcard
[Fire TV Android Development] dk1keith:
If I am already rooted on version 5.0.4 can I flash pre-rooted 5.0.3.1 to roll back?
[Fire TV Android Development] rbox:
Yes.
[Fire TV Android Development] dk1keith:
Great. Thanks
[Fire TV Android Development] aboshi:
Here is a script I whipped up and tested a few times.

I have made 2 scripts.

One for first time install of recovery.

The other for updating recovery when [MENTION=3991724]rbox[/MENTION] release's future updates.

To use the script(s) just upload the script to /sdcard/ along with all of the other files

When in adb shell:

su
cd /sdcard/
sh aftv2-recovery.sh

If updating:

su
cd /sdcard/
sh aftv2-recovery-update.sh

It doesn't get any easier :P

Again thanx to [MENTION=3991724]rbox[/MENTION] for another fine piece of work.
[Fire TV Android Development] BagiMT:
The instructions in the OP work great. Took literally 1 minute on a rooted FTV with adb over WiFi. Thanks for the great work rbox!
[Fire TV Android Development] zeroepoch:
Not sure but you might need the chmod after copying from /sdcard to /system/recovery. I know on some devices you can't really change permissions on /sdcard. Maybe you already tested that, so again not sure if needed or not. Also for upgrades you would just boot into TWRP and sideload or otherwise apply the pre-rooted image and it would update for you. I guess your update script would be for new recovery releases on the same version.
[Fire TV Android Development] aboshi:
No chmod needed. I tested it and I am on a mac so I already changed the perms, they looked like they carried over after pushing it to the aftv as I had no issues running the script. I also forgot that its just as easy to go into recovery and update from there in the future ;)

I guess it will be for lazy people who don't feel like hooking up a keyboard.

Or for testing purposes.
[Fire TV Android Development] deanr1977:
How do I get adb to find the directory? It says I have two devices connected? My ip & one starting with G070GV? Also when I press su it says not recognised as an internal or external command? I think I'm doing something wrong?
[Fire TV Android Development] rbox:
Are you connected with USB to the firetv and have usb debugging enabled and/or are you connected to another android device over USB? Disconnect it. If 'su' doesn't work... are you sure you are rooted?
[Fire TV Android Development] deanr1977:
Definitely rooted & running OS 5.0.3.1 i don't understand it? But I'm sure the command shouldn't say-

c:\Programe Files (x86)\Minimal ADB and Fastboot>

Shouldn't this be different?
[Fire TV Android Development] rbox:
You aren't in adb shell.
[Fire TV Android Development] deanr1977:
Thought I had android sdk tools on this laptop already? Must of done them on my compter before? I'm downloading that now, then will try again. Sorry rbox
[Fire TV Android Development] rbox:
I'm working on a much easier method, if you can wait a little more. Still needs adb though.
[Fire TV Android Development] deanr1977:
It should be ok, just not been using Adb or SDK tools In a while (I'm a little rusty), searching YouTube & found the answers I wanted to know so should be ok I reckon? How long does the rom take to flash please?
[Fire TV Android Development] rbox:
ROM takes a few minutes.
[Fire TV Android Development] dk1keith:
Not real sure what I may have done. But SuperSu must not be working. When I tried to restore my backup from TWRP it said can't mount system. Also in adb shell when I type su it doesn't take me to root. I'm on pre-rooted 5.0.4. I did do a Factory Reset and installed rbox pre-rooted 5.0.3.1. that didn't fix my video playback issue so I decided to go back to pre-rooted 5.0.4. Is it possible I lost root?
[Fire TV Android Development] rbox:
I may not have tested backup/restore... oops. What happens with su? Did you maybe not accept the prompt on the screen?
[Fire TV Android Development] dk1keith:
didn't see a su prompt? when would that have come up? also, the fact that I can't get to root from adb shell by typing su gave me the impression that SuperSu wasn't working. Supersu is installed but there is no Launch tab to open it.
[Fire TV Android Development] rbox:
When you type in 'su' at the adb shell, a prompt opens up on the screen. Do to some Amazon nonsense, you can't launch SuperSu.
[Fire TV Android Development] dk1keith:
Yeah forgot about that. I'm certain I didn't accept it on the screen after typing su. Just tried it and got the prompt.

thanks for the help!
[Fire TV Android Development] rbox:
I uploaded a v2. This includes an automated script to do everything, and I added some extra explicit steps to the process.
[Fire TV Android Development] Largewoodenspoon:
Hi guys.

I used the auto installer. It worked fine. But when it loads up to the boot selection, my tv screen is all screwed up. Some odd blurred double image. I dont know what the settings are supposed to be on my tv? Maybe thats the problem?
[Fire TV Android Development] deanr1977:
Thanks rbox, I waited after reading loads about this last night, but installed using the AFTV News guide this morning using your new v2 installer, went as smooth as silk mate as per usual. Thanks a lot now I have 5.0.4 root/rom & twrp recovery & blocked updates.
[Fire TV Android Development] Largewoodenspoon:
Tried this on 2 tvs now and am getting this odd double blurry image in recovery menu screen?
[Fire TV Android Development] Fruchttiger00x0:
rbox, your my man! My first aftv2 which was bricked since last year was bring back to live again.

There was just one thing that I had to do manually. While trying it the first time to install your prerooted rom (sloane-5.0.4-rooted_r1.zip

) via TWRP i still get errors with mounting /cache and /data partition (Invalid argument). Tried factory reset and wipe cache but the GUI just hangs right after starting (progress bar freeze)

!So for all you desperate guys with similar problems, watch out

-While in TWRP go to "Advanced"

-starting shell

command:

mkfs.ext4 /dev/block/mmcblk0p14 (for /cache)

mkfs.ext4 /dev/block/mmcblk0p15 (for /data WARNING: this wipes your whole data partition)

-exit the shell and reboot
[Fire TV Android Development] rbox:
That seems odd. Can you take a picture?

There' also an "advanced wipe" option in the wipe menu that can format cache and data. Glad you got it working though.
[Fire TV Android Development] Largewoodenspoon:
Pics of issue I'm having
[Fire TV Android Development] rbox:
Wow, can't say I've seen anything like that. Is the firetv connected directly to the tv? You said you tried 2 tvs, I don't suppose you have a computer monitor you can try?
[Fire TV Android Development] Largewoodenspoon:
Right into both tvs with hdmi cable. I had a similar issue with ouya boot option screen!? Can't think what's wrong!
[Fire TV Android Development] aboshi:
Have you tried different hdmi cables yet?

If you were having an issue with the ouya as well, you can pretty much rule out a software issue.
[Fire TV Android Development] Fruchttiger00x0:
[MENTION=3991724]rbox[/MENTION]

yeah I noticed that option but as I said the GUI did not proceed for some reason. It writes the command "mkfs.ext4...." and thats all. I wait for about 5 minutes but nothing happens. So I created the filesystems via shell and that worked. I checked it by mounting the fstab entries (mount -a) and no 'Invalid argument' was prompted. So anyway, guess I screwd up the partitions in the past by writing to wrong adresses^^

The only thing that matters is that you make my day. Thx again dude
[Fire TV Android Development] Aobeta:
Thanks! That did the trick.
[Fire TV Android Development] Largewoodenspoon:
Well I'm at a loss! Can't understand what's up. I've used 2 tvs, 3 hdmi cables and I still get this odd image thing. I could cry with frustration. I'm sure it's not the software. Just need to know other options that might be causing this.
[Fire TV Android Development] dk1keith:
Google Play since we now have recovery

Anyone know if we will be able to install Google Play now that we have a recovery for AFTV2? If someone has already installed can you please say what procedure you used.
[Fire TV Android Development] playingmax:
after doing all steps and installing TWRP. I clicked on reboot and ft keeps rebooting to the boot menu. if I click on normal it reboot and goes back to the boot menu and if I click TWRP Im able to go into it. but it will not boot to the regular amazon dashboard. can someone please help.
[Fire TV Android Development] dk1keith:
TWRP Backup Restore

I know rbox said he hadn't tested Backup and Restore with new recovery.....(again, thanks for the great work rbox!) has anyone tried to backup and restore with TWRP. I was able to backup with no problem but the restore failed with: cannot restore system--read only. any ideas how to fix that.

thanks
[Fire TV Android Development] rbox:
Please check your private messages.

I tried installing gapps last night and was unable to start the play store. Gave me an error. But I know a few weeks ago I tried it and was able to get to the login. So not sure.

I think that's something I'll have to fix. Somewhere in the settings there might be an option related to read only system. You could try changing that.
[Fire TV Android Development] dk1keith:
thanks for the reply rbox....do you recall which gapps you tried...I'd be willing to give it a try and see if result is the same. I have it installed on my rooted fire tv 1 but I think it only works because of Xposed Installer.
[Fire TV Android Development] ians325:
Hi Rbox, thanks for your hard work, could you tell me which version of xposed to install
[Fire TV Android Development] dk1keith:
Wanted to report back. you were right rbox. I had to go to Mount and check system, then uncheck: Mount system partition read-only. Once I did I was able to restore my backup and everything so far appears to be fine. I did have to re-register my account so don't be alarmed when that comes up, I think that may be normal. but so far it looks like Backup and Restore are working fine.

thanks again
[Fire TV Android Development] playingmax:
after doing all steps and installing TWRP. I clicked on reboot and it keeps rebooting to the boot menu. if I click on normal it reboot and goes back to the boot menu and if I click TWRP Im able to go into it. but it will not boot to the regular amazon dashboard. can someone please help
[Fire TV Android Development] aboshi:
[MENTION=3991724]rbox[/MENTION]

Just tested with your script and its not working. Recovery not showing up, might be perms issue again. Also at the end of your script you have an elf header as well (not sure if that was intentional)

I tested it after with the script that I made a few posts back and it worked. So def check and see if its setting perms correctly and/or copying the files over.
[Fire TV Android Development] rbox:
I used opengapps. Whatever you try, you need something for Android 5.1.

You want the xposed for sdk22 arm64.

Thanks, I'll get that fixed in the next version. If you wiped data, then yes, you would need to reregister.

While in recovery, can you adb connect and pull /tmp/recovery.log and paste it.

Weird, I tested it a whole bunch. Can you show me what it looks like when you run it and then show me the results of:

ls -l /system/bin/ext4_resize /system/recovery
ls -lZ /system/bin/ext4_resize /system/recovery
[Fire TV Android Development] aboshi:
ls -l /system/bin/ext4_resize /system/recovery
-rwxr-xr-x root shell 0 2016-02-07 16:01 ext4_resize
-rwxr-xr-x root root 0 2016-02-07 16:01 2ndinit
-rw------- root root 0 2016-02-07 16:01 ramdisk-recovery.cpio

ls -lZ /system/bin/ext4_resize /system/recovery
-rwxr-xr-x root shell u:object_r:system_file:s0 ext4_resize
-rwxr-xr-x root root u:object_r:system_file:s0 2ndinit
-rw------- root root u:object_r:system_file:s0 ramdisk-recovery.cpio
[Fire TV Android Development] rbox:
They're all 0 size... Did you have the .zip and the script in the same directory together when you ran it?
[Fire TV Android Development] aboshi:
I see on the tut on the OP now it says

I must have missed the part where it says put the zip on the sdcard as well after extracting.

I think others might miss that as well. Do you think separating the script from the updates might be less confusing?
[Fire TV Android Development] BagiMT:
Xposed SDK22 arm64 works fine. I flashed the latest Open Gapps for 5.1 for arm64, the pico package. Play store does not open, says it is not compatible. Older version Ioads and shows apps but crashes when trying to install an app. Interestingly the latest play store for Android TV works and can install apps but only shows Top Paid and Top Free apps and search does not work. This is with the HDXposed module enabled. Also, on the regular play store my USB mouse does not show but Wukong remote mouse works! Work in progress.
[Fire TV Android Development] playingmax:
Got it working just had to clear dev n cache. Boots perfect. Thanks
[Fire TV Android Development] rbox:
OK. I was thinking /cache had gotten corrupt. I'll add a note about it.
[Fire TV Android Development] KainanMaki:
Which version or which file did you flashed for Xposed?
[Fire TV Android Development] KainanMaki:
I just tried to flash the recovery on 5.0.5 and it worked like charm, then flashed 5.0.3.1 successfully.
[Fire TV Android Development] rbox:
Just curious why you want to go to 5.0.3.1?
[Fire TV Android Development] KainanMaki:
I don´t in fact. I have two 4K FTVs.

I had a bad flash on first use on one and I saved it with the 2 week slow flashing (zeroepoch method), since it wasn´t rooted and I left it powered on it went to 5.0.5.

The second one was rooted on 5.0.4, I wanted to restore it and start it from scratch and apply your recovery (which I did). The problem was the initial mandatory update so I was stuck not being able to pass that screen.

What I thought is "ok, if recovery works on 5.0.5, I can apply a prerooted 5.0.3.1 or 5.0.4 and afterwards generate a nandroid backup and restore it on the other FTV to bypass the update screen".

I downgraded just for the sake of keeping root. I assume 5.0.5 would have worked but of course without root.

The moment 5.0.5 prerooted is released I´ll update again.

I´m wanting to apply your module for xposed to change the default launcher, so that´s next.
[Fire TV Android Development] rbox:
I make no guarantees about that module actually working on FireOS5 or the FireTV2 in general. Once I make the prerooted for 5.0.5 for the FireTV1 i'll look into updating it. But you can try it and see what happens.