Android Installing Busybox Command Line Tools
From OMAPpedia
BradGriffis (Talk | contribs) (Include link to prebuilt busybox 1.19.3) |
BradGriffis (Talk | contribs) (→Installing Busybox at run-time: -- add adb root command) |
||
| (10 intermediate revisions not shown) | |||
| Line 1: | Line 1: | ||
| + | === Introduction (Prebuilt binary) === | ||
| + | |||
This article describes how to install the busybox command line tools in the Android file-system. | 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 [http://omappedia.org/wiki/Android_Getting_Started#Installing_Busybox_to_filesystem Installing Busybox to filesystem] if you select to use the prebuilt version. For the more information on the latest busybox environment visit: [http://www.busybox.net www.busybox.net] | 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 [http://omappedia.org/wiki/Android_Getting_Started#Installing_Busybox_to_filesystem Installing Busybox to filesystem] if you select to use the prebuilt version. For the more information on the latest busybox environment visit: [http://www.busybox.net www.busybox.net] | ||
| Line 9: | Line 11: | ||
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 46: | ||
Build busybox | Build busybox | ||
| - | $ make | + | pc$ make |
| - | === | + | ===Copying 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 |
| - | Bootup the board with Android filesystem | + | Copy the busybox binary to the /bin directory in the target file-system: |
| + | pc$ install -m 777 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 <font color=red>/system/busybox:</font>/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin | ||
| + | |||
| + | ===Installing Busybox at run-time=== | ||
| + | Bootup the board with Android filesystem, remount system with read-write permissions | ||
| + | pc> ./adb root | ||
| + | pc> ./adb remount | ||
Install the busybox command line tools on the target by executing the following commands on booted filesystem: | Install the busybox command line tools on the target by executing the following commands on booted filesystem: | ||
| - | $ cd / | + | pc> ./adb shell |
| - | $ ./busybox --install | + | target$ cd /system/busybox |
| + | target$ ./busybox --install . | ||
| + | target$ ./sh | ||
| - | + | '''NOTE: Don't forget the DOT at the end of the "install" step above!''' | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ===Make the Busybox shell the default shell=== | |
| - | $ | + | Save the original sh executable by renaming it, and then create a soft-link to busybox sh: |
| - | + | target$ cd /system/bin | |
| - | $ | + | target$ mv sh sh.android |
| + | target$ ln -s /system/busybox/sh sh | ||
| + | Now when you open a shell using "./adb shell" you will have the full busybox capabilities immediately. The serial port shell will also utilize busybox when you power-up the board. | ||
[[Category:Android]] | [[Category:Android]] | ||
Latest revision as of 18:57, 17 April 2012
Contents |
[edit] Introduction (Prebuilt binary)
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
[edit] 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
[edit] Copying 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 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
[edit] Installing Busybox at run-time
Bootup the board with Android filesystem, remount system with read-write permissions
pc> ./adb root 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 . target$ ./sh
NOTE: Don't forget the DOT at the end of the "install" step above!
[edit] Make the Busybox shell the default shell
Save the original sh executable by renaming it, and then create a soft-link to busybox sh:
target$ cd /system/bin target$ mv sh sh.android target$ ln -s /system/busybox/sh sh
Now when you open a shell using "./adb shell" you will have the full busybox capabilities immediately. The serial port shell will also utilize busybox when you power-up the board.