Android Installing Busybox Command Line Tools
From OMAPpedia
BradGriffis (Talk | contribs) (→Installing Busybox to filesystem: -- clarify step) |
BradGriffis (Talk | contribs) (differentiate shell prompts between the host PC and target) |
||
| Line 9: | Line 9: | ||
Extract the busybox source | Extract the busybox source | ||
| - | $ tar jxf busybox-1.19.3.tar.bz2 | + | pc$ tar jxf busybox-1.19.3.tar.bz2 |
| - | $ cd busybox-1.19.3/ | + | pc$ cd busybox-1.19.3/ |
Or if you prefer, you can get the latest version of busybox | Or if you prefer, you can get the latest version of busybox | ||
| - | $ git clone git://busybox.net/busybox.git | + | pc$ git clone git://busybox.net/busybox.git |
| - | $ cd busybox/ | + | pc$ cd busybox/ |
| - | $ git checkout -b my_working_branch 1_19_3 | + | pc$ 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: [http://omappedia.org/wiki/Support_Tools#Cross_Compilers Cross Compilers] | Export path to where the cross-compiler is located on the host. For more information on setting up cross-compiler in environment visit: [http://omappedia.org/wiki/Support_Tools#Cross_Compilers Cross Compilers] | ||
| - | $ export PATH=$PATH:/<toolchain_folder>/bin/ | + | pc$ export PATH=$PATH:/<toolchain_folder>/bin/ |
Configure busybox | Configure busybox | ||
| - | $ make menuconfig | + | pc$ make menuconfig |
In menuconfig set the following options | 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. | You can also enable and disable at that time the tools that are needed/not needed. | ||
| Line 44: | Line 44: | ||
Build busybox | Build busybox | ||
| - | $ make | + | pc$ make |
===Installing Busybox to filesystem=== | ===Installing Busybox to filesystem=== | ||
| Line 50: | Line 50: | ||
Create a busybox directory in the target file-system. For example: | Create a busybox directory in the target file-system. For example: | ||
| - | $ mkdir -p $MYDROID/out/target/product/blaze/system/busybox | + | pc$ 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 | + | pc$ 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: | Add the busybox directory to the default path. Open the init.rc file: | ||
| Line 66: | Line 66: | ||
pc> ./adb shell | pc> ./adb shell | ||
| - | $ cd /system/busybox | + | target$ cd /system/busybox |
| - | $ ./busybox --install . | + | target$ ./busybox --install . |
===Make the Busybox shell the default shell=== | ===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: | Edit the console service so that it runs the busybox shell and not the default shell by replacing: | ||
| - | + | pc> vim init.rc | |
-service console /system/bin/sh | -service console /system/bin/sh | ||
+service console /bin/sh | +service console /bin/sh | ||
| - | |||
| - | |||
| - | |||
| - | |||
[[Category:Android]] | [[Category:Android]] | ||
Revision as of 17:15, 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
pc$ tar jxf busybox-1.19.3.tar.bz2 pc$ cd busybox-1.19.3/
Or if you prefer, you can get the latest version of busybox
pc$ git clone git://busybox.net/busybox.git pc$ cd busybox/ pc$ 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
pc$ export PATH=$PATH:/<toolchain_folder>/bin/
Configure busybox
pc$ 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
pc$ 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:
pc$ mkdir -p $MYDROID/out/target/product/blaze/system/busybox
Copy the busybox binary to the /bin directory in the target file-system:
pc$ 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 PATH in init.rc:
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 target$ cd /system/busybox target$ ./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:
pc> vim init.rc -service console /system/bin/sh +service console /bin/sh