How To Use Busy Box Commands, And download Android Emulator


 Busybox on android, few lines explaining the magic of this single file

What is busybox ?
Busybox is a one big fat file, that does wonders, every time you run it on a way, something different happens. I call it a “multi binary file”, the reason why I call it, is because it does multiple things that require multi binary files. The best way to explain is with an example
On common Linux distributions we have several command files (binary files) that do a particular thing.
#ls ( lists the content of a folder )
#mkdir ( creates a folder )
#ln ( makes a link )
#rm ( removes a file or dir )

Each of the above usually are a binary compiled file, but on busybox they are all the same, examples:

#busybox ls ( lists the content of a folder )
#busybox mkdir ( creates a folder )
#busybox ln ( makes a link )
#busybox rm ( removes a file or dir )
So basically, when you run busybox command, it runs the same as the single file we had before
Thats why i call it a “multi binary file”. Because it is! :)
So, you might be thinking, why the hell we need a “multi binary”. Well, the reason is quite simple for some developers or maybe crazy of others, but in my point of view is this:
Imagine that for the mkdir command you have a source with some lines like this:
#include
#include
#include
#include
Then on the ls command you also have that, and then for ln, and so on.
Imagine then that you are compiling the same headers on every file, waste of space right?
Right! So busybox is the “smart” way to make all those commands together, this feature is very usefull for those very limited systems that exist (low memory devices)
On android devices, busybox is not present as default (only on custom roms like cyanogemod), one of the reasons is because busybox has the “mv” command that allows you to move files between partitions ( /data, /system, etc), and that for manufactures is a safety problem
However, on android there is a busybox “alike” that is called toolbox that has some limitations and does not have the mv command, or if it has, the mv command doesnt allow partition files moving

Why you need busybox on android?
Mostly it is needed because the adb shell does not have most of the commands supported such cp (copy), and it makes it difficult when you want to modify something (if you have rooted already) difficult because of unavailability of the commands support. So it is preferred to have Busy box, which has most of the command support, and if you had worked in Linux you would know what is busy box for.

How to use busybox?
Well, to use busybox its quite simple, you can do as above and run:
#busybox command
This is the “simple” way to do it, but its very frustrating, specially when you combine commands, like:
#ls | grep -i file | cut -d” ” -f3
With busybox it would be:
#busybox ls |busybox  grep -i file | busybox cut -d” ” -f3
OMG Right?
So what happend is that the busybox developers created a intelligent way do use it, you use file linking
File linking is a way to link files on different folders and names
basically you do
#ln -s file1 file2      or        # busybox ln -s file1 file2
Meaning that file2 is the exact same thing as file1
for busybox usage we can make a link for mkdir for example:
#ln -s pathtobusybox/busybox /system/bin/mkdir   or #busybox ln -s pathtobusybox/busybox /system/bin/mkdir
Then you can run mkdir directly instead of the annoying #busybox mkdir command

How to install busybox?
To install busybox you can do one of the following:
The nice guys from busybox created a installation procedure, they rule right? Yeah!
Usually, you need to copy the busy box binary on to whichever folder you need, with the help of any command line tool, then say busybox –install, it should setup the links for all the commands and should work for you.
How to install busybox on android?
You have two options
  • Manually
To install busybox manually, you will need adb and know how to use it, there is a very nice tutorial here
You will also have to have a rooted phone or rooted adb
then upload busybox, get su, give execution rights, remount system as writable,  copy it and install
Then you can download the latest busybox version here
#adb push busybox /data/local/tmp/
#adb shell
#su         ( allow on superuser if needed )
#chmod 755 /data/local/tmp/busybox
#/data/local/tmp/busybox mount -o rw,remount /system
#/data/local/tmp/busybox cp /data/local/tmp/busybox /system/xbin/
#/system/xbin/busybox –install -s /system/xbin/
  • Automatic
But now this application names ‘busybox installer’ does exactly the same, and it needs root permissions (to make it install in /system/xbin/ ) and you have the option to install any version of busybox you wish to. One you have installed it, it will automatically restart your phone. Now you have all the comands available on your phone when connected to adb. Some commands may still be taken from old toolbox.
From http://madteam.co

To download Terminal Enulator, CLICK HERE !
[facebook]
[blogger]

MKRdezign

Author Name

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget