How to compile busybox

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to compile busybox

Jump to solution
7,639 Views
lqll
Contributor III

Hello community

My environment is i.MX6Q and android 4.4.2.

I modified some commands in busybox then I want to compile it,I follow busybox on the i.MX6 sabre sd platform in a few commands ,and these are my steps:

$ cd myandroid/external/busybox

$ export ARCH=arm

$ export CROSS_COMPILE=~/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-

$ make defconfig

$ sed -i.orig 's/^#.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config

$ make

When I make,I got fail,like below:

CC      applets/applets.o

applets/applets.c:10:20: fatal error: assert.h: No such file or directory

compilation terminated.

make[1]: *** [applets/applets.o] Error 1

make: *** [applets_dir] Error 2

So,please tell me how to compile busybox?

Thank You

Qiulong Li

Labels (2)
0 Kudos
1 Solution
4,873 Views
JayTu
NXP Employee
NXP Employee

It's tool-chain issue. Please use ltib (or Yocto) toolchain instead of Android's.

View solution in original post

0 Kudos
8 Replies
4,873 Views
martincarra
Contributor I

Hello all,

I've downloaded, installed and built YOCTO to compile busybox 1.24.2

I have ran the following steps:

1.- MACHINE=imx6dlsabresd DISTRO=poky source ./setup-environment base

2.- bitbake meta-toolchain

3.- executed fslc-wayland-glibc-x86_64-meta-toolchain-armv7at2hf-neon-toolchain-2.2.2.sh to install the SDK

4.- executed environment-setup-armv7at2hf-neon-fslc-linux-gnueabi from the console in which I am running the make of the busybox.

make
SPLIT include/autoconf.h -> include/config/*
GEN include/bbconfigopts.h
HOSTCC applets/usage
applets/usage.c: In function ‘main’:
applets/usage.c:52:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(STDOUT_FILENO, usage_array[i].usage, strlen(usage_array[i].usage) + 1);
^
GEN include/usage_compressed.h
HOSTCC applets/applet_tables
applets/applet_tables.c: In function ‘main’:
applets/applet_tables.c:161:4: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets(line_old, sizeof(line_old), fp);
^
GEN include/applet_tables.h
CC applets/applets.o
In file included from /opt/fslc-wayland/2.2.2/sysroots/x86_64-fslcsdk-linux/usr/lib/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/6.2.0/include-fixed/syslimits.h:7:0,
from /opt/fslc-wayland/2.2.2/sysroots/x86_64-fslcsdk-linux/usr/lib/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/6.2.0/include-fixed/limits.h:34,
from include/platform.h:141,
from include/libbb.h:13,
from include/busybox.h:8,
from applets/applets.c:9:
/opt/fslc-wayland/2.2.2/sysroots/x86_64-fslcsdk-linux/usr/lib/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/6.2.0/include-fixed/limits.h:168:61: error: no include path in which to search for limits.h
#include_next <limits.h> /* recurse down to the real one */
^
In file included from include/libbb.h:13:0,
from include/busybox.h:8,
from applets/applets.c:9:
include/platform.h:152:23: fatal error: byteswap.h: No such file or directory
# include <byteswap.h>
^
compilation terminated.
scripts/Makefile.build:197: recipe for target 'applets/applets.o' failed
make[1]: *** [applets/applets.o] Error 1
Makefile:372: recipe for target 'applets_dir' failed
make: *** [applets_dir] Error 2

Any clue?

Regards,

Martín

0 Kudos
4,873 Views
shunpinglin
Contributor III

hello, Now I compile the busybox with freescale toolchains, find the same problem with you. How did  you resolve it ?

Please help.

Thank you! 

0 Kudos
4,874 Views
JayTu
NXP Employee
NXP Employee

It's tool-chain issue. Please use ltib (or Yocto) toolchain instead of Android's.

0 Kudos
4,873 Views
lqll
Contributor III

Hi,Jay

          You are right,use $ make CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi- ,then it works!

Thank You

0 Kudos
4,873 Views
tomzhu
Contributor II

Hi,Qiulong

                 I have the same problem now.I use $make menuconfig to selecte the Cross Compiler prefix ,but also report error.

I think the reason is the path for Makefile .but i dont know how to do.

0 Kudos
4,873 Views
poonguzhalip
Contributor II

It may be due to incompatibility between the busybox version and the toolchain version used for compiling busybox.

You can try a different version of toolchain and check.

Regards

0 Kudos
4,873 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Qiulong,

     Actually, the question is not in our support range, but I can give you some advice.

(1) Downloading new version if busybox from it's source code website.

(2)Adjusting it's Makefile according to the path of cross-compiler in your linux system.

(3)Compiling it by static mode(this mode will compile libs into those commands you want)

(4)After compiling, copy those .bin files in output directory to /system/bin/ of android.

(or, make a subdirectory, such as 'bin' in root directroy)

(5) Adding your commmand path to init.rc ( for example add /bin/ in path prameter)

   Hope above items can help you !

Regards,

Weidong

0 Kudos
4,873 Views
lqll
Contributor III

Hello Weidong

     It’s very kind of you to give me this advice.

     My busybox source code ( located at ~/myandroid/external/busybox ) and the binary file busybox ( located at ~/myandroid/device/fsl-proprietary/test/bin/busybox ) came from android_kk4.4.2_1.0.0-ga_core_source.tar.gz which download from freescale .So , when I patch code for i.MX, I got busybox source code and binary file,but I don't kown how to make the binary file from the source code.

     I'm stuck here for a long time,please help me out.

Thank You

Qiulong Li

0 Kudos