OTA modifier - Onetouch Idol 3 Android Development

What is this:
- This is a script which can be used from a Linux PC (should work on Mac too) in order to modify the OTA updates.
- It is suitable for all 6039 and 6045 devices.
- The owners of 6039 which returned the fastboot commands to their devices by using the guide in this section need to use the script in order to modify and install future OTA updates.
- The script removes the checks and the patches for the recovery. In addition for the 6039 users removes the check and the patches which remove the fatsboot commands.
How to use it:
- There are dependencies (i.e. packages which are needed) in order the script to function properly. In order to be widely supported the script has been written as bash script and needs only zip and unzip binaries in order to modify the upgrade file. All other commands used in it should be available as core packages on any Linux system.
- The script must have executable permissions and the update file to be provided as argument e.g.
Code:
ota_modifier.sh /home/Downloads/update.zip
there a few questions which can be asked by the script, which must be answered with y/n. At the end, in the directory from where the script has been executed, you will have a modified flashable ZIP which can be installed through TWRP in order to upgrade the device.
md5sum: ca536d39ec63845eb55803e1e8b57e3d ota_modifier.zip
P.S. If someone can modify the script to work under Windows is welcome to do it.

petrov.0 said:
What is this:
- This is a script which can be used from a Linux PC (should work on Mac too) in order to modify the OTA updates.
- It is suitable for all 6039 and 6045 devices.
- The owners of 6039 which returned the fastboot commands to their devices by using the guide in this section need to use the script in order to modify and install future OTA updates.
- The script removes the checks and the patches for the recovery. In addition for the 6039 users removes the check and the patches which remove the fatsboot commands.
How to use it:
- There are dependencies (i.e. packages which are needed) in order the script to function properly. In order to be widely supported the script has been written as bash script and needs only zip and unzip binaries in order to modify the upgrade file. All other commands used in it should be available as core packages on any Linux system.
- The script must have executable permissions and the update file to be provided as argument e.g.
Code:
ota_modifier.sh /home/Downloads/update.zip
there a few questions which can be asked by the script, which must be answered with y/n. At the end, in the directory from where the script has been executed, you will have a modified flashable ZIP which can be installed through TWRP in order to upgrade the device.
md5sum: f401a1a5baafa20110cf47606b45d99a ota_modifier.zip
P.S. If someone can modify the script to work under Windows is welcome to do it.
Click to expand...
Click to collapse
Not a zip file?
[email protected]:/workarea/android/idol3/updates > ls
update_20150928.zip
[email protected]:/workarea/android/idol3/updates > ota_modifier.sh update_20150928.zip
The provided file is not a zip file!
[email protected]:/workarea/android/idol3/updates > unzip update_20150928.zip
Archive: update_20150928.zip
signed by SignApk
inflating: META-INF/com/android/metadata
inflating: META-INF/com/google/android/update-binary
inflating: META-INF/com/google/android/updater-script
inflating: firmware/VERINFO/NON.VER
inflating: patch/boot.img.p
inflating: patch/emmc_appsboot.mbn.p
inflating: patch/firmware/IMAGE/CMNLIB.B01.p
inflating: patch/firmware/IMAGE/CMNLIB.MDT.p
inflating: patch/firmware/IMAGE/DXHDCP2.B01.p
inflating: patch/firmware/IMAGE/DXHDCP2.MDT.p
inflating: patch/firmware/IMAGE/ISDBTMM.B01.p
inflating: patch/firmware/IMAGE/ISDBTMM.MDT.p
inflating: patch/firmware/IMAGE/KEYMASTE.B01.p
inflating: patch/firmware/IMAGE/KEYMASTE.MDT.p
inflating: patch/firmware/IMAGE/MBA.MBN.p
inflating: patch/firmware/IMAGE/MODEM.B00.p
*update* You need to strip the filename to make it case insensitive. You may have files that don't end in .zip at all if they use the name the update saves as which was a number like 67039
[email protected]:/workarea/android/idol3/updates > ota_modifier.sh update_20150928.Zip
The file update_20150928.Zip is OK!
Creating a copy of the file...
Working hard...
*** Would you like to remove the checks and the ***
*** patches which remove the fastboot commands ? ***
*** Note that if your device is 6045 probably is not ***
*** affected by this, therefore is recommended to ***
*** choose 'n' from the prompt below. ***
*** If the update is for 6039 choose 'y' ***
Clean them all [y/n]: n
Creating the modified update file
/workarea/android/idol3/updates/update_20150928_modified.zip has been created.
Cleaning of the mess !
DONE!!!
[email protected]:/workarea/android/idol3/updates > ls -l
total 57420
-rw-r--r-- 1 famewolf famewolf 58793801 Sep 14 01:30 update_20150928.Zip <--- Where is the file it says it just created? Only the original is present.

famewolf said:
Not a zip file?
[email protected]:/workarea/android/idol3/updates > ls
update_20150928.zip
[email protected]:/workarea/android/idol3/updates > ota_modifier.sh update_20150928.zip
The provided file is not a zip file!
[email protected]:/workarea/android/idol3/updates > unzip update_20150928.zip
Archive: update_20150928.zip
signed by SignApk
inflating: META-INF/com/android/metadata
....
*update* You need to strip the filename to make it case insensitive. You may have files that don't end in .zip at all if they use the name the update saves as which was a number like 67039
Click to expand...
Click to collapse
Hm, interesting. Actually the check is based on the 'magic' of the file. Can you run:
Code:
file update_20150928.zip
and to provide the output.
Edit: Probably I should remove this check and to unzip the file blindly. And then on unsuccessful unzip to exit with error. Probably this is a better approach.

petrov.0 said:
Hm, interesting. Actually the check is based on the 'magic' of the file. Can you run:
Code:
file update_20150928.zip
and to provide the output.
Click to expand...
Click to collapse
[email protected]:/workarea/android/idol3/updates > file update_20150928.zip
update_20150928.zip: ERROR: cannot open `update_20150928.zip' (No such file or directory)
/workarea is a NAS share mounted via NFS if that matters. It may also explain why the output file disappeared. I'll try running it on a "local" directory.
---------- Post added at 05:34 PM ---------- Previous post was at 05:31 PM ----------
I think your path is off somewhere. Also if you upzip "blindly" you can still check the return code to ensure it was 0.
[email protected]:/tmp > ota_modifier.sh update_20150928.Zip
The file update_20150928.Zip is OK!
Creating a copy of the file...
Working hard...
*** Would you like to remove the checks and the ***
*** patches which remove the fastboot commands ? ***
*** Note that if your device is 6045 probably is not ***
*** affected by this, therefore is recommended to ***
*** choose 'n' from the prompt below. ***
*** If the update is for 6039 choose 'y' ***
Clean them all [y/n]: n
Creating the modified update file
zip I/O error: Permission denied
zip error: Could not create output file (../update_20150928_modified.zip)
/tmp/update_20150928_modified.zip has been created.
Cleaning of the mess !
DONE!!!
[email protected]:/tmp > ls up*
update_20150928.Zip

famewolf said:
[email protected]:/workarea/android/idol3/updates > file update_20150928.zip
update_20150928.zip: ERROR: cannot open `update_20150928.zip' (No such file or directory)
/workarea is a NAS share mounted via NFS if that matters. It may also explain why the output file disappeared. I'll try running it on a "local" directory.
---------- Post added at 05:34 PM ---------- Previous post was at 05:31 PM ----------
I think your path is off somewhere.
[email protected]:/tmp > ota_modifier.sh update_20150928.Zip
The file update_20150928.Zip is OK!
Creating a copy of the file...
Working hard...
*** Would you like to remove the checks and the ***
*** patches which remove the fastboot commands ? ***
*** Note that if your device is 6045 probably is not ***
*** affected by this, therefore is recommended to ***
*** choose 'n' from the prompt below. ***
*** If the update is for 6039 choose 'y' ***
Clean them all [y/n]: n
Creating the modified update file
zip I/O error: Permission denied
zip error: Could not create output file (../update_20150928_modified.zip)
/tmp/update_20150928_modified.zip has been created.
Cleaning of the mess !
DONE!!!
[email protected]:/tmp > ls up*
update_20150928.Zip
Click to expand...
Click to collapse
Yes, on the local machine will be better (also try the script from there) ... It works without problems on Debian and openSUSE
... No write access to / tmp ... Come on, who does not have access to there. <- This was an error in the script.

OK there was an error indeed in the directory switch (it was behind the fi) when you select n on the prompt. Download the script again. It is already updated.
Edit: @famewolf thanks for the fast response in order to be corrected.

petrov.0 said:
OK there was an error indeed in the directory switch (it was behind the fi) when you select n on the prompt. Download the script again. It is already updated.
Edit: @famewolf thanks for the fast response in order to be corrected.
Click to expand...
Click to collapse
Are you checking the "n" branch because I'm still unable to generate an output file trying both /tmp and /workarea/idol3/updates I've posted my update file at the bottom.
Example:
[email protected]:/tmp > /workarea/android/idol3/ota_modifier.sh update_20150928.Zip
The file update_20150928.Zip is OK!
Creating a copy of the file...
Working hard...
*** Would you like to remove the checks and the ***
*** patches which remove the fastboot commands ? ***
*** Note that if your device is 6045 probably is not ***
*** affected by this, therefore is recommended to ***
*** choose 'n' from the prompt below. ***
*** If the update is for 6039 choose 'y' ***
Clean them all [y/n]: n
Creating the modified update file
zip I/O error: Permission denied
zip error: Could not create output file (../update_20150928_modified.zip)
/tmp/update_20150928_modified.zip has been created.
Cleaning of the mess !
DONE!!!
[email protected]:/tmp > ls up*
update_20150928.Zip
[email protected]:/tmp >
This is on Linux Mint 17.2 KDE which is based on Ubuntu 14.04.
Choosing Y at the check DOES produce an output file.
[email protected]:/tmp > /workarea/android/idol3/ota_modifier.sh update_20150928.Zip
The file update_20150928.Zip is OK!
Creating a copy of the file...
Working hard...
*** Would you like to remove the checks and the ***
*** patches which remove the fastboot commands ? ***
*** Note that if your device is 6045 probably is not ***
*** affected by this, therefore is recommended to ***
*** choose 'n' from the prompt below. ***
*** If the update is for 6039 choose 'y' ***
Clean them all [y/n]: y
Cleaning the patches which affect the fastboot commands...
Creating the modified update file
/tmp/update_20150928_modified.zip has been created.
Cleaning of the mess !
DONE!!!
[email protected]:/tmp > ls up*
update_20150928_modified.zip update_20150928.Zip
[email protected]:/tmp >
Try the file yourself:
*Removed to prevent people from trying to install it on the wrong devices*

famewolf said:
Are you checking the "n" branch because I'm still unable to generate an output file trying both /tmp and /workarea/idol3/updates I've posted my update file at the bottom.
....
Click to expand...
Click to collapse
Damn. Sorry somehow I messed files ... this not been updated ... This section from the script must look like this:
Code:
if [ -d patch ]; then
if [[ "$ans" == "y" ]] || [[ "$ans" == "Y" ]]; then
pushd patch &>/dev/null
for i in emmc_appsboot.mbn.p hyp.img.p rpm.img.p sbl1.img.p tz.img.p
do
rm "$i"
done
popd &>/dev/null
fi
I will upload the correct file after a minute.

@famewolf now is OK ... checked (twice) .

petrov.0 said:
@famewolf now is OK ... checked (twice) .
Click to expand...
Click to collapse
Success!
-rw-r--r-- 1 famewolf famewolf 58623940 Oct 1 19:48 update_20150928_modified.zip
-rw-r--r-- 1 famewolf famewolf 58793801 Sep 14 01:30 update_20150928.Zip
Will have to restore factory image of UE40 then try to apply the update (I have a modified build.prop and other files that will prevent an update).
Windows users can put the update and the script on a jump drive and boot into a linux live iso to run it...the live iso can be booted in virtualbox as well which is a free virtual pc package.
*update* Just a quick followup to say the modified update applied just fine via twrp and worked as expected.

I see almost everyone is using Ubuntu. Would Debian be ok (I don't see why it shouldn't)? I am dual booting W7/Debian 8.2 and would hate to change to Ubuntu.
Thanks
Sent from my 6045Y using XDA Free mobile app

famewolf said:
Success!
-rw-r--r-- 1 famewolf famewolf 58623940 Oct 1 19:48 update_20150928_modified.zip
-rw-r--r-- 1 famewolf famewolf 58793801 Sep 14 01:30 update_20150928.Zip
Will have to restore factory image of UE40 then try to apply the update (I have a modified build.prop and other files that will prevent an update).
Windows users can put the update and the script on a jump drive and boot into a linux live iso to run it...the live iso can be booted in virtualbox as well which is a free virtual pc package.
*update* Just a quick followup to say the modified update applied just fine via twrp and worked as expected.
Click to expand...
Click to collapse
Anghirrim said:
I see almost everyone is using Ubuntu. Would Debian be ok (I don't see why it shouldn't)? I am dual booting W7/Debian 8.2 and would hate to change to Ubuntu.
Thanks
Sent from my 6045Y using XDA Free mobile app
Click to expand...
Click to collapse
Where you see this ? Of course it will work.

Anghirrim said:
I see almost everyone is using Ubuntu. Would Debian be ok (I don't see why it shouldn't)? I am dual booting W7/Debian 8.2 and would hate to change to Ubuntu.
Thanks
Sent from my 6045Y using XDA Free mobile app
Click to expand...
Click to collapse
I used OpenSuse KDE for around 10 years. I only switched to Linux Mint in the last couple of years due to issues getting certain hardware to work under opensuse that just worked out of the box with linux mint. (gscan2pdf..a minolta 1250W printer) I also was frustrated that certain software packages were only available from users instead of being in the main opensuse repo and some of those were broken in various ways. Debian should work just fine...actually just about any linux should work just fine but you could always use a live iso in virtualbox or boot off a live iso directly.

No need for a live one don't worry. I was more guessing about dependencies name issue or conflicts.
I used to be an Archlinux user for several years and know how complicated it can be when you mix 32 and 64 bits libraries.
I'm using my computer less and less so moved to Debian for a slower update pace.
Regarding Ubuntu, in the compilation topics, most of the people talk about Ubuntu so I was guessing there was something specific.
Thanks guys.
Sent from my 6045Y using XDA Free mobile app

Web based OTA modifier
This is strictly just "pie in the sky" thinking.....what would be ideal would be to have a webpage where you can upload your update and it processes it then provides you the modified file. I've seen this done with similar things...I know there are places online that would provide a linux shell to run the script..not sure how the web page would integrate but that would allow people to request the update from a phone.
Anyway the safest update method is to go to TWRP and 1) Backup your system, data, boot of existing system in case of problems. 2)Restore a factory image of the version you are on so everything is as the update will expect. 3) Apply the modified update. 4) Make another backup..this time of system image and boot..this will become your new "factory image" for the next update. You can then apply zip's like the supersu.zip and any special ones you've created with the zipme app. Finally reboot.

Really nice. Please port to windows.

Bostrot said:
Really nice. Please port to windows.
Click to expand...
Click to collapse
You'd have better luck in googling how to run bash scripts under windows (or using my live iso + jumpdrive suggestion). petrov.0 doesn't use windows.

do you think it's possible to crossflash my 6045y with the 6045i latest update with this modification since the partitions are the same?

keyra74 said:
do you think it's possible to crossflash my 6045y with the 6045i latest update with this modification since the partitions are the same?
Click to expand...
Click to collapse
As stated many times before, NO! The most recent update will only install on UE40 firmware and it upgrades it to UER0. It checks for it and even if it didn't the source code for the 6045Y and the 6045i are different...even if you removed the check when it tried to patch your radio it would probably kill both cell and wifi and create a mess you probably could not get back from unless you've used @DallasCZ's Backup_All script to backup all partitions on your device.
Having partitions in the same order just means they can use the same recovery since system, data and boot will be in the same places...nothing more.

alright

Related

Android Kitchen not working properly on Fedora 16 x64 [Solved]

Has anyone been able to get the android kitchen to actually work on Fedora 16 and if so, how?
The reason I ask is because it does start and it does find the system.img and boot.img but its complaining during the working folder set up. See below:
Code:
Creating working folder WORKING_112911_011054 ...
Copying boot.img ...
Copying system.img ...
Adding an update-script ...
Chunk size is 2048 bytes in system.img
Spare size calculated to be 64 bytes
Compiling unyaffs ...
In file included from /usr/include/features.h:387:0,
from /usr/include/sys/types.h:26,
from unyaffs.c:10:
/usr/include/gnu/stubs.h:9:27: fatal error: gnu/stubs-64.h: No such file or directory
compilation terminated.
Error: unyaffs not successfully compiled!
Never mind. I fixed it already.
So I'll share. If you run into that error just open up a new terminal and type:
Code:
su -
yum install glibc-devel.x86_64 --disablerepo=adobe\*
Simple enough, lol
sir
wildstang83 said:
Never mind. I fixed it already.
So I'll share. If you run into that error just open up a new terminal and type:
Code:
su -
yum install glibc-devel.x86_64 --disablerepo=adobe\*
Simple enough, lol
Click to expand...
Click to collapse
do you know how to add device in android kitchen?

[Solved] Mount a blank.img formated to ext? to bypass permission limitations?

I was wondering if I could mount an empty.img file so that I could add executable into it and chmod 777 them or what ever the number is maybe 666.
Then I would add the location to my $PATH variable in the "/system/etc/mkshrc" file so I could execute those programs from any directory.
What say you?
Has this been done before?
It works!
Well, I wen ahead and tried it out, I figured "What the hell, its not like I have to format my sd card." It worked!
So what I did
1) I changed directories to Downloads. ("cd ~/Downloads")
2) I created a directory for my image in Downloads, and moved into it. (mkdir image && cd ./image)
3) I created an empty 4 gig image called apps.img using dd ("dd if=/dev/zero of=apps.img bs=1MB count=0 seek=4096")
4) I formated it to ext2 ("mke2fs -F apps.img")
5) I used adb to push it to my phone ("adb push ~/Downloads/image/apps.img /storage/sdcard0/Download/")
6) Then on my phone as su I mounted the image ("mount -o loop '/storage/sdcard0/Download/apps.img' '/data/local/mnt' ") {with single quotes around the directories, the double quotes wrap the whole actual command, you don't need them} [EDIT: I used bash on the phone to do this, ie I "su" [enter] ; "bash" [enter] ; "THE ABOVE COMMAND" [enter]
7) To test I used the python interpreter as my executable so I created a folder in /data/local/mnt called apps,(note* I should have made that folder on my pc before I pushed it to my phone to ensure that the foder was actually in the apps.img file.) I created two more folders "bin" and "lib" using "File Manager" on my phone. I then moved what I needed to run python into those folders (though you'll see I forgot something)
8) I added PYTHONHOME PYTHONPATH and added the bin folder I created to $PATH in the /system/etc/bash/bashrc file (Ask and I'll explain). If you don't have bash the mkshrc file is located "/system/etc/mkshrc" on your phone (if its Sprint SGSIII) adding environment variable there will accomplish the same thing, sorta.
9) I connected my phone to pc w/usb, opened up a teminal on pc, started an adb shell
10)........
Code:
[email protected]:~$ adb devices
List of devices attached
xxxxxxxx device
[email protected]:~$ adb shell
[email protected]:/ $ su
[email protected]:/ # bash
void endpwent()(3) is not implemented on Android
localhost / # which python
/data/local/mnt/apps/bin/python
localhost / # python
'import site' failed; use -v for traceback
Python 2.6.2 (r262:71600, Mar 20 2011, 16:54:21)
[GCC 4.4.3] on linux-armv7l
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import sys
>>> import math
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named math
>>> import io
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/io.py", line 63, in <module>
ImportError: No module named _fileio
>>>
localhost / # exit
[email protected]:/ # ^D
[email protected]:/ $ ^D
[email protected]:~$
I'm thinking that if I can get my mkbootimg tools to work, I would mod an init script to mount the apps.img and then create links for each file in say '/mnt/apps/bin' create a link*in '/system/bin'. this should allow for phones with small or near full system partition install stuff like busybox or your own pprograms. More usefull for a developer.
I wanna try this with pythonforandroid, if I can make python and its modules. accessible during early init or just before the boot process finishes in general, and use it to run python, maybe python can handle boot in a different way, or maybe just one specific. function you might needs.
one big question I have. Does the pythonforandroid interpreter run ontop of the D VM?
Edge-Case said:
I'm thinking that if I can get my mkbootimg tools to work, I would mod an init script to mount the apps.img and then create links for each file in say '/mnt/apps/bin' create a link*in '/system/bin'. this should allow for phones with small or near full system partition install stuff like busybox or your own pprograms. More usefull for a developer.
I wanna try this with pythonforandroid, if I can make python and its modules. accessible during early init or just before the boot process finishes in general, and use it to run python, maybe python can handle boot in a different way, or maybe just one specific. function you might needs.
one big question I have. Does the pythonforandroid interpreter run ontop of the D VM?
Click to expand...
Click to collapse
I don't think so. All command-line programs I know of interface directly with the kernel.
Sent from my S3 on Sense 5 (you jelly?)
CNexus said:
I don't think so. All command-line programs I know of interface directly with the kernel.
Sent from my S3 on Sense 5 (you jelly?)
Click to expand...
Click to collapse
So getting an extended set of Linux (kernel) cli programs working with Android (kernel) is a matter of having the nessissary libraries, kernel prereq., and being compiled for the target processor?
From what I have read, the Android kernel has been cut back so far from the original Linux kernel that its difficult to port "Linux apps" to Android. Something about a slimmed down version of the GNU C/C++ libraries and the Android kernel being designed to run mostly Dalvik.
I haven't tried directly running any "Linux app" (already compiled for arm) on Android yet, but my game plan for that test was to load up an .img file with the nessissary execs, libs, config, etc files (as ext3 this time) and running some scripts that get the paths variables set up and then execute the script, I wrote a short Bash script that sets up python variables and adds others to PATH etc, and it worked, I had python on the img and the img mounted to /mnt/myside and python ran but with some errors, I need to get the variables right, its driving me mad, if its not this its that, last time it was the basic "help()" command not being declaired or something.
Well thats my plan, either these "Linux apps" run on Android without problem or I am going to A) write my own kernel to be compatible with Android/ cli Linux or I am going to get as much source code as I can and practice the art of compiling against Android and/or patching the code when/where nessissary.
We'll see what happens, I've done enough today/night.

[Nexus Player Root][LMY47D][5.1.0] root-boot - 03|26|2015

I am not responsible for whatever may happen to you or your device when using this, Run this at your own risk!!
Requires unlocked bootloader!
Based on SuperSU - v4.46 (the binary updates from within the app later on)
I put together root installer script that comes with SU-binary/App with a insecure boot.img, everything is done over adb shell since we don't have a recovery right now but i will be working on it and already booted CWM
For current firmware:
LMY47D - root-boot
For past firmware:
LRX21V - root-boot
For past firmware:
LRX21M - root-boot
crappy video but simple demonstration :good:​How to install:
Download the zip depending on your Nexus Player's firmware than extract & run root-boot.bat (Other operating system support coming soon for the installer script) Made on windows 7
Follow and read the on screen instruction carefully
Click to expand...
Click to collapse
SU app and binarys gets installed to /system/* directory's, The insecure boot.img gets installed to be able to access root adb shell and install those binarys
The root-boot boot.img is temporarily booted once during this process on the first boot of installation, it does not flash the boot.img
The previous boot.img before the installation is restored after SU is installed
Click to expand...
Click to collapse
Thanks @Chainfire for Superuser
My Donation Box​
Troubleshooting:
Check to make sure your device gets picked up in adb before running the script - - - ADB Drivers
This tool uses an unlocked bootloader and i have not unlocked mine yet, does unlocking the bootloader wipe the device? - - - Yes unlocking the bootloader will wipe the device
After fastboot flashed the boot.img than rebooted to the home screen i continued the the script like the installation steps said but it returned "device not found" - - - As long as it shows transferring files a few seconds after than its fine, adb restarts at that moment which will than return "device not found" than it reconnects and transfers. if fastboot flashed than rebooted fine than adb shouldn't have an issue
Help! Something went wrong and im bootlooping but i dont want to loose all my saved data - - - Everything is fine, Download the factory zip from here for your android version than extract the zip and retrieve the system.img and copy it into a folder that contains adb/fastboot and boot your device into fastboot mode and do "fastboot flash system system.img" doing it this way wont wipe your "/data" partition leaving everything intact but will restore the system back to its defaults
(If you were to run the factory zip as an update than it would format everything)
I installed SU with this method but cant use adb commands on my device - - - Go into "Settings>About" and click on "Build" 7 times very fast and it will enable "Developer options" in the settings menu, Go back to the settings menu and open developer options (You may need to reboot if it doesnt show up immediately) and enable the "USB debugging" option
Ill be updating this as new version of lollipop get released
support for both firmwares are up, any issues let me know i tested them both though and everything looked okay
Reuploading, had a minor issue
Edit: LRX21M link back up, let me know if there's any issues
Whoa...
Let the games begin....
ftarules said:
Whoa...
Let the games begin....
Click to expand...
Click to collapse
yeup, after recovery i have a few system modification ideas for the settings apk i was considering
i do have other devices to worry about though so it may take some time
bunchies said:
I put together root installer script that comes with SU-binary/App with a insecure boot.img, everything is done over adb shell since we don't have a recovery right now but i will be working on it and already booted CWM
For current firmware:
LRX21V - root-boot
Click to expand...
Click to collapse
Working well, Thank you, after semi-manually adapting for working from Linux Mint.
I don't have permission to do "adb logcat" or "adb shell logcat" anymore though, unless I restart adbd as root.
mikereidis said:
Working well, Thank you, after semi-manually adapting for working from Linux Mint.
I don't have permission to do "adb logcat" or "adb shell logcat" anymore though, unless I restart adbd as root.
Click to expand...
Click to collapse
Use adb shell
than type su to use root adb shell
Since running the script everything seems all good except for using voice search. Anybody else having issues where voice search just closes?
Update: Erased and manually flashed the V firmware as I was on M and now it appears to be working correctly, not sure if this is going to be a problem with people stuck on M for now but you may want to think of upgrading your fimware.
Getting ADB device not found.. Anywhere I can download drivers from? I have the latest android-sdk
xReaper7x said:
Getting ADB device not found.. Anywhere I can download drivers from? I have the latest android-sdk
Click to expand...
Click to collapse
http://developer.android.com/sdk/win-usb.html
at what point, adb will restart about half way through and it shows it cant connect to device but it really is
but if your in fastboot and it cant connect to the device than thats an issue
i should note this in the OP
Subscribed for later. Awaiting someone else to port a recovery for this, I am lazy.
Snuzzo said:
Subscribed for later. Awaiting someone else to port a recovery for this, I am lazy.
Click to expand...
Click to collapse
lol Snuzzo :good: recovery coming soon
Links are down. Does anyone have a mirror of 21V?
prsterero said:
Links are down. Does anyone have a mirror of 21V?
Click to expand...
Click to collapse
Links are up, hosted on android file host
Can mirror in a bit if needed
bunchies said:
Links are up, hosted on android file host
Can mirror in a bit if needed
Click to expand...
Click to collapse
Looks like it's working now. Before I was getting that the file couldn't be found. Thanks I appreciate you releasing this I just got it unlocked so time to root and have some fun expanding the storage to 128gb
Alright so I just got around to running the script, and none of the commands work after booting back up. There's a failure for every rmdir and mkdir command that's used, so the device doesn't get rooted. I tried doing a adb remount, but the device isn't allowing that.
________________________________________________________
root-boot: By Bunchies @xda
________________________________________________________
________________________________________________________
Power off/unplug the device, hold the power button while
plugging in the device until you see the google logo and
than let go to enter fastboot mode
________________________________________________________
________________________________________________________
Plugin the device to a PC using a usb cable
________________________________________________________
Press any key to continue . . .
waiting for ADB
target reported max download size of 536870912 bytes
sending 'boot' (5424 KB)...
OKAY [ 1.357s]
writing 'boot'...
OKAY [ 1.515s]
finished. total time: 2.876s
rebooting...
finished. total time: 0.602s
When boot completes
and you see the launcher
Press any key to continue . . .
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
error: device not found
error: device not found
error: device not found
error: device not found
error: device not found
error: device not found
error: device not found
rm: /system/bin/install-recovery.sh: Read-only file system
mkdir failed for /system/app/SuperSU, Read-only file system
mkdir failed for /system/bin/.ext, Read-only file system
failed to copy 'SuperSU/SuperSU.apk' to '/system/app/SuperSU/': Is a directory
failed to copy 'x86/su' to '/system/xbin/su': Read-only file system
failed to copy 'x86/supolicy' to '/system/xbin/supolicy': Read-only file system
failed to copy 'x86/libsupol.so' to '/system/lib/libsupol.so': Read-only file sy
stem
failed to copy 'x86/99SuperSUDaemon' to '/system/etc/init.d/99SuperSUDaemon': Re
ad-only file system
failed to copy 'x86/install-recovery.sh' to '/system/etc/install-recovery.sh': R
ead-only file system
cp: system/xbin/su: No such file or directory
cp: system/xbin/su: No such file or directory
cp: system/xbin/su: No such file or directory
cp: /system/xbin/sugote-mksh: Read-only file system
ln: /system/bin/su: Read-only file system
ln: /system/bin/install-recovery.sh: File exists
rm: /system/bin/app_process: Read-only file system
ln: /system/bin/app_process: File exists
mv: rename /system/bin/app_process32 to /system/bin/app_process32_original: Read
-only file system
ln: /system/bin/app_process32: File exists
cp: /system/bin/app_process32_original: No such file or directory
Unable to chmod /system/app/SuperSU: No such file or directory
Unable to chmod /system/app/SuperSU/SuperSU.apk: No such file or directory
Unable to chmod /system/xbin/su: No such file or directory
Unable to chmod /system/lib/libsupol.so: No such file or directory
Unable to chmod /system/bin/.ext: No such file or directory
Unable to chmod /system/bin/.ext/.su: No such file or directory
Unable to chmod /system/etc/init.d/99SuperSUDaemon: No such file or directory
Unable to chmod /system/xbin/daemonsu: No such file or directory
Unable to chmod /system/xbin/sugote: No such file or directory
Unable to chmod /system/xbin/sugote-mksh: No such file or directory
Unable to chmod /system/etc/install-recovery.sh: No such file or directory
Unable to chmod /system/xbin/supolicy: No such file or directory
Unable to chmod /system/bin/app_process32_original: No such file or directory
Unable to chmod /system/bin/app_process_init: No such file or directory
chcon: Could not label /system/xbin/su with ubject_r:system_file:s0: No such
file or directory
chcon: Could not label /system/bin/.ext/.su with ubject_r:system_file:s0: No
such file or directory
chcon: Could not label /system/lib/libsupol.so with ubject_r:system_file:s0:
No such file or directory
chcon: Could not label /system/etc/init.d/99SuperSUDaemon with ubject_r:syste
m_file:s0: No such file or directory
chcon: Could not label /system/bin/sh with ubject_r:system_file:s0: Read-onl
y file system
chcon: Could not label /system/xbin/sugote with ubject_r:zygote_exec:s0: No
such file or directory
chcon: Could not label /system/xbin/supolicy with ubject_r:system_file:s0: N
o such file or directory
chcon: Could not label /system/xbin/sugote-mksh with ubject_r:system_file:s0:
No such file or directory
chcon: Could not label /system/bin/app_process32_original with ubject_r:zygot
e_exec:s0: No such file or directory
chcon: Could not label /system/bin/app_process_init with ubject_r:system_file
:s0: No such file or directory
Finished, you can now exit the installer
Press any key to continue . . .
Edit: Fixed it! I had to manually do "adb root" then "adb remount" and remount succeeded that time and I was able to run the rest of the script and saw all the file transfers.
prsterero said:
Alright so I just got around to running the script, and none of the commands work after booting back up. There's a failure for every rmdir and mkdir command that's used, so the device doesn't get rooted. I tried doing a adb remount, but the device isn't allowing that.
Edit: Fixed it! I had to manually do "adb root" then "adb remount" and remount succeeded that time and I was able to run the rest of the script and saw all the file transfers.
Click to expand...
Click to collapse
Glad to hear that!
bunchies said:
Glad to hear that!
Click to expand...
Click to collapse
The first time around I got into the bootloop so I had to start over. Second time and it worked now it seems that I can't get apps to install through the adb install command. I'm mainly trying to get es file explorer and stick mount so I can use an external flash drive. Is it possible that the root method somehow nuked this functionality? I've already restarted the adb server numerous times, rebooted the player, turned debugging off and back on, etc. Even after all that it just sits after displaying the transfer rate and never finishes.
Edit: Nevermind. Looks like this issue also goes back to having to do adb root and adb remount. Gotta do it for everything apparently
prsterero said:
The first time around I got into the bootloop so I had to start over. Second time and it worked now it seems that I can't get apps to install through the adb install command. I'm mainly trying to get es file explorer and stick mount so I can use an external flash drive. Is it possible that the root method somehow nuked this functionality? I've already restarted the adb server numerous times, rebooted the player, turned debugging off and back on, etc. Even after all that it just sits after displaying the transfer rate and never finishes.
Edit: Nevermind. Looks like this issue also goes back to having to do adb root and adb remount. Gotta do it for everything apparently
Click to expand...
Click to collapse
Weird, windows 8?

Setting up a self-signed (restrictive) recovery for self-signed ROMs

Has anyone installed self signed ROMs using the method described in this blog http://mjg59.dreamwidth.org/31765.html? The goal is to install a self signed image that allows you to only install images signed by a key you generate yourself to avoid the giant security hole caused by custom recoveries that don't check signatures.
Here's the overview :
First: Unlock your bootloader. /data will be wiped.
Second: Get a copy of the stock recovery.img for your device.
Third: Grab mkbootimg from here and build it. Run unpackbootimg against recovery.img.
Fourth: Generate some keys. Get this script and run it.
Fifth: zcat recovery.img-ramdisk.gz | cpio -id to extract your recovery image ramdisk. Do this in an otherwise empty directory.
Sixth: Get DumpPublicKey.java from here and run it against the .x509.pem file generated in step 4. Replace /res/keys from the recover image ramdisk with the output. Include the "v2" bit at the beginning.
Seventh: Repack the ramdisk image (find . | cpio -o -H newc | gzip > ../recovery.img-ramdisk.gz) and rebuild recovery.img with mkbootimg.
Eighth: Write the new recovery image to your device
Ninth: Get signapk from here and build it. Run it against the ROM you want to sign, using the keys you generated earlier. Make sure you use the -w option to sign the whole zip rather than signing individual files.
Tenth: Relock your bootloader
Eleventh: Boot into recovery mode and sideload your newly signed image.
Click to expand...
Click to collapse
I have the 8" Tab (SM-T310) and want to try it. Anyone know if there's an official source of stock recovery images? I have the 4.4.2 update.zip from an OTA update I never installed (my tablet's still on stock 4.2.2), can the recovery somehow be extracted from that? Since I'm still on 4.2.2, I don't need to unlock the bootloader, right? Can I use Heimdall to put the new recovery on the tab?
Here's my step by step if anyone else is crazy enough to try this.
First: Unlock your bootloader. /data will be wiped.
Click to expand...
Click to collapse
Skipped so far, running 4.2.2 which from what I've been reading I think isn't locked.
Second: Get a copy of the stock recovery.img for your device.
Click to expand...
Click to collapse
Grabbed the update from Kies (on Windows VM):
Agreed to Kies update when I plugged in the tablet.
Watched my temp folder (from windows search bar enter %temp%) until tmp*.tmp.zipfolder showed up (wait for tmp*.tmp file to download and get converted to a zip, then it unzips into zipfolder automatically), unplugged the tablet immediately as it booted into download mode, copied tmp*.tmp.zipfolder somewhere else (desktop) before Kies cancelled the update process and deleted the temp files.
Third: Grab mkbootimg from here and build it. Run unpackbootimg against recovery.img.
Click to expand...
Click to collapse
Source is on github: osm0sis/mkbootimg From here on I'm using linux.
cd into mkbootimg folder and run "make"
run
Code:
./unpackbootimg -i recovery.img -o rec
(rec is the folder I unpacked to, make the folder first or it'll segfault)
Fourth: Generate some keys. Get this script and run it.
Click to expand...
Click to collapse
Saved script (posted below, can't post links yet...) to "make_key.sh", then
Code:
chmod +x make_key.sh
to make it executable.
Ran script, usage: /make_key.sh <name> <subject> [<keytype>]
subject must be in the format "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=example.com" (look up "Create CSR using OpenSSL Without Prompt (Non-Interactive)" for what all that means)
Fifth: zcat recovery.img-ramdisk.gz | cpio -id to extract your recovery image ramdisk. Do this in an otherwise empty directory.
Click to expand...
Click to collapse
Make a directory, cd into it, run
Code:
zcat recovery.img-ramdisk.gz | cpio -id
with recovery.img-ramdisk.gz pointing to where your file is (mine was ../recovery.img-ramdisk.gz).
Sixth: Get DumpPublicKey.java from here and run it against the .x509.pem file generated in step 4. Replace /res/keys from the recover image ramdisk with the output. Include the "v2" bit at the beginning.
Click to expand...
Click to collapse
Not sure why he's using a different DumpPublicKey.java than the one that's in the mkbootimg git... but it's in the "libmincrypt/tools/DumpPublicKey.java" that was in the mkbootimg git, I didn't see any differences using diff.
Running
Code:
javac DumpPublicKey.java
tells me I need BouncyCastleProvider. And now I'm stuck.
Downloaded the Bouncy Castle jar and put it in the same folder as DumpPublicKey.java and ran
Code:
javac -cp bcprov-jdk15on-152.jar DumpPublicKey.java
echo "Main-Class: DumpPublicKey" > manifest.txt
jar cvfm DumpPublicKey.jar manifest.txt DumpPublicKey.java
Then running
Code:
java com.android.dumpkey.DumpPublicKey
gave me various class not found errors and I ended up with a file structure like this trying to make it find the bouncy castle. Annnnnd I'm stuck.
.
├── bcprov-jdk15on-152.jar
├── com
│** └── android
│**** └── dumpkey
│****** ├── bcprov-jdk15on-152.jar
│****** ├── DumpPublicKey.class
│****** ├── DumpPublicKey.jar
│****** ├── DumpPublicKey.java
│****** └── manifest.txt
├── DumpPublicKey.class
├── DumpPublicKey.java
└── manifest.txt
I obviously don't know how to java at all.... any suggestions?
I just needed to put the "-cp" in the java command as well as the javac command.
Code:
java -cp .:./bcprov-jdk15on-152.jar com.android.dumpkey.DumpPublicKey
The full command is
Code:
java -cp .:./bcprov-jdk15on-152.jar com.android.dumpkey.DumpPublicKey /path/to/key.x509.pem > keys
After deleting stuff and testing, I found I only needed files in these locations:
.
├── bcprov-jdk15on-152.jar
├── com
│** └── android
│** └── dumpkey
│** ├── DumpPublicKey.class
│** └── DumpPublicKey.jar
├── DumpPublicKey.java
└── manifest.txt
Then I replaced the "/res/keys" file with the "keys" file I just made.
Seventh: Repack the ramdisk image (find . | cpio -o -H newc | gzip > ../recovery.img-ramdisk.gz) and rebuild recovery.img with mkbootimg.
Click to expand...
Click to collapse
From the folder that the ramdisk image was extracted into, run
Code:
find . | cpio -o -H newc | gzip > ../recovery.img-ramdisk.gz
mkbootimg needs offsets that were printed when I ran unpackbootimg:
BOARD_KERNEL_CMDLINE
BOARD_KERNEL_BASE 10000000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 01000000
BOARD_TAGS_OFFSET 00000100
Still in the folder where I unpacked the recovery image (mkbootimg is one directory up)
Code:
../mkbootimg --kernel recovery.img-zImage --ramdisk recovery.img-ramdisk.gz --base 10000000 --pagesize 2048 --kernel_offset 00008000 --ramdisk_offset 01000000 --tags_offset 00000100 -o newrecovery.img
Eighth: Write the new recovery image to your device
Click to expand...
Click to collapse
This thread says Heimdall 1.4.0 works for T31x: http://forum.xda-developers.com/showthread.php?t=2522091
Oh how nice, Heimdall 1.4.1 is in my package manager.
Connect device and restart in download mode (held the "HOME" button, "Volume Down" and "Power" all at the same time (for about 5 seconds). Hit the "Volume Up" to enter download mode when prompted.)
Code:
sudo heimdall flash --verbose --no-reboot --RECOVERY recovery.img
Ninth: Get signapk from here and build it. Run it against the ROM you want to sign, using the keys you generated earlier. Make sure you use the -w option to sign the whole zip rather than signing individual files.
Click to expand...
Click to collapse
signapk is on github in android/platform_build/tools. And it gives more bouncy castle errors. Put bcpkix-jdk15on-152.jar and bcprov-jdk15on-152.jar in the signapk folder and run
Code:
javac -cp .:./bcprov-jdk15on-152.jar:./bcpkix-jdk15on-152.jar SignApk.java
echo "Main-Class: SignApk" > manifest.txt
jar cvfm SignApk.jar manifest.txt SignApk.java
make directory com/android/signapk/ and move in all the *.class files and the SignApk.jar
Code:
java -cp .:./bcprov-jdk15on-152.jar:./bcpkix-jdk15on-152.jar com.android.signapk.SignApk /path/to/key.x509.pem /path/to/key.pk8 ../original.zip ../signed.zip
I just replaced the recovery in the OTA with the recovery with my keys from earlier, then rezipped it before signing. And after starting sideloading I noticed I left the "-w" option off the signing command, so I made another file with "-w".
Sideloaded with:
Code:
adb reboot recovery
(then volume down to select apply update from ADB)
adb sideload signed.zip
Then saw:
loading: 'update.zip'
sending: 'update.zip' <completion percent>
(might have to do some adb stopping/starting or adb usb beforehand to make it work, I was getting "error: closed" at first. If it just sits on "loading" something's wrong, as I found out last night when I waited hours for "loading" to turn into something else.)
After the file finished uploading, In terminal I got the response "* failed to write data 'protocol fault (couldn't read status): Success' *"
And on the device I got (for a few seconds before it showed only the sad robot on its back). Then after a couple minutes it rebooted back into recovery.
E: Footer is wrong
E: Footer is wrong
E: Signature verification failed
Installation aborted
So I tried again, but this time selected the option to wipe the cache before adb sideload. Then I tried again, using the update.zip that I forgot to add the "-w" option when signing. So far all fails.
I have no idea if the issue is how the recovery was flashed or what, so I'm doing it manual...
Code:
adb shell
su
#first backup current recovery
dd if=/dev/block/mmcblk0p10 of=/sdcard/recoverybk.img
adb pull /sdcard/recoverybk.img
# now push and dd my signed recovery
adb push /sdcard/recovery.img
dd if=/sdcard/recovery.img of=/dev/block/mmcblk0p10
And still having the same signature verification issue.
Edit: I went back and unpacked the recovery I pulled off the device (unpackbootimg), and it looks like somehow I managed to run mkbootimg with the old ramdisk image.
New problem with the new recovery: "E:failed to load keys". Maybe it had something to do with using ec keys just for funsies. So I remade the keys with the default, redumped into the ramdisk image, rebuild/reflashed recovery, resigned the update.zip. Now it's back to the "footer is wrong, signature verification failed" error.
But this is still trying to use the OTA 4.4.something update, not a full ROM. What's it do with Cyanogen?
First attempt: Download Cyanogen and sideload it (unmodified)
E:failed to verify whole-file signature
E:signature verification failed
Ok, expected behavior, it's not signed with my keys.
Attempt 2: sign Cyanogen with my keys and sideload it
Install from ADB complete!! Success!!
@user0002,
great thread! have you considered assembling a toolkit/suite for this process?
Thanks.
m
moonbutt74 said:
@user0002,
great thread! have you considered assembling a toolkit/suite for this process?
Thanks.
m
Click to expand...
Click to collapse
Hmmm... that's a good idea.

[Root] [Script] OTA Killer for LG K7 m1 and other devices

Disclaimer: I nor XDA nor anyone else is responsible for your lack of reading or comprehension skills, ignorance on your part or anyone else's nor just plain stupidity on your part or anyone else's, so if you don't know what you're doing and or don't know how to fix any bad things that could happen then just don't do it.
Root and Busybox required.
This is a more permanent solution to stop OTA updates from downloading on your rooted device that is designed to survive when you wipe /cache. I'm including the script which will work on any device that downloads it's OTA updates as update.zip to /cache without modification and a flashable zip, the flashable zip is for the LG K7 m1 Metro PCS variant rooted with Magisk ONLY (unless modified) and was fully tested, you're free to edit the script and or the updater-script in the flashable zip for your device (be sure you get the /system partition for your device right, the init process right if not rooted with Magisk and the proper location and file name for your OTA updates) and you may release it for others to use if you like but please give appropriate credit. The script can simply be dropped in your appropriate init folder (/data/adb/service.d/ for Magisk) and set chmod 0700 before rebooting your device.
Alternately you can use MacroDroid to run the script at boot.
Trigger > Device Events > Device Boot
Action > Applications > Shell Script (Paste script on line)
The rest should be self-explanatory.
Thanks to QuickNET Tech for coming up with this method. You can and should read about it HERE and follow up with part 3 from their post so you don't get the annoying notifications. Instructions for reversing this modification are also in that thread, in addition to those instructions you'll also need to delete the 22otakiller script from your init directory (default is /data/adb/service.d/).
QuickNET Tech said:
-Part 3. [Optional]
The annoying update notifications are actually Google Play Services fault. All you have to do is go to "Settings > Apps" and find Google play services and disable the apps ability to show you notifications.
Click to expand...
Click to collapse
What this script does:
The script (see bottom of this post) when ran either automatically on boot or manually will check for update.zip in /cache, if it exist but wasn't created by the script or using the same method with the appropriate attribute applied then it will delete it (regardless of size including an authentic update.zip file) and create the appropriate 0 byte update.zip file with the appropriate attribute and permissions, if it doesn't exist it will create the appropriate file with the appropriate attribute and permissions. It creates a 0 byte update.zip that can not be modified or deleted by anyone including the super user without removing the file attribute which can only be removed by the super user. The flashable zip for the LG K7 rooted with Magisk ONLY (unless edited for your device and or root method) will install the script to /data/adb/service.d/ and set it's permissions to 0700.
Please let me know and post your device information if the updater-script in the flashable zip works as-is with your device.
Enjoy!
Script (22otakiller):
Code:
#!/system/bin/sh
uzip="/cache/update.zip"
if [ -f "$uzip" ] && lsattr "$uzip" | cut -c 6 | fgrep -q 'i'
then
exit
elif [ -f "$uzip" ]
then
rm -f $uzip
touch $uzip
chmod 7400 $uzip
chattr +i $uzip
exit
else
touch $uzip
chmod 7400 $uzip
chattr +i $uzip
exit
fi
Been a long time since I've been on this site seeing as most every device after the K7 hasn't had any development. Glad to see people are still messing with this device. Good work man!

Categories

Resources