[TOTAL MOD] Playing With Fire (v4) NEW "LazyLeanback" Installer - AndroidTV on FireTV - Fire TV General

[TOTAL MOD] Playing With Fire (v4) NEW "LazyLeanback" Installer - AndroidTV on FireTV
This is not another "How-To install GApps on FireTV Thread"
Instead these heavy system modifications will finally allow you to completely control almost every aspect of the FireTV, including:
OpenGApps TV-Stock with almost all the main Android TV components working (Live Channels + USB Tuner, Leanback Launcher + Keyboard, Etc)
Button / Keycode Remapping + Change Default Launcher, Switch Keyboard IME, Access SuperSU Settings
Running Application View + Task Switcher, Foreground/Background Task Killers, Customizable On-Screen Shortcuts to Anything on the System
Access BOTH the Stock Amazon Settings Menu AND the Google Android TV Settings Menu at the Same Time (No signature spoofing either!)
Run and Install Apps from either the Google Play (Leanback-AndroidTV) Store OR the Official Amazon App Store
Automatic Updates to Google Play Services / Play Store / Play installed apps without issues thanks to minor build.prop tweaks
and finally Disabling / Using Amazon's own Blacklist against the various components of the Stock FireTV system that you want disabled.
Compatibility: Tested on AFTV-v1 running RBox v5.2.4.1 (r1 & r2) but as long as you have root you should be good to go
Confirmed working: on FireTV-v1 & FireStick-v1 & FireTV-v2, expected to work on FireStick-v2 once there is root.
UPDATE: v4 "LazyLeanback" -
I am now including two almost totally automated installer scripts for the newest v4 release of Playing with Fire. This NOT ONLY includes two bash scripts that automatically do almost everything for you with getting this installed, but also now includes a working "Updater script" that will stay with the ROM in the /system/addon.d/ folder, and allows you to flash the latest rbox releases over your current software without interfering with this MOD, SuperSU or Xposed Framework which will now all automatically get backed up and then put back into place properly once the new ROM is done installing! I have successfully tested this by wiping my entire system and reinstalling, using the LazyLeanback script to install the MOD, and then flashed the latest rbox [v5.2.4.1_r2] over my previous 5.2.4.1_r1 software. Everything worked and I was up and running on r2 without needing to rerun any MOD commands
As should be expected with such major modifications to basically every aspect of the FireTV System, this is 100% IMPOSSIBLE WITHOUT ROOT + XPOSED + BUILD.PROP MODIFICATIONS + SYSTEM PARTITION CHANGES + PATIENCE AND CAREFUL READING OF ALL INSTRUCTIONS. This Mod is not called "Playing with Fire" for no reason, your literally holding your FireTV's life in your hands, if you don't pay attention YOU WILL GET BURNED! Therefore if anyone asks stupid questions like "can I haz Leanfire TV on my Stick now plz?" you will be laughed at and ignored if not worse.
Screenshots from Completed Mod:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Full Gallery of Completed MOD Screenshots: https://imgur.com/a/3lucP
Installation Instructions:
Step One: Required Files - Download the following files. For some of these I will have listed two versions (ARM) and (ARM64) so make sure you pick the version that's appropriate for the architecture of your CPU. FireTV-v1 (ARM) & FireTV-v2 (ARM64). Additionally as my FireTV is running the latest release v5.4.2.1 I am using API22 binaries in this guide. Everything "should" still work if your running an older release, but you will need to get the API21 binaries if still on Lollipop 5.0. If you don't know what architecture / api level your FireTV is I suggest you do some research, as if you don't know that type of basic information, things can end up quite badly for your FireTV.
PlayFire_v2.tar.gz - https://www.androidfilehost.com/?fid=817550096634783100
Obsolete: Use ONLY for Manual Installation as of "v4_LazyLeanback" Contains my PlayFire-TvSettings.apk (modified from Peleg's AFTV2ATV Project) along with the other necessary "universal" files that will be pushed into your system partition.
XposedInstaller_3.1.1.apk - https://forum.xda-developers.com/attachment.php?attachmentid=3921508&d=1477916609
xposed-v87-sdk22-arm.zip - http://dl-xda.xposed.info/framework/sdk22/arm/xposed-v87-sdk22-arm.zip
xposed-v87-sdk22-arm64.zip - http://dl-xda.xposed.info/framework/sdk22/arm64/xposed-v87-sdk22-arm64.zip
HDXPosed-1.3.apk - https://forum.xda-developers.com/attachment.php?attachmentid=4198322&stc=1&d=1503094312 Created by rbox
Busybox-(Meefik) - This is my personal preference for Busybox installers, but you can use whichever installer you like. I have also included the TWRP Flashable ZIP which was generated from within the installed APK. Either version will work just fine, so pick whichever you find easier to install.
Busybox-(Meefik)-v1.27.1 (Updated August 8th, 2017) (APK Installer): https://github.com/meefik/busybox/releases/download/1.27.1/busybox-1.27.1-33.apk
Busybox-(Meefik)-v1.27.1 (TWRP Flashable ZIP): https://forum.xda-developers.com/attachment.php?attachmentid=4245669&stc=1&d=1503094312
Chainfire's SuperSU-v2.82-20170528234214 - https://download.chainfire.eu/1113/SuperSU/UPDATE-SuperSU-v2.82-20170528234214.zip
MAKE SURE YOU USE THIS SuperSU v2.82-20170528234214 and NOT THE CCMT version. One of the recent SuperSU-CCMT releases had a bug that resulted in device crashes and loosing root access when updating the binary. Also as this SuperSU is a Chainfire release, it's signed with a different key than the "official" CCMT versions so it will not show up in Play Store updates once everything has been installed. You can still flash the latest CCMT in TWRP at a later date if you want but it's not going to update automatically if installed using the Chainfire release posted above.
Note: As OpenGApps is built fresh every day it's possible a future update may break something. If you have issues with the current release, then go ahead and download the Old "Known Good" release posted below. You can always upgrade GApps by re-running the ZIP installer with a later build that hopefully fixes your issue.
TV-Stock (ARM):
Current Release (Make sure you download the MD5 along with the ZIP)
http://opengapps.org/?download=true&arch=arm&api=5.1&variant=tvstock
Known Working (Old Release)
https://github.com/opengapps/arm/releases/download/20170202/open_gapps-arm-5.1-tvstock-20170202.zip
https://github.com/opengapps/arm/re...2/open_gapps-arm-5.1-tvstock-20170202.zip.md5
https://github.com/opengapps/arm/re...gapps-arm-5.1-tvstock-20170202.versionlog.txt
TV-Stock (ARM64):
Current Release (Make sure you download the MD5 along with the ZIP)
http://opengapps.org/?download=true&arch=arm64&api=5.1&variant=tvstock
Known Working (Old Release)
https://github.com/opengapps/arm64/...202/open_gapps-arm64-5.1-tvstock-20170202.zip
https://github.com/opengapps/arm64/...open_gapps-arm64-5.1-tvstock-20170202.zip.md5
https://github.com/opengapps/arm64/...pps-arm64-5.1-tvstock-20170202.versionlog.txt
Step Two: Running the "LazyLeanback" Installation Scripts - New improvements as of "v4_LazyLeanback" are the Installation Scripts themselves as well as a brand new "addon.d" Updater script which allows ROM flashing without damaging the MOD installation, even through software upgrades. Both improvements are included in the "PlayFire" archive attached to this post. I have also removed the gapps-config.txt & Xposed Edge Config from the "PlayFire" archive so I can customize it for a different needs I've seen mentioned, now one version defaults to Leanback Launcher, and the other version Defaults to the Stock Amazon Launcher, you can pick whichever you'd like.
WARNING: While I did test all of this on my own system, and was successfully able to use the scripts to install everything from this MOD's guide AND THEN FLASH THE LATEST RBOX r2 RELEASE WITHOUT NEEDING TO RERUN ANY MOD CONFIGURATION, the LAZYLEANBACK SCRIPTS should STILL BE CONSIDERED "ALPHA-RELEASE" SOFTWARE AND SHOULD NOT (YET) BE FULLY TRUSTED OR RUN BY THOSE WHO DO NOT AT LEAST KNOW THE BASICS ON HOW TO RECOVER FROM UNEXPECTED ERRORS WHEN INSTALLING MODIFICATIONS. Also even if my scripts do work on getting everything installed quickly, they are definitely quite "ugly" (you might see some errors or other weirdness when running them) but they DO work, just ignore the minor errors that may pop up. It will be ironed out once I get a chance to get back to this.
You have been warned and I am (still) in no way responsible for any bricks that may occur from improper use of these instructions or badly written scripts.
A VERY very brief run through of EVERYTHING you need to install this MOD is now simply the following:
1) Download the required files listed above (and now including the separate Xposed Edge Configs and gapps-config.txt files)
2) Download the new "PlayFire_v4_LazyLeanback.tar.gz" archive and MOVE EVERYTHING TO THE ROOT OF YOUR SD CARD
3) Rename whichever version of the gapps-config file you want to use to EXACTLY "gapps-config.txt" and place it in /sdcard/gapps-config.txt
4) Connect to your device's ADB terminal and run the following commands. NOTE: You MUST Install the Busybox.apk then open the app and install the Busybox Binary BEFORE YOU RUN the LazyLeanback Scripts, or everything may APPEAR TO INSTALL OK, BUT YOU WILL BE MISSING A CRITICAL step that allows OpenGApps TV-Stock to fully install all required libraries properly.
Code:
tar -xzvf /sdcard/PlayFire_v4_LazyLeanback.tar.gz
5) MAKE SURE YOU GO TO A ROOT SHELL AND ONLY ONCE YOU ARE ROOT RUN THE LAZYLEANBACK SCRIPTS
Code:
sh /sdcard/PlayFire/LazyLeanback.sh
6) THATS IT, YOU'VE INSTALLED ALL THE HARD PARTS OF THE MOD AT THIS POINT. You still need to reboot into TWRP to install the Updated SuperSU-v2.82 (if you hadn't already) along with Xposed v87 and finally OpenGApps itself. Once you've successfully installed OpenGApps reboot into the system and run the next FINAL command AGAIN FROM A ROOT SHELL (OR IT WILL NOT WORK)
Code:
sh /sdcard/PlayFire/LazyNoTouch.sh
7) Go into Xposed and enable Xposed Edge, Then reboot (again) and go into Xposed Edge and Enable "Keys"
8) YOU ARE DONE, ENJOY!.
After all this you can finally go ahead and log into the Google Play TV (Leanback) Store, should have button mapping configured and can start my Blacklisting procedure.
However please note that the TV-Stock GApps package is quite large even when many of the useless packages are being ignored via my custom "gapps-config.txt" file which directs the GApps installer and tells it specifically what to install and what to ignore[/B]. For example on my FireTV-v1 after doing a total wipe of System, Data, Internal, Dalvik/Cache, then reinstalling RBox's Prerooted Rom, I only had about 140MB of free space in my /system partition. That's why I have left my gapps-config.txt file in the "Test" mode, so you can attempt to run the TV-Stock installer without it actually writing any files (yet) so you know if you will have enough space in your system partition. NOTE: As my custom gapps-config.txt comes with the TEST option set, you must modify this file with the "sed" command below (or manually edit the file by commenting out the #TEST line) for TV-Stock Installer to actually run in “real-mode” and not "test-mode".
Now go ahead and do a test-run of the TV-Stock installer. If it finishes without throwing “Error Code: 70 = insufficient storage” your good-to-go for the real-install once you comment out the TEST option. IF you DO get Error Code: 70 run the following line in terminal to view the TV-Stock Installer Logs and Determine what you want to do to free up some space. If you don't get any errors run the Completed Without Errors line.
Code:
Test-Run Error Code: 70
[email protected]:/ $ cat /sdcard/open_gapps_log.txt
Code:
Test-Run Completed Without Errors
[email protected]:/ $ sed -i -e 's|^Test|# Test|' /sdcard/gapps-config.txt
HOWEVER EVEN IF YOU GET NO ERROR CODES ON THE TV-STOCK TEST RUN YOU MUST STILL CHECK THE LOGS TO CONFIRM YOUR FIRETV WAS DETECTED AS “TV” AND NOT “PHONE”. IF YOU DO NOT CHECK THIS, AND YOU HAVE NOT PROPERLY MODIFIED YOUR BUILD.PROP TV-STOCK WILL DETECT A “PHONE INSTALL” AND WILL NOT INSTALL ALL NECESSARY LIBRARIES FOR THE ANDROID-TV (LEANBACK) FUNCTIONS TO WORK!
Code:
Device Model | AFTB
Device Type | tv
And at long last, with all these steps completed you should get TV-Stock to install successfully!
Enable Button Remapping via "Keys" in Xposed Edge & Editing the Xposed Edge Custom Configuration:
Home Button Single Press = Leanback Launcher (Home)
Home Button Double Press = Running Apps List Overlay + Task Switcher
Home Button Long Press = On-Screen Menu Options
Back Button Long Press = Kill foreground app
Menu Button Long Press = Installed Applications Drawer Overlay + App Launcher
Voice (Search) Button Single Press = Google Search (Katniss)
Voice (Search) Button Long Press = TV Voice Input
These settings along with all other custom button mappings can be edited within the Xposed Edge application. Please see the excellent guide @Y314K has put together (with detailed pictures) for some tips on how to configure more advanced features of this module. You also must ENABLE the "Xposed Edge" module within Xposed AND THEN ENABLE "Keys" from within the main Xposed Edge settings menu before all these configuration options will take effect. Please see Y314K's guide listed above for specific instructions on how to enable the REQUIRED "Keys" setting within Xposed Edge so that the button remapping gets activated.
Known Issues:
Leanback Launcher Auto-Start: In order for Leanback Launcher to start automatically upon boot of the system you MUST first disable the default FireTV Launcher "com.amazon.tv.launcher". You can run "pm disable com.amazon.tv.launcher" or follow the steps from post #2 in this thread about how I configure the Amazon Blacklist. Once Xposed Edge is enabled, you can still run the default Launcher (even when it's frozen) through the on-screen menu.
No recommendations loading: is a known issue caused by Amazon's "com.amazon.device.sale.service" package. You must disable this either through my method from the 2nd post in this thread or the "traditional" way of "pm disable com.amazon.device.sale.service". Recommendations will only load once you've installed some official "leanback" apps from the Play Store and have run them at least once (and in the case of CableTV apps like FoxNow, ABC, NBC, etc logged in with your network provider)
Enabling Xposed Modules without a mouse: I highly recommend Vysor it's most importantly free, and it connects to your device through ADB and mirrors your device display on your computer and therefore allows you to use the mouse on your computer to manipulate your device, and click those check boxes.
Chromecast Receiver: Is problematic for a few reasons, A) is at least on my FireTV-v1 there's not enough space in the /system partition to install it as a system app, so I have installed it as a user-app through the Play Store once everything else is working. Issue B) is that NO ONE (at least from the research i've been doing into this) has yet figured out how to properly spoof the proper Google Identification check that the Chromecast Receiver is doing before allowing you to Cast to a TV Box. Over at FreakTab another developer listed the problem as "Cast service can't get a Cast device cert through ClientAuthSigner" but this is something I am also going to try and look into and would very much like to get working, so definitely a work in progress even if I don't really know how feasible it is to expect this functional anytime soon.
Google Voice Search: Google Search on the other hand is semi-working and my custom Xposed Edge configuration already contains a button remap of the Search button to the Google Search app instead of the default Amazon Voice Interface. The text-based search part of this works flawlessly, but I seem to run into an issue when trying to actually use the Voice control part at which point the app throws an error about "Not able to connect to Google at this time". I am also working on trying to figure this out, but it's exponentially more likely to be working in the near future than the Chromecast Receiver functions.
Google Play Store Apps with Known Issues and/or Root Verification Checks : Currently I am aware of two apps that if installed via Google Play Store WILL NOT WORK on the FireTV, these are Netflix (which is publicly known to be blocking access on rooted devices) and the Showtime App. However as of July 5th, 2017 both these apps works without ANY issues if simply installed from the Amazon AppStore, giving users of the Playing with Fire MOD the best of both worlds. Install any app you can from Google Play (to get more frequent updates & features), but be able to revert to using Amazon AppStore apps when the Play Version does not work, or in the case of many TV:Go apps which do not currently exist in the Play Store at all, but are available on FireTV devices (Includes but is not limited to: USA Network, TruTV, Science Channel, Discovery Channel, ID Network, Animal Planet, TLC Network, among others like "Local NOW" which is actually a LiveStream of the Weather Channel if you can log in with the appropriate CableTV Network Credentials)
the_uker said:
Excuse me if this is a dumb question (it probably is), but I'm not too versed in the current state of the modding scene for the FTV devices. From what I've seen, TWRP for the FTV devices is available, so what's stopping you guys from creating a flashable image from a TWRP backup? (I know it's possible on regular Android)
Click to expand...
Click to collapse
A combination of technical, legal and logistical problems. This mod should work on all FireTV devices (I think, confirmation on AFTV1 + Stick1, still waiting on FireTV2 + Stick2) but I only have a FireTV-v1, my TWRP image would most likely brick any other type of FireTV device.
There are also legal / licensing issues to contend with, particularly concerning the OpenGApps packages, but also the modified copy of "PlayFire-TvSettings.apk" (which I had to ask @peleg for permission to distribute which he kindly agreed to), and also the Xposed Edge + Custom Config (which I have PM'd @jozein about but have not gotten a reply yet) among others. Even something as ubiquitous as SuperSU is not a open source package, you must get permission from Chainfire / CCMT before you may include it in a Custom ROM. The way this MOD is currently setup I am only directly distributing the minimal amount of files I need to, everything else is being obtained by the end-user through the official channels and in the way the package owners have specified.
CHANGELOG:
June 30th, 2017 (v1): Initial post introducing this MOD and exploring the capabilities that can be added to the FireTV through the Xposed Edge Module
July 2nd, 2017 (v2): Updated "PlayFire_v2.tar.gz" archive with a fixed gapps-config.txt and corrected some errors that were included in the initial commands
July 6th, 2017 (v3): Confirm MOD is working on AFTV1, AFTV2, and FTV-Stick1. Replace original build.prop edit method with new and improved sed/grep commands, update formatting of the MOD guide and add in final details on how to install and configure everything that is required for this MOD to work successfully
July 8th, 2017 (v4_LazyLeanback): Updated "PlayFire_v4_LazyLeanback.tar.gz" archive has been uploaded which contains NEW Auto-Installer Shell Scripts. Also as of v4_LazyLeanback the Playing with Fire MOD also includes a addon.d Updater script which allows you to flash the latest Rbox releases over your current software WITHOUT THEN NEEDING TO RE-RUN ANY MOD COMMANDS
CREDITS:
@peleg for the TvSettings.apk compatible with FireTV and AFTV2ATV Project which inspired this MOD
@rbox for the Prerooted FireTV ROMs and HDXPosed Module without which all this would be impossible
@jozein for the excellent Xposed Edge Module which provides almost 50% of the added features missing from the Stock AmazonTV Interface
@stangri for the contribution of the "sed" commands to edit build.prop directly through terminal
Shoutouts:
@talltree for being the first person brave enough to try this out on any device, and for his patience in helping me discover and fix a few initial flaws that were in the guide.
@tmtprsn and @stangri for confirming a working MOD on FireStick-v1
@f1ux for confirming a working MOD on FireTV-v2
@dewa710 for helping me track down the cause and resolution to the "spinning circle of doom" issue caused by TV-Stock overwriting NoTouchAuth

Blacklist Configuration: There are many ways in which you can disable the parts of the Stock AmazonTV system you do not want to have running, but I believe my new method is far superior as it uses Amazon's own blacklist technology against itself (which I just find incredibly funny) AND by disabling the components in this manner, every single time you reboot the system, the components will automatically get re-disabled if you happened to enable some function for whatever reason.
Amazon has the potential to use two different systems to "blacklist" certain things. These are "com.amazon.tv.nimh" (Not in my House) and the "com.amazon.tv.settings.tv.AppDisableService" which is currently being used to explictly block (and "soft-disable") the following applications: FiredTV-Launcher, FireStarter, and OnbootKodi. Both blacklisters are explained in depth over at AFTVNews (http://www.aftvnews.com/tag/blacklist/).
If you have followed my entire guide to this point the first blacklist I mentioned "com.amazon.tv.nimh" (Not in my House) has already been totally deleted from your system partition during the OpenGApps TV-Stock installation. I explicitly call this library out in my custom gapps-config.txt file and instruct the TV-Stock installer to delete all it's files. I do this because A) no one knows exactly what this component is capable of once Amazon decides to enable it's functions, and B) It currently has zero negative effect on a running FireTV system, so I fully remove it to prevent any future issues it may cause once Amazon decides to enable it's unknown functions.
The next blacklist included with Stock FireTV systems is the "com.amazon.tv.settings.tv.AppDisableService" which quite simply is a text database listing certain packages Amazon has decided it does not like, and these packages are forcibly "frozen" (aka "soft-disabled") upon boot of the system. Over at AFTVNews they already have great instructions on how to totally disable this functionality and re-enable the blocked apps, but I am going to show you how to use Amazon's AppDisableService to disable Amazon system components instead of the Apps Amazon does not like. This way instead of totally stopping AppDisableService, we remove the Amazon specified apps, and add in Amazon System components that will then automatically be frozen upon boot of the system.
To do this you need to launch the Amazon Settings On-Screen Menu I have included in my Xposed Edge configuration. To access this 1) Hold the Home Button until the On-Screen Menu Appears, 2) Navigate one space to the right, and then one space down in the On-Screen Grid, this will be a box with a bunch of Amazon System apps in it. Once you select the AmazonApps square, navigate to the bottom right most square, and this will launch the Internal Amazon Settings Debug Menu. 3) You want the select the option that is a orange square with the "Amazon Fire" text in white.
Once you have selected the appropriate "Amazon Fire" Settings app from within my preconfigured On-Screen Menu, you will be presented with a Black Screen with a list of options. Scroll down to "com.amazon.tv.settings" and select this option. On the next black screen you will see a two columns, one labeled "Key" and another labeled "value". The only "Key" is DisableApps, while the value is the package names of FiredTV-Launcher, Firestarter, and OnbootKodi. Move your selector to the "Edit" button and go ahead and remove all three packages Amazon has included, and then add in whatever parts of the Amazon System you want disabled (i.e. anything you previously used pm disable on)
I strongly suggest you use this Auto-PackageDisable feature to "soft-disable" the default AmazonFireTV Launcher "KFTV" so that the system will automatically boot into the Leanback Launcher. You can also disable any other Amazon System package, in my following example I also disable the blacklist technologies, KFTV Launcher, and Vizzini (Amazon's Voice Interface so that the Google Voice Interface can take over). My own "blacklist" includes the following, but you do not need to include everything I do, and can add additional packages I do not. My blacklist kills the Amazon OTA service, Amazon "Sale Service" which blocks the Leanback Launcher recommendations, and Amazon Voice Search among others.
My personal blacklist includes:
Code:
"com.amazon.device.software.ota,com.amazon.device.software.ota.override,com.amazon.device.sale.service,com.amazon.tv.launcher,com.amazon.tv.nimh,com.amazon.vizzini"
Manual Installation Instructions: If you want to fully understand what this MOD is actually doing to your system the manual instructions give a much clearer picture of what is being modified and why to achieve a successful Leanback install on the FireTV. These instructions are obsolete as of v4_LazyLeanback but are being retained in the thread as extra information for any other hackers who may want to take this further
Manual Installation - (Part One): Modifying Build.Prop
NOTE: The beginning of the commands is actually an important indicator of "where" your supposed to be inputting the commands.
~$ = the shell or command prompt on YOUR computer. With FireTV Utility you may need to type "exit" to get back to a "computer shell"
shell@firetv:/ $ = the shell on the FireTV device. The "firetv" part will change depending on your device name
root@firetv:/ # = Notice how the last part in red changed from $ --> # this is the difference between a normal user shell and a "root shell"
EDIT: @stangri has provided some terminal commands that expertly accomplish the necessary build.prop modifications without needing to follow my old instructions to pull the file off the device, edit it and then push it back to the filesystem. Thanks to this contribution we can now edit build.prop with the following commands, BUT YOU MUST HAVE BUSYBOX INSTALLED FOR THESE COMMANDS TO WORK. First off make sure your device is powered on and connected to your network and has ADB debugging enabled.
EDIT: This is the OLD BUILD.PROP METHOD. You can use this but it will be much easier to use the "sed" commands above.
There are a few different ways this step can be done so do whatever is easier for you. As my FireTV-v1 has a built-in Ethernet port + USB port I find it convenient to connect via ethernet, use the USB keyboard to enter recovery and then ADB into recovery and edit the build prop with the command-line text editor "vi". However only the FireTV-v1 makes doing it that way easy, and anyone who knows how to use vi can probably figure this part out on their own without any further instructions.
For the rest of you on FireTV-v2 or FireTV-Sticks here's probably the easiest way for you to complete this step. First make sure your device is powered on and connected to your wifi network with ADB Debugging enabled.
Code:
~$ adb connect "YOUR IP"
~$ adb shell
[email protected]:/ $ exit
Code:
~$ adb connect "YOUR IP"
~$ adb pull /system/build.prop ~/
If you get to a terminal prompt great, now type "exit". Now type "adb pull /system/build.prop/ ~/" this command should grab a copy of your build.prop and place it in your user's home directory. Now you need to edit the file using a good text editor (NOT Microsoft Word / WordPad / Any other "fancy" program that will add additional formatting, and wind up destroying the file). If on Windows I recommend NotePad++, if on any other operating system, you should be fine with the default text editor.
NOTE: The first two lines are towards the top of of your build.prop file, while the last two lines should be the VERY BOTTOM. Also the first two lines already exist in the file and need to be modified, while the last two lines DO NOT already exist in your build.prop, you need to add them as the very last two lines.
Code:
ro.build.version.number=573210520 --> ro.build.version.number=987654321
ro.build.characteristics=default --> ro.build.characteristics=tv
^ TOP
BOTTOM ٧
Code:
ro.com.google.clientidbase=android-xiaomi-tv
ro.com.google.gmsversion=5.1_r1_TV
Once you have completed the required build.prop modifications, we need to push the edited file back into the FireTV's filesystem
Code:
~$ adb connect "YOUR IP"
~$ adb push ~/build.prop /sdcard/build.prop
[email protected]:/ $ su
[email protected]:/ # cp /sdcard/build.prop /system/build.prop && chmod 644 /system/build.prop && chown root:root /system/build.prop
Unfortunately each device's build.prop contains completely different information, and this can even change within the same device between different software versions, so I cannot post an example for this one, as it would be useless and dangerous if someone tried to use it on the wrong device / software version. But this modification is necessary, the "top" edits give the TV-Stock installer the correct information to know this is a TV Device (otherwise it will detect the FireTV as a "Phone" and skip installing some necessary libraries, while the bottom two lines allow the device to register correctly with the Play Store and prevents the issue a lot of us were having with updates to Google Play breaking things.
Code:
~$ adb connect "YOUR IP"
~$ adb shell
[email protected]:/ $ exit
If you get to the "FireTV" terminal prompt great, now type "exit" and proceed to the next set of commands. If you dont get to the "FireTV" terminal you need to double check you have ADB debugging enabled and your device is in fact connected to the appropriate network.
Code:
~$ adb shell
[email protected]:/ $ cp /system/build.prop /sdcard/default.prop
[email protected]:/ $ su
[email protected]:/ # mount -o rw,remount /system
[email protected]:/ # sed -i 's|ro.build.version.number=.*|ro.build.version.number=987654321|' /system/build.prop
[email protected]:/ # sed -i 's|ro.build.characteristics=.*|ro.build.characteristics=tv|' /system/build.prop
[email protected]:/ # ! grep -q "ro.com.google.clientidbase=android-xiaomi-tv" /system/build.prop && echo "ro.com.google.clientidbase=android-xiaomi-tv" >> /system/build.prop
[email protected]:/ # ! grep -q "ro.com.google.gmsversion=5.1_r1_TV" /system/build.prop && echo "ro.com.google.gmsversion=5.1_r1_TV" >> /system/build.prop
Manual Installation - (Part Two): Putting it all together - You should now have XposedInstaller.apk, XposedFramework.zip, HDXPosed-1.3.apk, SuperSU.zip, PlayFire.tar.gz, Busybox.apk or Busybox.zip TV-Stock.zip and TV-Stock.zip.md5 and a modified build.prop ready to go. Next you need to move all these files onto your device, and I am going to use the root of /sdcard/ and the /sdcard/PlayFire/ directory as defaults. You can use something else, but you will need to modify the following commands.
Get your device up and running and load all the files you have downloaded into the root of your /sdcard/ partition. Once everything is on the root of your /sdcard/ run the following commands, and note that everything on a single line should be copy/pasted as one command.
If running these commands from TWRP recovery, everything will already work as TWRP comes with busybox. If running this connected to adb on a running FireTV system you must install busybox prior to running these commands. Install the ZIP through TWRP then boot into the system or use the APK to install busybox into your /system partition.
Code:
~$ adb connect "YOUR IP"
~$ adb shell
[email protected]:/ $ pm install /sdcard/XposedInstaller_3.1.1.apk
[email protected]:/ $ pm install /sdcard/HDXPosed-1.3.apk
[email protected]:/ $ tar -xzvf /sdcard/PlayFire_v2.tar.gz
[email protected]:/ $ su
[email protected]:/ # mount -o rw,remount /system
Code:
[email protected]:/ # cp /sdcard/PlayFire/tv_core_hardware.xml /system/etc/permissions/tv_core_hardware.xml && chmod 644
/system/etc/permissions/tv_core_hardware.xml && chown root:root /system/etc/permissions/tv_core_hardware.xml
[email protected]:/ # cp /sdcard/PlayFire/whitelist.json /system/etc/whitelist.json && chmod 644 /system/etc/whitelist.json && chown root:root /system/etc/whitelist.json
[email protected]:/ # tar -xzvpf /sdcard/PlayFire/XposedEdge-DataConfig.tar.gz -C / && (chown -R system:system /data/app/com.jozein.xedge-1 && chown -R root:root /data/data/com.jozein.xedge)
Code:
[email protected]:/ # mkdir /system/priv-app/TvSettings && chmod 755 /system/priv-app/TvSettings && cp /sdcard/PlayFire/PlayFire-TvSettings.apk /system/priv-app/TvSettings/TvSettings.apk && chmod 644 /system/priv-app/TvSettings/TvSettings.apk && chown root:root /system/priv-app/TvSettings/TvSettings.apk
[email protected]:/ # mkdir /system/app/NoTouchAuthDelegate && chmod 755 /system/app/NoTouchAuthDelegate && cp /sdcard/PlayFire/TV-NoTouchGsf.apk /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk && chmod 644 /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk && chown root:root /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk
[email protected]:/ # mv /sdcard/PlayFire/gapps-config.txt /sdcard/gapps-config.txt
The next command is OPTIONAL, but it disables the Wifi-Direct broadcast "Fire-DIRECT-####" which I found useless and very annoying
Code:
[email protected]:/ # cp /sdcard/PlayFire/android.hardware.wifi.direct.xml /system/etc/permissions/android.hardware.wifi.direct.xml && chmod 644 /system/etc/permissions/android.hardware.wifi.direct.xml && chown root:root /system/etc/permissions/android.hardware.wifi.direct.xml
Manual Installation - (Step Three): The Final Piece of the Puzzle - So the MAIN things that had been messing up installing TV-Stock GApps on FireTV or anything else for that matter is A) No one was editing the /system/etc/permissions files appropriately and B) that the OpenGApps TV-Stock installer includes a broken copy of NoTouchAuth which wont allow you to register with Google Play Services. In one of the above commands we installed a copy of NoTouchAuth I pulled from a Official AndroidTV box (so it actually works) and once you have completed the next steps and reboot, you will be able to log into Google Play without issue. Also at this point we have replaced the stock system build.prop with the modified one to allow a proper TV-Stock installation, and allow for proper authentication with Google Play Services, installed the modified copy of peleg's TvSettings.apk (ATV Settings Widget/Menu) which now does not require signature spoofing due to my removal of the "com.android.shared.uid" value from the Android Manifest, disabled Wifi-Direct broadcasting, and installed XposedInstaller.apk + HDXPosed.apk, along with the ESSENTIAL Xposed Module "Xposed Edge" which is what will allow us to remap Buttons / Keycodes & provides the Running App List + Task Switcher + an unbelievable amount of other useful features and ability to customize just about anything.
So now that all that has been done the last step is to reboot into TWRP recovery (however that is done on your device) and install the final ZIP files of updated SuperSU v2.82, Xposed Framework v87, and finally OpenGApps TV-Stock itself.
EDIT: Due to issues with OpenGApps TV-Stock overwriting NoTouchAuth during installation, you must run the following AFTER finishing the TV-Stock installation to avoid the "spinning circle of doom" issue, which will prevent Google Play login. After running the commands below REBOOT and you should be able to login to Google Play without further problems.
Code:
[email protected]:/ $ su
[email protected]:/ # mount -o rw,remount /system
[email protected]:/ # rm /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk
[email protected]:/ # cp /sdcard/PlayFire/TV-NoTouchGsf.apk /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk
[email protected]:/ # chmod 644 /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk && chown root:root /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk
Work-in-Progress
Updater Script: Completed-as-of v4_LazyLeanback
I am currently in the process of investigating whether it may be possible to write an "Updater Script" that functions as the OpenGApps Updater scripts do, which would allow users to seamlessly flash the latest rbox prerooted ROM releases while keeping all these MOD changes in tact through the upgrade process. I have just starting looking into this, so have no estimate for when or if It might be completed.
Update.zip Flashable Installer: Completed-as-of v4_LazyLeanback
I MAY also attempt to investigate the possibility of creating an "all-in-one" Update.zip package which would be flashed through TWRP and preform as many of the steps of this MOD as possible. In any case DO NOT THINK THIS WILL BE A "FULL" CUSTOM ROM, It will only be exactly what is currently discussed in this thread, It will not at any time include the rbox ROM, OpenGApps installers or any other modules not currently already included within my "PlayFire.tar.gz" archive. I have not even started looking into the first steps of how this may or may not be possible, just something I have in the back of my mind as a possible continuation of this MOD and my learning process. Do NOT ask me when this might be completed, as I have not even begun the most basic of firsts steps, again just something I may consider trying to do at a later date. If you want this MOD installed anytime soon, your going to need to follow current procedure outlined in this guide for the time being.
Custom Compiled OpenGApps TV-Stock Installers: Again, this is something I MAY attempt to do at a MUCH LATER DATE, and only AFTER I have created both the Updater Script and the Update.zip package. As there are numerous issues with the OpenGApps built TV-Stock I may try to build the installer from source myself and resolve as many issues as they relate to the FireTV as possible. Again, do NOT ask me when this will be ready, as I honestly have no clue, but again is something I am considering if there is enough interest shown and/or more serious problems with the current OpenGApps TV-Stock installers become apparent.

SimLynks said:
The next command is OPTIONAL, but it disables the Wifi-Direct broadcast "Fire-DIRECT-####" which I found useless and very annoying
Click to expand...
Click to collapse
If i'm not wrong on AFTV2 its uses for connection of the remote. So disabling may be very dangerous. Don't know if remote can connect without broadcasting. @peleg correct me if i wrong.

Hi I attempted to get it to work but I am having issues. First of all thanks for making this guide looking forward to getting it to work. I found a small potential error while following instructions the line that says
Code:
[email protected]:/ # tar -xzvpf /sdcard/PlayFire/XposedEdge-DataConfig.tar.gz -C / && chown -R root:root /data/data/com.jozein.xedge-1
Didn't work for me but it looks like it extracts the files to /data/app instead so I cchanged that part. Also I couldn't find anywhere you said to use the HDXPosed-1.3.apk so I activated it in xposed anyway just in case. Another thing, you mentioned that you had a TEST line in the google gapps-config.txt, the one I downloaded had it commented out with a #.
So the problem I am having that after activating Xposed Edge and enabling the keys(took me a while to figure out I had to long press to do it) the keys don't seem to activate from what you preset. I did find leanback by going to the Xposed Edge button key configuration and using the activites option. But it seems when I visted lean back there is no data to display. A biger problem, the Google play store just gets stuck on its background with a blue cirlce spinning. Any idea what would cause those to go wrong? While in leanback I went to settings and tried to add a google account but that screen comes up blank. Thanks a million for your help.
UPDATE: I went back and imputed the commands again looks like the settings are working now. Is it possible that flashshing the TV-Stock after everything overwrote some of the files or settings? Seems to be working okay now.
Update 2: It seems I ran into some more issues. When I restart the button mappings go away. Also I tried to install some apps from the play store but they get stuck on pending installation. Any help appreciated.

talltree said:
Hi I attempted to get it to work but I am having issues. First of all thanks for making this guide looking forward to getting it to work. I found a small potential error while following instructions the line that says
Code:
[email protected]:/ # tar -xzvpf /sdcard/PlayFire/XposedEdge-DataConfig.tar.gz -C / && chown -R root:root /data/data/com.jozein.xedge-1
UPDATE: I went back and imputed the commands again looks like the settings are working now. Is it possible that flashshing the TV-Stock after everything overwrote some of the files or settings? Seems to be working okay now.
Update 2: It seems I ran into some more issues. When I restart the button mappings go away. Also I tried to install some apps from the play store but they get stuck on pending installation. Any help appreciated.
Click to expand...
Click to collapse
Hi talltree, first off thanks for essentially being the brave soul to "beta test" this for me! Also thanks for pointing out the issue with the Xposed Edge command, tuns out I did mess that one up a bit, mixed up the permissions / group ownership and some directories.
For now please try the following and let me know if this resolves your issue (so I can then go back and update the "official" command above)
Code:
[email protected]:/ $ su
[email protected]:/ # tar -xzvpf /sdcard/PlayFire/XposedEdge-DataConfig.tar.gz -C /
data/app/com.jozein.xedge-1/
data/app/com.jozein.xedge-1/base.apk
data/app/com.jozein.xedge-1/lib/
data/data/com.jozein.xedge/
data/data/com.jozein.xedge/prefs/
data/data/com.jozein.xedge/prefs/prefs
data/data/com.jozein.xedge/prefs/collection
data/data/com.jozein.xedge/prefs/panels
data/data/com.jozein.xedge/local_prefs
data/data/com.jozein.xedge/lib
data/data/com.jozein.xedge/cache/
data/data/com.jozein.xedge/cache/com.android.opengl.shaders_cache
[email protected]:/ # chown -R system:system /data/app/com.jozein.xedge-1
[email protected]:/ # chown -R system:system /data/data/com.jozein.xedge
That "should" fix your Xposed Edge mapping issues (I hope), but let me know so I can try and revise the commands again if not. However you previously said that the original command only extracted files to /data/app, but the "tar -xzvpf" command should extract files to both /data/app & /data/data (/data/app is the actual APK installed into your system, and /data/data/ holds my custom configurations for Xposed Edge). So if my prior mangled command was only dropping files into /data/app, that might have been part of your problem.
As for the Google Play "Spinning Circle of Doom" issue, thats has previously been the bane of my existence (and through way too much trial and error I discovered it was generally due to the faulty NoTouchAuth installed by the OpenGApps TV-Stock installers for all platforms).
As you also noticed my gapps-config.txt files did not have Test commented out (accidentally), as this was a modified version in which I attempted to prevent OpenGApps TV-Stock from overwriting my working "TV-NoTouchGsf.apk" which is "NoTouchAuthentication". However as I preformed all these commands from within TWRP (after installing TV-Stock) it's possible running them on a live system BEFORE installing TV-Stock may change some minor things.
If you continue having issues either initially registering with Google Play ("Spinning Circle of Doom") or have issues with Google Play actually installing Applications, please try to reinstall my attached working copy of NoTouchAuth (TV-NoTouchGsf.apk) with the following commands and again please let me know if this fixes your issues.
Code:
[email protected]:/ $ su
[email protected]:/ # mount -o rw,remount /system
[email protected]:/ # mkdir /system/app/NoTouchAuthDelegate/ && chmod 755 /system/app/NoTouchAuthDelegate/
[email protected]:/ # cp /sdcard/PlayFire/TV-NoTouchGsf.apk /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk
[email protected]:/ # chmod 644 /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk && chown root:root /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk
Expected output from "correct" NoTouchAuthDelegate being installed:
Code:
[email protected]:/ # ls -la /system/app/NoTouchAuthDelegate
-rw-r--r-- root root 5935368 2017-06-23 18:48 NoTouchAuthDelegate.apk
After fixing both these items, reboot and let me know if that squashes the bug. Also please keep an eye on this thread, the RESERVED post is going to be updated shortly (tomorrow most likely) with the final bits of this guide including the full instructions for configuring Xposed Edge and (my favorite part of guide) using Amazon's own Blacklist technology against the Amazon System itself. For now I just wanted to get the initial steps of the guide posted and make sure it worked (kinda) before moving on to the next steps.
Finally if you dont mind can you please attach a copy of your open_gapps_logs.txt file and let me know which model (AFTV1, AFTV2, AFTV-Stick) you've run my MOD on, along with the output from the following command so I can get a sense of the free space in /system on other devices (if you dont have a FireTV-v1 like myself).
Code:
[email protected]:/ # df -h /*

Wow , really love your work and how you take it forward. Your guide is accurate and detailed. Let me know if you need some help regarding to tvsetting.apk or you if you like to get its source code. This post can be officially continues to AFTV2ATV project! And much more . Next step can be to make a recovery zip file of all those installations for noobies that would like to experience the mod without involving all those configurations.
peleg.

Kramar111 said:
If i'm not wrong on AFTV2 its uses for connection of the remote. So disabling may be very dangerous. Don't know if remote can connect without broadcasting. @peleg correct me if i wrong.
Click to expand...
Click to collapse
As far as I know it shouldn't affect the remore operation , it migth cause issues to wifi broadcasting services like google cast.

Fantastic work. I hope to apply this to an AFTV-Stick once the snags get smoothed over.

Glad to help, the project is really cool. I have a firetv1 5.4.2.1. Yeah sorry just the data/data files did extract correctly just was the data/app folder that was off. I ran the commands and rebooted, I still cannot install anything from play store it just gets stuck on "Install Pending." Any suggestions for this? As for the button mapping. Strangely when I rebooted the first time that mappings worked but then I rebooted again to see if they would stay and it went back to default amazon mappings which is what I was experiencing before. Anything else you want me too look at?
Here are the results of what you wanted:
Code:
[email protected]:/ # df -h /*
Filesystem Size Used Free Blksize
-h: No such file or directory
/acct 0.0K 0.0K 0.0K 4096
/cache 755.2M 214.7M 540.5M 4096
/charger 0.0K 0.0K 0.0K 4096
/config 0.0K 0.0K 0.0K 4096
/d 0.0K 0.0K 0.0K 4096
/data 5.6G 2.0G 3.5G 4096
/default.prop 0.0K 0.0K 0.0K 4096
/dev 973.3M 64.0K 973.3M 4096
/etc 755.2M 741.5M 13.7M 4096
/file_contexts 0.0K 0.0K 0.0K 4096
/firmware 64.0M 7.9M 56.0M 16384
/fstab.qcom 0.0K 0.0K 0.0K 4096
/init 0.0K 0.0K 0.0K 4096
/init.base.rc 0.0K 0.0K 0.0K 4096
/init.build.rc 0.0K 0.0K 0.0K 4096
/init.class_main.sh 0.0K 0.0K 0.0K 4096
/init.environ.rc 0.0K 0.0K 0.0K 4096
/init.qcom.class_core.sh 0.0K 0.0K 0.0K 4096
/init.qcom.early_boot.sh 0.0K 0.0K 0.0K 4096
/init.qcom.rc 0.0K 0.0K 0.0K 4096
/init.qcom.sh 0.0K 0.0K 0.0K 4096
/init.qcom.syspart_fixup.sh 0.0K 0.0K 0.0K 4096
/init.qcom.usb.rc 0.0K 0.0K 0.0K 4096
/init.qcom.usb.sh 0.0K 0.0K 0.0K 4096
/init.rc 0.0K 0.0K 0.0K 4096
/init.target.rc 0.0K 0.0K 0.0K 4096
/init.trace.rc 0.0K 0.0K 0.0K 4096
/init.usb.rc 0.0K 0.0K 0.0K 4096
/init.zygote32.rc 0.0K 0.0K 0.0K 4096
/mnt 0.0K 0.0K 0.0K 4096
/ota.sh 0.0K 0.0K 0.0K 4096
/ozwpan.sh 0.0K 0.0K 0.0K 4096
/persist 7.8M 4.3M 3.5M 4096
/proc 0.0K 0.0K 0.0K 4096
/property_contexts 0.0K 0.0K 0.0K 4096
/root 0.0K 0.0K 0.0K 4096
/sbin 0.0K 0.0K 0.0K 4096
/sdcard 5.6G 2.0G 3.5G 4096
/seapp_contexts 0.0K 0.0K 0.0K 4096
/selinux_version 0.0K 0.0K 0.0K 4096
/sepolicy 0.0K 0.0K 0.0K 4096
/service_contexts 0.0K 0.0K 0.0K 4096
/set_eth_mac.sh 0.0K 0.0K 0.0K 4096
/storage 0.0K 0.0K 0.0K 4096
/sys 0.0K 0.0K 0.0K 4096
/system 755.2M 741.5M 13.7M 4096
/tmp-mksh 0.0K 0.0K 0.0K 4096
/tombstones 5.6G 2.0G 3.5G 4096
/ueventd.qcom.rc 0.0K 0.0K 0.0K 4096
/ueventd.rc 0.0K 0.0K 0.0K 4096
/usbdisk 0.0K 0.0K 0.0K 4096
/vendor 755.2M 741.5M 13.7M 4096
Thanks a million!

Axecaster said:
Fantastic work. I hope to apply this to an AFTV-Stick once the snags get smoothed over.
Click to expand...
Click to collapse
Axecaster, thanks for the interest, but if you want to help get this moving along for the FireTV-Sticks I need you to get me some information.
I might ask some "obvious" questions, but want to double-check any of my assumptions are correct.
1) What device (FireTV-Stick v1 / FireTV-Stick v2)
2) What version of the RBox ROM are you running?
3) Have you previously installed Google Play anything into your System Partition? (Need to know this so I know if the next command is of a "fresh" system, or one that already has some space taken up by other applications outside of the Stock AmazonTV stuff.
4) Need you to run the following commands and please attach the output##.txt files (trying to avoid this thread becoming a giant wall of debug info, these are the same type of commands I had talltree run, just stuffing the output into a txt file for connivence for me).
Code:
[email protected]:/ $ su
[email protected]:/ # df -h /* > /sdcard/FireStick-outputDF.txt
5) Finally I also would like to see the results from this "new" command again so I can determine the potential amount of free space in a Stick's System Partition
Code:
[email protected]:/ $ su
[email protected]:/ # (du -h /system/priv-app && du -h /system/app) > /sdcard/FireStick-outputDU.txt
talltree said:
Anything else you want me too look at?
Click to expand...
Click to collapse
Thanks again for helping me out with this! Not sure what's causing your issues but would like to see the same info Im asking for from Axecastor so I can compare the output to my own (working) system and try to figure out how to resolve your issues. Please run the following and attach the resulting output so I can analyze it.
Code:
[email protected]:/ $ su
[email protected]:/ # (du -h /system/priv-app && du -h /system/app) > /sdcard/FireTV1-outputDU.txt
[email protected]:/ # ls -laR /system > /sdcard/FireTV1-outputLS.txt

SimLynks said:
Axecaster, thanks for the interest, but if you want to help get this moving along for the FireTV-Sticks I need you to get me some information.
I might ask some "obvious" questions, but want to double-check any of my assumptions are correct.
1) What device (FireTV-Stick v1 / FireTV-Stick v2)
2) What version of the RBox ROM are you running?
3) Have you previously installed Google Play anything into your System Partition? (Need to know this so I know if the next command is of a "fresh" system, or one that already has some space taken up by other applications outside of the Stock AmazonTV stuff.
4) Need you to run the following commands and please attach the output##.txt files (trying to avoid this thread becoming a giant wall of debug info, these are the same type of commands I had talltree run, just stuffing the output into a txt file for connivence for me).
Code:
[email protected]:/ $ su
[email protected]:/ # df -h /* > /sdcard/FireStick-outputDF.txt
5) Finally I also would like to see the results from this "new" command again so I can determine the potential amount of free space in a Stick's System Partition
Code:
[email protected]:/ $ su
[email protected]:/ # (du -h /system/priv-app && du -h /system/app) > /sdcard/FireStick-outputDU.txt
Click to expand...
Click to collapse
1) Gen 1 stick
2) Prerooted 5.2.4.1 (Never beyond stock 5.0.5)
3) No Google Play attempts yet for this specific install/stick. Xposed framework is already flashed and a few modules installed to access and update the built-in supersu binary.
4) attached
5) attached

Axecaster said:
1) Gen 1 stick
2) Prerooted 5.2.4.1 (Never beyond stock 5.0.5)
3) No Google Play attempts yet for this specific install/stick. Xposed framework is already flashed and a few modules installed to access and update the built-in supersu binary.
4) attached
5) attached
Click to expand...
Click to collapse
Awesome, thanks for that info Axecaster. Turns out (much to my surprise) that the FireStick-v1 actually has more space in the /system partition than even my FireTV-v1 does. Everything in my guide is written to be "cross-device compatible" so you should be able to use the same info as everyone else.
I have uploaded a new "PlayFire_v2.tar.gz" archive with an updated and fixed gapps-config.txt (that's actually in TEST MODE this time) and have corrected the Xposed Edge extract and permissions commands to what I believe should fix the issues @talltree was experiencing. Also because you HAVE NOT previously installed any Play Services your actually in the best possible position for this to work correctly as when I was testing this MOD I was constantly wiping my entire box to keep starting off from a fresh slate (as you are). Any Xposed modules you have already installed should have no effect as those are not installed into your system partition anyway.
If you would like to try out this mod, you should now be good to go. Please let me know how it turns out if you take the plunge! Also if your feeling adventurous you could even use gapps-config to install some items I cannot on a FireTV-v1 due to space limitations in /system. I'd recommend Play Music as that one seems to always update to a non-leanback version (and not just on FireTV people all over even with official AndroidTV boxes are running into that issue). All the other Leanback apps can easily be installed through the Play Store once that is working.
Good luck and let me know how it goes.
EDIT: One last tip. If after you've installed the MOD you have ANY issues either registering with Google Play and/or Installing Apps from Google Play, install the working copy of "TV-NoTouchGsf.apk" i've included. After digging through some of the logs I've been sent from talltree it appears the OpenGApps TV-Stock installer is ignoring my instruction to leave the working NoTouchAuth package alone and may be overwriting it. Even just to be on the safe side once you've completed everything and gotten TV-Stock to install without issue, just overwrite whatever NoTouchAuth exists with my known working good copy, then reboot and profit!

Really impressive.
Any chance to have a Complete modified / rooted image ready to flash using twrp? (I know I'm lazy but I think it's the logical solutioin once stuff is working fine).
Regards and thanks for your work.

Very interesting stuff! I look forward to playing with it soon. @SimLynks please enable your XDA donation option or provide a donation link so I can ask people to throw money at you if I write my own guide for this.

So if I'm understanding correctly this is for FireTV box not stick, right?

jegaa69 said:
So if I'm understanding correctly this is for FireTV box not stick, right?
Click to expand...
Click to collapse
No, just slightly harder to install
Sent from my Samsung GT-I9300 using XDA Labs

jegaa69 said:
So if I'm understanding correctly this is for FireTV box not stick, right?
Click to expand...
Click to collapse
No, this should work on any FireTV (FireTV1, FireTV2, FireTV-Stick) you just need to be rooted already.
From the info Axecastor has provided me, the FireTV-Stick on v5.4.2.1 actually has MORE free space than my FireTV-v1 box so can even try to install some more things into system than I currently can.

SimLynks said:
Thanks again for helping me out with this! Not sure what's causing your issues but would like to see the same info Im asking for from Axecastor so I can compare the output to my own (working) system and try to figure out how to resolve your issues. Please run the following and attach the resulting output so I can analyze it.
Code:
[email protected]:/ $ su
[email protected]:/ # (du -h /system/priv-app && du -h /system/app) > /sdcard/FireTV1-outputDU.txt
[email protected]:/ # ls -laR /system > /sdcard/FireTV1-outputLS.txt
Click to expand...
Click to collapse
Attached is the result of those commands. Thanks!

This looks amazing! Since the FireTV Stick 2nd Gen can't be rooted on any firmware, it would never work on it, right?

talltree said:
Attached is the result of those commands. Thanks!
Click to expand...
Click to collapse
So the good part is that from what I can tell going through your logs, you appear to have done everything correctly, all files appear to be in place and with the proper permissions set. The not so good part is the possible issue I thought might be causing your Play Store issue cannot be the reason, as all the necessary libraries are the same as what I have on my system...
I have two suggestions for you to finally resolve the issue. One is going to be a bit of a pain the other relatively painless, so I'd recommend the painless one first, if that does not resolve your issue, then the annoying option definitely will do the trick.
Painless Option: As you mentioned you originally had issues registering with the Play Store im thinking that maybe something wonky is going on when the Play Services is trying to authenticate your account to permit the installs. To (hopefully) resolve this just go into the Android-TvSettings from the Leanback Launcher, and completely delete your Google Account. After you have deleted the Google Account reboot into TWRP, clear your Cache & Dalvik Cache and reboot. Once the system has rebooted, open Play Store and sign back into your account and try to install something. If at this point you keep running into the same issue, please run the following logcat command (you will not see any output, it's being placed into a text file) and while logcat is running try to install a different app, then another and another for about 5 minutes. Once that has been done I should be able to pinpoint in your logs whatever is causing the issue but hopefully we wont need to get to that part anyway, as signing out, clearing the cache and reboot will fix the issue.
Code:
~$ adb connect "YOUR IP"
[email protected]:/ $ exit
~$ adb logcat > ~/FireTV1-TvStoreLOG.txt
Painful Option: Im 95% certain this option WILL fix your issue, but is going to be a bit of a pain admittedly. This option is 1) Reboot to TWRP and Wipe your System Partition. 2) After you wipe system DO NOT REBOOT UNTILL YOU HAVE REINSTALLED RBOX's PREROOTED ROM. I can not stress that last part enough, if you reboot after the wipe but before you reinstall Rbox's ROM you will not be happy and will end up with a brick at worst, definitely loosing root access at best. To do this you'll want to have the RBox Prerooted ROM already moved onto USB or somewhere else in the filesystem. On the bright side if you ONLY WIPE SYSTEM, all your "normal" apps and settings will be intact in your data partition, so you wont need to redoing everything. You will however need to rerun all my commands to install the components from this MOD as all those changes (except Xposed Edge) are writting into /system.
Finally addressing your Xposed Edge Issue: I have updated (again) the XposedEdge extract and permissions commands. Please totally clear all data from Xposed Edge while still installed from the Amazon App Management Interface (including Cache and Data), then totally uninstall Xposed Edge. After you have done this, then reinstall XPosed Edge using the updated commands from the first post of this thread.
As always please let me know if you have any further issues (and attach the logcat if the above does not resolve your Play Store issue), and thanks again for all your input and testing thus far. As you've been quite helpful please feel free to PM me if you continue to have any issues so I can work with you personally and work to fix the remaining problems you seem to be experiencing.

Related

CIFS / Windows file share module

Through sheer geekitude, I've compiled a custom cifs / windows file sharing kernel module which I'll make available here. This is specifically geared toward rooted CDMA Heros using stock HTC software or the MoDaCo ROM.
First let me lay this out there:
This is not for the feint of heart, does not currently have any automated methods, is not really all that useful in it's current state, and requires your phone to be rooted.
One of the beautiful things about open source, however, is once the tools are available, someone will (hopefully) make it useful. Right now, it's very 'command line' oriented.
What this allows you to do:
Mount Windows / SMB / CIFS fileshares on your Hero, which can be accessed via a file browser such as Astro or Linda file managers.
Copy files to/from your Hero to your PC via these shares.
What this does not allow you to do (currently):
Allow you to stream music / video / images from your PC through the default music player.
The Guide:
Download the attached cifs-module.zip file, extract it somewhere on your PC.
Connect your phone via USB. Run:
Code:
./adb shell
$ su (if you're not already root)
#
If your /system partition isn't already mounted read/write, you'll need to remount it inside the shell:
Code:
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
Change the permissions of the modules folder to allow you to push in the module (again, you should be in the adb shell):
Code:
# chmod 777 /system
# chmod 777 /system/lib
# chmod 777 /system/lib/modules
# exit
$ exit
Now, back at your command prompt, push the kernel module you just downloaded and extracted:
Code:
./adb push cifs.ko /system/lib/modules/cifs.ko
Back into the shell to load it in, reset the permissions, and mount your fileshare.
First, load the module (and fix the /system permissions):
Code:
./adb shell
$ su
# insmod /system/lib/modules/cifs.ko
# chmod 775 /system
# chmod 775 /system/lib
# chmod 775 /system/lib/modules
Congrats so far! You've just loaded in a kernel module! Now to actually use it. You'll want to be connected to your network via WiFi, and have an accessible file share to mount.
Make a folder where you'll mount the share:
Code:
# mkdir /system/remote
Next, mount the share. The username, password, and share name will of course be the info for your local fileshare. The IP I'm using here is just an example, you'll want to use the IP of the PC where your fileshare is located:
Code:
# mount -t cifs -o username=yourusername,password=yourpassword //192.168.1.20/sharename /system/remote
If that goes off without a hitch, you're done! You've successfully mounted a fileshare from your PC to your phone. You can verify by taking a look at the contents:
Code:
# cd /system/remote
# ls
<you should see your list of shared files>
You can also at this point use an app on your phone like Asrto or Linda file manager to browse to this /system/remote folder and copy files to/from your PC!
Again, this is very raw, only tested on my own phone so far, and will really only allow you to copy files to/from your PC. I was able to play a couple of MP3s via Astro, but unfortunately the stock music player can't access the /system or /data folders on your phone, and because your /sdcard is a fat32 filesystem, you cannot mount other filesystems there unfortunately.
If someone knows a good way to get the stock apps reading from the share, please share.
The module is rather large as well, ~ 2.9mb. If anyone can give me some tips on optimizing the module for size, that'd be great - This is the first ARM modules I've ever built, and did so using a cross-compiler, I'm not sure of all the little tricks of the trade yet.
Enjoy!
You might have more luck if you run an ext3/4 fs on the sd card, although I am not sure if that would work.
I tried the above steps on a nexus one running cyanogen mod 5.0.6 and the insmod command failed with a execute error.
Im guessing the model is not build for an ARM v7 chip?!
What were you steps in building the module? I would be keen on trying it myself.
I dropped development on this ages ago as there are far better options available for CIFS/Samba sharing.
Try out EStrong's File Explorer from the market, has a much more usable implementation of LAN file sharing built right in.
I followed these step in order to copy my cifs.ko to modules dir but I get an "out of memory" error when trying to copy the file to the modules dir
any hint?

[TUT] Linux in chroot on your iconia

So, many of you want to run a full-size linux on your iconia. Unfortunately due to the fact that acer are a bunch of stupid mofos not releasing kernel source code and do not allow to flash unsigned ROMs we'll have to run it in chroot within android.
First thing to do is to get yourself a rootfs of linux. You can use angstrom, ubuntu.. I'm building debian using multistrap, the config is below. You'd better use pre-built ubuntu/backtrack and skip up to somewhere between steps 4 and 5, unless you have experience with dpkg and apt-get.
Code:
[General]
arch=armel
directory=/home/alexander/builds/multistrap
cleanup=false
retainsources=true
allowrecommends=false
noauth=true
unpack=true
aptsources=Grip
debootstrap=Debian
[Debian]
packages=screen openssh-server alsa-utils wireless-tools wpasupplicant nmap netcat
source=http://ftp.uk.debian.org/debian
keyring=debian-archive-keyring
suite=sid
[Grip]
packages=locales
keyring=emdebian-archive-keyring
source=http://www.emdebian.org/grip
suite=sid
Now we need to get it to iconia somehow. Running it from microsd would be incredibly slow and internal ssd is formatted to vfat. So let's loop mount it.
1. Create the loopback image
Code:
#700 mb
dd if=/dev/zero of=debian.img bs=10M count=70
mkfs.ext2 -f debian.img
2. Mount it as you always do.. on your desktop yet
Code:
mkdir /mnt/debian
mount -o loop -t ext2 debian.img /mnt/debian
3. Copy the desired files.. As a root user, you can cd to the rootfs (generated by multistrap) and
Code:
tar cvp . | tar xvp -C /mnt/debian
4. unmount the image.. (umount /mnt/debian) and copy to the /sdcard. I copy to the /sdcard/linux/debian.img. Also, I use the /sdcard/linux/uroot directory to mount the image on the tablet.
5. now, you need adb or terminal emulator and superuser permissions ('teh rewt')
Now let's make some script, name it android_sh and put it to /bin in /sdcard/linux/uroot. And make it executable (chmod +x /bin/android_sh)
Code:
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export USER=root
export HOME=/root
export TERM=linux
if [ -z "`pidof Xtightvnc`" ] ; then
vncserver -geometry 1280x740 -depth 8
else
kill -9 `pidof Xtightvnc`
rm /tmp/.X11-unix/X*
rm /tmp/.X*lock
fi
/bin/bash -
Ok. now make another script, in /sdcard/linux
Code:
#!/bin/sh
LOOPBASE=/sdcard/linux
LOOPFILE=debian.img
LOOPTARGET=uroot
cd $LOOPBASE
if [ -z "`grep $LOOPBASE/$LOOPTARGET /proc/mounts`" ]; then
echo "mounting $LOOPFILE"
mount -o loop -t ext2 $LOOPBASE/$LOOPFILE $LOOPBASE/$LOOPTARGET
else
echo "$LOOPFILE already mounted"
fi
for i in dev proc sys
do
echo "processing $i"
if [ -z "`grep $LOOPBASE/$LOOPTARGET/$i /proc/mounts`" ]
then
echo "mounting $i"
mount -o bind /$i $LOOPBASE/$LOOPTARGET/$i
else
echo "$i already mounted"
fi
done
if [ -z "`grep $LOOPBASE/$LOOPTARGET/dev/pts /proc/mounts`" ]
then
mount -t tmpfs none $LOOPBASE/$LOOPTARGET/dev/pts
fi
echo "chroot into $LOOPBASE/$LOOPTARGET"
chroot $LOOPBASE/$LOOPTARGET /bin/android_sh
now, execute it (sh /sdcard/linux/chroot.sh). You should be in root shell now. If you're building debian using multistrap, configure the packages (dpkg-configure -a). Remember I told you to keep out of debian? Dash package is somewhat broken so you may need to lurk through mailing lists to make it install.. And you need to manually add your sid/testing mirrors to the aptitude config.
So what now? Install tightvnc server (in debian/ubuntu, use apt-get update; apt-get install tightvncserver), exit the shell and launch chroot.sh again.
If you're building rootfs yourself, don't forget to install some x desktop environment. I use lxde on debian, it is lightweight and starts automatically with tightvnc
Now, you can use the vnc client on android to connect to your X11. When chrooting, tightvnc wil tell you the number of x session, so use it as the last digit of the port (5901, 5902 etc). I welcome suggestions on how to improve the android_sh to cleanly kill all tightvnc servers and remove temporary files so that the port number is always the same
In the end you may or may not get something similiar to this:
http://img820.imageshack.us/img820/9076/img3159qm.jpg
P.S.
I recommend you to install Hacker's Keyboard which will give you the tab key, esc and arrows simultaneously and allow to use cool software like vim and emacs without pain
https://market.android.com/details?id=app-org.pocketworkstation.pckeyboard
U.B.D.Man...
Cool...But I got stucked at the first step. Where can I get debian.img?
you create a new file named debian.img using dd, then you format it to ext2 using mkfs.. well. you can just take backtrack image from xoom. essentially it's just ubuntu with some software added
I'm just curious why you chose ext2 as opposed to ext4? Given that the filesystem is actually a file on a filesystem, I sort of understand ext2, especially considering you can mount it with the ext4 driver now.
This probably sounds like a stupid question, but for some reason I cannot use bash?
It may be that my paths are not configured properly, but i dont have a bin at the "/" level. I have looked in /system/bin and /system/xbin, but have not found bash there either.
I installed busybox and have been able to perform root tasks, so I am not sure what I missed.
because.. you don't have bash.. you should have it in your chroot. if you need it in android, just install it (like http://forum.xda-developers.com/showthread.php?t=537827)
I installed bash according to the link you posted, but I still don't have a /bin outside of /system. I did change the above scripts to reflect this by saying:
#!/system/bin (but then I get the error 'event not found')
My prompt reads: "sh-3.2#" after reboot, which I understand is bash replacing the stock terminal.
I tried creating the /bin directory in the root, but even with root terminal, it said it was read only. Do I have to remount the root and then create a /bin directory?
When I rooted, I don't remember their being a lengthy discussion about bash installation, or the creation of a /bin directory.
I welcome all suggestions, as I am trying to learn more about the inner workings of the tablet, but still have little experience.
you need bash only in the linux in chroot and therefore do not need to modify scripts.
anyway,
mount -o remount,rw /system
cp bash /system/bin
chmod 755 /system/bin/bash
mount -o remount,ro /system
then you can start bash by typing 'bash' in shell
Hello,
I have tried and I still can't get it run. I am not used to Linux stuffs and scared that I may screwed up my tab. Can you please pack the required files and upload it so that we can follow easier? something like this http://www.secmaniac.com/may-2011/backtrack-5-on-motorola-xoom-in-10-minutes-or-less/ would be great.
Thank you.
PS: I sincerely want to get BackTrack on my tab so that I can run R on this
moved to http://forum.xda-developers.com/showthread.php?t=1094237
sp3dev said:
because.. you don't have bash.. you should have it in your chroot. if you need it in android, just install it (like http://forum.xda-developers.com/showthread.php?t=537827)
Click to expand...
Click to collapse
I ended up installing bash, but I still had problems with chroot and getting the scripts to run, so I decided to reverse what I was doing. In the process of trying to remove the bash shell and replace with the stock sh, I must have messed something up.
I tried a factory reset, and when I loaded back up again, I can't get wifi to connect. My suspicion is that there is at least two separate things wrong:
-My shell is somewhere in permission limbo or non-existant
I try running >adb shell and I get:
"- exec '/system/bin/sh' failed: No such file or directory (2) -"​
-The permissions on my wpa_supplicant are probably messed up, hence I can't connect to wifi
Any suggestions?
Well I tried a few more things:
-Tried copying over bash to /system/bin, got an error that it is a read-only file system. Funny, because I need shell (chmod?) in order to repair the shell, those bastards.
-Tried installing apk using adb, got same message about 'sh' missing. I think I will have to reflash a system.img, but I can't seem to find the Wifi-US with a working link.
Any help would be much appreciated.
Hey guys, could you upload and send me the link of a video of this working? Cause I love the idea of it but I'm not sure if its really practical
Sent from my A500 using XDA Premium App

[HOWTO] Add init.d to stock ROM + a few other goodies

I have been resisting the urge to flash a custom ROM for a bit, but I really miss having init.d support. So I read a few threads for other phones and rolled my own.
Warnings
I borrowed bits and pieces from various places. If you don't know what init.d is, you probably don't want to do this. If you aren't willing to take responsibility for bricking your tablet, don't do this. Seriously, the risk of bricking is very low, but if you aren't comfortable booting into an adb shell from recovery, maybe this is not for you. Strongly suggest a nandroid backup before you get started so if you totally bork things you can just hit rewind.
Note: The latest CWM may prompt you on a reboot that the ROM may overwrite the bootloader and offer to fix it for you. Don't do that. The init.d hack takes over the bootloader install script, but does not change your bootloader! If you accidentally do let it fix things for you, just rebuild the install-bootloader.sh file. The other steps should be fine.
Prerequisites
First, you need root, busybox, and some sort of terminal (either adb, or some terminal you like using on the tablet).
I have found that I like Busybox Installer (from the market; https://play.google.com/store/apps/details?id=com.jrummy.busybox.installer) but for some reason it doesn't create new symlinks unless you click advanced install.
Let's get to it!
In the shell (don't type # or anything after #):
Code:
su # get root
mount -o remount,rw /system # get access to /system (4.04 seems to mount ro as is usual; seems like the original mounted rw)
which run-parts # if you don't see /system/xbin/run-parts you need to install/reinstall busybox; if it is somewhere else, note it
mkdir /system/etc/init.d
Create a file called sysinit -- we are going to put it in /system/bin. You can edit it in place with vi, mount your tablet and edit it on your computer, or create it on the computer and push it via adb. Whatever.
Here's the file (you do need the # and the things after it in the file!):
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/xbin/run-parts /system/etc/init.d
Note that if your run-parts is not in /system/xbin (from the which command) then fix the above to reflect your reality.
In the shell, make it executable
Code:
chmod 755 /system/bin/sysinit
Now go in the init.d directory and create some things you want to run at start up. For example:
Code:
cd /system/etc/init.d
echo '#!/system/bin/sh' >99test # note: you do need the first # in this line but not the 2nd!
echo 'date >>/data/tmp/init.d-log.txt' >>99test
chmod 755 99test
Here's a more practical one (yes, you need the # signs). Name it something like 10diskperf -- don't forget to chmod it.
Code:
#!/system/bin/sh
# Set disk read aheads to 1024
chmod 777 /sys/block/mmcblk0/queue/read_ahead_kb
echo "1024" > /sys/block/mmcblk0/queue/read_ahead_kb
chmod 777 /sys/block/mmcblk1/queue/read_ahead_kb
echo "1024" > /sys/block/mmcblk1/queue/read_ahead_kb
chmod 777 /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo "1024" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
Or here is one to tweak some TCP parameters (25sysctl):
Code:
#!/system/bin/sh
sysctl -w net.core.rmem_max=524288
sysctl -w net.core.wmem_max=524288
sysctl -w net.ipv4.tcp_rmem=6144 87380 524288
sysctl -w net.ipv4.tcp_wmem=6144 87380 524288
Whatever files you put in, you need to remember to make them executable (chmod 755).
Finally, you need to kick it all off at start up. The hack for that is we are going to create /system/etc/install-recovery.sh which apparently runs on each boot.
Code:
cd /system/etc
echo '#!/system/bin/sh' >install-recovery.sh
echo '/system/bin/sysinit' >>install-recovery.sh
chmod 755 install-recovery.sh
Tips and troubleshooting
If you are too lazy to cut and paste I have the files here (View attachment init.d-support.zip) that you can just move to the right places and change permission. If you are really lazy there is lightly tested install script below.
I like to try running the whole thing before a reboot to see if I get any errors:
Code:
/system/etc/install-recovery.sh
I'd suggest putting the 99test file in first. Verify that you get the expected file in /data/tmp and then reboot and check again. Then you can remove 99test.
Same goes for adding new scripts. Try running them from the shell to see if they throw errors before you reboot!
If you have trouble, see if this looks right:
Code:
ls -ld /system/etc/install-recovery.sh /system/bin/sysinit /system/etc/init.d /system/xbin/run-parts
-rwxr-xr-x root root 39 2012-07-14 10:00 install-recovery.sh
-rwxr-xr-x root root 140 2012-07-14 10:01 sysinit
drwxrwxrwx root root 2012-07-14 10:10 init.d
lrwxrwxrwx root root 2012-07-14 09:55 run-parts -> /system/xbin/busybox
For the brave
The install-init.d zip file (View attachment install-init.d.zip) contains a lightly tested script that SHOULD do the install steps for you.
Send the file to your android to someplace that can execute code (e.g., /system/xbin; I had to use adb to put it on the sdcard and then move it to /systemxbin in the shell since I don't have the adb root kernel installed).
Code:
cd /system/xbin # or wherever you have it
chmod 755 install-init.d
./install-init.d
It performs rude checks to see if init.d exists, and tries to handle moving or missing busybox. It only installs 99test as a script.
Let me know if this works or doesn't work for you.
For the extra brave: There is no reason this should only work on the Samsung. This ought to work on pretty much most stock ROMs as long as they execute install-recovery.sh on start up.
Scripts
What do you put in your init.d? If you post anything cool I'll put it up here in the op.
One that gave me some real gains in I/O performance required a new version of the tune2fs executable. By default, it is part of busybox but the busybox one only has a few simple options. I've included a stand alone version and the script 10disktune here View attachment disktune.zip. Unpack the zip and put the 10disktune in /system/etc/init.d (don't forget to chmod) and put tune2fs in /system/bin (chmod that too). Note that busybox has one in /system/xbin but the script specifically calls out the one in /system/bin.
Here's one that will zipalign your apks on each boot
Code:
#!/system/bin/sh
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk
ZCHECK=$?
if [ $ZCHECK -eq 1 ]; then
zipalign -f 4 $apk /cache/$(basename $apk)
if [ -e /cache/$(basename $apk) ]; then
cp -p -f /cache/$(basename $apk) $apk
rm /cache/$(basename $apk)
fi;
fi;
done;
Fin
Corrections welcome. I considered using exec or . to load some of this into one shell but given that it runs once at startup, I figured it is fine as is.
All files for reference
View attachment init.d-support.zip
View attachment install-init.d.zip
View attachment disktune.zip
Great guide, gonna try it tonight.
Sent from a GNote, hell yeah!
SirRhor said:
Great guide, gonna try it tonight.
Sent from a GNote, hell yeah!
Click to expand...
Click to collapse
I'm curious how it went. If you ran into any issues, let me know so I can update the op. Thanks!
Hmm did anyone get this to work?
wd5gnr said:
Hmm did anyone get this to work?
Click to expand...
Click to collapse
I did it on my Galaxy Nexus.
It works great, I had a bit of problem with the sysinit file, but when I downloaded your zip file and used your sysinit, it worked, so it must be a problem from my side
Thanks for this, I can finally use "Odex Me"
aavan said:
I did it on my Galaxy Nexus.
It works great, I had a bit of problem with the sysinit file, but when I downloaded your zip file and used your sysinit, it worked, so it must be a problem from my side
Thanks for this, I can finally use "Odex Me"
Click to expand...
Click to collapse
Great, just wanted to be sure I hadn't made any typos/errors in the guide.
A lot of init.d files collected here: http://forum.xda-developers.com/showthread.php?t=1227269
Also build.prop things, etc.
Thanks, I use your guide and worksperfect for my RK3066 devices. Very simple to understand all steps and what we are doing to our system, perfect for me. Thanks again dude
Melch1zedeK said:
Thanks, I use your guide and worksperfect for my RK3066 devices. Very simple to understand all steps and what we are doing to our system, perfect for me. Thanks again dude
Click to expand...
Click to collapse
Glad to help!
What is thhe utility of this?
moliverac8 said:
What is thhe utility of this?
Click to expand...
Click to collapse
Init.d is how Linux and many Android (which is kind of Linux, after all) systems manage executing commands on boot up.
The /etc/init.d files run in numerical order as root and you can do things like change system settings, manipulate the file system, etc.
See the init.d section linked below for some ideas.
http://forum.xda-developers.com/showthread.php?t=1227269
Question? what is the difference in this method and running a script?
wd5gnr said:
Init.d is how Linux and many Android (which is kind of Linux, after all) systems manage executing commands on boot up.
The /etc/init.d files run in numerical order as root and you can do things like change system settings, manipulate the file system, etc.
See the init.d section linked below for some ideas.
http://forum.xda-developers.com/showthread.php?t=1227269
Click to expand...
Click to collapse
I use the "swap memory script" and was wondering if it would also work this way with the init.d If so would there be any benefit this way over the current way of running it one way or the other? One drawback I see running the script as is is that I have to wait once the system has fully booted until the script has run and I see the Smanager screen to let me know that my memory has been remounted.
Thanks for the info and the learning process.
Here is the script and the link.
http://forum.xda-developers.com/showthread.php?t=1961097
Code:
sleep 5
mount -o remount,rw /
mount -t vfat -o umask=0000 /dev/block/vold/179:25 /mnt/sdcard
sleep 5
mount -o bind /data/media /mnt/extSdCard
As long as the device is ready to mount at boot time and doesn't get remounted, ought to work. Backup and try it
External memory wasn't ready
wd5gnr said:
As long as the device is ready to mount at boot time and doesn't get remounted, ought to work. Backup and try it
Click to expand...
Click to collapse
Thanks for the guide, but I think that the external memory was not ready to be mounted at that time. it didn't see the card till after boot. It was worth a shot, Reverted back to the script in /data and all worked again,
Note: I didn't find /system/xbin/run-parts however, I did find /system/bin/run-parts and changed the path to reflect that, I don't think this was an issue but I'm not 100% sure.

[Q] Flashing HD2 without touch screen

Hy.
I have a HTC HD2 with a dead touch screen (I can read, but touch is not reactive). I could reset it to factory settings via buttons. So I have a Windows Welcome screen.
I can also enter HSPL.
Is it possible to flash the device, and install Android without working screen ?
Once I have Android, I can do stuff with the device, and use it as VNC client, and manage remotly via ssh. My problem is to install Android on it. Most tutos say at one step or an other to activate ActiveSync in Windows, what is not possible for me.
I am used to HTC Sensation, and to all classic Android tools (adb, fastboot). I have Windows and Linux hosts.
Classic tutos are not usable for me.
Otherwise, the device will go for sale, for peaces. 10€.
Thanks.
voldown + power --> bootloader,
fhlash hspl
flash radio 2.15.50
flash magldr
use toolkit to apply partition size and cwm
into cwm
flash rom from zip
no touchscreen necessary
the instruction about activesync is a red herring, , it doesn't refer to the app on the PC, and it doesn't require winmo to be running on the phone either, it just means get a usb connection.
however if you have trouble flashing hspl, then manually updating windowsmobiledevicecenter (find it on microsoft website) will help fix driver errors, and later, when you get into magldr and start using 'usb flasher' you may wanna install 'myphoneexplorer' for the android drivers it comes with.
^That's true, but you might have a problem with Aroma installer. I think it may work with the volume keys too, but if it doesn't then you'll have to find a ROM which doesn't use Aroma (most relatively old ROMs don't) and flash that instead.
Nigeldg said:
^That's true, but you might have a problem with Aroma installer. I think it may work with the volume keys too, but if it doesn't then you'll have to find a ROM which doesn't use Aroma (most relatively old ROMs don't) and flash that instead.
Click to expand...
Click to collapse
Aroma does work without touchscreen, buttons can be used to select the default choices, (can't recall if volume buttons can used to change selected option, so may need to edit ROM zip so the defaults are what you want). The issue I'd see is how you go about issuing commands and starting apps; it's possible of course - there are commands to simulate screen presses (monkeyrunner) and command to start apps/processes but those commands can get complicated.
If you get a VNC system set up without touchscreen then could you add your procedure?
I am stuck at almost last step: pushing CWM: I have downloaded Recovery-400 from http://www.filecrop.com/Clockworkmod-Recovery-hd2.html , but I get the RSPL error message. I have Windows XP SP3 with .NET3 SP1, so i am admin, i have EnterBootloader.exe and rapidtool.exe, and I have unticked the USB stuff in ActiveSync ... but i am still stuck at the RSPL error :/
About going further: if I have ADB access from CWM, I will just install Armel by copying from my Sensation (Debian Armel have been installed using LinuxInstaller by Galoula). If i don't have adb, I will have to pre-install it in the zip, and reflash. In short, I push a chrootable env, and find an init script that will run sshd after boot. Once I have ssh, i'm done.
I had to install RAPI.dll, and CEUTIL.dll (found in google), re-install ActiveSync, and use a very specific ROM. HD2toolkit did not work at all for me. I forgot how I installed MAGDLR, but it was PITA to install it. And once installed, I spent 2 days on trying to use it. Putting ROMs on uSD does not allow to install the from SD.
After viewing http://cdn.youtubeavi.com/view-video/0TpYHpfHW-8 (confirmed by reading http://resetguide.com/2012/05/how-to-install-android-on-hd2-nand/ ), I saw that amongst my 1GB of data downloaded in the last days, I did not have the file ANDR_install.exe; I downloaded all possible ROMs until I find one having this magic file: http://forum.xda-developers.com/showthread.php?t=893637 . Only this ROM has andr_install.exe . And when I ran it, it worked on the first time (while of course having HD with MAGLDR on option 5: USB flash).
Now, my HD2 started Android. I still can not use it at all for now, but at least, I have made a step.
adb works, so it will probably be very easy for me. From ADB, I can do almost anything: install APKs(pm install), getprop, remount /system rw, install Debian manually ... the hardest part may be to click on buttons, but I can find a WA for this: create minimal apps on my other Android phone, using Tasker with AppFactory, apps which will be able to send keystrokes, and start them as required. Long way, but should work (if I don't have CPU uncompat issues). Anyway, without touch pad, it's not gonna stay a "phone"; it will mostly be a VNC-viewer for other devices (like my RaspberryPi).
Hell I am lucky: both HTD HD2 and HTC Sensation use the exact same CPU: "ARMv7 Processor rev 2 (v7l)" . Gonna be trivial to have fun around An example to install a VNC-client:
Code:
[email protected] /tmp $ adb -s SH169V80XXXX pull /data/app/android.androidVNC-1.apk
1703 KB/s (245795 bytes in 0.140s)
[email protected] /tmp $
[email protected] /tmp $ adb -s 0123456789ABCDEF install android.androidVNC-1.apk
2015 KB/s (245795 bytes in 0.119s)
pkg: /data/local/tmp/android.androidVNC-1.apk
Success
[email protected] /tmp $
Same for server.
Like in my Sensation (definitly, I am lucky), I have a free folder in the default PATH :
Code:
localhost / # echo $PATH
/sbin:/system/sbin:/system/xbin:/system/bin
localhost / # ls /system/
app dmesg.txt framework lost+found lost+found xbin
bin etc lib lost+found media
build.prop fonts lost+found lost+found usr
localhost / #
so, let's populate it
Code:
localhost / # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 205.9M 0 205.9M 0% /dev
tmpfs 205.9M 0 205.9M 0% /mnt/asec
/dev/block/mtdblock1 127.3M 118.8M 8.5M 93% /system
/dev/block/mtdblock3 248.8M 65.2M 183.5M 26% /data
/dev/block/mtdblock2 40.0M 1.1M 38.9M 3% /cache
/dev/block/vold/179:1
3.7G 2.3G 1.4G 63% /mnt/sdcard
/dev/block/vold/179:1
3.7G 2.3G 1.4G 63% /mnt/secure/asec
localhost / # mount -o remount,rw /dev/block/mtdblock1 /system
localhost / # cd /system/
localhost system # ln -s /data/local/bin/ sbin
localhost system #
Now add my personal boot script:
Code:
localhost system # cd /etc/init.d/
localhost init.d # ls -l
-rwxrwxrwx 1 root root 365 Feb 29 2008 00banner
-rwxrwxrwx 1 root root 27 Oct 9 2010 01sysctl
-rwxrwxrwx 1 root root 229 Feb 29 2008 03firstboot
-rwxrwxrwx 1 root root 105 Feb 29 2008 04modules
-rwxrwxrwx 1 root root 1593 Feb 29 2008 05mountsd
-rwxrwxrwx 1 root root 794 Feb 29 2008 20userinit
localhost init.d # ln -s /data/local/bin/rc.local 99doublehp
localhost init.d #
and populate /data as required:
Code:
bash-3.2# tar -czf bin.tgz /data/local/bin/
tar: removing leading '/' from member names
bash-3.2#
[email protected] /tmp $ adb -s SH169V80XXXX pull /data/app/bin.tgz
3660 KB/s (411734 bytes in 0.109s)
[email protected] /tmp $
[email protected] /tmp $ adb -s 0123456789ABCDEF push bin.tgz /data/local/tmp/
1972 KB/s (411734 bytes in 0.203s)
[email protected] /tmp $
localhost / # tar -xvzf /data/local/tmp/bin.tgz
data/local/bin/
data/local/bin/cpu
data/local/bin/rc.local
data/local/bin/psa
[...]
ah ... at last, ONE difference:
Code:
localhost / # head -n1 /system/sbin/psa
#!/system/bin/bash
localhost / # which bash
/system/xbin/bash
localhost / #
localhost / # cd /system/bin/
localhost bin # ln -s ../xbin/bash .
localhost bin #
No way to edit each and every script ^^
Most important one for debugging:
Code:
localhost ~ # vibrate 100
Voltage not provided. Using default 3100 mV.
/system/sbin/vibrate: line 37: /sys/devices/virtual/timed_output/vibrator/voltage_level: No such file or directory
localhost ~ # vibrate 500
Voltage not provided. Using default 3100 mV.
/system/sbin/vibrate: line 37: /sys/devices/virtual/timed_output/vibrator/voltage_level: No such file or directory
localhost ~ #
Let's prepare the SDcard for Debian use; since CM6 does not have mkfs.ext3, I did that on my workstation.
Code:
localhost / # mkdir -p /data/local/mnt/sdcard_ext
localhost / # mount /dev/block/mmcblk0p1 /data/local/mnt/sdcard_ext/
localhost / #
I should have started by this (to help understand these logs), but it's never too late:
on HD: vi /etc/bash/bashrc
PS1='\[\033[01;31m\][email protected]\[\033[01;34m\]:\w\[\033[00m\] '
on Sensation: vi $HOME/.bashrc
PS1='\[\033[01;31m\][email protected]\[\033[01;34m\]:\w\[\033[00m\] '
This prompt is handy so that I can do copy-paste of the prompt itself for use with scp and rsync: if I am at one place in ssh, I can copy the prompt to scp a file there from an other machine.
So ... I was about to copy my Debian: I put both SDcards in the workstation.
Code:
[email protected]:~ cp -a /media/uSD_ext3/Linux /media/Hmmm/
Remove sshd keys to force regen ( /etc/ssh/ssh_host_*). Update hostname (it never properly worked in Armel).
... I'll continue overnight.
doublehp said:
I
After viewing http://cdn.youtubeavi.com/view-video/0TpYHpfHW-8 (confirmed by reading http://resetguide.com/2012/05/how-to-install-android-on-hd2-nand/ ), I saw that amongst my 1GB of data downloaded in the last days, I did not have the file ANDR_install.exe; I downloaded all possible ROMs until I find one having this magic file: http://forum.xda-developers.com/showthread.php?t=893637 . Only this ROM has andr_install.exe . And when I ran it, it worked on the first time (while of course having HD with MAGLDR on option 5: USB flash).
Click to expand...
Click to collapse
...because thats the old, outdated way of installing android,, pre-nand recovery, , and those are old, outdated android roms which is why only they have the 'magic' (now obsolete) file.
samsamuel they may be outdated, but I love CM6 (after 1h of use, I find it very good), and no other method worked (4 or 5 other different methods all ended up in the RSPL.cpp issue).
To take control of my new Android, a friend told me to try AndroidScreenCast. It's some kind of VNC, specially written for Android.
Once Android is installed, you can have fun with it, without touchpad, by using http://code.google.com/p/androidscreencast/ . I am lucky that on CM6, adb was enabled by default. Download http://androidscreencast.googlecode.com/svn/trunk/AndroidScreencast/dist/androidscreencast.jnlp and run it with
Code:
javaws androidscreencast.jnlp
I will try to not use it at all. I tried it, just so that I can tell "it works", and discard all welcome menus. Did not even configure Wifi.

[Q] Mounting & Changing Permissions Using Terminal Emulator on Android Phone

How to properly MOUNT the system so I can change its permission? (USING TERMINAL EMULATOR)
I know the first command for it (mount) (I dont know what command follows)
Because I need to first mount the system before changing permissions.
How to change permissions for a system app (for example SystemUI.apk)? After doing some changes into my SystemUI.apk, I push it into my system and it has different permissions.
I want to change its permission into rw-r--r
In the emulator:
Code:
$ su
# mount -o remount,rw /system
# chmod 0644 /system/app/SystemUI.apk
or:
Code:
$ su
# cd system/app
# mount -o remount,rw /system
# chmod 0644 SystemUI.apk
- What does the "0" in 0644 stands for?
Can you elaborate how that mount works so I can properly use it.
mount -o (what this for) remount (and this) ,rw (this also) /system(its the directory, the one I understand)
klmiciano said:
- What does the "0" in 0644 stands for?
Can you elaborate how that mount works so I can properly use it.
mount -o (what this for) remount (and this) ,rw (this also) /system(its the directory, the one I understand)
Click to expand...
Click to collapse
Permissions for system files go beyond simply rw-r-r. Since Android is essentially Linux, Linux permissions do exist in Android. Alongside the Owner, Group and Other permissions, of which you set rw, r and r respectively, special permissions which are the Sticky bit, GID and UID exist as well. However, since these special permissions are not required for the functioning of Android, the 0 in 0644 is to disable all three of them.
-o in mount is essentially a flag. Flags are options to obtain different outcomes for each command. For example,
Code:
ls -s
not only lists the files in the current directory, but also lists the files' sizes in kB. I am not sure about -o in this case, however.
Remounting is required as your system is already a mounted filesystem, but as read-only (ro). Hence you have to remount it as read-write (rw), in order to change the properties of its files.
This is some good stuff. I need to learn more.
The last time I use the chmod command. I didn't include the '0'. I've only type
chmod 644 (blahblah)
Btw, Thank you for teaching me this stuff.
More power.:laugh:
NightRaven49 said:
Permissions for system files go beyond simply rw-r-r. Since Android is essentially Linux, Linux permissions do exist in Android. Alongside the Owner, Group and Other permissions, of which you set rw, r and r respectively, special permissions which are the Sticky bit, GID and UID exist as well. However, since these special permissions are not required for the functioning of Android, the 0 in 0644 is to disable all three of them.
-o in mount is essentially a flag. Flags are options to obtain different outcomes for each command. For example,
Code:
ls -s
not only lists the files in the current directory, but also lists the files' sizes in kB. I am not sure about -o in this case, however.
Remounting is required as your system is already a mounted filesystem, but as read-only (ro). Hence you have to remount it as read-write (rw), in order to change the properties of its files.
Click to expand...
Click to collapse
This guide probably helped me as well

Categories

Resources