00. 目录
01. BusyBox简介
BusyBox 是一个集成了一百多个最常用Linux命令和工具的软件。BusyBox 包含了一些简单的工具,例如ls、cat和echo等等,还包含了一些更大、更复杂的工具,例grep、find、mount以及telnet。有些人将 BusyBox 称为 Linux 工具里的瑞士军刀。简单的说BusyBox就好像是个大工具箱,它集成压缩了 Linux 的许多工具和命令,也包含了 Android 系统的自带的shell。
02. 编译BusyBox
2.1 解压文件
[root@itcast tools]# tar -xzvf busybox-1.17.2-20101120.tgz
2.2 配置BusyBox
[root@itcast tools]# cd busybox-1.17.2
[root@itcast busybox-1.17.2]# make menuconfig
2.3 选择编译选项
2.4 编译BusyBox
[root@itcast busybox-1.17.2]# make -j4
2.5 安装BusyBox
[root@itcast busybox-1.17.2]# make install
2.6 验证生成的文件
[root@itcast busybox-1.17.2]# ls _install/
bin linuxrc sbin usr
[root@itcast busybox-1.17.2]#
03. 最小网络文件系统
3.1 创建共享目录
[root@itcast /]# mkdir rootfs
[root@itcast /]#
3.2 拷贝busybox编译好的文件到rootfs中
[root@itcast busybox-1.17.2]# cp _install/* /rootfs/ -rf
[root@itcast busybox-1.17.2]#
3.3 拷贝etc目录
[root@itcast busybox-1.17.2]# cp examples/bootfloppy/etc /rootfs/ -rf
[root@itcast busybox-1.17.2]#
3.4 拷贝库
[root@itcast busybox-1.17.2]# mkdir /rootfs/lib
[root@itcast busybox-1.17.2]# cp /usr/local/arm/4.5.1/arm-none-linux-gnueabi/lib/*
/rootfs/lib/ -rf
[root@itcast busybox-1.17.2]#
3.5 手动创建目录
[root@itcast rootfs]# mkdir mnt media misc home sys proc tmp var dev boot net opt
[root@itcast rootfs]#
3.6 修改配置文件
[root@itcast rootfs]# vim etc/profile
[root@itcast rootfs]# cat etc/profile
# /etc/profile: system-wide .profile file for the Bourne shells
echo "============================="
echo " welcom to dengjin system "
echo "============================="
export PS1="[root@deng \W]# "
[root@itcast rootfs]#
3.7 修改rcS配置文件
[root@itcast rootfs]# vim etc/init.d/rcS
#修改内容如下:
[root@itcast rootfs]# cat etc/init.d/rcS
#! /bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
mount -t sysfs none /tmp
mount -t sysfs none /dev
/sbin/mdev -s
[root@itcast rootfs]#
3.8 修改inittab文件
[root@itcast filesystem]# vim etc/inittab
# 修改内容如下
::sysinit:/etc/init.d/rcS
#::respawn:-/bin/sh
ttySAC0::askfirst:-/bin/sh
#::ctrlaltdel:/bin/umount -a -r
[root@itcast filesystem]#
3.9 设置nfs共享
[root@itcast rootfs]# vim /etc/exports
# 最后一行添加如下内容
/rootfs *(rw,sync,no_root_squash)
[root@itcast /]# chmod -R 755 /rootfs
[root@itcast /]# /etc/init.d/nfs reload
[root@itcast /]#
3.10 设置启动参数
# kernel不用修改 就是qt的kernel
# 在minicom中的uboot设置启动参数
DengJin #set bootargs root=/dev/nfs nfsroot=192.168.88.88:/rootfs ip=192.168.88.77
console=ttySAC0,115200 lcd=S70 ctp=2
DengJin #save
Saving Environment to SMDK bootable device...
done
3.11 测试
[ 14.075000] VFS: Mounted root (nfs filesystem) on device 0:10.
[ 14.075000] Freeing init memory: 212K
Please press Enter to activate this console.
===============================
welcom to uplooking system
===============================
[root@itcast /]#
[root@itcast /]#
[root@itcast /]#
[root@itcast /]#
04. 下载
4.1 BusyBox工具
下载:busybox-1.17.2-20101120.tar.bz2
4.2 制作好的文件系统
下载:filesystem.tar.bz2