What is Android Virtual Device?
An Android Virtual Device (AVD) is an emulator configuration that lets you model an actual device by defining hardware and software options to be emulated by the Android Emulator.
In simple words, this thing will let you use android phone in your PC! But, with some limitations.
This AVD comes with Android SDK. So, the guide starts now.
♦ Setup Android SDK -
● Download and install Java - Link or Link
● Download and install Android SDK - Link
● While installing SDK choose the directory C:\android-sdk-windows\ only (Install it in root directory, not in any extra folder).
● Now, you have installed sdk.
● Now, open SDK Manager from android-sdk-folder. Here, you will see a list of tools. In that deselect everything first and then select Android Version (API) of your choice.
● Click on install packages and let the packages to be downloaded and installed.
♦ Setup and start AVD -
● Open AVD Manager from android-sdk.
● Click on "New" button. A window will appear with many choices and selection.
● Fill every box as per your choices and requirements and click on ok.
● Window will hang for some time as it is creating your AVD.
● Once the AVD is created, close everything.
♦ Rooting AVD and Adding Google Play -
● Now, in your pc, open CMD (Start>run>cmd or Start>search>cmd)
● In cmd, type - cd C:\android-sdk-windows\tools\ In general, it is the directory where your android sdk's tools directory is.
● Now, we will start the emulator from command line. For that, type -
Code:
emulator -avd your avd name -system-partition 128 -no-snapshot-load
and press enter.
● It will start the avd. Now, we will push the needed files to system via adb.
● Download the attachment below. Extract all files to the "tools" folder in your android-sdk.
● In cmd, type -
Code:
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock0 /system
● Now, we will push files to system, type -
Code:
adb push su /system/xbin/
adb push busybox /system/xbin/
adb push Superuser.apk /system/app/
● Now, we have to give permissions, type -
Code:
adb shell chmod 06755 /system/xbin/su
adb shell chmod 06755 /system/xbin/busybox
adb shell chmod 644 /system/app/Superuser.apk
Rooting done!
● Now, for Google play, we have to push the files -
Code:
adb push Vending.apk /system/app/
adb push GoogleServicesFramework.apk /system/app/
adb push MarketUpdater.apk /system/app/
● Now, permissions, type -
Code:
adb shell chmod 644 /system/app/Vending.apk
adb shell chmod 644 /system/app/GoogleServicesFramework.apk
adb shell chmod 644 /system/app/MarketUpdater.apk
● Now, if you want -
Code:
adb push rootexplorer.apk /system/app/
adb push rootcheck.apk /system/app/
adb shell chmod 644 /system/app/rootexplorer.apk
adb shell chmod 644 /system/app/rootcheck.apk
● Now, important. We have to copy system to data for making it modifyable image. Type -
Code:
adb shell busybox rm -R /data/*
adb shell busybox ls /data
● Type -
Code:
adb shell busybox cp -a /system/* /data/
adb shell busybox ls /data
Done!
● Now, /data is your /system. So, now navigate to - C:\Users\yourusername\.android\avd\youravdname.avd\
and copy the file "userdata-qemu.img to a root directory such as C:\userdata-qemu.img. Rename it to "system.img"
● Close the emulator and then again type in cmd -
Code:
cd C:\android-sdk-windows\tools\
and type -
Code:
emulator -avd your avd name -system C:\system.img
This will start the AVD with your customized rooted system image. Everytime start the AVD like this.
● Now, check the root with root checker app and you are done..!!!
Now, Enjoy your android device on PC with root as well as Google Play.
Mods not now. Coming soon........
found this
http://www.ehalm.at/avd-4.3-gapps.php?l=en
pre built system img with su and market all ready to go
[Root AVD] Rooting Android Emulator (inc. 'x86_64') with SuperSU installable ZIP
maybe be useful for any..)
& !! of course GREAT THANKS to @Chainfire for amazing work !! &
#########################################
example result:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
preface
tried before Genymotion, but ..
wish to FULL control my emu
//& really some performance issues, especially in comparison with x64 arch! )
read&try before some methods, but no any satisfied;
especially with AVD x86_64 based system images
so 'at last' - go to "primary sources" of SU http://su.chainfire.eu , and there
6 Embedding (Nov 27, 2014)
6.1 Files
6.2 Custom ROMs
6.3 Exploits
Click to expand...
Click to collapse
significantly http://su.chainfire.eu/#embed-exploit
6.3. Exploits
Over the past years, many exploits have installed SuperSU as their means of persistent root. Often the exploit leaves the system in an unstable state, and a proper and lengthy installation may not be possible. The APK can fix a partial install as long as basic root works. At the time of this writing, that means at least these files need to be present, and for the right architecture and amount of bits for the firmware (see the ZIP script for permissions and API levels):
/system/xbin/su
/system/xbin/daemonsu
/system/xbin/supolicy
/system/lib(64)/libsupol.so
Furthermore, daemonsu --auto-daemon needs to be launched somehow on boot. This is generally done via install-recovery.sh, 99SuperSUDaemon, or hijacking app_process([32|64]).
Alternatively, you can include the ZIP and run SuperSU's installation script. For this to work, at the time of this writing, the following commands need to be available on the PATH:
cat, chmod, chown, cp, dd, echo, grep, ln, ls, mkdir, mount, mv, rm, rmdir, sh, sleep, sync, umount, unzip
Additionally, sh needs test support ([ ] square brackets work in if statements). Aside from unzip, all of these should be present on a fully booted 4.3+ Android device. If not, you can provide a (SELinux capable) toolbox or busybox and symlink these commands somewhere on the PATH. Last but not least, /tmp should be writable. If all of these dependencies are met, you can install the ZIP as follows:
unzip /path/to/supersu.zip META-INF/com/google/android/* -d /tmp
sh /tmp/META-INF/com/google/android/update-binary dummy 1 /path/to/supersu.zip
Due to the script trying things in various ways to support different systems and recovery versions, it will throw errors at you regardless of if the installation is succesfull or not. Just ignore those, reboot, and see if the SuperSU GUI complains when you open it.
Click to expand...
Click to collapse
so - accord to @Chainfire rec:
Manual for rooting any version of AVD (emu) with SuperSU installable ZIP
in this example:
host machine:
Code:
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
Path=C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Win
dowsPowerShell\v1.0\;C:\Program Files\PuTTY;C:\adb;c:\Program Files\Java\jdk1.8.0_25\bin;C:\Users\admin\AppData\Local\An
droid\android-sdk\platform-tools;C:\Users\admin\AppData\Local\Android\android-sdk\tools;C:\Users\admin\.android\
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=2a07
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
"d:\SU237" used 'as working dir'
"UPDATE-SuperSU-v2.37.zip" - last ver of installable ZIP at this moment )
"x86L_64r" - testing AVD:
Code:
d:\SU237>android list avd
Available Android Virtual Devices:
...
---------
Name: x86L_64r
Device: Nexus 4 (Google)
Path: C:\Users\admin\.android\avd\x86L_64r.avd
Target: Android 5.0 (API level 21)
Tag/ABI: default/x86_64
Skin: WXGA720
Sdcard: 200M
WXGA720 - my favorite skin
emu = emulator
acc. = according to
addit. = additional(ly)
rec. = recommendations
etc.
0. of course - "sdk tools have to be installed & AVD have to be created"
1. download last ver of SuperSU installable ZIP
2. unpack the content of "UPDATE-SuperSU-v*.**.zip" to supersu folder 'in working dir':
Code:
d:\SU237>tree /f
Folder PATH listing for volume D
Volume serial number is 2**
D:.
│
└───supersu
├───arm
│ chattr
│ chattr.pie
│ libsupol.so
│ su
│ supolicy
│
├───arm64
│ libsupol.so
│ su
│ supolicy
│
├───armv7
│ chattr.pie
│ libsupol.so
│ su
│ supolicy
│
├───common
│ 99SuperSUDaemon
│ install-recovery.sh
│ Superuser.apk
│
├───META-INF
│ │ CERT.RSA
│ │ CERT.SF
│ │ MANIFEST.MF
│ │
│ └───com
│ └───google
│ └───android
│ update-binary
│ updater-script
│
├───mips
│ chattr.pie
│ libsupol.so
│ su
│ supolicy
│
├───mips64
│ libsupol.so
│ su
│ supolicy
│
├───x64
│ libsupol.so
│ su
│ supolicy
│
└───x86
chattr
chattr.pie
libsupol.so
su
supolicy
d:\SU237>
3. start AVD
usually using '*.bat' file for starting AVD - as in this case addit. params can be used
for example 'my' "x86L_64r.bat":
Code:
cmd /k "emulator -cpu-delay 0 -cache ./cache -no-boot-anim -partition-size 900 -gpu on -verbose -shell -accel on -scale 0.5 -avd x86L_64r"
for details about params - of course look at:
http://developer.android.com/tools/help/emulator.html
http://developer.android.com/tools/devices/managing-avds-cmdline.html
addit. "-partition-size 900" - is due to often (esp. at def. params of sys partitions API <= 19 )
- there are no any free space on system partitions -- so 'rooting can not be done ("have no space for copying req. files"))'; for exmpl:
Code:
---------
Name: x86jb412
Device: Nexus S (Google)
Path: C:\Users\admin\.android\avd\x86jb412.avd
Target: Android 4.1.2 (API level 16)
Tag/ABI: default/x86
Skin: WXGA720
Sdcard: 50M
Code:
C:\Users\admin\Desktop>adb shell
[email protected]:/ # df
df
Filesystem Size Used Free Blksize
/dev 441M 68K 441M 4096
/mnt/secure 441M 0K 441M 4096
/mnt/asec 441M 0K 441M 4096
/mnt/obb 441M 0K 441M 4096
[B][COLOR="Red"]/system 264M 264M 0K 4096[/COLOR][/B]
/data 388M 8M 379M 4096
/cache 64M 1M 62M 4096
/mnt/sdcard 196M 6K 196M 512
/mnt/secure/asec 196M 6K 196M 512
[email protected]:/ #
4. enter CMD (or in shell)) commands:
Code:
adb remount
adb shell mount -o rw,remount -t rootfs rootfs
adb shell mkdir /tmp
adb shell mkdir /tmp/supersu
adb push supersu /tmp/supersu
adb shell sh /tmp/supersu/META-INF/com/google/android/update-binary dummy 1 /tmp/supersu/supersu.zip
adb shell su -v
adb shell su -V
adb shell stop
ping -n 5 -w 1000 127.0.0.1
adb shell start
ping -n 15 -w 1000 127.0.0.1
adb shell daemonsu --daemon
comments:
adb remount // -- (re)mount system writeable
adb shell mount -o rw,remount -t rootfs rootfs // -- (re)mount "/" as writeable for creating req following dirs -- acc. to @Chainfire rec. "Last but not least, /tmp should be writable." above
adb shell mkdir /tmp
adb shell mkdir /tmp/supersu
adb push supersu /tmp/supersu //-- transfer folder 'supersu' into emu
adb shell sh /tmp/supersu/META-INF/com/google/android/update-binary dummy 1 /tmp/supersu/supersu.zip //-- last param '/tmp/supersu/supersu.zip' can be ignored due to absence of toolbox or busybox at native emu - but that is 'no deal at all')
//-- example log of execution: - look at attach 'example_adb_log.txt'
adb shell su -v //-- check ver of su binary
adb shell su -V //-- check ver of su binary
adb shell stop //-- for SuperSU appear at "App drawer" - need 'restart emulator' --- and ("after updrading") -- SuperSU appear in "App drawer" )
ping -n 5 -w 1000 127.0.0.1 //-- timeout
adb shell start
ping -n 15 -w 1000 127.0.0.1 //-- timeout; after restarting (esp. at ARM arch!)
adb shell daemonsu --daemon //-- su daemon do need to be started! // another case: adb shell daemonsu --auto-daemon &
^C = CTRL+C - for exit from terminal
additionally:
Code:
adb shell am start -n eu.chainfire.supersu/.MainActivity
-- to open SuperSU app 'from adb'
Code:
adb shell su --self-test
--self-test //-- from "- Various logs (very important)" http://forum.xda-developers.com/apps/supersu/support-update-failures-t2907365
Code:
adb shell su -h
-- help (interesting)
Code:
telnet localhost 5554
-- to control emu from console ))
for example - 'kill' emu (close instance)
or resize window (window scale 0.5)
+addit. Using the Emulator Console http://developer.android.com/tools/devices/emulator.html#console
------------
to save created (rooted) system image -- you can look at 'verbose view' of console (*.bat file) started emu
and there find like:
Code:
...
emulator: Mapping 'system' partition image to C:\Users\admin\AppData\Local\Temp\\AndroidEmulator\TMPF1D7.tmp
...
(exmpl. - attach "verbose_cmd.txt")
so (at moment of working emu!; of course when you close the emu - this file will be deleted! - http://developer.android.com/tools/devices/emulator.html#temporaryimages)
- just copy this "*.tmp" file to another place and use it "as your rooted system image!"
Related
Hi,
I'm making a batch file (*.bat) for myself to try make some things easier file where I enter commands with adb.exe.
The problem is, any code after 'adb shell' is not executed in the batch.
So if I had a batch with the following:
Code:
adb shell
su
'su' will not be executed and stays at '$'.
It seems like it's too deep for a batch file to enter codes.
I also tried pushing a sh with the same script and run it from adb but then all I get it permission denied.
I have also tried 'adb shell su' without any luck.
Anyone with a solution?
Anyone? Or how about a .rc file that gets su and runs commands...
Sent from my HTC
To execute a script, you can always push your script and then execute it:
Code:
adb push script /sdcard/script
adb shell sh /sdcard/script
As for the commands you have shown, keep in mind that su doesn't simply change the running shell's permissions or the like but creates a new child environment within its own shell. You leave your script and after the new shell has finished, you're back in your old environment and the script continues.
mizch said:
To execute a script, you can always push your script and then execute it:
Code:
adb push script /sdcard/script
adb shell sh /sdcard/script
As for the commands you have shown, keep in mind that su doesn't simply change the running shell's permissions or the like but creates a new child environment within its own shell. You leave your script and after the new shell has finished, you're back in your old environment and the script continues.
Click to expand...
Click to collapse
yes, is there any way to automate the script inside the shell and use exit to finally go back to the batch script.
Can you provide me with an example of what you want to achieve?
To execute shell commands from a batch, it doesn't matter if I have to push a script and execute it. It's so that I get su and automate commands after that. Like flash_image, remount, chmod etc..
you will need to use the 'adb shell command' ad 'sh' files
I am trying to create a unix script file that copies files from /dbdata/databases to another folder as a backup.
When I try running the script in adb shell as SU, I get
cd: can't cd to /dbdata/databases
This is on a rooted Captivate. Any help would be greatly appreciated!
Hi,
su -c "command" should do the job for you. You will need to enclose the whole of the command in quotes however, otherwise su will be expecting the command to execute, doing nothing.
Example: adb shell "su -c 'sqlite3 /data/data/my.db/databases/mydb.db < /sdcard/dump.sql'" (run from a Unix or Windows(?) shell). Notice the use of "" and ''.
(in this case dump.sql contains .dump, for instance)
Of course the sqlite3 command could be placed within another script on the android device.
Hope that helps.
I looked around a bit and found the answer.
The simple answer is, wrap the command
Code:
cp "source" "destination"
in double quotes!
Thank you grindingbob for the adb shell "su -c 'sh /mnt/sdcard/tmp/2.sh'" command.
No probs I was more referring to executing commands as a su without interacting with adb shell.
As a side-note, cp might not be a good idea, unless you're sure no db accessing is taking place at the same time.
I am pretty sure well as sure as a novice can be! The files I am backing up are log files, call history and text message history.
The results from running a unix script which contains
Code:
cp "/dbdata/databases/com.android.providers.contacts/contacts2.db" "/mnt/sdcard/tmp4/contacts2.db"
cp "/dbdata/databases/com.android.providers.telephony/mmssms.db" "/mnt/sdcard/tmp4/mmssms.db"
cp "/dbdata/databases/com.sec.android.provider.logsprovider/logs.db" "/mnt/sdcard/tmp4/logs.db"
are only the logs.db file is copied, the other two are not.
grindingbob said:
No probs I was more referring to executing commands as a su without interacting with adb shell.
As a side-note, cp might not be a good idea, unless you're sure no db accessing is taking place at the same time.
Click to expand...
Click to collapse
Permission issues for *.sh files from ADB
Dear All,
I have a 3.2 device with Root permissions & Busybox.
I created a sample *.sh file, Pushed to SDcard, and gave '777' Permissions. When i Try to run it from ADB shell its not working Any help...
CMD prompt Traces:
Step -1: Created a sh file
cat TAB.sh
#!/bin/sh
cd /data/data/com.android.gallery/shared_prefs
Step -2 Pushed the file to SDcard
# ls -l *.sh
ls -l *.sh
-rw-rw-r-- root sdcard_rw 56 2012-03-13 15:06 SP.sh
-rw-rw-r-- root sdcard_rw 62 2012-03-13 15:05 TAB.sh
Step -3 Gave 777 permission for *.sh files
# chmod 777 *.sh
chmod 777 *.sh
# ls -l
ls -l
-rw-rw-r-- root sdcard_rw 56 2012-03-13 15:06 SP.sh
-rw-rw-r-- root sdcard_rw 62 2012-03-13 15:05 TAB.sh
Execute permission not applied
Tried other operations, dint workout
Step 4 other options:
# chmod +X *.sh
chmod +X *.sh
Bad mode
# chmod +x *.sh
chmod +x *.sh
Bad mode
# chmod u+x *.sh
chmod u+x *.sh
Bad mode
Any Help?
Common Commands used in Linux.
Since, Android is based on Linux, there is much possibility that there is a need to use a Linux based OS. For such use, UBUNTU
is favoured, for its easy and more user friendly.
Today, I am going to Post a few commands that are very useful to the newbies to development
I myself am new, and have faced many problems with this, so I am posting a this thread, to help all the noobs/newbies find what they need in a single place
Okay so, lets start with some basic commands, which can be classified as general commands, and each Linux user MUST KNOW ALL OF THEM !!
Code:
sudo
It simply means "Superuser do". It requires password.
Code:
sudo apt-get install APPLICATION_name
This installs the application finding it on the internet, and gives you the suitable output(If the app exists or not).
Code:
sudo apt-get remove APPLICATION_name
It Removes the application
Code:
sudo apt-get update
it updates the repositories
Code:
sudo apt-get upgrade
upgrades your installed application with their latest versions from Ubuntu repositories
Code:
killall APPLICATION_NAME
kills (terminates) an application
Code:
ps -e
displays currently running processes
Code:
kill APPLICATION_PID
kills an application; where APPLICATION_PID.
NOTE: YOU CAN FIND "PID" USING EARLIER CODE.
Code:
wget http://path_to_file.com
downloads a file from the web to current directory
Code:
cd /PATH/TO/DIR
changes current directory to DIR. Use cd to change the current directory into any dir
Code:
cd ..
Like ms-dos, goes up one directory
Code:
dir
OR
Code:
ls
lists directory content
Code:
man COMMAND
Displays manual for command.
eg: man sudo
Code:
cp ORIGINALFILE NEWFILE
Copy a file
Code:
mv SOURCE DESTINATION
Moves a file
NOTE: YOU CAN ALSO RENAME A FILE WITH THIS.
EG: mv old_filename new_filename
Code:
mkdir FOLDERNAME
Make a directory/folder
Miscellaneous: Level 2
Code:
du -sh folder name
This calculates the size of the folder
Code:
ps -aux
This shows all the running processes
Code:
chown -R User:User dir
Change owner of files and directories
Code:
chmod 777 yourScript
This makes a shell script ".sh" extension
Code:
netstat -anltp | grep "LISTEN"
See all open ports on your machine
Code:
sudo apt-get install ufw
sudo ufw allow 80/tcp
sudo ufw allow 22/tcp
sudo ufw allow 443/tcp
sudo ufw allow 21/tcp
sudo ufw enable
Ubuntu provides a uncomplicated firewall (ufw). To install it and only allow SSH, FTP, and webtraffic use the following command.
Network Commands
Code:
ifconfig
Shows the network connections
WILL UPDATE REGULARLY AS MUCH I COULD.
Code:
passwd
Run after installing Linux when you see "[email protected]:~$" to set your root pass word
Code:
adduser
Replace and run to add a new user
Code:
adduser sudo
Replace and run to add that user to sudo
Code:
sudo apt-get purge
Replace and run to purge your system of that package
Code:
apt-cache search
Replace and run to search for new packages to install
Note: "wild cards" eg "*" are acceptable
Code:
find -type f -iname 'some-compressed-file*' -print0 | xargs -0 sudo tar -vxpzf
Replace with at least the "root" directory you want to search through and Replace " some-compressed-file " (leave the single quotes ' ' and the wild card *) and run to find every file under the given directory that has that name and the pipe " | " it out to tar so that'll extract to your current directory
Note: "find" does the finding, the "-type -f" tells find to only look for files, the "-iname" tells find to search parts of file names, the ' ' around "some-compressed-file" keeps the * from doing bad things, the "print0" tells find to "scrub" for spaces and such before outputting a result, the " | " pipes the results of find to xargs, the "-0" is because of "print0" in the find side of the pipe, and "sudo tar - vxpzf" is where tar extracts the findings of find.
Code:
find $HOME -type f -iname '*zip' -print0 | xargs -0 ls
Run to find and list every zip file under the home folder
Say you want to make a file to contain some notes wile in the command line
Code:
sudo cat > $HOME/someNotes.txt <<EOF
# place a command here
echo "hello world, I update aptget"
sudo apt-get update -q
EOF
Try editing the part after $HOME; type it in or write a file that contains the combo of " cat > $HOME/someNotes.txt <<EOF " some text or commands " EOF " and you'll find making custom scripts of varying complexity to be easy.
.......
Hope some of these are also found to be useful for others.
Thanks for starting this here thread.
Hit the link in my signature for more help with Linux for new and seasoned users
Edit 08082013- added another useful tip and reformatted commands to better fit the OP's formatting.
Sent from either my SPH-D700 or myTouch3Gs
Debian Kit/QEMU Linux Install guide for all android devices that I'm writing:
http://forum.xda-developers.com/showthread.php?t=2240397
Now have working Installers for ARM Java 7 JDK + Maptools + jMonkey
Yo ! Nice Share
To delete contents of a large text file ..
Code:
cat /dev/null > NameOfTheFile
Useful variations of ls command :
Show dir content in a list
Code:
ls -l
Show dir content in a list sorted by modification time (newer first)
Code:
ls -lt
Show dir content in a list sorted by modification time (older first)
Code:
ls -lrt
Show subdirectories recursively
Code:
ls -R
If you want to show files starting with . (hidden file), you can add -a option.
More options with command :
Code:
man ls
Useful variations of grep command :
grep is used to print lines matching a pattern.
Find the entry for current user in file /etc/passwd :
Code:
cat /etc/passwd | grep $USER
Find all the entry except current user entry in file /etc/passwd :
Code:
cat /etc/passwd | grep -v $USER
Find all the numbers in file /etc/passwd :
Code:
cat /etc/passwd|grep '[0-9]*'
Add color to grep command :
Code:
cat /etc/passwd | grep --color $USER
(You can add
Code:
alias grep='grep --color=auto'
in ~/.bashrc to always have colored grep)
Useful variations of tar command :
Create archive_name.tar from dirname :
Code:
tar cvf archive_name.tar dirname/
Create archive_name.tar.gz (compressed) from dirname :
Code:
tar zcvf archive_name.tar.gz dirname/
Extract archive_name.tar.gz :
Code:
tar zxvf archive_name.tar.gz
Useful variations of mkdir command :
Create directory and subdirectories if not existing :
Code:
mkdir -p /tmp/a/b/c
(mkdir /tmp/a/b/c will fail if /tmp/a and /tmp/a/b don't exist)
Useful tip :
Use bash variable "!$" to get the value of the last argument of the last command interpreted.
For example :
Code:
mkdir /tmp/test_a
cd !$ (equivalent cd /tmp/test_a)
or,
Code:
mv /tmp/a /tmp/b
ls !$ (equivalent ls /tmp/b)
have you got bored of your one Text colored terminal ?
when you look at the results you always are confused ?
well .. you came into the right thread
I'm here today to show you how to make every busybox command fully functional
I was trying to make this command work but no success
Code:
#ls --color=always
then i ended up making busybox fully functional
Note: you must have rooted device and custom recovery and SDK tools " incase you don't have adb.rar "and your phone developer mode and USB debugging checked .
go to your SDK tools press sheft and right mouse click and open cmd here
________________________________________________________________________
now .. lets get to it shall we ?
1 - reboot into recovery and connect your device in your PC
2 - type in these commands in your PC command prompt you opened in order :
Code:
# adb shell
# mount system
# cp /system/bin/sh /sdcard/Download/sh
#adb reboot
3 - reboot your device
4 - download this busybox app and start it
jrummy.busybox.installer
5 - you'll see in the app's INSTALLER icon a location /system/xbin
change it to /system/bin
6 - open app's settings "upper right corner beside the three dot's" and check all what's in the installer settings
7 - press back and click install " your phone will boot into recovery and install the busybox "
8 - after finishing the process your device will reboot normally but wait a minute !!! SU is not working anymore :crying:
9 - reboot your device again into recovery !! " I'll try to fix it for you "
10 - type in these commands in order :
Code:
#adb shell
#mount system
#cp /sdcard/Download/sh /system/bin/sh
#chmod 755 /system/bin/sh
#adb reboot
and we are done
look at the attachment below this is how your terminal will look like and error free
I'm sorry about this post
apparently I was kinda mistaken
I think what happens that lead to this is
when you write down the applet's name in terminal the device start to search inside bin file first .. if the applet was not found in bin .
the device will start to search on xbin file and maybe the whole storage for that command
so .. since there are some applets in bin are the same one in busybox and I was able to locate them "took me like an hour to do so"
and these applets are :
Code:
[COLOR="blue"]blkid
brctl
cat
chmod
chown
clear
cmp
cp
date
dd
df
dmesg
du
grep
gzip
hd
id
ifconfig
insmod
ionice
ip
kill
ln
ls
lsmod
lsof
mkdir
mke2fs
mknod
mkswap
mount
mv
netstat
nohup
ping
ping6
printenv
ps
readlink
reboot
renice
rm
rmdir
rmmod
route
sh
sleep
swapoff
swapon
sync
top
touch
tune2fs
umount
uptime[/COLOR]
there are a lot of difference in results between the factory applets and the busybox applets
if you want to see the difference install busybox in /system/xbin and in terminal type one of these applets above like this :
for busybox applets result :
Code:
busybox [I][COLOR="blue"]applet[/COLOR][/I]
for system applets result :
Code:
[I][COLOR="Blue"]applet[/COLOR][/I]
it might not be a new thing but for me it is
I just wanted to share that info for the ones who doesn't know
Edit : there is also one applet in system/xbin which is " nc "
thanks .
A few days ago, I flashed a zip onto my phone that set SELinux to permissive. However, there was a problem: it deleted logd, which is essential to adb logcat. Considering I'm an Android developer, that isn't a good thing! It took me a bit to figure out how to get it back, so I'm making this guide to share with you guys to help whatever poor soul has to fix this next.
Note that these steps were designed with Linux in mind, though they might be adaptable to Cygwin/OSX with some effort.
Also, make sure you delete any SELinux permissive scripts from init.d/su.d first!
Prerequisites
The OTA or custom rom zip that your device is currently running
adb
simg2img (available in the Ubuntu software repositories)
sdat2img (available here)
Instructions
Put your OTA/custom ROM zip file in a new folder and unzip it (this example is using the Pure Nexus ZIP):
Code:
mkdir restore_logd
cp pure_nexus_hammerhead-7.0-20161025-HOMEMADE.zip restore_logd
cd restore_logd
unzip pure_nexus_hammerhead-7.0-20161025-HOMEMADE.zip
Now, look for a file named either system.new.dat or system.img.
If you have system.img, then run:
Code:
simg2img system.img system.raw.img
If you have system.new.dat AND system.transfer.list, instead run:
Code:
sdat2img.py system.transfer.list system.new.dat system.raw.img
Either way, you should now have a file named system.raw.img. Next, mount it:
Code:
mkdir system_mnt
sudo mount -t ext4 -o loop system.raw.img system_mnt
This will mount the system image onto the system_mnt folder.
Plug in your device to your computer and make sure USB debugging is enabled, then run:
Code:
adb push system_mnt/bin/logd /sdcard/logd
adb shell
You should now be in a shell connected to your device. Inside, run:
Code:
su
mount -o rw,remount /system
cp /sdcard/logd /system/bin/logd
chmod 755 /system/bin/logd
exit
This will install the logd binary and close the shell.
This next part is very important! Making sure you closed the adb shell and are still inside the directory you created, run:
Code:
ls -Z system_mnt/bin/logd
If the output looks like this:
Code:
? system_mnt/bin/logd
then you have nothing else to do. Otherwise, it might look a bit like this:
Code:
u:object_r:logd_exec:s0 system_mnt/bin/logd
Copy part before the path; in this case, it's:
Code:
u:object_r:logd_exec:s0
Then, run:
Code:
adb shell su root chcon permission /system/bin/logd
replacing permission with the string you copied.
Now you can unplug and restart your device; logd should now be fully working!
Last but not least, run:
Code:
sudo fusermount -u system_mnt
to unmount the system image from your computer.
Enjoy!
Execute command failed while replacing permission
Code:
adb shell su root chcon permission /system/bin/logd
u:object_r:logd_exec:s0
/system/bin/sh: <stdin>[1]: u:object_r:logd_exec:s0: not found
i can't root Samsung galaxy a02 -- SM-A022F/DS Build No: A022FXXU2BUI3 , android 11 , i dont know what to do for rooting and i dont have firmware file (bootloader unlocked)
To get the superuser access ( AKA root ) to be able to control various aspects of Android OS means you need to perform a certain modification that will root your phone's Android. An unlocked bootloader isn't needed to root Android.
Here is what you have to do to root your device's Android:
Replace Android's Toybox binary - what is a restricted version by default - by unrestricted Toybox v0.8.5.
This e.g. can get achieved by means of a Windows command script making use of ADB coomands.
jwoegerbauer said:
To get the superuser access ( AKA root ) to be able to control various aspects of Android OS means you need to perform a certain modification that will root your phone's Android. An unlocked bootloader isn't needed to root Android.
Here is what you have to do to root your device's Android:
Replace Android's Toybox binary - what is a restricted version by default - by unrestricted Toybox v0.8.5.
This e.g. can get achieved by means of a Windows command script making use of ADB coomands.
Click to expand...
Click to collapse
hi , i dont know what is toybox or i dont know really what to do can you tell me step by step please? i have ADB already
dleaderp said:
hi , i dont know what is toybox or i dont know really what to do
Click to expand...
Click to collapse
Typically people do a Google search like "Android Toybox" ...
To save you this search: Toybox is a suite of Linux commands ported to Android.
The commands supported are
Code:
acpi arch ascii base64 basename blkid blockdev bunzip2 bzcat cal cat
catv chattr chgrp chmod chown chroot chrt chvt cksum clear cmp comm
count cp cpio crc32 cut date devmem df dirname dmesg dnsdomainname
dos2unix du echo egrep eject env expand factor fallocate false fgrep
file find flock fmt free freeramdisk fsfreeze fstype fsync ftpget
ftpput getconf grep groups gunzip halt head help hexedit hostname
hwclock i2cdetect i2cdump i2cget i2cset iconv id ifconfig inotifyd
insmod install ionice iorenice iotop kill killall killall5 link ln
logger login logname losetup ls lsattr lsmod lspci lsusb makedevs
mcookie md5sum microcom mix mkdir mkfifo mknod mkpasswd mkswap mktemp
modinfo mount mountpoint mv nbd-client nc netcat netstat nice nl nohup
nproc nsenter od oneit partprobe passwd paste patch pgrep pidof ping
ping6 pivot_root pkill pmap poweroff printenv printf prlimit ps pwd
pwdx readahead readlink realpath reboot renice reset rev rfkill rm
rmdir rmmod sed seq setfattr setsid sha1sum shred sleep sntp sort
split stat strings su swapoff swapon switch_root sync sysctl tac tail
tar taskset tee test time timeout top touch true truncate tty tunctl
ulimit umount uname uniq unix2dos unlink unshare uptime usleep uudecode
uuencode uuidgen vconfig vmstat w watch wc which who whoami xargs
xxd yes zcat
As you might see su is the ROOT functionality.
dleaderp said:
can you tell me step by step please? i have ADB already
Click to expand...
Click to collapse
Actually I'm working on a Windows command script that makes use of ADB what does the job. I'll publish it here when finished:
[TOOL][ADB]][Windows] A 100% Safe Non-systemless Root Tool - No Soft-bricked Adroid Guaranteed
Grant Root Privileges to Regular Users Using Devices With Android 6 and up by Simply Upgrading Android's Multi-command Applet Toybox.
forum.xda-developers.com
jwoegerbauer said:
Actually I'm working on a Windows command script that makes use of ADB what does the job. I'll publish it here when finished:
Click to expand...
Click to collapse
happy to hear that xd
i got a last question, i think my phone's storage is shrunked after i used firmware is it possible ? if yes how can i fix it. it was 32 gb now its 8gb
i fixed i used another firmware i'll be wait for your ADB