Android Installing Busybox Command Line Tools

From OMAPpedia

(Difference between revisions)
Jump to: navigation, search
(Installing Busybox to filesystem: -- update directions (verified using L27.G.5))
(Installing Busybox to filesystem: -- add steps for modifying path)
Line 52: Line 52:
  $ mkdir -p $MYDROID/out/target/product/blaze/system/busybox
  $ mkdir -p $MYDROID/out/target/product/blaze/system/busybox
-
Copy the busybox binary to the /bin directory in the target file-system
+
Copy the busybox binary to the /bin directory in the target file-system:
  $ install -m 777 $YOUR_PATH/busybox/busybox $MYDROID/out/target/product/blaze/system/busybox/busybox
  $ install -m 777 $YOUR_PATH/busybox/busybox $MYDROID/out/target/product/blaze/system/busybox/busybox
 +
 +
Add the busybox directory to the default path.  Open the init.rc file:
 +
pc> vim $MYDROID/out/target/product/blaze/root/init.rc
 +
Add /system/busybox to the path:
 +
export PATH <font color=red>/system/busybox:</font>/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
Bootup the board with Android filesystem, remount system with read-write permissions
Bootup the board with Android filesystem, remount system with read-write permissions

Revision as of 17:10, 29 December 2011

This article describes how to install the busybox command line tools in the Android file-system. Please note that a pre-built version of busybox has been attached to this article if you would prefer not to build busybox yourself. Skip to Installing Busybox to filesystem if you select to use the prebuilt version. For the more information on the latest busybox environment visit: www.busybox.net

Configure and Build

Download busybox-1.19.3.tar.bz2 from www.busybox.net.

Extract the busybox source

$ tar jxf busybox-1.19.3.tar.bz2
$ cd busybox-1.19.3/

Or if you prefer, you can get the latest version of busybox

$ git clone git://busybox.net/busybox.git
$ cd busybox/
$ git checkout -b my_working_branch 1_19_3

Export path to where the cross-compiler is located on the host. For more information on setting up cross-compiler in environment visit: Cross Compilers

$ export PATH=$PATH:/<toolchain_folder>/bin/

Configure busybox

$ make menuconfig

In menuconfig set the following options

$ Busybox Settings --> Build Options --> Build Busybox as a static binary (no shared libs)  -  Enable this option by pressing "Y"
$ Busybox Settings --> Build Options --> Cross compiler prefix  -  Set this option equal to "arm-none-linux-gnueabi-"
$ Busybox Settings --> General Configuration --> Don't use /usr  -  Enable this option by pressing "Y"
$ Linux Module Utilities --> [ ] Simplified modutils
                             [*]   insmod
                             [*]   rmmod 
                             [*]   lsmod
                             [*]     Pretty output
                             [ ]   modprobe
                             [ ]   depmod
$ Linux Module Utilities --> [ ] Support version 2.2/2.4 Linux kernels
$ Linux Module Utilities --> [ ] Try to load module from a mmap'ed area
$ Linux Module Utilities --> [*] Support tainted module checking with new kernels
$ Linux Module Utilities --> () Default directory containing modules - Set this option to nothing
$ Linux Module Utilities --> () Default name of modules.dep - Set this option to nothing

You can also enable and disable at that time the tools that are needed/not needed. Example of tools that could be disabled: Print Utilities, Mail Utilities

Build busybox

$ make

Installing Busybox to filesystem

Once the busybox executable has been placed in the target file system you will need to "install" busybox, i.e. you will need write permission. Therefore it's recommended to place busybox in the system partition where you can use the "adb remount" command to get write permissions.

Create a busybox directory in the target file-system. For example:

$ mkdir -p $MYDROID/out/target/product/blaze/system/busybox

Copy the busybox binary to the /bin directory in the target file-system:

$ install -m 777 $YOUR_PATH/busybox/busybox $MYDROID/out/target/product/blaze/system/busybox/busybox

Add the busybox directory to the default path. Open the init.rc file:

pc> vim $MYDROID/out/target/product/blaze/root/init.rc

Add /system/busybox to the path:

export PATH /system/busybox:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin

Bootup the board with Android filesystem, remount system with read-write permissions

pc> ./adb remount

Install the busybox command line tools on the target by executing the following commands on booted filesystem:

pc> ./adb shell
$ cd /system/busybox
$ ./busybox --install .

Make the Busybox shell the default shell

Edit the console service so that it runs the busybox shell and not the default shell by replacing:

$ vim init.rc
-service console /system/bin/sh
+service console /bin/sh

Add the path of the busybox command line tools to the system path variable by replacing:

$ export PATH /sbin:/system/sbin:/system/bin:/system/xbin
#with
$ export PATH /bin:/sbin:/system/sbin:/system/bin:/system/xbin
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox