【Tiny4412】最小網絡文件系統製作

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

05. 附錄

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章