How to compile Busybox?

15,461

How to compile busybox?

1st download toolchain. You can refer to this: Advice regarding installing ARM toolchain on Ubuntu VM (64bit)

  1. untar new source-code

  2. create default config

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- defconfig

A default configuration file is created.

  1. update config to change it to our needs:

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig

The option to compile Busybox as a static executable, so that we don’t have to copy the dynamic libraries inside the root filesystem. The setting can be found in “Busybox Settings --> Build Options“. Also, select what utilities you want embedded in Busybox.

  1. Then, the following command builds Busybox and creates a directory called _install containing the root filesystem tree:

    make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- install.

Compile statically. If you compile dynamically then you need to copy libraries to target.

For more details see this link: http://balau82.wordpress.com/2010/03/27/busybox-for-arm-on-qemu/

Share:
15,461
user42276
Author by

user42276

Updated on June 04, 2022

Comments

  • user42276
    user42276 about 2 years

    (The i9100 and i9100p phones have Exynos 4210 SoC which includes Cortex A9 dual core 1.2Ghz processor which supports NEON.)

    I will compile the latest busybox source snapshot available and upload it for everyone for free on internet and maybe even make my own free BusyboxInstaller.apk (I already downloaded today's 14th March snapshot from the official website) because so many busybox installers have very outdated versions and I want to take advantage of possible optimizations for the Cortex A9 cpu.

    (NEON technology is a 128-bit SIMD (Single Instruction, Multiple Data) architecture extension.

    It can can accelerate multimedia and signal processing algorithms such as video encode/decode, 2D/3D graphics, gaming, audio and speech processing, image processing, telephony, and sound synthesis.)

    1 does such as mean it will also benefit my busybox?

    2 What other instructions/anythingelse I can use to optimize for i9100 devices?

    3 Can I compile on my phone instead of PC with only 1x2Ghz and 2GB RAM? I think it should be much quicker because it has 2x1.5GHz and 1GB RAM (I overclock only a bit) versus 1x2GHz, am I right?

    4 How to compile busybox?

    What are these options for?

    Force NOMMU build
    Additional CFLAGS
    Additional LDFLAGS
    Additional LDLIBS
    all in general configuration and Busybox Library Tuning and debug (I googled for each for a few hours but nothing satisfactory)
    

    What kind of applet links to install?

    (./_install) BusyBox installation prefix

    **I have eeror when following vinayhunachyai instructions.

    make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- install
    /home/euphoria/Sourcery/busybox/scripts/gcc-version.sh: line 11: arm-none-linux-gnueabi-gcc: command not found
      CC      applets/applets.o
    /bin/sh: 1: arm-none-linux-gnueabi-gcc: not found
    scripts/Makefile.build:197: recipe for target 'applets/applets.o' failed
    make[1]: *** [applets/applets.o] Error 127
    Makefile:372: recipe for target 'applets_dir' failed
    make: *** [applets_dir] Error 2
    
    • user42276
      user42276 over 10 years
      what applets can i safely disable?
  • user42276
    user42276 over 10 years
    @vinayhunchyai Im sorry I didnt see this earlier.When I run command 1) I get arm-none-linux-gnueabi-gcc not found.Should I be concerned? ALso Im checking out each option in the busybox configuration and I couldnt find satisfactory information what they are for: please see my edited question
  • user42276
    user42276 over 10 years
    @vinayhunachyai please help with busybox options.(I would vote you up but it requires 15 reputation)
  • user42276
    user42276 over 10 years
    @vinayhunachyai I get erro at step 3: make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- install /home/euphoria/Sourcery/busybox/scripts/gcc-version.sh: line 11: arm-none-linux-gnueabi-gcc: command not found CC applets/applets.o /bin/sh: 1: arm-none-linux-gnueabi-gcc: not found scripts/Makefile.build:197: recipe for target 'applets/applets.o' failed make[1]: *** [applets/applets.o] Error 127 Makefile:372: recipe for target 'applets_dir' failed make: *** [applets_dir] Error 2
  • vinay hunachyal
    vinay hunachyal over 10 years
    do u have cross-toolchain ? if not download it sourcery.mentor.com/GNUToolchain 1st, the error is due to missing of toolchain gcc
  • user42276
    user42276 over 10 years
    @vinayhunachyai I dnt download this because it requires registration and is commercial so I downloaded gnu toolchain in parts (compiled bison and all the rest successfully) and I get the same error as before. Does it have to be gnu toolchain from the website you provided?
  • vinay hunachyal
    vinay hunachyal over 10 years
    i dont know which toolchain r u using , So my suggestion is download lite version with your gmail account ,its free just u need to give your email id they ll send link to gmail
  • user42276
    user42276 over 10 years
    @vinayhunachyai I want to understand this better.I went to en.wikipedia.org/wiki/GNU_toolchain and there is for example bison listed so I searched each tool lsted there (like bison) from official gnu download (like ftp.gnu.org/gnu/bison) and compiled it.Ive done that with every tool listed there except the ones I already had (like Make) and checked in terminal if they work (by typing in for example bison)So now I have every tool listed there working.I want to avoid installing any more if possible because my disk space is running out.So what is wrong with what I've described above???
  • vinay hunachyal
    vinay hunachyal over 10 years
    is you intense is to compile busybox for ARM rite ??
  • user42276
    user42276 over 10 years
    @vinayhunachyai yes my intention is to copmile for arm, specifically for Galaxy S2
  • vinay hunachyal
    vinay hunachyal over 10 years
    Then pls follow the above as i told ,to achive your goal. Once u compiled it take busybox exe. copy to target and execute it.
  • user42276
    user42276 over 10 years
    @vinayhunachyai But can I compile busybox after what I've done yesterday? (see comment above)
  • makouda
    makouda about 9 years
    I got error include/platform.h:152:23: fatal error: byteswap.h: No such file or directory # include <byteswap.h> any help please
  • Dr.jacky
    Dr.jacky over 8 years
    After all of these, where should we put busybox binary file in android source code, to have it on output.zip?