busybox编译成arm平台的二进制文件时,需要注意编译器选项。推荐使用codesourcery提供的交叉编译器,它默认提供的-march参数是 armv5te. 而Ubuntu软件包中的交叉编译器默认的march参数是armv7-a.
相关链接:BusyBox各版本下载
具体的参数区别如下:
codesourcery:
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with:
/scratch/julian/2009q3-respin-linux-lite/src/gcc-4.4/configure
--build=i686-pc-linux-gnu
--host=i686-pc-linux-gnu
--target=arm-none-linux-gnueabi
--enable-threads
--disable-libmudflap
--disable-libssp
--disable-libstdcxx-pch
--enable-extra-sgxxlite-multilibs
--with-arch=armv5te
--with-gnu-as
--with-gnu-ld
--with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables} %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}'
--enable-languages=c,c++
--enable-shared
--disable-lto
--enable-symvers=gnu
--enable-__cxa_atexit
--with-pkgversion='Sourcery G++ Lite 2009q3-67'
--with-bugurl=https://support.codesourcery.com/GNUToolchain/
--disable-nls
--prefix=/opt/codesourcery
--with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc
--with-build-sysroot=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/libc
--with-gmp=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
--with-mpfr=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
--with-ppl=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
--with-cloog=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
--disable-libgomp
--enable-poison-system-directories
--with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin
--with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67)
COLLECT_GCC_OPTIONS='-v'
'-o'
'aa'
'-march=armv5te'
'-funwind-tables'
/opt/arm-2009q3-none-linux-gnueabi/bin/../libexec/gcc/arm-none-linux-gnueabi/4.4.1/cc1
-quiet
-v
-iprefix
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/ -isysroot /opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc
aa.c
-quiet
-dumpbase
aa.c
-march=armv5te
-auxbase
aa
-version
-funwind-tables
-o /tmp/cc1pXwY1.s
#include "..." search starts here:
#include <...> search starts here:
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/include
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/include-fixed
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/include
/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/include
GNU C (Sourcery G++ Lite 2009q3-67) version 4.4.1 (arm-none-linux-gnueabi)
compiled by GNU C version 4.3.2, GMP version 4.3.1, MPFR version 2.4.1-p5.
GGC heuristics:
--param
ggc-min-expand=100
--param
ggc-min-heapsize=131072
Compiler executable checksum: 74011fea7f66b1cda6b19363b6694363
COLLECT_GCC_OPTIONS='-v'
'-o'
'aa'
'-march=armv5te'
'-funwind-tables'
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/as
-v
-march=armv5te
-meabi=5
-o
/tmp/cc4FZC9V.o
/tmp/cc1pXwY1.s
GNU assembler version 2.19.51 (arm-none-linux-gnueabi) using BFD version (Sourcery G++ Lite 2009q3-67) 2.19.51.20090709
COMPILER_PATH=/opt/arm-2009q3-none-linux-gnueabi/bin/../libexec/gcc/arm-none-linux-gnueabi/4.4.1/:/opt/arm-2009q3-none-linux-gnueabi/bin/../libexec/gcc/:/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/
LIBRARY_PATH=/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/:/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/:/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/lib/:/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/lib/
COLLECT_GCC_OPTIONS='-v'
'-o'
'aa'
'-march=armv5te'
'-funwind-tables'
/opt/arm-2009q3-none-linux-gnueabi/bin/../libexec/gcc/arm-none-linux-gnueabi/4.4.1/collect2
--sysroot=/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc
--eh-frame-hdr
-dynamic-linker
/lib/ld-linux.so.3
-X
-m
armelf_linux_eabi
-o
aa
/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/lib/crt1.o
/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/lib/crti.o
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/crtbegin.o
-L
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1
-L
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc -L/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/lib
-L
/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/lib /tmp/cc4FZC9V.o
-lgcc
--as-needed
-lgcc_s
--no-as-needed
-lc
-lgcc
--as-needed
-lgcc_s
--no-as-needed
/opt/arm-2009q3-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/crtend.o
/opt/arm-2009q3-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/libc/usr/lib/crtn.o
ubuntu cross compiler: