全部博文(404)
分类: LINUX
2008-10-14 15:55:19
环境:fedora 7
编译器: 交叉编译器 3.3.2
busybox: 1.4.2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
一 修改
修改busybox中的 makefile文件
找到 arch 和 cross_compile 修改成如下
arch ?= arm
cross_compile ?= /usr/local/arm/3.3.2/bin/arm-linux-
二 配置
[root@localhost busybox-1.4.2]# make defconfig
[root@localhost busybox-1.4.2]# make xconfig
-------------------------------------------------------------------------
修改配置 主要修改如下
-------------------------------------------------------------------------
busybox settings
build options
[ ]build busybox as a static binary
//此选项选了就会出错。所以只能动态编译。
miscellaneous utilities
[]readahead //如果上面去掉了busybox settings---> build options---->[ ]build with large file support
//该选项就不会出现。
[]taskset //选了就会出错
linux module utilities
[*]support version 2.2.x to 2.4.x linux kernels
shells
choose your default shell
选 ash
三 编译
[root@localhost busybox-1.4.2]# make all install
[root@localhost busybox-1.4.2]# cd _install/bin/
[root@localhost bin]# pwd
/root/maoyong/busybox-1.4.2/_install/bin
[root@localhost bin]# ls
addgroup catv cpio dmesg fdflush hostname iprule login more nice ps sed su uname
adduser chattr date dumpkmap fgrep ip iptunnel ls mount pidof pwd setarch sync uncompress
ash chgrp dd echo getopt ipaddr kill lsattr mountpoint ping rm sh tar usleep
bbconfig chmod delgroup ed grep ipcalc linux32 mkdir mt ping6 rmdir sleep touch vi
busybox chown deluser egrep gunzip iplink linux64 mknod mv pipe_progress rpm stat true watch
cat cp df false gzip iproute ln mktemp netstat printenv run-parts stty umount zcat
[root@localhost bin]# file busybox
busybox: elf 32-bit lsb executable, arm, version 1, dynamically linked (uses shared libs), for gnu/linux 2.0.0, stripped
四 查看共享了哪些库文件
用命令 arm-linux-readelf -a ${program} | grep "shared library"
---------------------------------------------------------------
[root@localhost bin]# pwd
/root/maoyong/busybox-1.4.2/_install/bin
[root@localhost bin]# arm-linux-readelf -a busybox | grep "shared library"
0x00000001 (needed) shared library: [libcrypt.so.1]
0x00000001 (needed) shared library: [libm.so.6]
0x00000001 (needed) shared library: [libc.so.6]
------------------------------------------------------------------
如上所示 要把 /usr/local/arm/3.3.2/arm-linux/lib目录下的
libcrypt.so.1
libm.so.6
libc.so.6
文件是busybox所需的共享库文件,要把它以及和他相关的链接文件拷贝到
你新建的文件系统的 lib 目录。
(注意: libcrypt.so.1 libm.so.6 libc.so.6相关的链接文件也要拷贝到lib目录)
==================================================================================
环境:fedora 7
编译器: 交叉编译器 3.3.2
busybox: 1.5.1
(busy1.5.1 可以静态编译,不会出错 :))
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
一 修改
修改busybox中的 makefile文件
找到 arch 和 cross_compile 修改成如下
arch ?= arm
cross_compile ?= /usr/local/arm/3.3.2/bin/arm-linux-
二 配置
[root@localhost busybox-1.5.1]# make defconfig
[root@localhost busybox-1.5.1]# make xconfig
-------------------------------------------------------------------------
修改配置 主要修改如下
-------------------------------------------------------------------------
busybox settings
build options
[*]build busybox as a static binary
//选此项静态编译。
miscellaneous utilities
[]taskset //选了就会出错
其他的和1.4.2 操作相同。
[root@localhost busybox-1.5.1]# make all install
最后会在 busybox-1.5.1/_install/目录生成你要的 bin sbin usr 目录
[root@localhost busybox-1.5.1]# cd _install/
[root@localhost _install]# ls
bin linuxrc sbin usr
[root@localhost busybox-1.5.1]# cd _install/
[root@localhost _install]# ls
bin linuxrc sbin us
[root@localhost _install]# cd bin
[root@localhost bin]# ls
addgroup chattr date dumpkmap fgrep ip iptunnel ls mount pidof pwd setarch sync uncompress
adduser chgrp dd echo getopt ipaddr kill lsattr mountpoint ping rm sh tar usleep
ash chmod delgroup ed grep ipcalc linux32 mkdir mt ping6 rmdir sleep touch vi
busybox chown deluser egrep gunzip iplink linux64 mknod mv pipe_progress rpm stat true watch
cat cp df false gzip iproute ln mktemp netstat printenv run-parts stty umount zcat
catv cpio dmesg fdflush hostname iprule login more nice ps sed su uname
[root@localhost bin]# file busybox
busybox: elf 32-bit lsb executable, arm, version 1, statically linked, stripped
(此处没有和busybox1.4.2输出信息,是因为是静态编译的,不需要用到库了 :) )
[root@localhost bin]# arm-linux-readelf -a busybox | grep "shared library"
[root@localhost bin]#