yashsingh1/xdaforums huggingface dataset:
[Fire TV General] zeroepoch:
Simpler Rooting

[MENTION=394912]ImCoKeMaN[/MENTION] and I have been working to simplify the rooting steps, especially for Windows users. We now have a single script that does the handshaking, version check, and patching with resume. It also includes the Windows drivers and patch files in the zip file. This is the only file you need to download now. Windows users no longer need to install python. You can find it below:

http://download.zeroepoch.com/aftv2/5.0.3.1/root-aftv2-5.0.3.1.zip

The underlying method is still the same just streamlined so it's going to take 2 hours or more as usual.

Windows Users:

1. Install the included drivers following this guide, http://thebroodle.com/microsoft/win...loader-usb-vcom-drivers-in-windows/#arvlbdata

2. Run root_aftv2.bat after unzipping the file

Linux Users:

1. Install pyserial for python 3 from your distro

2. Run root_aftv2.py after unzipping the file (try with sudo)

Mac OS X Users:

1. Install Python 3.5 from python.org

2. Install pyserial from the terminal (pip install pyserial)

3. Run root_aftv2.py after unzipping the file

If these instructions don't make sense then you should follow the original steps instead for now. Providing any feedback would be appreciated if you believe you know what the problem is. It's been tested on Linux and Windows 10, not yet on OS X, but it's mostly just a combination of the previous steps and safe to run many times or switch back to the older method if something happens.

Still not sure yet if 5.0.4 will be rootable for devices already on that firmware or how easy it will be to upgrade, but we're hoping this new approach might help people get rooted before the update comes out. If feedback seems pretty positive we can starting switching the guides over to this method.
[Fire TV General] jbombs16:
If I have a never powered on box, do I need to power it on to turn on usb debugging before I can run the windows bat file?
[Fire TV General] ultimate_spy_binns:
thanks I will test the Windows script out, since I had a big shipment of boxes today to get done, thought it might be a wise idea to get a lot of them done just in case the next version can't be rooted.
[Fire TV General] Lol.:
I have a quick question Zeroepoch: I believe a factory restore still retains root, does it also retain the disabled update setting? Or must we run this after a restore? Thanks.

---------- Post added at 03:21 AM ---------- Previous post was at 03:18 AM ----------

Would you mind posting how you installed this on the Fire TV?
[Fire TV General] zeroepoch:
Nope. You can actually root it from the very first power on. You don't need to be online ever. Make sure you run checkver.py or the single script version first. If it's not 5.0.3.1 you need to login and update it first.

EDIT: Let me clarify sightly. It does not use adb so that's why you don't need to enable it first. It uses a mediatek protocol that's always enabled.
[Fire TV General] zeroepoch:
You will need to disable updates again after a factory reset but it does keep root as you said.
[Fire TV General] stangri:
If you bought them from the return-friendly place, any chance you can let one update to 5.0.4 and test if the checkver/handshake still work?
[Fire TV General] santamanga:
Okay. Hmn, but after we achieved root, you need to power it up and set up an account and let it connect to amazon servers, before you are allowed to enter settings to turn on adb developer options, to disable updates. But i guess, then it already has updated. Or am I wrong in my assumptions and you can disable updates before?

Maybe your next version of root (:D) could also hide the update app, if that doesn't softbrick the device?
[Fire TV General] dk1keith:
so do we connect Fire TV 2 to pc via A to A cable before running script? Or does it prompt you when to connect it? also when I install the drivers I get an exclamation mark on the driver in Windows Control Panel, but the drivers do install. Is this a problem?

Sorry for the basic questions, and thanks for making rooting an easier process.
[Fire TV General] ldeveraux:
The first post says after you root to disable the updates. It's not really that difficult.
[Fire TV General] sjyi:
bluetooth& remote control issues

Thank you for sharing your hard work.

I've noticed some issues and hoping someone could provide pointers to iron out these issues.

After I've rooted my AFTV and everything seemed fine until I tried my bluetooth mouse. The mouse cursor only comes on within an application not at the main menu. Prior to rooting, I was able to use it to navigate the main menu and start any app.

When I went back to the downloaded stock image, the remote controller does not work unless it is placed literally right above the AFTV.

When I went back to the rooted version, the weird mouse behavior came back and I could use the remote controller normally.

I could use the mouse after I start an app, but losing the use of the remote controller when I go back to the stock image is puzzling.

Any information would be appreciated.

Thanks,

SJ
[Fire TV General] :
It's not about difficult, it's about going through amazon sign in (and trigger the update), before you can get a rooted shell to disable updates. It's just about the time window between signing in and beeing able to issue the pm command.
[Fire TV General] ldeveraux:
When following the guide and first booting the device, you don't connect to the network and don't sign in. You enable ADB and prepare for root. After rooting, you immediately disable the OTAs, reboot, connect to internet, then sign in. At no point should this be internet able before root.
[Fire TV General] santamanga:
You are sure that's possible? When I booted 1st, it wasn't possible to enter Settings before everything.
[Fire TV General] :
How do I get a shell to disable updates? Via adb.

How do I enable adb? In settings -> system.

How do I reach settings -> system, without enable network and signing in?

So the question - you don't answer - is: how to disable updates, without signing in and setting up network to get to settings -> system, to enable adb?

As for your pointer to OP: How to setup adb and usb without signing in? You can't skip that on Fire OS.
[Fire TV General] ldeveraux:
at some point during the initial setup, you can skip the remainder and start using the device. I don't remember where or when, I did this a week ago. i think if you've already gone through the entire setup, it may be too late. Did you watch the video using VMWare? http://xdaforums.com/fire-tv/general/tutorial-how-to-root-amazon-fire-tv-gen-t3261716

I followed the procedure and everything worked out fine for me. I don't feel I need to defend myself to you, this has worked for many others as well. :good:
[Fire TV General] fourlans:
I'm about a half hour into the Windows batch process, having previously loaded the MTK Preloader USB VCOM drivers, but I don't know whether it's working or not. I was hoping for a progress message or two but so far nothing after the message "2. Power On / Power cycle the AFT2 to initiate the preloader". Is this how it works ?

Running Windows 7 64-bit.
[Fire TV General] zeroepoch:
You're right about disabling updates and to do that you need adb which is after initial setup. Don't know of a way right now to do that from the rooting process, at least not safely. From what I've been told since the system partition is modified it should abort the update after an initial check fails.
[Fire TV General] Patrick_445:
With all due respect [MENTION=1360535]ldeveraux[/MENTION], you are being too quickly dismissive of the point made. The question [MENTION=4405529]nvertigo67[/MENTION] raised is a good one. The video you linked to in fact instructs people to setup the Amazon box and to login (around to 0:55 mark), which would trigger automatic updates before the user has a chance to enable ADB debugging. As far as I know, Amazon does not allow you to skip setup; maybe what you skipped was the video that plays on first boot.

[MENTION=4405529]nvertigo67[/MENTION]. I was able to root my box because it came with firmware 5.0.3.1 preloaded, and there was no update available when I logged in. I would suggest you think about blocking software updates via router settings or a DNS service such as OpenDNS. See http://www.aftvnews.com/how-to-block-software-updates-on-the-amazon-fire-tv-or-fire-tv-stick/. As an added measure of protection (I have not tested this myself!) consider what [MENTION=7078058]ultimate_spy_binns[/MENTION] wrote:

If the login occurs before the update check (I don't remember), this might work. However you will only be asked to log into Amazon if your box does not come pre-linked to your account. So if you will try this technique and you have an Amazon account, you need to unlink the box from your account BEFORE connecting the FireTV to the internet. Go to your Amazon content and devices page online (https://www.amazon.com/mn/dcw/myx.html), select the "Your Devices" tab and un-register your new FireTV (this webpage shows the same serial number that is on the box).

If you successfully get past the login without updating, you can then disable ADB debugging. Honestly, chances are that if you successfully root the box before ever connecting it to the internet, you will be safe. My guess is that Amazon probably checks that the System partition has not been modified before applying firmware update. This guess is based on a couple of things I've read from [MENTION=3991724]rbox[/MENTION], the foremost expert in rooting the FireTV 1 (sorry can't remember where exactly he stipulated this)

Keep us posted!
[Fire TV General] ldeveraux:
You know what? You're right! I had rooted my FireTV2 and Fire Tablet at the same time and clearly got my thoughts crossed. The Fire Tablet requires you to not connect to Wifi so you can still root. THAT setup you CAN skip. I guess I never skipped the FireTV setup because there wasn't a new update to be installed anyway. When I did this, there was only the one firmware. Sorry for the mixup!
[Fire TV General] Patrick_445:
What about writing a hosts file that will redirect the update domains to 127.0.0.1 (I think the hosts file is /system/etc/hosts)? According to AFTVNews(http://www.aftvnews.com/how-to-bloc...-the-amazon-fire-tv-or-fire-tv-stick/#opendns), blocking the domains "amzdigitaldownloads.edgesuite.net", "softwareupdates.amazon.com", and "updates.amazon.com" would neuter updates. Could that be done along with root safely and without the need for ADB?
[Fire TV General] :
:cyclops:

Oh, my device is rooted, I've gone through the steps in OP, prepering adb before rooting. Before I wrote this, I ree#stted my device to factory, and found NO way to skip sign in at amazon. So my question, how to disable updates without signing in is still not answred. I belive you, that one can skip setting up amazon account, so there is absolutly no reason to feel you have defend yourself. I'm feeling noob, 'cause I don't find this "skip" or "later" or whatever button.

I'm just curious, how getting adb and adb ober usb up without signing in at amazon. I belive that your expirience on setting up adb and adb over usb is valuable for users, receiving their device, after an amazon fire os update. Please get me right: I just want to participate your knowledge on how to skip amazon sign in. I'm sure, I'm noob and there is a way, but I just can't find the way to skip it.

I'm ready to factory reset again, when you tell me, what I should look for to skip amazon sign in.
[Fire TV General] ldeveraux:
See my above regretful reply. i was confusing devices. Maybe you CAN'T skip setup and MUST connect to WIFI. I don't know anymore. :confused:
[Fire TV General] :
[MENTION=3411776]zeroepoch[/MENTION]: thanx for your reply and even more for your work to root FireOS on FireTv! And because I want that users in the future are also able to root their devices, I'm curious how to deal with this. What I have done, immideatly after klicking "continue" in the sign up form, I chopped the power from wlan router (old vodafon labled esybox6xxx, no way to manipulate A-records). But when reading, you can skip sign in, I thought there is an easier way... ...and as stated earlier: avoid updates may become mandatory.

BTW: do you see any chance to unlock the bootloader on aftv2? Would be to happy, if we would have an unlocked bootloader and working fastboot, I would like to try to port cm to it. But sadly evrything I found about the aftv2's bootloader doesn't look promising.I even found some (not validated) information, that an efuse fires, if you try to unlock. Could we use this mediatek preloader to boot an alternate recovery? Or do you see any chance to get fasboot working? (I'm thinking of something insane, like tethered booting an alien boot image. Would be at least a starting point for developing without changing boot.img on device - would be wunderfull for the first tests-boots with an alternate rom. I think you know better then me, that a fallback on aftv2 is more important, then on a device with unlocked bootloader and working third party recovery... Man, you really got my respects for rooting this withoit fastboot and/or custom recovery!!!)

---------- Post added at 19:23 ---------- Previous post was at 18:58 ----------

Ah, ok. This is my first FireOS device, so I thought I missed something (I hoped for an answer like: there is no skip button, but it skips, when you press the ff key.) As I said: I didn't mean to make you feel defensive. I just want to keep the ability for all future users, and I don't think, that my way - pulling power from router, directly after signing in - is smarter then to skip sign in (in deed I like the idea of skipping very much!).

BTW: the trick with putting false A-records in /system/etc/hosts could work:

1|root@sloane:/ # cat /etc/hosts
127.0.0.1 localhost
10.1.9.9 testhost testhost.test.com
root@sloane:/ # nslookup testhost
Server: 0.0.0.0
Address 1: 0.0.0.0

Name: testhost
Address 1: 10.1.9.9 testhost
root@sloane:/ # nslookup testhost.test.com
Server: 0.0.0.0
Address 1: 0.0.0.0

Name: testhost.test.com
Address 1: 10.1.9.9 testhost
root@sloane:/ #

I've also tested ping, telnet and ssh: they all resolve to 10.1.9.9

[MENTION=3411776]zeroepoch[/MENTION]: It may be a problem, that the hosts file is larger after alteration, I'm not sure, if that works with your patching mechanism. Perhaps pulling power from router is much smarter then I thought... ;)
[Fire TV General] santamanga:
I'm pretty sure the 1st thing the box did was to search for updates. Before the setup and the registering process.

Also on aftvnews they write that a modified host file with blocking amazon softbricks the device after factory reset, because it can't register. So I could imagine, even if it were possible to alter hosts before the initial full boot, it would be bricked for not being able to register.
[Fire TV General] :
Just checked: you are right, after an factory reset, the device trys to update BEFORE amazon sign in - so pulling the power AFTER sign in was totaly unnesseccery. I was to coward to try with edited host file. Before trying that, how can I access the manipulated hosts file? I don't want to flash complete rom with mediatek preloader (2 weks...).

What I hope is the following: if we send only the update server to nirvana but not the www.amazon.com, it hopefully doesn't softbrick.
[Fire TV General] finndo:
What would be necessary, would be for someone to setup a "fake" amazon update repo and let people redirect to it. Where the only update would be 5.0.3.1, then it could successfully check for updates and not know it was spoofed. While my website could handle the traffic, I am not sure of the files that would be necessary, nor certain my host would let me store them there (they complained when I had any file over 200 megs on the system for more than a month previously. The contract is unlimited bandwidth, unlimited everything, as long as it is used for text based sites and not file hosting or sharing. I even got a nasty email when I uploaded some backup files from my PC before reimaging it...)
[Fire TV General] rbox:
Can't do this. It talks SSL to the server with encrypted hashes and it tells it what the appropriate update is. You can't fake that. If you give it a file of something it wasn't expecting, it'll reject it. Although if does wind up rejecting it, atleast it will fail and won't attempt to even update to it.
[Fire TV General] TROJAN4EVR:
Can't enable ADB unless you log in...No way around it...SO there's a chance you'll update to 5.0.4.

Depending on the date of production of Fire TVs you either have a unit which needs to update to 5.0.3.1 or one that's already on 5.0.3.1. This is a list of serial numbers I've come across that required updating in order to log in to enable ADB:

G070GV01"5""353"xxxx includes remote with soft touch plastic body and glossy hard plastic buttons

G070GV01"5""357"xxxx gaming edition comes with new controller / does not come with voice remote

G070GV01"5""373"xxxx includes remote with soft touch plastic body and glossy hard plastic buttons

G070GV05"5""444"xxxx ***comes with voice remote found on 2015 Fire TV Stick(hard plastic and soft buttons)***

Based on AFTV1 serial decoding by aftvnews.com ...."5" would denote2015 production and the next three digits "xxx" denote week(first two digits) and day(third digit). If you want an AFTV2 with the soft touch plastic body then look for serial numers under "373".....I know "444" comes with the voice remote thats included with the newly released 2015 Fire TV Stick($49.99). Here's the article on differing remotes:

http://www.aftvnews.com/slightly-cheaper-voice-remote-shipping-with-newer-fire-tvs/
[Fire TV General] zeroepoch:
That could be done I guess but harder to undo. I can look up the offset for that file. Instructions on modifying a file are in the readme if you wanted to try it.
[Fire TV General] zeroepoch:
That's the kind of thing I was worried about in blocking updates pre booting. Also just remembered from the previous comments that the file needs to be smaller or equal size. It's a bit more complicated to change file sizes.
[Fire TV General] zeroepoch:
It should print waiting for preloader. Try running it again which I'm sure you did by now.
[Fire TV General] FreedomRunner:
I tried to root my FTV with the windows batch and had the same problem like dk1keith.

First I installed the drivers -> I get an exclamation mark on the driver in Windows Control Panel, but the drivers do install. Is this a problem?

then I started the bat-file -> waiting for preloader...

rebooted the FTV -> nothing happens -> after one minute i hear the "usb device detected sound" and the FTV is connected as a storage device.

Do I have to set a baudrate or any other settings in the VCOM driver settings?
[Fire TV General] dk1keith:
I rooted mine yesterday using the VMware video method. It actually went pretty smoothly. The only real issue I had was that I had to run the handshake twice, but the video already warned that you will have to run the handshake command twice. Other than that it was pretty easy. After it finished patching I disabled ota updates using adb and su was installed. I'm on Windows 7 64 bit. If you continue to have problems with the drivers you may want to give this method a shot.
[Fire TV General] FreedomRunner:
I also tried by using the VMware the day before.

I used my 3 years old desktop machine and booted the virtual machine.

After starting the Python script, i got the message: "waiting for preloader..."

Afterwards i have "power cycled" the FTV, but nothing happens - no more messages!

I tried at least 20 times with different USB ports - no success!!!

any suggestions?
[Fire TV General] fourlans:
I've given up. I've tried it 20-30 times but the results have always been the same. I've noticed that 'root_aftv2.exe' doesn't terminate when the command window is closed and I can't stop the processes (it starts with 3 processes, only one of which I can end with Task Manager. So I'm having to reboot after each try to ensure that I don't have any previous instances running that might interfere with my next try. At various times the Fire TV has been displayed as an extra drive in Windows explorer labelled 'Fire', once with a sub-folder labelled 'USB' which had further sub-folders similar to those displayed for any Android device connected via a usb cable. I could see their contents. One time during the reboot process, Windows reported that it had successfully installed the pre-loader usb drivers, which I thought were already installed, by me.

I've also tried the method described by ultimate_spy_binns but the outcome has been the same.

Does anyone have any suggestions to try ?
[Fire TV General] bash-ninja:
Thank you guys for your hard work on this root! I've been following it since day one.

If there's anything I can do to help, let me know.

Is there any way I can build a kernel for the FTV2 and get it loaded with this new root? I've built a few kernels for my Android phone and would love to get started with the FTV2. I'm hoping to get a few modules added to the kernel. Maybe update xpad.c and give the Xbox One Controller some native support here on the FireTV.
[Fire TV General] gafaschoco:
My Firetv 2 updated to 5.04, anyway I decided to try rooting the device following the good steps provided by zeroepoch using WMware, I was able to handshake and flash the rooted img, about 2 hrs, any way after power cycling the firetv2 it wont pass the white amazon logo, I can still handshake, and flash the same rooted img, after the first flash, I notice every time I flash it just compares what is in device with the flashing img, and goes quick probably less than a minute, anyway the Firetv2 will softbrick, no access to recovery with wired keyboard, and no ssh either. just wanted to share with you guys.

Note 2: I have successfully un-softbricked my Firetv2, also rooted 5.0.4 following the instructions in this thread .;)
[Fire TV General] zeroepoch:
$ /data/local/tmp/filefrag -v /system/etc/hosts
Filesystem type is: ef53
File size of /system/etc/hosts is 25 (1 block of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 0: 308717.. 308717: 1: last,eof
/system/etc/hosts: 1 extent found

Look at the modifying a file section of the README file in the repo. You will want to first edit the file and add some padding so it's size has been increased. The filefrag binary is in the repo as well in case you want to double check the location of a file.
[Fire TV General] kayiman74:
so does root work if padding the file?
[Fire TV General] zeroepoch:
When I tried it on a Windows 10 64-bit it actually shows the device with no exclamation mark or anything. It's hidden when not available and looks like a normal device with no warnings or errors when it's present and doesn't disappear as expected once handshaked. If you have python 3.5 installed you can run the handshake.py script from the repo in a command prompt and see if that works. I'd be surprised if it does but that would be something to go on. Not sure what else to suggest right now. Maybe the PC is not picking up the device fast enough (it does only have about 3 seconds). py2exe only works with python 3.4 instead of 3.5 but I tried it on a Windows 10 VM with no python installed and it started fine. Also [MENTION=394912]ImCoKeMaN[/MENTION] did some testing with the bundle version and it worked for him, but he also had python 3.5 installed. Could be a Windows 7 vs Windows 10 issue maybe?
[Fire TV General] zeroepoch:
Try pressing CTRL+C instead to terminate the waiting for preloader step. That should exit more cleanly.
[Fire TV General] zeroepoch:
If you were truly on 5.0.4 then that's great news that the preloader still handshaked and that it was able to write something to the flash! The very bad news for you is that you've kind of soft bricked the device. Each time the device updates all the files physically move around so patching 5.0.3.1 on top of it will basically corrupt the filesystem. The one silver lining to this is once we get the new original image for 5.0.4 you'll be able to use that and the diff from 5.0.3.1 to get back to stock and then maybe try to root again if we have a 5.0.4 version.