mighaoze 2011-07-20
1. 准备工作
Busybox源码下载
具体下载目录在 /pub/2011/07/20/Busybox/
# cd /home/liao
# tar –jxvf busybox-1.13.3.tar.bz2
# cd busybox-1.13.3
2. busybox编译
2.1修改Makefile
CROSS_COMPILE ?=arm-linux-
ARCH ?=arm
2.2 配置busybox
# make menuconfig
Busybox Settings--->
Build Options--->
[*] Build BusyBox as a static binary(no shared libs)
[*] Build with Large File Support(for accessing files>2GB)
Installation Options->
[]Don’t use /usr
Applets links (as soft-links) --->
(./_install) BusyBox installation prefix 修改(./_install)为/utu2440/rootfs
Busybox Library Tuning --->
[*] vi-style line editing commands
[*]Fancy shell prompts
Linux Module Utilities--->
(/lib/modules)Default directory containing modules
(modules.dep)Default name of modules.dep
[ ] simplified modutils
[*] insmod
[*] rmmod
[*] lsmod
[*] modprobe
-----options common to multiple modutils
[ ] support version 2.2/2.4 Linux kernels
[*]Support tainted module checking with new kernels
[*]Support for module .aliases file
[*] support for modules.symbols file
Linux System Utilities --->
[*]Support /etc/mdev.conf
[*]Support command execution at device addition/removal
# make
# make install
编译出错:
networking/interface.c:818: error: `ARPHRD_INFINIBAND' undeclared here (not in a function)
networking/interface.c:818: error: initializer element is not constant
networking/interface.c:818: error: (near initialization for `ib_hwtype.type')
make[1]: *** [networking/interface.o] 错误 1
make: *** [networking] 错误 2
解决:在networking/interface.c文件中添加:
#define ARPHRD_INFINIBAND 32 /* InfiniBand */
编译后,在rootfs目录下会生成目录bin、sbin、usr和文件linuxrc的内容
3. 建立根文件目录
前面已经生成了bin、sbin等目录,这里建立一些必要的文件目录
# mkdir dev etc lib proc sys mnt tmp var home boot root
# mkdir usr/lib usr/modules
# mkdir etc/init.d etc/sysconfig
# mkdir mnt/etc mnt/jffs2 mnt/data mnt/temp
# mkdir var/lib var/lock var/run var/tmp
# chmod 1777 tmp
# chmod 1777 var/tmp
# sudo mknod -m 600 dev/console c 5 1
# sudo mknod -m 600 dev/null c 1 3
这两个设备节点需要root用户建立,具体原因有待研究