compile busybox for android

  1. Download BusyBox source code from Busybox official website
    • wget http://www.busybox.net/downloads/busybox-1.18.3.tar.bz2
    • tar -jzvf busybox-1.18.3.tar.bz2

  2. Download the ARM Toolkit, e.g. Sourcery G++ Lite 2008q1-126 for ARM GNU /Linux
    • wget http://www.codesourcery.com/sgpp/lite/arm/portal/package2549/public/arm-none-linux-gnueabi/arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
    • tar -jzvf arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

    note: using the newest toolchain compile busybox-1.18.1 failed, use this toolchain 4.2.3 compiled ok.

  3. configure the busybox
    • cd busybox-1.18.3
    • make menuconfig
      • Busybox Settings -> Build Options ->
        [*] Build BusyBox as a static binary (no shared libs)
        (/yourpath/arm-2008q3/bin/arm-none-linux-gnueabi-) Cross Compiler prefex
      • Busybox Settings -> Installation Options->
        [*] Don’t use /usr

  4. compile the busybox
      if not set Cross Compiler prefix at step 3
    • make CROSS_COMPILE=/yourpath/arm-2008q1/bin/arm-none-linux-gnueabi- LDFLAGS="--static" CFLAGS="--static"
    • else
    • make LDFLAGS="--static" CFLAGS="--static"

  5. Get the Busybox binary
    • file busybox
      busybox: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, stripped

沒有留言:

張貼留言