[Resource] System and Vendor Files for Surface Duo & How-To Guide - Microsoft Surface Duo Guides, News, & Discussion

Extracted System and Vendor Files
Please use these files for your correct system version only! I am not liable for any system crashes or errors. This is only a resource for development purposes.​Access Extracted Files (GitHub):
Access System Files
Access Vendor Files
How-To Extract Files:
Requirements:
MUST be Rooted
Magisk Installed
Terminal Emluator (Termux was used) OR Android Debugging Bridge on Computer (ADB)
Create a directory on both your Duo and Computer to save the files to. (Ex. Surface-Duo/system and Surface-Duo/vendor)​
Open your Terminal app or connect the Duo to your computer and open Terminal or Command Prompt​
Commands to run (first save to phone):​
Code:
adb shell *For Computer ONLY*
su *This will ask the device for root permissions. Click Allow.*
cp -r /system /sdcard/Surface-Duo/system/
cp -r /vendor /sdcard/Surface-Duo/vendor/
In the terminal, some files will show "Operation not permitted". Those files are symlinks (the files are located somewhere else and links the directory so the files can be found while the system is running.) You can try to move these files with a file explorer on your Duo that can get root permissions (FX File Explorer)​
Copy the files from your device manually to your computer or adb pull them.​
Some Notes:
Keep Track of the build number of your device!
There are 3 different build versions of the phone, along with several software updates over its release. Keeping Track of the build number will help make sure you use the right files for the right version your phone is running on.​​Feel Free to Send Me the Files!
If your build version is not on the GitHub, feel free to send me the files! I will add them (and give you credit) or I can add you as a contributor to add the files to a new branch!​
GitHub Branch Name Format:
The branch names follow the same format as Microsoft's branch naming scheme for the Surface Duo. The scheme is as follows:​​device_name/android_version/build_number​​So if your device is the Surface Duo, running Android 10, on Build Number 2021.817.35 the branch you want to use is:​​surfaceduo/10/2021.817.35​
Happy Modding!

Dear... Now that I have put your magiskpatched12.158.img file, the device works, but without touching. I tried to extract the boot file from paylod.bin, but it is useless. Is there a file that you can help me with?

Related

[GUIDE] Beginner guide how to make your ROM *.img from Linux OS !!!

First you must to install yaffs!!!
Download attached archive and unpack it to /usr/sbin/ folder with your File Manager or Terminal window. I preffered File Manager, it is simpliest way.
After copyed mkfs.yaffs2 and unyaffs, you must to change permissions on these two files.
Open Terminal if you don`t previously opened and write...
[email protected]_name:~$ sudo nautilus
Nautilus is File Explorer on Ubuntu Linux. On other Linux distribution you may have other File Explorer. Anyway... open it with sudo command.
Enter your root password and navigate to /usr/sbin folder.
Find these two files mkfs.yaffs2 and unyaffs.
Right click mouse on it then click to see "Properties".
In properties tab you will see "Permissions" tab.
Click on it and set "read and write" option for all users and group in this tab then close window and Terminal.
You can change permission in the Terminal window with this command if you want...
[email protected]_name:~$ sudo chmod 667 /usr/sbin/mkfs.yaffs2
[email protected]_name:~$ sudo chmod 667 /usr/sbin/unyaffs
This is it for install mkfs.yaffs2 and unyaffs.
After that, create new folders on your desktop named as "newrom".
Copy system.img from ROM instalation folder to newrom folder and run unyaffs.
Open terminal and type... Only type BOLD text.
[email protected]_name:~$ cd /home/your_name/Desktop/newrom
[email protected]_name:~/Desktop/newrom$ unyaffs /home/your_name/Desktop/newrom/system.img
Wait unyaffs to uncompress all files and folders from system.img
When unyaffs has been completed uncompress procedure, you will see something like that...
end of image
[email protected]_name:~/Desktop/newrom$
Close terminal window if you want to close.
Open folder newrom and delete system.img file. Folder "newrom" contains everything from your system.img file. You may to change, delete or something else to create your new Android build. Yes you may to be ROM cookers.
After your intervention on files and many other stuff in your "new rom", you will be prepare to create your new "system.img" file.
This process must to be in other folder with diference name. Not to be in same folder where is your previous uncopressed folders and files. In my case this folder is "newrom".
Folder for new "system.img is my Desktop.
Ok, let see what we must to do... In case when you previous closed Terminal window, you must be placed on Desktop uses CD command in Terminal.
[email protected]_name:~$ cd Desktop
You must see this...
[email protected]_name:~/Desktop$
Enter this...
[email protected]_name:~/Desktop$ mkfs.yaffs2 newrom/ system.img
And you must see this...
mkfs.yaffs2: Android YAFFS2 Tool,Build by PowerGUI
at http://www.openhandsetalliance.org.cn
Building...
Build Ok.
[email protected]_name:~/Desktop$
After that you will see new system.img on your Desktop.
For boot.img file, procedure is same except name of *.img file.
That`s it. I hope that is help.
Thanks to everyone who helped me to write this guide.
Enjoy.
FileFixer.
so much thanks. i'll have a try~
Ignore this
I have extracted the files in to the directories as suggested but when I run the command to extract the system.img I get access is denied. I have tried this as my standard user account and logged on as root any ideas?
Edit: modified the permissions on the two files I dumped in to sbin and resolved the issue!
Yes... If you don`t permission you can login as root and change rigts on this two files.
In my case i just copy these two files in /usr/sbin folder and everything work fine.
This is, maybe i think,for per user mod.
I would be to edit thread for this problem...
Works very well very nice thread man. I was able to fully extract the img file from a gingerbread build and play arround with it and rebuild it cheers!
Pictures or video's?
You will be free to create them. I have no much time for this. if you try my procedure step by step, you can learn something...
@FileFixer
Maybe you could also post a way for us to edit the initrd.gz files in the rom builds, so we can make some changes that are necessary for SD builds to work with MAGLDR "AD SD" option ourselves?
Thanks, Santroph.
Unpack initrd.gz on your desktop and open cpio archive. Inside is a few scripts and few elf files.
I am not developer but i will trying to learn more about this.
Pretty useful tutorial i will try that soon.
FileFixer said:
Unpack initrd.gz on your desktop and open cpio archive. Inside is a few scripts and few elf files.
I am not developer but i will trying to learn more about this.
Click to expand...
Click to collapse
Cool guide did you have any help you would like to credit
No, i don`t have any help about this. I just playing with some files.
FileFixer said:
No, i don`t have any help about this. I just playing with some files.
Click to expand...
Click to collapse
KillaHurtz said:
Cool guide did you have any help you would like to credit
Click to expand...
Click to collapse
hehe
(10 chars)
When I use the command unyaffs /home/your_name/Desktop/newrom/system.img I get an error open image file failed.
Why is this not working for me?
...
Never mind, it worked!
Very useful topic!
Yo MUST be placed in to your "newrom" folder before start unyaffs command.
[email protected]_name:~$ cd /home/your_name/Desktop/newrom
then type this...
[email protected]_name:~/Desktop/newrom$ unyaffs /home/your_name/Desktop/newrom/system.img
Only type BOLD text.
Never mind, it worked for you!
After repack - no root
I did unpack and repack system.img according this guide (without any changes - only for testing). After flash the ROM works fine, but is not rooted. Original ROM is rooted.
Why? I didn't make any changes in unpacked system.img.
Can anyone help me with this, please?
Thanks.
I think that you must set permissions to all before pack img file.
santroph said:
@FileFixer
Maybe you could also post a way for us to edit the initrd.gz files in the rom builds, so we can make some changes that are necessary for SD builds to work with MAGLDR "AD SD" option ourselves?
Thanks, Santroph.
Click to expand...
Click to collapse
Hi,
Here's a quick howto
* mkdir initrd-temp
* cp initrd.gz initrd-temp
* cd initrd-temp
* gunzip initrd.gz -c | cpio --extract --make-directories
* rm initrd.gz
* Make your changes
* find .|cpio -H newc -o|gzip -9 -c - > ../initrd.gz
I hope that helps
Hey,
thanks for this useful thread!
I have problems in this whole process of booting a custom rom ( in my case Miui) in the Emulator . I have compiled the whole rom on a Linux VM with your Guide and pushed it in a Windows system into android-9/images/system.img but it won't boot I don't know what I am doing wrong. My system.img is 2 GB big I think this is not normal. if i am replacing the system.img with the original out of the emulator, it is booting. I just want to boot the Miui rom to port some features to Cyanogenmod... Thanks in advance. I have a HTC Legend btw .

[TOOLS] [LINUX, MAC, WINDOWS] Knives & Forks

Hello guys and girls. I'm gonna describe a little tool called Knives & forks and why it's so awesome. It's made by a user called DieHappy, so all credit to him! Source post: http://forums.acsyndicate.net/showthread.php?5008
Need I say once more that this isn't my work?
Before we start, I'd like to say I take no responsibility if something bad happens!
What is this, you say?
It is a set of tools for everyone, all operating systems and devices. It is a toolkit written in Python to work for Linux, Mac OS X and Windows.
Well, what does it actually do?!
Easy there. DieHappy started working on this not so long ago, so the features are limited. Right now, he focuses on making sure this program offers a stable base for all known android devices. It sets up correct ADB and Fastboot drivers and also makes the need of an android sdk useless if you only use the drivers. No need to set up an environmental path to the sdk or to navigate to a folder to use ADB, you can use ADB from ANYWHERE! Just open up cmd/a terminal and type adb and bam, it works.
How to support this project?
I don't really offer assistance to this as my knowledge is limited, but I can probably give you answers to most questions. Check out the original thread here for more help.
How to reply to this thread?
Ask anything, or write anything about this program here. Do not clutter the original thread over at ascyndicate forums.
Ok, how do I go about installing this?
First off, make sure you know how to decompress archives (namely zip or rar archives). Try 7-zip. Also, make sure you know the process of creating and renaming folders.
Download current version: 12.02.04
Mac OS X
This was tested on Mac OS X 10.7.2. Please report your success or any errors you have running this on other versions, but report them on the source thread, no use in reporting this here.
Unzip to "/Users/INSERT-YOUR-USERNAME-HERE/knives-and-forks/"
NOTE: REPLACE "INSERT-YOUR-USERNAME-HERE" WITH YOUR COMPUTER USERNAME.
FOR EXAMPLE, I WOULD UNZIP THE FILE TO: "/Users/DieHappy/knives-and-forks/"
NOTE: MAKE SURE THE DIRECTORY NAME IS SIMPLY "knives-and-forks".
DO NOT INCLUDE THE VERSION NUMBER IN THE FILE NAME FOR THE .ZIP FILE YOU DOWNLOADED.
Open Finder to "/Users/INSERT-YOUR-USERNAME-HERE/knives-and-forks/"
Double-Click "/Users/INSERT-YOUR-USERNAME-HERE/knives-and-forks/Knives-and-Forks-Mac.app"
You should see the Knives and Forks Main Menu in the Terminal window.
Linux
This was tested on Ubuntu 11.10 and Xubuntu 11.10. Please report your success or any errors you have running this on other versions or Linux distros.
Unzip to "/home/INSERT-YOUR-USERNAME-HERE/knives-and-forks/"
NOTE: REPLACE "INSERT-YOUR-USERNAME-HERE" WITH YOUR COMPUTER USERNAME.
FOR EXAMPLE, I WOULD UNZIP THE FILE TO: "/home/DieHappy/knives-and-forks/"
NOTE: MAKE SURE THE DIRECTORY NAME IS SIMPLY "knives-and-forks".
DO NOT INCLUDE THE VERSION NUMBER IN THE FILE NAME FOR THE .ZIP FILE YOU DOWNLOADED.
Open Terminal
Change the permissions to executable for "Knives-and-Forks-Linux.sh" by typing this into the Terminal window, then pressing [ENTER]:
Code:
chmod +x ~/knives-and-forks/Knives-and-Forks-Linux.sh
NOTE: "~" is a shortcut so you don't have to type "/home/INSERT-YOUR-USERNAME-HERE/"
Change to the "knives-and-forks" dir by typing the following in the Terminal window, then pressing [ENTER]:
Code:
cd ~/knives-and-forks
Run "Knives-and-Forks.sh" by typing the following in the Terminal window, then pressing [ENTER]:
Code:
[B]./[/B]Knives-and-Forks-Linux.sh
NOTE: DON'T FORGET TO TYPE "./" BEFORE THE FILE NAME.
THIS TELLS LINUX TO RUN THE SCRIPT IN THE CURRENT DIRECTORY.
TYPING JUST THE FOLLOWING WOULD RESULT IN AN ERROR:
Code:
Knives-and-Forks-Linux.sh
You should see the Knives and Forks Main Menu in a new Terminal window.
Windows
This was tested on Winows 7 Pro x64. Please report your success or any errors you have running this on other versions.
Unzip to your user profile directory
-- Vista, 7, Server 2008, Server 2008 R2: "c:\Users\INSERT-YOUR-USERNAME-HERE\knives-and-forks\"
-- 2000, XP, Server 2003: "c:\Documents & Settings\INSERT-YOUR-USERNAME-HERE\knives-and-forks\"
NOTE: REPLACE "INSERT-YOUR-USERNAME-HERE" WITH YOUR COMPUTER USERNAME.
FOR EXAMPLE, IN WINDOWS 7 I WOULD UNZIP THE FILE TO: "c:\Users\DieHappy\knives-and-forks\"
NOTE: MAKE SURE THE DIRECTORY NAME IS SIMPLY "knives-and-forks".
DO NOT INCLUDE THE VERSION NUMBER IN THE FILE NAME FOR THE .ZIP FILE YOU DOWNLOADED.
Run "c:\Users\INSERT-YOUR-USERNAME-HERE\knives-and-forks\Knives-and-Forks-Windows.cmd"
Python will automatically be downloaded and installed for you.
Once python is installed, you should see the Knives and Forks Main Menu in the command prompt window.
Ok, installed it, now what?
You should be able to open up your terminal application (or command prompt) and run some adb commands. In the future we will be automating adb commands for you, but for now you can try rebooting your device via adb by opening up a terminal (or command prompt) window, then typing the following, then pressing [ENTER]:
Code:
adb reboot
NOTE: AT THIS STAGE, YOU SHOULD ONLY NEED TO RUN THE KNIVES & FORKS SCRIPT ONCE TO INSTALL DRIVERS AND GET ADB WORKING. ONCE SETUP IS COMPLETE, YOU CAN RUN ADB COMMANDS AS SOON AS YOU OPEN UP YOUR TERMINAL/COMMAND PROMPT WINDOW.
If everything worked, your Android device should reboot. For further reading on what you can do with adb you can read THIS PAGE.
Code:
[B]**** 12.02.04 ****[/B]
- LINUX CHANGES:
-- "python2" is now called by "Knives-and-Forks-Linux.sh" instead of "python" on Arch.
- This prevents starting the script with Python 3, which results in errors.
-- Changes to "scripts/linux/install-adb-linux.sh":
- "su" will be used if "sudo" is not installed, or user doesn't have permissions to use it.
- Added 32-bit libs for more 64-bit distros:
- Arch (new in this release)
- CentOS (new in this release)
- Debian
- Fedora (new in this release)
- Ubuntu, Kubuntu, Xubuntu
- Added Debian version of '/etc/udev/rules.d/99-android.rules'
- Added '/lib/udev/rules.d/92-permissions.rules' for Debian.
This should fix permissions, allowing adb to run without sudo or su.
- WINDOWS CHANGES:
-- Fixed a couple of missing quotes which were breaking things under Windows XP
- "%userprofile%" was coming back as "c:\documents" instead of
"c:\documents and settings\username" in a couple of places
-- "c:\python27" is now the only directory where we look for python.exe
- It is faster to download and install Python to "c:\Python27" than it is to search for it
elsewhere.
- This will also prevent issues where Python 3 was installed instead of Python 2, since the
script currently gives errors under Python 3.
-- Updated amd64 and x86 versions of setx.exe for updating system PATH on XP/VISTA/7
-- PATH is updated with adb.exe location after Python is installed.
-- The computer will now reboot after updating the PATH, to make sure it will be updated before
running the main program.
[B]
**** 12.01.27 ****[/B]
- GENERAL CHANGES:
-- After adb is installed, adb will reset the android device by running "adb reboot" instead of
displaying a list of attached devices with "adb devices".
adb was occasionally reporting no devices were attached, when they infact were. When this happened
"adb reboot" still worked, so it is a better test to see if adb is setup properly.
-- Friendlier messages during adb install and testing
-- Added a startup check to make sure the script is running from the correct directory
-- Removed empty Project directory, as it is not being used yet.
- LINUX CHANGES:
-- Added support for "lxterminal" and "urxvt" in "Knifes-and-Forks-Linux.sh"
-- Changed idVendors for Linux udev rules to lowercase instead of uppercase.
- WINDOWS CHANGES:
-- Startup script searches for python in "C:\Program Files (x86)" then "C:\Program Files" and
"c:\" last.
-- Drivers should now install even if the language is not English
-- Added drivers for Casio C771 G'zOne Commando
-- Added LG drivers
-- Replaced setx.exe
[B]**** 12.01.25 ****[/B]
- Replaced "Knives-and-Forks-Mac.sh" with "Knives-and-Forks-Mac.app".
Starting the script on a Mac should now be as simple as double-clicking the new .app file.
[B]**** 12.01.24 ****[/B]
- Fixed a typo which caused the script to crash when viewing the credits screen.
- Smarter python fix for Windows users.
-- "C:\" and all sub-directories are searched for python.exe.
-- If python is not not found, it will be downloaded from python.org and installed to c:\python27.
-- If python is found (in "C:\python27", "c:\python", "c:\xyz123", "c:\program files\python27" or
in any directory with any name anywhere on drive c:) the main menu script will launch.
- Added changelog.txt to the release .zip file.
[B]
**** 12.01.23 ****[/B]
- Minor update to fix Python installation for Windows users, which was causing the script not to launch.
[B]
**** 12.01.22 ****[/B]
(FIRST PUBLIC RELEASE)
- Added option to install adb & fastboot for Linux, Windows, Mac
- Added Linux drivers for:
-- ACER
-- ASUS
-- DELL
-- FOXCONN
-- GARMIN-ASUS
-- Google
-- Hisense
-- HTC
-- HUAWEI
-- K-TOUCH
-- KT Tech
-- KYOCERA
-- LENEVO
-- LG
-- MOTOROLA
-- NEC
-- NOOK
-- NVIDIA
-- OTGV
-- PANTECH
-- PEGATRON
-- PHILIPS
-- PMC-SIERRA
-- QUALCOMM
-- SK TELESYS
-- SAMSUNG
-- SHARP
-- SONY ERICSSON
-- TOSHIBA
-- ZTE
- Added Mac drivers for:
-- Nothing. According to Google, "It just works." Let me know if they are right.
- Added a custom Windows installer with drivers for:
-- GOOGLE
-- HTC
-- HUAWEI
-- SAMSUNG
is it useful to you guys? I mean, you don't ever have to hassle with having bad drivers as these always work. And you never need to hassle with ADB and/or fastboot commands as this sets up environmental values and other stuff so you can access the adb and fastboot commands from wherever you are, i.e. no need to navigate to a certain folder.
*bump*
Thanks man. Did some googling just now and found tools for my linux mint debian edition. Any new on this tools mate?Perhaps new features for next release.
Mac OSX 10.6.8, nothing happens on double click on .app file
Can You Mirror?
Theshawty said:
*bump*
Click to expand...
Click to collapse
I have tried 4 a wk. It seems the site is down. Could you please attach the latest version here or mirror it mega? I would greatly appreciate it. I just wanted to try this out and "round out" my toolkits. Thank you for your time and help.

[GUIDE] ADB, logcat, shell, etc

ADB:-
Android Debug Bridge
Very useful program made itself by Google for Programmers and developers. Its based on command line and basically communicates with your Android to respond to certain commands. There is vast amount of knowledge about adb but its most useful commands limit to getting:-
Logcat:-
A real time log of what is happening in background of our devices. It is really useful for developers to see which component has malfunctioned and helps to narrow down their search for what failed and what needs to be fixed. Several times users are asked to give logcats of their devices which are giving errors. We will go in detail that how to get logcats in every and easiest way possible.
App Installation and Management:-
adb proves really handy if you want to install apks directly from your PC or want to batch install or delete them.
Shell Execution:-
You must have heard of Terminal Emulator. It is an app for android to execute shell commands(linux commands) which are basically present as applets in /system/bin, /system/sbin or /system/xbin(in our case) folders. A very imporant applet called busybox is installed there mainly used for execution of basic commands during root browsing or ROM installation. Many times updater script of ROMs use busybox commands to install it. Well, these commands can be initiated from your device too but they can be initiated from adb also making it easy for programmers.
Pushing and Pulling:-
Most used commands of adb. adb makes it a piece of cake for new device developers to get an ideo of structure and basic knowledge of devices by pulling command. We can pull out i.e copy any files or folders from our devices to our PC, even the root directories without rooting the devices. It help rooters and ROM chefs of new devices to get an idea and implement their mods on them. Pushing is also very useful command. It copies your files and folders from PC to your device. Very useful in pushing some /system apps and other things
Remounting and setting permissions
Basic commands:-
Of-course basic commands such as reooting and rebooting in recovery ode and download mode are supported.
Others:-
There are several other features of adb such as fastboot, aapt, etc
Setting up ADB
Pre Requirements:-
A little amount of brain
PC(This is a windows guide, if asked I will add linux and mac guide later)
Java Runtime environment or Java Developing kit
Your Device Drivers
An Android Device
Assuming you all these ready and working properly, we continue
If you are having trouble completing Pre-Requisites, there are several guides featuring them too
Start
1. First Download Android SDK. Roughly about 70 MB
2. There may be any compressed zip file or exe file
If zip file, then extract it to C:\android-sdk
If exe file then double click on it and install it in C:\ Drive(or any other drive you want)
3. Now to get adb and other tools, you need to download 'Platform Tools'
To download them, go to the android-sdk folder and double click on SDK Manager
It will ask you which package to download? However, it is your choice which package to Download, but here, we will only talk about platform
Tools. So, simply tick on Platform Tools and click on install. Once you have done it. Go to the platform-tools folder in the directory where you installed android-sdk. You will find several files there like adb, fastboot, aapt, etc
4. Now, you can backup the whole folder of android-sdk to any external storage that will make you not download package
again if you want to. You can have it placed in any computer and run it as it does not require registry to work
5. Now, you are just one step away from using adb. Next step is SKIPPING SETTING ENVIRONMENT VARIABLE
Many guides on internet say that it is to be done for making it easy for users and if you have some basic knowledge of Command Prompt,
you will know that to execute any application with command prompt, you first need to change the directory to the one where application is
placed. And to skip changing the directories every time you open CMD, you need to put that application is environment variable. Howeve, we will not do so.
6. Type cmd in the search bar. Copy cmd.exe from there. Go to the directory where you have installed android-sdk. Go to platform-tools folder. Paste cmd there, right click on it and in the settings, select Run as Administrator.
7. You are done. Now what to do in it?
ADB Commands
Type adb in command prompt. And several commands will show up on your screen. It is very difficult to analyse these all commands, so we will only talk about most used and important commands
Connect your device via USB cable
And open the CMD in platform-tools folder(Make a shortcut of it on desktop). And type the suitable commands
Code:
adb devices
Will show the list of devices attached to the PC andtheir serial numbers. If this shows up correctly on your PC, then it means that everything is fine for continuing.
Logcat
Code:
adb logcat
It will display the real time log of your device
Best time to do it is when your device boots up
Now, many users ask me how to copy the logcat and upload it from CMD
There are several methods:-
1. Right click on the Title Bar of Command Prompt. Hover the cursor over edit and select mark. Select all the things you want to copy and then click enter. All the things will be copied to clipboard.
2. This is the correct way of getting logcat saved.
Code:
adb logcat > logcat.txt
This command will create a logcat.txt document in platform-tools folder with the complete logcat of the device. Ofcourse you can type any name instead of logcat.txt
3. I prefer taking logcat this way as it neatly compiles logs of different time
Code:
adb logcat -v long > logcat.txt
This is a very nice way to get logcat.
Installing Apps
Code:
adb install %PATH OF APK%
This will install an app on your Android
For example, if my app AreeB.apk is in G:\ drive (G:\AreeB.apk)
Then I will type
Code:
adb install G:\AreeB.apk
Be sure your apk is not in a folder that has space in its name, else the command will break at space bar.
For eg:-
G:\Program Files\AreeB.apk
Mounting
However, I never found any problem in tweaking with system files with adb, but some users said that they couldn't do it, so the problem was that their system partition was mounted as Read Only(R/O)
So, it is necessary now to tell how to mount system partition as Read Write(R/W)
Code:
adb remount
It is easiest way to do so, if it does not work then
There is another method that we will discuss in ADB Shell commands section
Pushing and Pulling
For pushing,
Type
Code:
adb push %PATH TO BE PUSHED% %PATH WHERE TO BE PUSHED%
Suppose I have an app named SystemUI.apk(PATH = G:\SystemUI.apk) which I want to push in /system/app/ on my android(or in other words, install an app as a system app). Then I would type
Code:
adb push G:\SystemUI.apk /system/app/
More examples
G:\Dance.txt file to be pushed in Dance folder in sdcard
Code:
adb push G:\Dance.txt /sdcard/Dance/
OR
Code:
adb push G:\Dance.txt /mnt/sdcard/Dance/
G:\Movies folder to be transferred in SDCARD in Videos Folder
Code:
adb push G:\Movies /sdcard/Videos/
G:\system\framework\framework-res.apk to be pushed in /system/framework/
Code:
adb push G:\system\framework\framework-res.apk /system/framework/
For pulling,
push command replaces with pull and paths are swapped
Code:
adb pull %PATH TO BE PULLED FROM% %PATH TO PLACE PULLED FILE%
Example,
All system apps are to be pulled to G:\ROM\system\app
Code:
adb pull /system/app G:\ROM\system\app\
build.prop to be extracted to desktop
Code:
adb pull /system/build.prop C:\Users\Areeb\Desktop\
However, if a folder is in platform-tools folder, you don't need to type full path
Suppose if I type
Code:
adb pull /system/ system
Then a folder named system will be created inside platform-tools with all the files in system in it
If a file is in platform-tools folder, then also no need to type full path
For example,
There is an app name DeskClock.apk in this folder then, to push it to /system/app, type
Code:
adb push DeskClock.apk /system/app/
ADB Shell Commands
This mode of adb allows you to execute linux shell commands from your PC
These commands can aldo be executed through the mobile using Terminal Emulator
To initiate shell mode
Type
Code:
adb shell
You will get an prompt like this
sh-3.2#
Now you are in shell mode
adb commands won't work here and a new set of commands will work here. But we will only go in a little detail here.
Assuming you are in adb shell mode, I will only type commands that will work on shell. Note:- These commands won't work if you type them alone on cmd. But, these command will directly work on your mobile's Terminal Emulator
As these commands can also work on mobile, I am going to tell you a way of taking logcat on mobile
Type
Code:
logcat
You will see log of your device
To save this
Type
Code:
logcat > /sdcard/log.txt
A file named log.txt will be generated in sdcard
Uninstalling Applications
Code:
cd /data/app
This will change the directory to /data/app
Code:
ls
This will show the list of files in there
Suppose, there is an app named com.opera.browser (Opera Mobile) you want to uninstall it
Type
Code:
rm -r com.opera.browser
This will uninstall the app
Mounting Command:-
Code:
mount -o rw,remount /dev/block/mtdblock3 /system
Miscellanous commands:-
su: Initiates root request
du: Shows file foldrs and size
date: Shows todays date
Forgot next ones, will write later
Credits
Google: For Android and several searchings
Samsung: For Galaxy Ace s5830I
Broadcom: For their Open Sourceness
XDA Forums : For the precious knowledge
My Uncle: For gifting me this Phone
My Teachers: For teaching me English(I would not be here without them)
You: For future Thanks
Till now, thats it, will add some more things later
If any problem, I will add it too
Suggestion? They are welcome
Doesn't it belong to General section???
great work, now i know how to make a logcat. hehehehe. tnx a lot.
Ganesh A said:
Doesn't it belong to General section???
Click to expand...
Click to collapse
Well if you say so
I will request a mod to move it
But I have seen several threads (even stickies) that are guides just about logcat
And my guide features it all
Well I will not argue and request a mod if you insist
Keep it in this section

(Guide) How to logcat, ADB, shell, etc

ADB:-
Android Debug Bridge
Very useful program made itself by Google for Programmers and developers. Its based on command line and basically communicates with your Android to respond to certain commands. There is vast amount of knowledge about adb but its most useful commands limit to getting:-
Logcat:-
A real time log of what is happening in background of our devices. It is really useful for developers to see which component has malfunctioned and helps to narrow down their search for what failed and what needs to be fixed. Several times users are asked to give logcats of their devices which are giving errors. We will go in detail that how to get logcats in every and easiest way possible.
App Installation and Management:-
adb proves really handy if you want to install apks directly from your PC or want to batch install or delete them.
Shell Execution:-
You must have heard of Terminal Emulator. It is an app for android to execute shell commands(linux commands) which are basically present as applets in /system/bin, /system/sbin or /system/xbin(in our case) folders. A very imporant applet called busybox is installed there mainly used for execution of basic commands during root browsing or ROM installation. Many times updater script of ROMs use busybox commands to install it. Well, these commands can be initiated from your device too but they can be initiated from adb also making it easy for programmers.
Pushing and Pulling:-
Most used commands of adb. adb makes it a piece of cake for new device developers to get an ideo of structure and basic knowledge of devices by pulling command. We can pull out i.e copy any files or folders from our devices to our PC, even the root directories without rooting the devices. It help rooters and ROM chefs of new devices to get an idea and implement their mods on them. Pushing is also very useful command. It copies your files and folders from PC to your device. Very useful in pushing some /system apps and other things
Remounting and setting permissions
Basic commands:-
Of-course basic commands such as reooting and rebooting in recovery ode and download mode are supported.
Others:-
There are several other features of adb such as fastboot, aapt, etc
Setting up ADB
Pre Requirements:-
A little amount of brain
PC(This is a windows guide, if asked I will add linux and mac guide later)
Java Runtime environment or Java Developing kit
Your Device Drivers
An Android Device
Assuming you all these ready and working properly, we continue
If you are having trouble completing Pre-Requisites, there are several guides featuring them too
Start
1. First Download Android SDK. Roughly about 70 MB
2. There may be any compressed zip file or exe file
If zip file, then extract it to C:\android-sdk
If exe file then double click on it and install it in C:\ Drive(or any other drive you want)
3. Now to get adb and other tools, you need to download 'Platform Tools'
To download them, go to the android-sdk folder and double click on SDK Manager
It will ask you which package to download? However, it is your choice which package to Download, but here, we will only talk about platform
Tools. So, simply tick on Platform Tools and click on install. Once you have done it. Go to the platform-tools folder in the directory where you installed android-sdk. You will find several files there like adb, fastboot, aapt, etc
4. Now, you can backup the whole folder of android-sdk to any external storage that will make you not download package
again if you want to. You can have it placed in any computer and run it as it does not require registry to work
5. Now, you are just one step away from using adb. Next step is SKIPPING SETTING ENVIRONMENT VARIABLE
Many guides on internet say that it is to be done for making it easy for users and if you have some basic knowledge of Command Prompt,
you will know that to execute any application with command prompt, you first need to change the directory to the one where application is
placed. And to skip changing the directories every time you open CMD, you need to put that application is environment variable. Howeve, we will not do so.
6. Type cmd in the search bar. Copy cmd.exe from there. Go to the directory where you have installed android-sdk. Go to platform-tools folder. Paste cmd there, right click on it and in the settings, select Run as Administrator.
7. You are done. Now what to do in it?
ADB Commands
Type adb in command prompt. And several commands will show up on your screen. It is very difficult to analyse these all commands, so we will only talk about most used and important commands
Connect your device via USB cable
And open the CMD in platform-tools folder(Make a shortcut of it on desktop). And type the suitable commands
Code:
adb devices
Will show the list of devices attached to the PC andtheir serial numbers. If this shows up correctly on your PC, then it means that everything is fine for continuing.
Logcat
Code:
adb logcat
It will display the real time log of your device
Best time to do it is when your device boots up
Now, many users ask me how to copy the logcat and upload it from CMD
There are several methods:-
1. Right click on the Title Bar of Command Prompt. Hover the cursor over edit and select mark. Select all the things you want to copy and then click enter. All the things will be copied to clipboard.
2. This is the correct way of getting logcat saved.
Code:
adb logcat > logcat.txt
This command will create a logcat.txt document in platform-tools folder with the complete logcat of the device. Ofcourse you can type any name instead of logcat.txt
3. I prefer taking logcat this way as it neatly compiles logs of different time
Code:
adb logcat -v long > logcat.txt
This is a very nice way to get logcat.
Installing Apps
Code:
adb install %PATH OF APK%
This will install an app on your Android
For example, if my app AreeB.apk is in G:\ drive (G:\AreeB.apk)
Then I will type
Code:
adb install G:\AreeB.apk
Be sure your apk is not in a folder that has space in its name, else the command will break at space bar.
For eg:-
G:\Program Files\AreeB.apk
Mounting
However, I never found any problem in tweaking with system files with adb, but some users said that they couldn't do it, so the problem was that their system partition was mounted as Read Only(R/O)
So, it is necessary now to tell how to mount system partition as Read Write(R/W)
Code:
adb remount
It is easiest way to do so, if it does not work then
There is another method that we will discuss in ADB Shell commands section
Pushing and Pulling
For pushing,
Type
Code:
adb push %PATH TO BE PUSHED% %PATH WHERE TO BE PUSHED%
Suppose I have an app named SystemUI.apk(PATH = G:\SystemUI.apk) which I want to push in /system/app/ on my android(or in other words, install an app as a system app). Then I would type
Code:
adb push G:\SystemUI.apk /system/app/
More examples
G:\Dance.txt file to be pushed in Dance folder in sdcard
Code:
adb push G:\Dance.txt /sdcard/Dance/
OR
Code:
adb push G:\Dance.txt /mnt/sdcard/Dance/
G:\Movies folder to be transferred in SDCARD in Videos Folder
Code:
adb push G:\Movies /sdcard/Videos/
G:\system\framework\framework-res.apk to be pushed in /system/framework/
Code:
adb push G:\system\framework\framework-res.apk /system/framework/
For pulling,
push command replaces with pull and paths are swapped
Code:
adb pull %PATH TO BE PULLED FROM% %PATH TO PLACE PULLED FILE%
Example,
All system apps are to be pulled to G:\ROM\system\app
Code:
adb pull /system/app G:\ROM\system\app\
build.prop to be extracted to desktop
Code:
adb pull /system/build.prop C:\Users\Areeb\Desktop\
However, if a folder is in platform-tools folder, you don't need to type full path
Suppose if I type
Code:
adb pull /system/ system
Then a folder named system will be created inside platform-tools with all the files in system in it
If a file is in platform-tools folder, then also no need to type full path
For example,
There is an app name DeskClock.apk in this folder then, to push it to /system/app, type
Code:
adb push DeskClock.apk /system/app/
ADB Shell Commands
This mode of adb allows you to execute linux shell commands from your PC
These commands can aldo be executed through the mobile using Terminal Emulator
To initiate shell mode
Type
Code:
adb shell
You will get an prompt like this
sh-3.2#
Now you are in shell mode
adb commands won't work here and a new set of commands will work here. But we will only go in a little detail here.
Assuming you are in adb shell mode, I will only type commands that will work on shell. Note:- These commands won't work if you type them alone on cmd. But, these command will directly work on your mobile's Terminal Emulator
As these commands can also work on mobile, I am going to tell you a way of taking logcat on mobile
Type
Code:
logcat
You will see log of your device
To save this
Type
Code:
logcat > /sdcard/log.txt
A file named log.txt will be generated in sdcard
Uninstalling Applications
Code:
cd /data/app
This will change the directory to /data/app
Code:
ls
This will show the list of files in there
Suppose, there is an app named com.opera.browser (Opera Mobile) you want to uninstall it
Type
Code:
rm -r com.opera.browser
This will uninstall the app
Mounting Command:-
Code:
mount -o rw,remount system /system/
Miscellanous commands:-
su: Initiates root request
du: Shows files, folders and size
date: Shows todays date
surfaceflinger: Shows your bootanimation (Tested on GB)
grep: Used to search through text files
chmod: Sets permission to files
sh: Initiates shell mode
echo: Displays the text you wrote with the command. Analogous to PRINT command on QBasic
Forgot next ones, will write later
Credits
Google: For Android and several searchings
Samsung: For Galaxy Ace s5830I
Broadcom: For their Open Sourceness
XDA Forums : For the precious knowledge
My Uncle: For gifting me this Phone
My Teachers: For teaching me English(I would not be here without them)
You: For future Thanks
Till now, thats it, will add some more things later
If any problem, I will add it too
Suggestion? They are welcome
Nice thread , every thing is very clearly stated.
Thx, Nice guide.
I suggest to change the 'remount' command in:
mount -o remount,rw /system
As the effect is the same and it works universally (at least, should)
Sent from my GT-5660 using xda app-developers app
ItachiSama said:
I suggest to change the 'remount' command in:
mount -o remount,rw /system
As the effect is the same and it works universally (at least, should)
Sent from my GT-5660 using xda app-developers app
Click to expand...
Click to collapse
I use the command you mentioned every time. Thanks for reminding. I can't remember why I wrote that command there!

[ADB GUIDE] How to use ADB. (Noob edition)

ADB
Android Debug Bridge
Very useful program made itself by Google for Programmers and developers. Its based on command line and basically communicates with your Android to respond to certain commands. There is vast amount of knowledge about adb but its most useful commands limit to getting:-
Logcat:-
A real time log of what is happening in background of our devices. It is really useful for developers to see which component has malfunctioned and helps to narrow down their search for what failed and what needs to be fixed. Several times users are asked to give logcats of their devices which are giving errors. We will go in detail that how to get logcats in every and easiest way possible.
App Installation and Management:-
adb proves really handy if you want to install apks directly from your PC or want to batch install or delete them.
Shell Execution:-
You must have heard of Terminal Emulator. It is an app for android to execute shell commands(linux commands) which are basically present as applets in /system/bin, /system/sbin or /system/xbin(in our case) folders. A very imporant applet called busybox is installed there mainly used for execution of basic commands during root browsing or ROM installation. Many times updater script of ROMs use busybox commands to install it. Well, these commands can be initiated from your device too but they can be initiated from adb also making it easy for programmers.
Pushing and Pulling:-
Most used commands of adb. adb makes it a piece of cake for new device developers to get an ideo of structure and basic knowledge of devices by pulling command. We can pull out i.e copy any files or folders from our devices to our PC, even the root directories without rooting the devices. It help rooters and ROM chefs of new devices to get an idea and implement their mods on them. Pushing is also very useful command. It copies your files and folders from PC to your device. Very useful in pushing some /system apps and other things
Remounting and setting permissions
Basic commands:-
Of-course basic commands such as reooting and rebooting in recovery ode and download mode are supported.
Others:-
There are several other features of adb such as fastboot, aapt, etc
Setting up ADB
Pre Requirements:-
A little amount of brain
PC(This is a windows guide, if asked I will add linux and mac guide later)
Java Runtime environment or Java Developing kit
Your Device Drivers
An Android Device
USB Debugging MUST be turned ON in the device for ADB to see it & Developer options is hidden in Android 4.2 and
above, Hitting Build number 10 times in
About Phone/Tablet reveals the menu (Thanks lilHermit for reminding me to add it)
Assuming you all these ready and working properly, we continue
If you are having trouble completing Pre-Requisites, there are several guides featuring them too
Start
1. First Download Android SDK. Roughly about 70 MB
2. There may be any compressed zip file or exe file
If zip file, then extract it to C:\android-sdk
If exe file then double click on it and install it in C:\ Drive(or any other drive you want)
3. Now to get adb and other tools, you need to download 'Platform Tools'
To download them, go to the android-sdk folder and double click on SDK Manager
It will ask you which package to download? However, it is your choice which package to Download, but here, we will only talk about platform
Tools. So, simply tick on Platform Tools and click on install. Once you have done it. Go to the platform-tools folder in the directory where you installed android-sdk. You will find several files there like adb, fastboot, aapt, etc
4. Now, you can backup the whole folder of android-sdk to any external storage that will make you not download package
again if you want to. You can have it placed in any computer and run it as it does not require registry to work
5. Now, you are just one step away from using adb. Next step is SKIPPING SETTING ENVIRONMENT VARIABLE (If you however want to set environment variables.)
We can easily append the sdk platform-tools and tools folder to your systems environmental path variable directly from command line(cmd) by simply issuing one command and performing a system reboot:
Code:
SETX PATH "%PATH%;SDK_Install_Path\platform-tools;SDK_Install_Path\android-sdk-windows\tools" -m
Just replace the "SDK_Install_Path" in the above with the proper path of your SDK installation. Example: C:\android-sdk-windows
Many guides on internet say that it is to be done for making it easy for users and if you have some basic knowledge of Command Prompt,
you will know that to execute any application with command prompt, you first need to change the directory to the one where application is
placed. And to skip changing the directories every time you open CMD, you need to put that application is environment variable. Howeve, we will not do so.
6. Type cmd in the search bar. Copy cmd.exe from there. Go to the directory where you have installed android-sdk. Go to platform-tools folder. Paste cmd there, right click on it and in the settings, select Run as Administrator.
7. You are done. Now what to do in it?
ADB Commands
Type adb in command prompt. And several commands will show up on your screen. It is very difficult to analyse these all commands, so we will only talk about most used and important commands
Connect your device via USB cable
And open the CMD in platform-tools folder(Make a shortcut of it on desktop). And type the suitable commands
Code:
adb devices
Will show the list of devices attached to the PC andtheir serial numbers. If this shows up correctly on your PC, then it means that everything is fine for continuing.
Logcat
Code:
adb logcat
It will display the real time log of your device
Best time to do it is when your device boots up
Now, many users ask me how to copy the logcat and upload it from CMD
There are several methods:-
1. Right click on the Title Bar of Command Prompt. Hover the cursor over edit and select mark. Select all the things you want to copy and then click enter. All the things will be copied to clipboard.
2. This is the correct way of getting logcat saved.
Code:
adb logcat > logcat.txt
This command will create a logcat.txt document in platform-tools folder with the complete logcat of the device. Ofcourse you can type any name instead of logcat.txt
3. I prefer taking logcat this way as it neatly compiles logs of different time
Code:
adb logcat -v long > logcat.txt
This is a very nice way to get logcat.
Installing Apps
Code:
adb install %PATH OF APK%
This will install an app on your Android
For example, if my app AreeB.apk is in G:\ drive (G:\AreeB.apk)
Then I will type
Code:
adb install G:\AreeB.apk
Be sure your apk is not in a folder that has space in its name, else the command will break at space bar.
For eg:-
G:\Program Files\AreeB.apk
Note:
If you have spaces in path of apk, you can execute the command without breakage if you include the path inside quotes. (Thanks to etcman)
Eg:-
Code:
adb install "G:\Program Files\AreeB.apk"
Mounting
However, I never found any problem in tweaking with system files with adb, but some users said that they couldn't do it, so the problem was that their system partition was mounted as Read Only(R/O)
So, it is necessary now to tell how to mount system partition as Read Write(R/W)
Code:
adb remount
It is easiest way to do so, if it does not work then
There is another method that we will discuss in ADB Shell commands section
Pushing and Pulling
For pushing,
Type
Code:
adb push %PATH TO BE PUSHED% %PATH WHERE TO BE PUSHED%
Suppose I have an app named SystemUI.apk(PATH = G:\SystemUI.apk) which I want to push in /system/app/ on my android(or in other words, install an app as a system app). Then I would type
Code:
adb push G:\SystemUI.apk /system/app/
More examples
G:\Dance.txt file to be pushed in Dance folder in sdcard
Code:
adb push G:\Dance.txt /sdcard/Dance/
OR
Code:
adb push G:\Dance.txt /mnt/sdcard/Dance/
G:\Movies folder to be transferred in SDCARD in Videos Folder
Code:
adb push G:\Movies /sdcard/Videos/
G:\system\framework\framework-res.apk to be pushed in /system/framework/
Code:
adb push G:\system\framework\framework-res.apk /system/framework/
For pulling,
push command replaces with pull and paths are swapped
Code:
adb pull %PATH TO BE PULLED FROM% %PATH TO PLACE PULLED FILE%
Example,
All system apps are to be pulled to G:\ROM\system\app
Code:
adb pull /system/app G:\ROM\system\app\
build.prop to be extracted to desktop
Code:
adb pull /system/build.prop C:\Users\Areeb\Desktop\
However, if a folder is in platform-tools folder, you don't need to type full path
Suppose if I type
Code:
adb pull /system/ system
Then a folder named system will be created inside platform-tools with all the files in system in it
If a file is in platform-tools folder, then also no need to type full path
For example,
There is an app name DeskClock.apk in this folder then, to push it to /system/app, type
Code:
adb push DeskClock.apk /system/app/
ADB Shell Commands
This mode of adb allows you to execute linux shell commands from your PC
These commands can aldo be executed through the mobile using Terminal Emulator
To initiate shell mode
Type
Code:
adb shell
You will get an prompt like this
sh-3.2#
Now you are in shell mode
adb commands won't work here and a new set of commands will work here. But we will only go in a little detail here.
Assuming you are in adb shell mode, I will only type commands that will work on shell. Note:- These commands won't work if you type them alone on cmd. But, these command will directly work on your mobile's Terminal Emulator
As these commands can also work on mobile, I am going to tell you a way of taking logcat on mobile
Type
Code:
logcat
You will see log of your device
To save this
Type
Code:
logcat > /sdcard/log.txt
A file named log.txt will be generated in sdcard
Uninstalling Applications
Code:
cd /data/app
This will change the directory to /data/app
Code:
ls
This will show the list of files in there
Suppose, there is an app named com.opera.browser (Opera Mobile) you want to uninstall it
Type
Code:
rm -r com.opera.browser
This will uninstall the app
Mounting Command:-
Code:
mount -o rw,remount /dev/block/mtdblock3 /system
Miscellanous commands:-
su: Initiates root request
du: Shows file foldrs and size
date: Shows todays date
ls: Shows list of directory
cd: Changes working directory
rm: Removes the file
logcat: Displays logcat
mount: Mounts the partition
busybox: Busybox Applets
Forgot next ones, will write later
All credits go to
iamareebjamal
For writing this up.

Categories

Resources