二、移植步骤
1、 源码下载
我们选择的版本是busybox-1.17.3.tar.bz2下载路径为:http://www.linuxidc.com/Linux/2011-08/40704.htm
2、 解压源码
$ tar xvf busybox-1.17.3.tar.bz2
3、 进入源码目录
$ cd busybox-1.17.3
4、 配置源码
$ make menuconfig
Busybox Settings ---> Build Options ---> [*] Build BusyBox as a static binary (no shared libs) [ ] Force NOMMU build [ ] Build with Large File Support (for accessing files > 2 GB) (arm-cortex_a8-linux-gnueabi-) Cross Compiler prefix () Additional CFLAGS
5、 编译
$ make6、 安装
busybox默认安装路径为源码目录下的_install
$ make install
7、 进入安装目录下
$ cd _install
$ ls
bin linuxrc sbin usr8、 创建其他需要的目录
$ mkdir dev etc mnt proc var tmp sys root9、 添加库
在_install目录下创建一个lib文件夹,将工具链中的库拷贝到lib目录下
$ mkdir lib $ cp /home/linux/x-tools/arm-cortex_a8-linux-gnueabi/arm-cortex_a8-linux-gnueabi/lib/* ./lib/
删除lib下的所有目录、.o文件和.a文件,对库进行瘦身以减小文件系统的大小
$ rm *.o *.a $ arm-cortex_a8-linux-gnueabi-strip lib/*
10、 添加系统启动文件
在etc下添加文件inittab
$ vim /etc/inittab
文件内容如下:
#this is run first except when booting in single-user mode. :: sysinit:/etc/init.d/rcS # /bin/sh invocations on selected ttys # Start an "askfirst" shell on the console (whatever that may be) ::askfirst:-/bin/sh # Stuff to do when restarting the init process ::restart:/sbin/init # Stuff to do before rebooting ::ctrlaltdel:/sbin/reboot
在etc下添加文件fstab
$ vim /etc/fstab
文件内容如下:
#device mount-point type options dump fsck order proc /proc proc defaults 0 0 tmpfs /tmp tmpfs defaults 0 0 sysfs /sys sysfs defaults 0 0 tmpfs /dev tmpfs defaults 0 0
这里我们挂在的文件系统有三个proc、sysfs和tmpfs,在内核中proc和sysfs默认都支持,而tmpfs是没有支持的,我们需要添加tmpfs的支持
修改内核配置:
$ make menuconfig
File systems ---> Pseudo filesystems ---> [*] Virtual memory file system support (former shm fs) [*] Tmpfs POSIX Access Control Lists
