Tutorial for modifying stock android wear images. - LG Watch Urbane 2

This is a tutorial to make your own system image from the original stock image and is not a comprehensive instruction set, but can probably be used on other devices. Before you start the process read the instructions as many times as necessary to completely understand what you are doing. With that I am not responsible for any misuse or problems that may arise from any usage of these instructions or any files provided currently or in the future. If you do not believe that the benefits outweigh the risk, then do not use the information/files. I encourage anyone who does use these instructions to upload and post their images here, but if you do post please test your system image before it is uploaded to ensure that there is nothing that can be harmful to others. I will allow those who are not able or afraid, to post requests for those who can. This instruction set will not allow you to modify the system image from the device directly, because squashfs is read only by default Squashfs, but you can make changes to the system image and flash a modified stock image to the device.
The required materials for this tutorial is a linux computer with either dual boot capabilities or virtual operating system capabilities that has windows, along with the original update suppled here:update.zip or the TWRP flashable zip version uploaded within this forum in another thread. You will also need platform-tools/fastboot from Google.
Five items before you start:
1. In order to do this you will need to understand Linux and Linux terminal commands, I will not give an instruction of this here you will also need to download and understand the commands within adb and fastboot please search for these and read as many times as needed to understand.
2. You will need to understand that not everything in the system image can be changed or correctly flashed, system partitions are usually confined to a certain size and you can only flash up to that amount, this may be different with Android Wear, but beware of size limitations.
3. BACKUP. Make sure you have a backup of everything needed before flashing including original or TWRP modified flashing images, because errors can easily happen that can make the phone unusable until reflashed.
4. If you cannot make the image yourself and are requesting, please be patient and remember you may not be able to get what you wanted or anything at all, especially if you are expecting quick results (it is up to the ones who are willing to take their time and put it together if at all possible).
5. When flashing make sure not to disturb the process, it may be a long time until it completes the flashing depending on the parameters setup within the process, also initial boot can take a long time depending upon what was put into the specific process.
First you will need the system image, if you get from the update zip supplied by LG you can unzip it then you have a number of files of which you probably won’t need except for two the largest file system.new.dat and also system.transfer.list. I have already completed the process for the most recent image as of today, It is at system.img. You will need the program at Extract (windows), be sure to thank the developer. Extract and open the program then place both the system.new.dat and system.transfer.list and follow the instructions to the point where it indicates there is a problem in the app and that something has failed, once that happens immediately close the command prompt then the failed program and copy the system.img.img located within the folder to another folder, rename it system.img. Next you need Linux, Ubuntu works for most, because it’s the easiest one to use. Now we will use unsquashfs to turn the system image to a folder that we could use and make modifications to. In order to use the unsquashfs we will need root, so in terminal type sudo unsquashfs system.img and enter your password, this will give us a folder named squashfs-root. The folder will be owned by root, because we entered sudo before unsquashfs, but it is required for the image to unpack correctly. Now you have two choices from here one is to take ownership of the folder to make changes (will make it easier to make changes, but can substantially make it harder to ensure that it will flash correctly), or two to make the changes within terminal, this is the point where knowledge of terminal commands will be required. After you have made your changes we will need to make it into a squashfs again, but first you need to know what the parameters of the system image we have, to do this we will go back to unsquashfs, this time we will use unsquashfs -s system.img, that will give you the exact superblock parameters needed to do mksquashfs. Now that we know what parameters to use for mksquashfs we will create the new squashfs image, I have given the information specific to the Urbane 2 from the image provided earlier with one change I added -Xhc, mainly because when that is not used your file can be larger than the original, which will make flashing take longer, you are not required to use it to repack the image. If you are not using the image supplied the parameters provided may not work, but you can easily figure it out from the unsauashfs superblock information that you did previously. If you are unsure of how to unsquashfs or mksquash commands, just type either one into terminal, that will give you the syntax for it, once again I have completed this and have attached it below. After you have the modified image all you have to do is go to the bootloader and flash the image, you will need to install and/or download any necessary platform-tools/fastboot utilities. Now it is required to move or copy the image to that folder. To flash the image just enter fastboot flash system system.img and you have a modified stock image installed on the device (you will probably need root for this to be successful for this type sudo su. As a simple proof you can compare the original with this one I uploaded modified-system.img, the only change I made was in build.prop, in the LCD density, where on the original it is at ro.sf.lcd_density=340 and my modified version is ro.sf.lcd_density=240. If you are helped by this tutorial please donate to a charitable organization.

physicistman said:
This is a tutorial to make your own system image from the original stock image and is not a comprehensive instruction set, but can probably be used on other devices. Before you start the process read the instructions as many times as necessary to completely understand what you are doing. With that I am not responsible for any misuse or problems that may arise from any usage of these instructions or any files provided currently or in the future. If you do not believe that the benefits outweigh the risk, then do not use the information/files. I encourage anyone who does use these instructions to upload and post their images here, but if you do post please test your system image before it is uploaded to ensure that there is nothing that can be harmful to others. I will allow those who are not able or afraid, to post requests for those who can. This instruction set will not allow you to modify the system image from the device directly, because squashfs is read only by default Squashfs, but you can make changes to the system image and flash a modified stock image to the device.
The required materials for this tutorial is a linux computer with either dual boot capabilities or virtual operating system capabilities that has windows, along with the original update suppled here:update.zip or the TWRP flashable zip version uploaded within this forum in another thread. You will also need platform-tools/fastboot from Google.
Five items before you start:
1. In order to do this you will need to understand Linux and Linux terminal commands, I will not give an instruction of this here you will also need to download and understand the commands within adb and fastboot please search for these and read as many times as needed to understand.
2. You will need to understand that not everything in the system image can be changed or correctly flashed, system partitions are usually confined to a certain size and you can only flash up to that amount, this may be different with Android Wear, but beware of size limitations.
3. BACKUP. Make sure you have a backup of everything needed before flashing including original or TWRP modified flashing images, because errors can easily happen that can make the phone unusable until reflashed.
4. If you cannot make the image yourself and are requesting, please be patient and remember you may not be able to get what you wanted or anything at all, especially if you are expecting quick results (it is up to the ones who are willing to take their time and put it together if at all possible).
5. When flashing make sure not to disturb the process, it may be a long time until it completes the flashing depending on the parameters setup within the process, also initial boot can take a long time depending upon what was put into the specific process.
First you will need the system image, if you get from the update zip supplied by LG you can unzip it then you have a number of files of which you probably won’t need except for two the largest file system.new.dat and also system.transfer.list. I have already completed the process for the most recent image as of today, It is at system.img. You will need the program at Extract (windows), be sure to thank the developer. Extract and open the program then place both the system.new.dat and system.transfer.list and follow the instructions to the point where it indicates there is a problem in the app and that something has failed, once that happens immediately close the command prompt then the failed program and copy the system.img.img located within the folder to another folder, rename it system.img. Next you need Linux, Ubuntu works for most, because it’s the easiest one to use. Now we will use unsquashfs to turn the system image to a folder that we could use and make modifications to. In order to use the unsquashfs we will need root, so in terminal type sudo unsquashfs system.img and enter your password, this will give us a folder named squashfs-root. The folder will be owned by root, because we entered sudo before unsquashfs, but it is required for the image to unpack correctly. Now you have two choices from here one is to take ownership of the folder to make changes (will make it easier to make changes, but can substantially make it harder to ensure that it will flash correctly), or two to make the changes within terminal, this is the point where knowledge of terminal commands will be required. After you have made your changes we will need to make it into a squashfs again, but first you need to know what the parameters of the system image we have, to do this we will go back to unsquashfs, this time we will use unsquashfs -s system.img, that will give you the exact superblock parameters needed to do mksquashfs. Now that we know what parameters to use for mksquashfs we will create the new squashfs image, I have given the information specific to the Urbane 2 from the image provided earlier with one change I added -Xhc, mainly because when that is not used your file can be larger than the original, which will make flashing take longer, you are not required to use it to repack the image. If you are not using the image supplied the parameters provided may not work, but you can easily figure it out from the unsauashfs superblock information that you did previously. If you are unsure of how to unsquashfs or mksquash commands, just type either one into terminal, that will give you the syntax for it, once again I have completed this and have attached it below. After you have the modified image all you have to do is go to the bootloader and flash the image, you will need to install and/or download any necessary platform-tools/fastboot utilities. Now it is required to move or copy the image to that folder. To flash the image just enter fastboot flash system system.img and you have a modified stock image installed on the device (you will probably need root for this to be successful for this type sudo su. As a simple proof you can compare the original with this one I uploaded modified-system.img, the only change I made was in build.prop, in the LCD density, where on the original it is at ro.sf.lcd_density=340 and my modified version is ro.sf.lcd_density=240. If you are helped by this tutorial please donate to a charitable organization.
Click to expand...
Click to collapse
great guide. will try that later. thx

Where is the stock TWRP flashable rom zip you're referring to in this post? I need to return to stock :-/
Thanks for your help!

Helpful tutorial
very HELPFUL TUTORIAL

Modified system image not boot after flash.

Related

[GUIDE] How to create a your own ROM

How to create your own ROM update.zip for the T-Mobile MyTouch 3G
Things you will need to perform this:
Java SE Dev Kit from Sun. java.sun.com
May need Cygwin with zlib0 package, from cygwin.com
This will give you Android 1.6 with all the Google applications, Root access.
I never found one place where all this information is all together, so that is why I compiled this together.
Now anyone can do this themselves.
Thanks to all the hard work others have done before this.
1.
First Root your phone and install a new Recovery image, either Amon Ra or Cyanogens Recovery image.
Instructions for one-click root: http://theunlockr.com/2009/08/22/how-to-root-the-mytouch-3g-or-g1-in-one-click/
2.
Download the Android 1.6 System image from
http://developer.htc.com/google-io-device.html
extract the contents of signed-google_ion-img-14721.zip.
3.
You now need to extract the contents of system.img using a tool called unyaffs. The source code is here:
http://code.google.com/p/unyaffs/downloads/list
Or download a prebuilt win32 version here.
http://jiggawatt.org/badc0de/android/index.html
Note you may also need cygwin1.dll and cygz.dll (zlib0 package). Found at cygwin.com
Of course if you already have Cygwin installed with the GCC packages, you can just compile it yourself. Then also
if you comment out the line 67 to "// symlink(oh->alias, full_path_name);"
then it will not create the copies of the symbolic link file, and you will not have to worry about deleting duplicate
symbolic link files later.
Now in the directory where system.img exists, create a new directory called "system"
go into the "system" directory.
type the following command:
unyaffs ..\system.img
That should extract all the files from the system.img file into the system directory.
4.
Now we just need to clean up some items. Since the system.img is a linux file system, it has symbolic
links built into it, but when we extracted it, it just created duplicate files, if you used the prebuilt unyaffs.exe.
So we can just delete the duplicates and have a script recreate the symlink on install.
So we need to delete some extra files from the system\bin directory.
Run the attached DeleteExtras.bat file from the same directory where system.img is in.
If you notice, all the files it deletes are 28 byte files, and if you open them in notepad only contain:
"!<symlink>toolbox..."
And we will remake the symbolic link when it is installed.
5.
Now from the directory where the system.img is, enter the following commands
mkdir META-INF
mkdir META-INF\com
mkdir META-INF\com\google
mkdir META-INF\com\google\android
Now copy the included file "update-script.txt" into the "META-INF\com\google\android" directory
and RENAME it to just "update-script".
This update-script gets run to recreate the symbolic links.
Not sure if these two are needed but they are in some custom ROMs here:
Copy the two files "fix_permissions" and "flash_image" to the "system\bin" directory.
6.
-- Optional --
These add root and Superuser access to the ROM, plus the Terminal Emulator application.
Copy the file "su" from Cyanogen's rom to the folder "system\bin"
Copy the file "Superuser.apk" to the folder "system\app"
Copy the file "Term.apk" to the folder "system\app"
You can also replace the "system\etc\apns-conf.xml" with a more complete one from here:
http://forum.xda-developers.com/showthread.php?t=547718
or here
http://docs.google.com/Doc?docid=0AZNbAmKkmakoZGZxZHNwMnpfMjJkaHg3ejN3eg&hl=en
Turn data roaming off by default by editing line in the build.prop file:
ro.com.android.dataroaming=false
Also to fix the Market program to show "Protected" applications change the ro.build.fingerprint line to the following:
ro.build.fingerprint=tmobile/opal/sapphire/sapphire:1.5/COC10/150449:user/ota-rel-keys,release-keys
Only phones with a fingerprint of a "released" device can access some market applications.
--------------
7.
Now we just need to create a ZIP file for the final ROM
Zip up the following file and two folders:
boot.img
META-INF
system
8.
Now sign the zip file.
See here how to sign a ZIP file for flashing it.
http://androidforums.com/developer-101/8665-how-signing-roms.html
9.
Copy it to your SD card, boot into recovery, wipe, apply the update, Reboot.
You are now running Android 1.6!
the finger print is found in build.prop is this correct and what app do you use to edit your build.prop
Yes the fingerprint is in build.prop
Make sure to use an advanced text editor like TextPad, UltraEdit, or EditPlus. It has to handle UNIX text files.
Also use this for the update_script.
how abt kernel parameters?
How would one go about customizing this with Hero? Or is that not possible at this point?
detox702 said:
How would one go about customizing this with Hero? Or is that not possible at this point?
Click to expand...
Click to collapse
Would like more info on hot to incorporate senseui
Thanks for sharing... Got nothing to do today, so I experimented on my phone... I gotta say, I'm pretty amazed w/ this feature. Was able to sort out and organize my files.
Kudos!
How does one create the system.img file once one has the system files...
What I want to do is use some of the custom roms here and put it on an AVD emulator system.
Can someone help with this please.
NOTE: I dont have linux. So if there is an alternative to mkbootimg, it will be excellent.
the ion is the 32b if I'm not mistaken?
Is there an image for the 32a or do we always have to use the ion and throw a patch over it?
Sorry if this is a stupid question
in step 5. it says
Not sure if these two are needed but they are in some custom ROMs here:
Copy the two files "fix_permissions" and "flash_image" to the "system\bin" directory.
Where do i copy the files from or download please?
thanks in advance
P.S. any tips on changing the splash screen would be much appreciated.
DeleteExtras.txt or DeleteExtras.bat doesn't work. I have to delete the extra files by myself - one by one.
codysoloman said:
DeleteExtras.txt or DeleteExtras.bat doesn't work. I have to delete the extra files by myself - one by one.
Click to expand...
Click to collapse
check this: http://forum.xda-developers.com/showthread.php?t=633246
Perhaps someone here knows or could point me to the right resources, but if the phone isn't supported by Cyanogen, how would a custom rom be made in that case?
How is a custom rom made from scratch? Since android is just linux, is it simply a matter of building it with the right drivers for the phone and installing it? How can an image be manually copied to the phone if it isn't supported by Clockwork recovery? How can it's steps be manually done?
ping pong...
Can i install my own rom on samsung ace?????
anybody knows how to make a ROM customized and make a "update.img" to run on a un-rootable device? I know when you backup a linux image for example ubuntu, this image will run on all other PCs, the image will automatically knows the new PC's drivers and adapt everything with that, is it what happening to an android too ?
---------- Post added at 08:36 AM ---------- Previous post was at 08:33 AM ----------
and pls let me know how to open/edit a "update.img" file, thnx
Question
androidcustomrom said:
How to create your own ROM update.zip for the T-Mobile MyTouch 3G
Things you will need to perform this:
Java SE Dev Kit from Sun. java.sun.com
May need Cygwin with zlib0 package, from cygwin.com
This will give you Android 1.6 with all the Google applications, Root access.
I never found one place where all this information is all together, so that is why I compiled this together.
Now anyone can do this themselves.
Thanks to all the hard work others have done before this.
1.
First Root your phone and install a new Recovery image, either Amon Ra or Cyanogens Recovery image.
Instructions for one-click root: http://theunlockr.com/2009/08/22/how-to-root-the-mytouch-3g-or-g1-in-one-click/
2.
Download the Android 1.6 System image from
http://developer.htc.com/google-io-device.html
extract the contents of signed-google_ion-img-14721.zip.
3.
You now need to extract the contents of system.img using a tool called unyaffs. The source code is here:
http://code.google.com/p/unyaffs/downloads/list
Or download a prebuilt win32 version here.
http://jiggawatt.org/badc0de/android/index.html
Note you may also need cygwin1.dll and cygz.dll (zlib0 package). Found at cygwin.com
Of course if you already have Cygwin installed with the GCC packages, you can just compile it yourself. Then also
if you comment out the line 67 to "// symlink(oh->alias, full_path_name);"
then it will not create the copies of the symbolic link file, and you will not have to worry about deleting duplicate
symbolic link files later.
Now in the directory where system.img exists, create a new directory called "system"
go into the "system" directory.
type the following command:
unyaffs ..\system.img
That should extract all the files from the system.img file into the system directory.
4.
Now we just need to clean up some items. Since the system.img is a linux file system, it has symbolic
links built into it, but when we extracted it, it just created duplicate files, if you used the prebuilt unyaffs.exe.
So we can just delete the duplicates and have a script recreate the symlink on install.
So we need to delete some extra files from the system\bin directory.
Run the attached DeleteExtras.bat file from the same directory where system.img is in.
If you notice, all the files it deletes are 28 byte files, and if you open them in notepad only contain:
"!<symlink>toolbox..."
And we will remake the symbolic link when it is installed.
5.
Now from the directory where the system.img is, enter the following commands
mkdir META-INF
mkdir META-INF\com
mkdir META-INF\com\google
mkdir META-INF\com\google\android
Now copy the included file "update-script.txt" into the "META-INF\com\google\android" directory
and RENAME it to just "update-script".
This update-script gets run to recreate the symbolic links.
Not sure if these two are needed but they are in some custom ROMs here:
Copy the two files "fix_permissions" and "flash_image" to the "system\bin" directory.
6.
-- Optional --
These add root and Superuser access to the ROM, plus the Terminal Emulator application.
Copy the file "su" from Cyanogen's rom to the folder "system\bin"
Copy the file "Superuser.apk" to the folder "system\app"
Copy the file "Term.apk" to the folder "system\app"
You can also replace the "system\etc\apns-conf.xml" with a more complete one from here:
http://forum.xda-developers.com/showthread.php?t=547718
or here
http://docs.google.com/Doc?docid=0AZNbAmKkmakoZGZxZHNwMnpfMjJkaHg3ejN3eg&hl=en
Turn data roaming off by default by editing line in the build.prop file:
ro.com.android.dataroaming=false
Also to fix the Market program to show "Protected" applications change the ro.build.fingerprint line to the following:
ro.build.fingerprint=tmobile/opal/sapphire/sapphire:1.5/COC10/150449:user/ota-rel-keys,release-keys
Only phones with a fingerprint of a "released" device can access some market applications.
--------------
7.
Now we just need to create a ZIP file for the final ROM
Zip up the following file and two folders:
boot.img
META-INF
system
8.
Now sign the zip file.
See here how to sign a ZIP file for flashing it.
http://androidforums.com/developer-101/8665-how-signing-roms.html
9.
Copy it to your SD card, boot into recovery, wipe, apply the update, Reboot.
You are now running Android 1.6!
Click to expand...
Click to collapse
Could you tell me where I can correct the fake data in the phone like the real RAM is 512 MB but it say 1GB ,can you tell me how to
correct it thanks in advance:good:

GUIDES & FAQs [Android]: ADB Workshop by Adrynalyne and Guide by Captainkrtek

DO NOT POST IN THIS THREAD BEFORE READING THE WHOLE POST
PLEASE ADD GUIDES TO COMMON ISSUES YOURSELVES
To my recollection, the previous WM Guides thread was successful.. so we'll be moving on to android as well - from beginner to pro.
I hope this thread will provide answers to a decent percentage of your questions.
Please hold until guide collecting is finished..
In the meanwhile you are ALL invited to send me links or full guides to add to this thread.. remember, we are all about sharing.
COMING SOON! (in the meanwhile, you've got a great battery life guide at http://forum.xda-developers.com/showthread.php?t=471521 - be sure to thank BruceElliot for it!)
also, if you decide to post a guide, please keep the guide as neat as possible, with a title containing the LEVEL ([BEGINNER], [INTERMEDIATE], [PRO]) and the commonly searched words so that people who look for it can find it easily. (if you can, use the same color (dark orange) and same size (4) and Bold.. for the main title.. tho that's not a must )
post #2. [BEGINNERS+INTERMEDIATE] Replacing System Files using Android Commander
post #3. [EVERYONE] ADB Workshop by Adrynalyne and Guide by Captainkrtek
post #4. [QUICK FAQ's] Common QnA's for beginners by Timmymarsh (work in progress)
[BEGINNERS] Replacing system files using Android Commander
Replacing system files using Android Commander:
(This post was formally based in the HD2's RTL support thread and revolved around our need to replace frameworks)
so:
1. Download the android SDK from: http://dl.google.com/android/android...08-windows.zip
2. EXTRACT(!!!) the android-sdk-windows to c:\
(make sure you extract the dir - not run the setup from inside the zip file)
3. install Android Commander from http://androidcommander.com
4. Connect your device and make sure it's set to Debugging mode in /settings/applications/development/
5. You might have to set a dir containing your adb.exe file. set it to c:\android-sdk-windows\tools\
6. You will see a Total Commander-like interface. you can then copy the framework.jar file to the correct directory (there's no difference between SD android builds and androids in ROM - the system dir will be shown the same way)
a. Yes, you can replace/delete system files while android is running.
b. (for androids running from SD) Any file copied to /sdcard/android/root/system/X will be copied to /system/X in the system file. The sdcard/android root dir is JUST LIKE your root in ROM androids.
c. Make sure you either created a backup or verified a match in any other way before replacing files like frameworks, zimage, modules, etc.. your android might not boot afterwards (I keep all system.ext2 files backed up so that i can restore them incase i screw something up.)
enjoy
[EVERYONE] ADB Workshop by Adrynalyne and Guide by Captainkrtek
This following guide was rewritten by Captainkrtek, please make sure to thank him for it
Original Post:
(http://forum.xda-developers.com/showthread.php?t=879701)
This workshop was held in #android-learning on irc.freenode.net by XDA Member Adrynalyne. All credit to him for this guide, I simply am taking it and turning it into a guide. Here we go!
You can find the raw IRC log here
Good evening folks, and welcome to my ADB workshop. This is by no means a full explanation on the subject, but more of a crash course to help folks get up to speed, and get more from their devices. There may be some things you already know here, so please be patient and respect those who do not.
Reference Files
http://adrynalyne.us/files/How to install adb.pdf
http://adrynalyne.us/files/Using ADB.pdf
So, lets just start with the basics.
What is ADB?
ADB stands for the android debugging bridge and is used for testing and debugging purposes by developers.
However, we like to get more out of our devices, and its a great way to fix things.
Knowing adb can mean the difference between a paperweight and a working phone.
So, to start with, we will look at installing ADB.
Generally speaking, the Sun/Oracle JDK is required to run all SDK functions.
ADB is but one tool in the SDK arsenal.
So, we begin by downloading and installing the JDK. This can be found here:
https://cds.sun.com/is-bin/[email protected]_Developer
Choose your OS, download and install. I recommend that 64 bit users use the regular x86/32 bit version as well.
Moving ahead, we download the Windows sdk from here:
http://dl.google.com/android/installer_r08-windows.exe
Due to already installing JDK, you won't be stopped by the install process.
Now, if you notice, I installed it to:
C:\android-sdk-windows
I did this because it makes things easier when setting up path variables.
I encourage everyone to do the same, but obviously it is not required.
So, this SDK is handy, but is only good up to 2.2. We want the latest and greatest! (Well I do)
So, we navigate to:
C:\android-sdk-windows\
and we run SDK Manager.exe
If you notice in your PDF file for installing adb, you will notice that you can update, and I made a choice not to include earlier sdk versions.
I won't go into full detail on that, but depending on the version of SDK you have, 8 or 9, it WILL make a difference in using adb.
By default, for version 8 adb.exe resides in C:\android-sdk-windows\tools
By default, for version 9 adb.exe resides in C:\android-sdk-windows\platform-tools
We will assume version 9 in this guide
Really, the SDK is installed and adb is usable right now, but in my humble opinion, its not enough
I like the ability to use adb in ANY directory on my machine.
To do this, we edit Windows's environment variables.
Specifically, the system path.
To do this, we click on start, or the orb (depending on OS), and right click on Computer, left clicking on properties in the menu.
If its windows XP, I believe it brings you into advanced system properties immediatly. Vista and 7 need a second step.
On the left hand side, as you notice I have highlighted in the pdf, left click advanced system settings.
Under advanced tab, we left click environment variables...
There are two boxes here.
We are concerned with system variables, however.
So we scroll down the list and highlight path and click edit.
Ignoring all the extra stuff in here, make sure you are at the end of the line, and type
Code:
;C:\android-sdk-windows\platform-tools
The semicolon allows us to separate it
from the previous path statement.
Click ok all the way out.
We now have ADB setup globally. We can use cmd.exe (I use powershell) and no matter what directory we are in, adb is recognized.
If it is not, make certain you entered the path into system variables, and made no typos.
If you installed to a different location, you will need to adjust the path accordingly.
This concludes the section on installing the Android SDK to use ADB.
This next section will be on using ADB, so please open that pdf now.
Now, this applies to any OS, not just Windows.
Well, with the exception of the USB drivers.
I will not go too much into that, but if you take a look at the PDF, it goes through installing usb drivers for the sdk, and how to download them.
Fiarly straightforward, in that rspect.
Now, to setup our phones to use with the SDK and ADB, we must change some settings.
First, we go to menu softkey, then settings.
We scroll down to Applications and tap it.
Under Development, we will check Enable USB Debugging. Please note the SGS phones are different in this respect.
The USB cable must be unplugged before enabling or disabling this setting.
Once this is done, we are now ready to play with adb
One quick note: If you get device not found/conencted, please reboot your phone. DJ05 has a quirk in it where ADBD randomly crashes on boot.
A reboot will fix this
ADBD= ADB Daemon
Ok, continuing on.
Lets look at installing applications. This is also known as sideloading.
Unlike installing from the SD card, it does not require unknown sources to be enabled.
The command for this is
Code:
adb install packagename
This assumes that you are working from the directory where the file is located.
This will install the application to /data/app.
It will also show sometimes useful errors if install fails.
That is not something you will see from the Android GUI.
Now, a lot of us have probably deleted files with apps like Root Explorer. While this isn't really a bad thing, it leaves behind databases and data for the application removed.
This is where the 0kb applicaiton entries come from.
If you take that application entry name, you can uninstall the extra data via adb.
First we go to the adb shell which logs into the phone.
Code:
adb shell
If we end up with a $, we will want admin rights, in many cases. This is not one of them, I don't beleive.
To get admin rights, you want to type
Code:
su
Look at your phone if this is the first time, it may prompt you to allow access. Else you will get permission denied.
If you are not rooted, this will not work either.
Ok, now that we are logged in, we will type
Code:
pm uninstall packagename
where packagename is the name of the 0kb listing.
Now this seems like a pain in the a** and I agree.
HOWEVER
There will be a time where Manage applications crashes when you try to uninstall it from the phone. In this case, a factory reset, or this method is the only effective way to fix the problem.
Moving on.
How many of us have removed system applications or renamed them? Did you know that you can simply disable them from the system?
Code:
adb shell
su
pm disable appllicationname
This will disable it, and the system will ignore it.
This can be seen as safer than deleting or renaming things, but your mileage may vary.
On the other hand, you can also re-enable these applications.
Code:
adb shell
su
pm enable applicationname
Please note: Not all applications will properly re-enable. I believe a factory reset or reinstall of said application will fix the issue.
Also, application names are absolutely case sensitive.
*nix based Operating Systems see the letter 'a' and 'A' as two different things.
when you log into adb shell, you are playing by android rules
Ok, a lot of us tweak and mod our phones and turning off the device to get to clockwork recovery, or battery pulls, or multiple button holds to get into Download mode are troublesome and annoying at best.
ADB can help us here.
Here, we do not need to be logged into the shell
If we want to merely reboot the phone:
Code:
adb reboot
If we want to go to recovery (works well with voodoo5)
Code:
adb reboot recovery
If we want to go to Download Mode because we need Odin, heaven forbid:
Code:
adb reboot download
Its instant. No waiting on animations or anything else.
Its also handy if Android has locked up, but yet still works in adb.
I for one hate taking my case off to battery pull.
So now we move on to pushing and pulling files.
Sometimes, I don't feel like mounting my sd card to copy a file over to my phone.
I can use this command to push a file straight to my sd card:
Code:
adb push filename /pathtodirectoryonphone
So for instance, if I have test.txt that I want to send, I would type:
Code:
adb push test.txt /sdcard/
and there it goes.
Ok moving on
Pushing files can be done to any directory, however, some are protected.
For instance, /system is going to give you a permission denied or a read only filesystem error.
To get around this, the easiest thing to do is push the file to your sdcard, then log into the shell:
Code:
adb shell
Code:
su
We will then mount the system as writable
Code:
mount -o rw,remount /dev/block/stl9 /system
Then we can use something like
Code:
cp /sdcard/test.txt /system/app/test.txt
cp stands for copy
and it requires the path of the file and destination path. The name of the file is optional
When you copy it, you can rename it to whatever you like.
For instance, if we wanted to backup a file
Code:
cp /sdcard/test.txt /sdcard/backuptest.txt
Now, lets assume you do not have busybox installed.
You non rooted users will not.
Then you must use a slightly more complicated command called dd
This is used like this:
Code:
dd if=/sdcard/test.txt of=/system/app/test.txt
if is for inputfile
of= output file
Not every user friendly, but probably one of the safer copy commands.
Ok, moving on to pulling files.
Lets say you want to get a file from your phone, to modify, backup, etc.
To do this, we simply use adb in this manner:
Code:
adb pull /pathtofile/filename destinationname
For instance, if I wanted to backup ADW launcher in system/app
I would do this
Code:
adb pull /system/app/ADWLaucnher.apk ADWLauncher.apk
And it will pull the file from the phone and put it in the current directory.
Like above, you can specifcy where it goes.
pushing files to the sdcard, it seems prudent to talk about changing permissions.
sdcards are typically fat32, which destroys permisisons, and Android is heavily permission based.
So if you push an application to your sd card, then try to copy it to /system/app/ bad things are going to happen, or the app may not even show up.
So in that case, we use something called chmod.
This is used in this manner
Code:
adb shell
su
chmod 755 /pathtoapplication/applicationname
Keep in mind
you dont want to do this while its still on your sd card.
an example
Code:
adb shell
su
chmod 755 /system/app/ADWLauncher.apk
755 is good for applications and script files.
Just a couple more topics to cover.
Lets go over deleting files.
This becomes especially handy for removing rogue applications.
To do this, we must be in the adb shell.
Code:
adb shell
su
rm /system/app/ADWLauncher.apk
You may need to remount system as writable with:
Code:
mount -o rw,remount /dev/block/stl9 /system
That applies when using chmod as well.
So what I did above was delete ADW Launcher from system/app
However, what if I wanted to delete the entire contents of a directory?
Same thing as before, except
Code:
adb shell
rm -f /data/dalvik-cache/*.*
I just cleared my dalvik-cache with that command
very quick, very effective.
If you just tried that, please reboot your phone now
Ok....this leaves us with the final topic: logcat
logcat allows us to log what the OS is doing, and possibly delve information for when things are not working
its quite simple Reading it is another.
To use logcat
Code:
adb shell
logcat
To logcat to a certain file do
Code:
adb shell
logcat > /sdcard/logcat.txt
Now we let the log settle down to a reasonable amount of data coming in and not a wall of scrolling, then start the app in question. When it gives an error, we hit ctrl-C and kill the adb shell session.
This should have captured enough data to see the error. Now, I prepared an example. A user came to me on IRC, and Google Maps was force closing. Clearing data didnt fix it, Clearing dalvik-cache, and fix permissions did not fix it. In this case, the user did not know how to use adb So I had him grab an app called alogcat from the market and email me the log. This is also a very valid method.
this file explains what the problem was, and highlights what to look for as an example.
http://adrynalyne.us/files/logcat.pdf
___________________________________________________________________
This concludes the guide from Adrynalyne, there will be more workshops such as this one in irc.freenode.net #android-learning.
Thanks to everyone in #samsung-fascinate !
QUICK FAQ's
sources: Q&A Section, The Weekly Q&A Section by XDA News Writers (thanks guys)
Q: ‘Is there any way to block specific apps from using my data connection?’
A: Try the Droid Wall application.
Q: ‘I read how you can make changes in the build.prop file on my Android device. How exactly do I get to it?’
A: Install ASTRO file manager, browse to /system, long press on build.prop – Edit – Copy. Press on the home icon then Edit icon – Paste. Connect sd card, edit it, and paste it over from where you copied build.prop
Q: What happens if I update my phone? will I need to re-root it and get the ROM again? will all of my applications get erased? If so, is there a way around this?
A: You will lose your root, but not apps if it is just an update.
Q: I just tried to flash a ROM from recovery on my Android phone and got “Verification Failed, Installation Aborted” What happened?
A: Before you can flash a custom ROM the .zip file must be digitally signed in the ROM kitchen, if unzipped and re-zipped it will lose its verification, this happens often using the Safari browser as it likes to decompress .zip’s. Or if your download is corrupted (download the ROM again) it will fail the Verification.
Q - HTC Location Widget shows "map data unavailable"
A - On the widget, click the pin/then click the windows button/click get more/scroll to download maps/download relevant map (care, maybe a big file). Now exit and click onto map, your location should now be visible :)
Q:So, I moved all the apps on the SD, but is still not enough. How can I free some memory? I could delete the cache of the older upgrade or something else?
A:Do you have pictures and videos? If so, check if they are on the SD card and not on your internal memory. Cleaning your cache helps, and try deleting your text messages threads.
Q: ‘What exactly is a kernel and what are the benefits in changing it?’
A: A kernel is a bridge between the applications and the actual data processing done at the hardware level. The kernel’s responsibilities include managing the system’s resources – the communication between hardware and software components. Flashing different kernels gives you different operating speeds, better battery life, the ability to overclock, and more.
Android control other device with IOIO Board.
It use ADB.
http://androidcontrol.blogspot.com/2011/10/ioio-board-for-android-control-io.html
timmymarsh said:
QUICK FAQ's
sources: Q&A Section, The Weekly Q&A Section by XDA News Writers (thanks guys)
Q: ‘Is there any way to block specific apps from using my data connection?’
A: Try the Droid Wall application.
Q: ‘I read how you can make changes in the build.prop file on my Android device. How exactly do I get to it?’
A: Install ASTRO file manager, browse to /system, long press on build.prop – Edit – Copy. Press on the home icon then Edit icon – Paste. Connect sd card, edit it, and paste it over from where you copied build.prop
Q: What happens if I update my phone? will I need to re-root it and get the ROM again? will all of my applications get erased? If so, is there a way around this?
A: You will lose your root, but not apps if it is just an update.
Q: I just tried to flash a ROM from recovery on my Android phone and got “Verification Failed, Installation Aborted” What happened?
A: Before you can flash a custom ROM the .zip file must be digitally signed in the ROM kitchen, if unzipped and re-zipped it will lose its verification, this happens often using the Safari browser as it likes to decompress .zip’s. Or if your download is corrupted (download the ROM again) it will fail the Verification.
Q - HTC Location Widget shows "map data unavailable"
A - On the widget, click the pin/then click the windows button/click get more/scroll to download maps/download relevant map (care, maybe a big file). Now exit and click onto map, your location should now be visible :)
Q:So, I moved all the apps on the SD, but is still not enough. How can I free some memory? I could delete the cache of the older upgrade or something else?
A:Do you have pictures and videos? If so, check if they are on the SD card and not on your internal memory. Cleaning your cache helps, and try deleting your text messages threads.
Q: ‘What exactly is a kernel and what are the benefits in changing it?’
A: A kernel is a bridge between the applications and the actual data processing done at the hardware level. The kernel’s responsibilities include managing the system’s resources – the communication between hardware and software components. Flashing different kernels gives you different operating speeds, better battery life, the ability to overclock, and more.
Click to expand...
Click to collapse
Thank you for your patience and taking the time to answer those questions. I loved your simple and easily digestible format.
There is a note
*nix based Operating Systems see the letter 'a' and 'A' as two different things.
when you log into adb shell, you are playing by android rules
Click to expand...
Click to collapse
this note is all wrong..
1. linNUX is not *NIX.
2. Mac OS-X is a *NIX OS, it is based upon UNIX, they use their own variant called Darwin. Darwin does not require capitolization.
3. The word should be POSIX. Linux is POSIX compliant and POSIX defines the capitolization standardards
soft brick
Taioba said:
Is there any way to use ADB even though I can not enable USB debugging by the android?
I have an Atrix with soft-brick. How can I restore a file (framework-res.apk) knowing that my USB debugging is off?
I can enable ADB via fastboot?
Thanks!
Click to expand...
Click to collapse
I found this for atrix 4g....
http://forum.xda-developers.com/showthread.php?t=965546
hope it helps
knoknot said:
i have a bricked s2 not so sure how to go about reviving it via adb
Click to expand...
Click to collapse
check this thread
http://forum.xda-developers.com/showthread.php?t=1237815
thanks. searched for that
Thanks for it.
Great Guys............ :good:
Thanks for sharing.
Thanks for sharing this guild :d, i am new member for reccod
Great job~ Sometimes could be used this.
I'm using Windows 10 RTM and I've set the path, yet I still get the "unrecognized application" error in the command console. What am I missing?
Nevermind, a restart fixed it. Used to be you didn't have to.... sheesh.
nir36 said:
Replacing system files using Android Commander:
(This post was formally based in the HD2's RTL support thread and revolved around our need to replace frameworks)
so:
1. Download the android SDK from: http://dl.google.com/android/android...08-windows.zip
2. EXTRACT(!!!) the android-sdk-windows to c:\
(make sure you extract the dir - not run the setup from inside the zip file)
3. install Android Commander from http://androidcommander.com
4. Connect your device and make sure it's set to Debugging mode in /settings/applications/development/
5. You might have to set a dir containing your adb.exe file. set it to c:\android-sdk-windows\tools\
6. You will see a Total Commander-like interface. you can then copy the framework.jar file to the correct directory (there's no difference between SD android builds and androids in ROM - the system dir will be shown the same way)
a. Yes, you can replace/delete system files while android is running.
b. (for androids running from SD) Any file copied to /sdcard/android/root/system/X will be copied to /system/X in the system file. The sdcard/android root dir is JUST LIKE your root in ROM androids.
c. Make sure you either created a backup or verified a match in any other way before replacing files like frameworks, zimage, modules, etc.. your android might not boot afterwards (I keep all system.ext2 files backed up so that i can restore them incase i screw something up.)
enjoy
Click to expand...
Click to collapse
Thanks, this Guide is very informative
Help with LG D722
I'm using LG D722 phone and I somehow unlocked bootloader and installed twrp recovery. I backed up Lollipop that's what I'm using and i want to restore custom ROM
I know I need to install Google Apps after installing Custom ROM. But Do I also need to install Modem files on my device ? Because I can't find them on XDA Forums. Please give me a link or something. The help is not just appreciated but seriously needed.
Success. Thanks
Hello, I walk testing one recovery but I'm booting before flashing, the question is, will the recovery feel same when booted vs flashed? I've booted and used to flash a pair of zips but felt very laggy and bugged although did the work right. Thanks
Edit: solved, tried myself
Sent from my SHIELD Tablet K1 using XDA-Developers mobile app
http://forum.xda-developers.com/showthread.php?t=872128&page=2

A Beginner’s Guide to Modifying Android Devices

Warning: Even an expert runs the risk of “bricking,” or locking up their Android device when modifying it. Often this is a ‘soft brick’ from which they can recover, but sometimes the device is “hard bricked” from which no recovery is possible, and the device becomes a source of spare parts. Proceed at your own risk. Neither the author, nor XDA is liable if you do “brick” your device.
Note: I have insufficient posts to include outside links. I'll add them when I do. Until then you'll need to search the 'net.
Keeping that in mind, you may wish to acquire an older model device to practice with before attempting to modify leading edge devices. Kijiji and Craig’s List are good sources for low cost, used devices that can be used for practice. I acquired the Samsung Galaxy S5 neo (SM-G903W) with Android 7.0.0 (Nougat) installed, I’m using in this guide for about $20 USD. Although any device will do, try to get one from the same manufacturer as the device you want to modify. If your device is a phone, you do not need a SIM card to follow this guide.
The Android OS is a derivative of Linux, and many, but not all commands are the same. You should refer to Linux or Unix manuals for an explanation of the commands. Search the ‘net for “Linux Commands” to find the latest manuals.
As the boot animation and sound are the most common modifications, changes to those are the goals of this guide. It seems as though there is an app for everything now. Yes, they are handy, but this guide will use the command line for many of the modifications. I use Terminal Emulator on the device for command line access. I also use BusyBox to expand the command set available. Both are available from the Play Store. You need root access to install and use BusyBox.
The first step is to read the manual for your device. Pay particular attention to the method used to enter the download and recovery modes. The Samsung Galaxy S5 neo uses volume up + home + power to enter the recovery mode, and volume down + home + power To enter the download mode from the power off condition. Press the volume and home buttons first, and then press the power button while holding them down. The device will boot into the desired mode. You may also require special USB drivers on your PC for your device.
Next you need to take as complete a backup of your device as possible using the stock options. See your manual for help with this. It’s also a very good idea to download the full firmware, as well as the boot and recovery partitions and any tools needed to re-flash this software. The best way to find these is to consult the manufacturer’s website, then this forum, followed by a ‘net search if nothing else provides results. For my device I need Odin on my PC. I found the full firmware at sammobile.com and firmware.mobi. The boot and recovery images can be extracted from the Samsung file, and then re-compressed using 7-zip on your PC. The firmware.mobi website offers all three files for several versions of Android, as well as a configured Odin package to root my device.
Now that we’re ready, the next few posts in this thread will cover the following sequence:
1. Root Device
2. Install Recovery
3. Install Applications
4. NANDroid backup
5. Make your modifications​
Root Device with Chainfire
Warning: If you have a KNOX enabled device, rooting it will trip the KNOX warranty flag, voiding your warranty. This flag cannot be reset, and will prevent some applications from working.
Warning: Rooting improperly can “Hard Brick” your device, turning it into a source of spare parts.
There are numerous rooting tools out there. I use Chainfire whenever possible. The current website firmware.mobi will generate an easy to use package including Odin for supported devices. Download and extract the package to a new folder on your PC. Start Odin using the root.bat file. Read the warnings. Next:
Ensure Developer Options are enabled on your device. On the SM-G903W, go to Settings/About Phone/Software information/Build number seven times. Other devices may use a different method. Consult your manual.
In Settings / Developer Options ensure OEM Unlock is on and turn on USB Debugging
Note: I also turn “Auto update system” off
Turn the device off, then re-boot into the download mode (Volume Down + Home + Power, and then press Volume Up on my device)
Plug the device into a USB port of your PC
Select AP in Odin, then select the image.tar.md5 file downloaded with your package.
Ensure one of the COM ports is highlighted.
This is your last chance to abort. DO NOT CONTINE if you have any doubts.
Click Start
When your device is rooted successfully you’ll see a green pass in Odin. Congratulations! Your device will re-boot into recovery mode to root the device, and then re-boot normally. Well, that’s how it was supposed to work. When I used the CF Autoroot file for the SM-G903W, I got the error message “Recovery is NOT seandroid enforcing”, and was unable to boot into the recovery mode. I used Odin to re-flash the recovery partition which allowed me to enter the recovery mode again. A little searching on this forum, led me to this post by Neoony. I used the link for the SM-G903F and succeeded in rooting the device.
Now you need a root manager. My preference is Super SU. Install it from Google Play. Run Super SU. It will let you know if you were not successful by reporting that your device is not rooted.
Install Backup/Recovery (TWRP)
As we intend to modify the Android system itself, we need the ability to back it up and restore it. There are several options including Clockwork Mod (CWM), Team Win Recovery Project (TWRP) and Titanium Backup. My personal preference is TWRP.
Installation is as follows:
Install the “Official TWRP App” from Google Play
Run the App, agree to the Terms and Conditions, and enable “Run with root permissions,” then tap OK.
Tap “TWRP FLASH” on the next screen
Select your device from the drop down menu, you will need a network connection for this. You’ll be presented with a series of choices. Choose the latest and greatest. The image will be downloaded to your device.
Select “FLASH TO RECOVERY”, and confirm the image is correct. You will see the message “Flash Completed Successfully!” when installation is complete.
Exit the “Official TWRP App” and re-boot your device into the Download, followed by Recovery, and finally normally to confirm all is well.
Install Applications
The applications to install are those you will use to customize your device. I suggest BusyBox, and Terminal Emulator from the Play Store. BusyBox requires root access for the expanded command set. Terminal Emulator will allow command line access on your device so you won’t need ADB on your computer. You will be able to gain root access through it to modify anything on your device anytime, anywhere.
Other Apps you may find useful are the Jota Text Editor, and Hex Editor. These are also available through the Play Store.
NANDroid backup
Once the device is rooted, and your choice of applications are installed it’s a good idea to fully back up the device. This includes ALL partitions, so you have a baseline that you can re-flash. If your device has minimal memory, you may need an SD card or USB OTG drive to hold your backup. These backups will often be larger than 4GB.
Re-boot your device into the Recovery Mode. In TWRP, select ALL the partitions. Select the desired Storage location, and tap OK. Swipe to backup your device. Note the warning that “Backups of data do not include any files in internal storage such as pictures or downloads.” That is not the purpose of TWRP, and is best accomplished with the native backup utility. This backup will require several minutes.
Make your modifications
With root access, a recovery program and needed applications installed; and a complete backup we are finally ready to modify the Android installation of your device. We’ll start with the boot animation.
Modifying the boot animation:
Most devices use a ZIP file for boot animations. Samsung uses a proprietary QMG file. I tried to convert a boot animation that I put together a few years ago into the QMG format using Samsung’s Theme Designer Version 2.0.4 (Build 3918), as the links I found to newer versions on the XDA forum were broken. Searching through this forum, I found this post by Jertlok. I used the Marshmallow version with Nougat successfully.
Enough of this talking, let the games begin! Find the boot animation you want to use and download it to your device.
I’m using the Terminal Emulator for this installation. Our first step is to find the source and destination folders for this file. The relevant folders for the SM-G903W are:
boot animation: /system/media
downloads: /data/media/0/Download
If you have another device and the boot animation is located elsewhere, do a search of this forum first to find them. Look for your device first, and the other models by the same manufacturer.
Type the following commands using the Terminal Emulator:
Code:
su get super user privileges
mount -o rw,remount /system remount /system with read & write permissions
cd /system/media go to directory with boot media files, may differ
ls verify this is the correct folder
mv /data/media/0/Download/bootanimation.zip . move the file to our current location
ls verify the file was moved
exit leave super user mode
Reboot your device and verify the boot animation works.
Note: Don’t forget the period at the end of the mv command. This is a shortcut meaning the current directory, saving you from typing the full location.
Modifying the boot sound:
Finding the location for the boot sound can be more involved that finding that for the boot animation. If you know the name of the file, you can do a search through Terminal Emulator with the following commands:
Code:
su get super user privileges
cd /system/media choose a starting point for your search
find –name PowerOn.ogg name of the boot sound on the SM-G903W
This shows the file to be located in /system/media/audio/ui. Put the sound you want in the Download folder. I’ve named mine bootsound.ogg to show another use of the mv command. Use the following commands in Terminal Emulator:
Code:
su get super user privileges
mount -o rw,remount /system remount system with read /write permissions
cd /system/media/audio/ui go to the folder containing PowerOn.ogg
ls confirm we’re in the right folder
mv PowerOn.ogg PowerOn.ogg.bak rename PowerOn.ogg
mv /data/media/0/Download/bootsound.ogg . move bootsound.ogg
mv bootsound.ogg PowerOn.ogg rename bootsound.ogg
ls confirm the change has been made
exit leave super user mode
Reboot your device and verify the boot sound works. The shutdown sound is not used in the stock ROM. You can add a shutdown sound in the same manner by placing PowerOff.ogg in /system/media/audio/ui. Note: If PowerOn.ogg or PowerOff.ogg do not play, check your file permissions. Set them to the same values as the remainder of the files in the directory, usually 644.
Wrap up
Everyone needs to start somewhere. My goal in starting this thread was to provide that starting point, and a path forward for those new to modifying an Android device. That is why I started with a stock not-too-old device, and showed how to take it to manually changing the boot animation and sound. Why manually, when there are apps for that? An App can only accomplish a single task, such as changing the boot animation. At the command line you can do almost anything. You won’t be stopped by the lack of an App.
Much of the material covered by this guide is specific for a device. Those with Samsung devices came out far ahead, and those with a Galaxy S5 neo may just have hit the jackpot. The general sequence for all devices is the same. You’ll just need to dig for those devilish details.
There are two things that should stick out:
1. Use a not too old device by the same manufacturer as your target when starting. It’s far cheaper than bricking a bleeding edge device.
2. Backup, backup, backup! This can’t be stressed enough. Losing hours or days of work is very depressing, and often leads to dropping a project.
Good luck modding your device. This forum is one of the best, if not THE best place for resolving those devilish details that you will encounter.
The Next Step: Changing the Boot Logo
First, thanks to Near_07 for his post Galaxy S9 and S9+ Boot logo. I modified his package to make one for the Samsung Galaxy S5 neo. Note that his script is for the same exynos platform. This is critical for packages containing binaries.
I unpacked the pile to a new directory on my PC.
The first thing I did was to verify paths and filenames in the script "update-binary". I opened the file using WordPad on my PC for ease of reading. The file contains references to "/dev/block/platform/11120000.ufs/by-name/UP_PARAM", which does not exist on the S5 neo. I used Terminal Emulator to check for something close and found "/dev/block/platform/13540000.dwmmc0/by-name/PARAM ". I copied the file to the Download directory, and from there to my PC. Opening the archive, I found that it contained the file "logo.jpg". Bingo! I was in the right place. I copied the "update-binary" back to the Download directory on the S5 neo, and used Jota Text Editor to change ALL the references from 11120000.ufs to 13540000.dwmmc0; and UP_PARAM to PARAM. I then copied the modified "update-binary" back to replace the original on my PC. Why did I use Jota Text Editor on the S5 neo, instead of notepad on my PC? Unix, Linux, and Android use different end of line sequences than the PC. There are programs for the PC capable of generating Android compatible files, but I'm sticking with software already mentioned in this tutorial.
Choosing or Creating a New Boot Logo:
Choose or create a new .jpg image, the same size as your screen for your new boot logo. I've attached the original logo.jpg from my S5 neo to this post. I used that as a starting point, moving and adding elements to mate with my boot animation. I've included a demo copy in the zipped package. I've also attached a copy of the first image in my boot animation sequence. The powered by Android Nougat element fades in as the animation runs.
How to Change the Boot Logo:
You are rooted and have TWRP installed if you've been following along. These are pre-requisites. STOP NOW if they are not installed.
Download the file S5neo_Boot_Logo_Changer
Unzip the file to an empty directory
Replace logo.jpg with your desired logo. Note the name MUST be exactly the same.
Use 7-Zip to compress the contents of your working folder, with 'Store' as the compression method
Copy the resulting archive to the Download folder on your S5 neo
Re-boot your S5 neo into the Recovery mode
Install the package, re-boot, and enjoy!
Removing Bloatware (or fun with scripts)
Bloatware consists of the unwanted apps generously added to your phone by Google, the manufacturer, and your carrier. There can literally be a hundred or more of these apps on your phone. So how do you get rid of them? You can use a package found on this site, but that can be problematical. You may have a different view of bloatware than the package’s author. You may not know what each APK deleted by the package does, and delete one you actually want on your phone. If this happens you’ll need to restore from backup, factory reset the phone, or even re-flash the firmware. My preference is to archive the APK on my desktop so that hopefully I can restore the APks with the package manager.
To start, grab one of the packages to delete bloatware for your version of Android, for as close to your phone as possible. I used this one by Windforce. The contents of updater-script may include a section that looks like this:
Code:
run_program("/sbin/rm", "-rf", "system/app/AASAservice");
run_program("/sbin/rm", "-rf", "system/app/BluetoothMidiService");
run_program("/sbin/rm", "-rf", "system/app/CloudGateway2017");
run_program("/sbin/rm", "-rf", "system/app/GooglePrintRecommendationService");
There are many tools such as word processors, and text editors that you can use to strip out the unwanted bits so that you end up with something like this:
Code:
AASAservice
BluetoothMidiService
CloudGateway2017
GooglePrintRecommendationService
Save it as a file, ensuring that you have an Android (Unix) end of line character. We end up with a list of folders containing the unwanted APKs. Next we need a script to archive the APKs.
The following script has been designed to run in the ‘Download’ folder, from the Terminal Emulator, or ADB (Android Debugging Bridge). It was written on my desktop using Notepad++, to ensure the proper end-of-line character was used. The script, and APK lists must be copied to the Download folder from the desktop. To access the Download folder from the Terminal Emulator or ADB, Super User or root permissions are required. File permissions allowing root to execute the script must be set. Finally the script must be run from within a shell.
Code:
mount -o rw,remount /system # mount /system for read/write
tempdir=/system/app/app # temporary folder for APKs to be archived
mkdir $tempdir
while read apkname # loop parses file for APK names to archive
do
mv /system/app/$apkname $tempdir/$apkname
done < sysapp.txt # supplied list of APKs to be archived
tar -czvf sysapp.tar.gz $tempdir # archive APKs
rm -rf $tempdir # remove temporary folder recursively
rm -rf /cache/* # clear cache contents
rm -rf /data/dalvik-cache/* # clear dalvik-cache contents
reboot
exit 0
After the script has executed, you’ll note the icons for the archived APKs remain on the apps screen, and are still listed under Apps. The must be manually removed. You’ll find that ‘Uninstall’ is now available in both places for the archived apps.
Attached is a .zip file containing the script, and data files I used on a Samsung Galaxy S5 neo (SM-G903W).

Incremental OTA Payload Extractor - Linux Only currently - Op8T 11.0.9.9.KB05AA Posted

FIRST OFF - THIS IS HIGHLY TECHINICAL AND NOT FOR NON-TECH INCLINED PEOPLE. YOU CAN REALLY MESS UP YOUR PHONE IF YOU DO IT WRONG. SO PAY ATTENTION OR FIND SOMEONE SMARTER THAN YOU WITH THIS ANDROID / LINUX STUFF. YOU DO THIS ON YOUR OWN - NO WARRANTIES EXPRESSED OR IMPLIED. IT'S FOR PEOPLE THAT DON'T WANT TO WAIT FOR THEIR VENDOR TO POST A FULL ROM AND UPDATE RIGHT WHEN AN OTA COMES.
So I wanted to update my rooted Op8T OOS version, and you CAN'T (haha) do it if you're rooted. That's kind of a misconception. I knew there had to be a way... so I found a dead repo out there that used to work on Incremental OTAs. And I read the issues - did not actually work. Why? Because you need to extract the prior firmware (full ROM) first with a Payload extraction tool (most are in Python, and most are Linux-only). Well, they got stuck because the original ROM has one signature (encryption), and the OTA update has another signature, so the program would break when they didn't match. So what did I do??? Well I have to give credit to the dev I forked this from, because he mentioned - of course the signatures don't match, they are different releases! So I did something kind of... well... let's put it this way, you aren't verifying any signatures anymore. So if you screw up and put the wrong ROM base (prior full ROM) and Payload extract the payload.bin, then apply the Incremental OTA, well, you're in for trouble. BE POSITIVE YOU ARE USING THE VERSION OF THE ROM THE OTA IS INTENTED TO INCREMENTALLY UPDATE!!!!
In this case, it was quite clear. I was trying to update an A11 Op8T from OnePlus. It was on 11.0.8.3 ROM and an OTA was posted that was for 11.0.9.9. SO I used a Windows tool to extract the first set of files (the full ROM is huge BTW). The incremental update came as a 150mb file zipped up, but it modified the BIG files. Once it finished, I found that system and system_ext are not flashable (grew in size, can't resize super on active slot, not updated), the rest are. And you MUST flash from fastbootd - this is kind of a mysterious new place with modern AB devices. It can be a pain to actually get there. The standard steps if you're on stock recovery are to enable developer options, USB debugging, install the Latest ADB and Fastboot https://github.com/fawazahmed0/Latest-adb-fastboot-installer-for-windows/releases/tag/v1.7 (this script will update it for you). Ignore the God references it's a batch file you can just modify it, and I don't judge. It will pull the latest versions (Minimal ADB and Fastboot are super outdated). Next steps...
Now, getting an incremental update off a rooted phone is not easy. 1) you have to flash a stock boot.img and recovery.img. 2) you have to basically uninstall Magisk, or at least the images 3) then you MAY be able to download with Oxygen Updater or the system app. It won't install though because root is fully exposed. Once it's downloaded, it appears in some very strange location with a random character string.zip I believe. So now you have to reinstall Magisk (to get adb shell SU access). So after I confirmed it downloaded (but wouldn't flash), I had to hook my phone up to the USB cable, go to the PC and Latest ADB and Fastboot folder, adb shell, su, then cd /; find . -name *.zip > /dev/null 2>&1; to cut out some of the garbage output and scroll until I found a logical zip stored somewhere (a folder than sounded like a OnePlus update folder). Then I did a: cp [random characters.zip] /sdcard/Download/OTA_Update.zip, which I could then transfer from my phone to PC with a USB cable. Developer options / default mode USB File Transfer FYI.
Okay that was one of the hard parts. Now next to more hard parts. You need a Linux environment (I used WSL2 Debian Buster). The easiest setup (after spending hours attempting to get the correct packages loaded) was to install the personal version of Anaconda Python x64 for AMD64 processors for Linux. Then I could use conda install [package name] for missing dependencies as the program would throw errors. Yes you have to read the errors or you won't be able to figure out what is actually not installed. Anyhow, the modded forked repo of python files is here: git clone the repo: git clone https://github.com/mrslezak/update_payload_extractor.git - now if git isn't setup on your Linux box, well, you're in for some trouble.
So once it's installed, you need to actually use python3 commands for each step - so anywhere you see "python" put "python3" instead as most machines have both 2.7 and 3.X installed. I used Python 3.8 something, so ignore the 3.6 it's not required. So here I took a payload.bin extracted with a Windows.exe file (available somewhere on XDA, there are severel, one is Go based) and copied them once extracted from the original ROM to the WSL instance on my Win10 PC. Now there come issues here. They need to go into an "old" directory you must create (in update_payload_extractor directory), and copying from Windows will make them root access only, so a: sudo chown user:user old/ is required to get it writable. I believe the program will make the rest of the files on its own. They will end up in "output." You just need to extract the payload.bin and payload.properties files from the incremental update you extracted and place them in the update_payload_extractor directory.
Now there is some strange stuff going on, this was always beta, and never working. So I took the note of the issues and blocked a Google certificate validation routine (just commented it out) so it doesn't verify anything. I say it again BE EXTREMELY CAREFUL THAT YOUR PRIOR FULL ROM AND OTA UPDATE ARE MEANT TO BE USED TOGETHER. Anyhow, run what it says if your system is setup:
Incremental OTA​
Copy original images (from full OTA or dumped from devices) to old folder (with part name without file extension, ex: boot, system) - I put an .sh script here if your files are .img called remove_img_extension_old.sh - note that GitHub sometimes loses the execute permission so you may have to type: sudo chmod +x remove_img_extension_old.sh. It is meant to be run from the root of the project. ./remove_img_extension_old.sh
LD_LIBRARY_PATH=./lib64/ ./extract.py --output_dir output/ --old_dir old/ payload.bin
The above line will start the extract and combine process the OTA usually does on your phone, and output the files to the output directory. Once those are generated, then you can run another helper script I wrote to add back .img to each file called add_img_extension_output.sh again meant to be run from the root folder. Now you need to copy these output files (no guarantee all are updated, it will have all of them - on Op8T system and system_ext couldn't be flashed because they grew in size, and I don't know how to expand the super partition space to enable them to flash, so they aren't in the linked file - it still updates). The files on Op8T ending in lp5 are RAM files for the newest devices that are running LPDDR5 memory, the flash.bat script will need to be modified if you have one of these (2 flashes). The way I made the file will work in 98% of devices.
Okay I run the rest from Windows, so now it gets a little tricky. You need to get into Fastbootd, which means flash boot.img (you just extracted it), flash recovery image (same), using fastboot flash boot boot.img, fastboot flash recovery recovery.img. Now getting to fastbootd can be quite perplexing. You may just have your phone on, type adb reboot bootloader, then type fastboot reboot fastboot, and be in fastbootd (it will look like stock recovery but say fastbootd on top). The other way is to boot to recovery (developer options extended boot menu makes this much easier), then select Fastboot. Sometimes you get Fastboot and sometimes Fastbootd. It seems quite random. DON'T START THE FLASH_ALL.BAT UNTIL YOU KNOW YOU ARE IN FASTBOOTD!!!!
The fastboot command to tell you if you are in fastbootd (it will report yes if so: fastboot getvar is-userspace
Otherwise, those files will NOT be allowed to flash to your device, and you will end up with some random combination of prior and updated files. That could end badly. Once you DO get to Fastbootd, run the flash_all.bat, and DON'T SWITCH SLOTS. Yes, this is an OTA, but you already patched the files. Upon successful flashing, you can reboot to fastboot and flash a patched kernel with Magisk already enabled such as my forked Radioactive here: https://github.com/mrslezak/Radioactive_kernel_oneplus8/releases/tag/v2.2.5-MOD - the .img file is a Magisk patched custom kernel, you can also flash the twrp alpha (that seems to work in my experience, it's just slow, on OOS works fine despite warnings it doesn't). https://forum.xda-developers.com/t/recovery-11-alpha-teamwin-recovery-project-8t-kebab.4302449/ fastboot commands for the kernel: fastboot flash boot image_name.img; recovery fastboot flash recovery twrp_name.img.
I successfully updated while rooted from the prior ROM version. I'm sure it will work on many phones. Best of luck to you!!! I did find out how to install "the full ROM" unreleased on a rooted phone, there is some undocument fastboot stuff I had to figure out (temp system-cow and system_ext-cow files that use up all the space in the super partition) so I added them to my batch file. Now install for whatever device you have, and watch out for those weird temp files that aren't documented anywhere that I could find. Took literally hours to get it working, but it does now!!!
BTW if anyone knows how to resize the super partition, that would complete this project. I.e. you could flash the patched system and system_ext on an Op8T.
Your phone may have no issue or no super partition, then you don't care, it's not needed. I can't recall when dynamic (resizable) partitions came out but I think in Android 10 some devices started to use them. They are developer hell in my opinion.
Some TWRP versions allow you to just resize the partition on the fly, while on my phone, it's not an added feature yet. I'm also not sure if the resize does an auto-wipe either then you could also find yourself in trouble if you couldn't immediately get to Fastbootd. Some ROMs will boot to "Device is corrupt" if things like this change, just a warning, which I tried by switching A/B slots, but I had luckily installed TWRP on the other partition and was able to switch slots there and go back to booting.
UPDATE: I was able to eventually locate why the Super partition was getting full - there are temp files created as dynamic partitions when trying to install an OTA - I had to delete any logical partitions with the extension "-cow" which existed for system and system_ext (on the Op8T I was using), I was on slot A, so they were called system_a-cow and system_ext-cow, I deleted them like this:
fastboot delete-logical-partition system_a-cow
fastboot delete-logical-partition system_ext_a-cow
To see if you have any temp files present, you type:
fastboot getvar-all
And scroll through them and see if any of these mystery -cow files are present.
(bootloader) is-logical:system_a-cow:yes
(bootloader) is-logical:system_ext_a-cow:yes
Whew! That was a pain. But no more waiting for incremental updates to become full ROMs anymore on a rooted phone!
Oh, and I put the update for OOS here: https://forum.xda-developers.com/t/...install-from-fastbootd.4316147/#post-85441161

Xperia XZS Root

I have been trying to root my Xperia XZs G8232. BL unlocked successfully, flashed TWRP 3.1.1 successfully, just that it wouldn't boot up. Can someone enlighten me which step I have missed out ? Managed to flash SuperSU 2.8.2 and Magisk 19 via TWRP recovery. The phone still wouldn't boot up....
Can anyone share proper comprehensive guide of rooting of G8232 ?
Usually when I offer an answer, the reply is something along the lines of "I found an answer already."
This is a quick guide in case you haven't. I suggest you have a micro-sd card inserted.
First, the stock image you are rooting is signed and verification is still active on the device. You will need to resign the boot.img. I suggest you worry about that after performing a boot into recovery to get ahold of the boot.img. Second, the TWRP you are using really isn't an ideal version. You can safely install this to the recovery parition for rooting and backup too even though it was built for the XZ (chip instruction set and partition table are near identical, it works safely with Keyaki). Go ahead and install the recovery, then once you boot into it comes the somewhat more technical approach.
You need to first mount system and the micro-sd card, by tapping Mount on the main menu and then by checking off System and Micro-SD so they can be accessed (loaded/mounted/whateveryouwannacallit). Now, go back to the main menu and tap Advanced and tap Terminal. From here you will need to copy the boot.img which can be achieved by typing:
dd if=/dev/block/by-name/boot of=sdcard1/boot.sin
You may have to search through the /dev/block directory a bit further, as I cannot recall if it is nested under platform/some number junk/etc... You can safely navigate through the directories with: cd or maybe find -name boot 2> /dev/null until you find the directory by-name that has the partitions you need and fill that path into the dd if= path I presented above. Just make sure the if (input file) is the directory you wish to copy and the of (output file) is where you want it to go.
Once you have successfully copied the boot partition (kernel) to an sd-card you can go ahead and run this tool to unsign it , from my experience you will also need to repack and sign it as AOSP with this to get the stock kernel and system running with root access available.
Both tools work similarly, read through the guides where you download each.
You will need to extract AIK and place the boot.img into the first directory that has the scripts with it. Simply type/choose ./unpackimg.sh and when that completes, choose ./repackimg.sh (depending on which OS you use the commands might be somewhat different, but the above suggestions should guide you through it). You should receive a prompt stating it was completed and packed/signed for AOSP. Copy or cut the new-Image.img out of the AIK directory back to the root directory of your sd-card.
Boot into TWRP (or maybe you attempted this with the mobile version through TWRP, idk?). Select Install, tap install .img (bottom right) and tap the new-Image.img you just created and flash it to boot.
From here you can go ahead and reboot and you should be able to access the stock system with your rooted boot.img. BTW, you don't need Magisk v19. You can install the 25.2 app and patch the new-Image through the app and then repeat the previous step above to have your kernel rooted with the latest Magisk.

Categories

Resources