Cross compile busybox for ARM – Android

Requirements:

Busybox – http://www.busybox.net/

Sourcery G++ Lite 2011.03-41 for ARM GNU/Linux – http://www.codesourcery.com/sgpp/lite/arm/portal/release1803

Igepv2 board – http://www.igep-platform.com/index.php

Install code sourcery using the bin file. I choose not to install the binaries in my path so that it wouldn’t mess with my environment. I just export the toolchain’s bin directory before using it

Export path to where the cross-compiler is located on the host.

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

Configure

$ cd <path_to_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”
      • Cross compiler prefix – Set this option equal to “arm-none-linux-gnueabi-“
    • General Configuration
      • Don’t use /usr – Enable this option by pressing “Y”

Build

$ make

Then, push the busbox file to the target board, using adb (you have to connect to the target board first).

Install

$ adb push <path_to_busybox>/busybox /

$ adb shell

$ ./busybox –install -s /system/bin/

Script to make busybox and install it on the connected device (the android device has to be connected through adb before using this script).

Change the CODESOURCERY variable to whatever path you installed CodeSourcery to (if you chose to install this toolchain in your Path, you can remove this variable and the export PATH line). You also need to change the BUSYBOXDIR to wherever you downloaded the busybox source code.

#!/bin/sh
CODESOURCERY=~/CodeSourcery/Sourcery_G++_Lite
FILES=~/Desktop/Files
BUSYBOXDIR=$FILES/busybox-1.18.5
echo "Using defaults"
echo "Codesourcery at $CODESOURCERY"
echo "Busybox at $BUSYBOXDIR"

export PATH=$PATH:$CODESOURCERY/bin/
make clean
cp $FILES/.busyboxConfig $BUSYBOXDIR/.config
make
adb push $BUSYBOXDIR/busybox /system/bin/
adb shell ./busybox --install -s /system/bin/
Advertisements

One thought on “Cross compile busybox for ARM – Android

  1. Luke

    dont use linix often, what does it mean by

    ===============================================================
    Error: Missing 32-bit libraries on 64-bit Linux host
    ===============================================================
    Your 64-bit Linux host is missing the 32-bit libraries
    required to install and use Sourcery G++.

    Please follow this Knowledge Base entry to install the
    required 32-bit libraries:
    https://support.codesourcery.com/GNUToolchain/kbentry62

    Once you have installed the 32-bit libraries, please restart
    the installer.
    ===============================================================

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s