使用BusyBox制作linux根文件系统(CramFS+mdev)

发布者:EuphoricVoyage最新更新时间:2024-08-30 来源: cnblogs关键字:BusyBox  linux  根文件系统 手机看文章 扫描二维码
随时随地手机看文章

root@arm2410s:/#                                                        
root@arm2410s:/# exit     #退出当前 shell                                                       
                                                                                 
Please press Enter to activate this console.          #再按回车开启一个新的login shell                           
starting pid 799, tty '/dev/console': '-/bin/sh '                                
Processing /etc/profile                               #再次执行/etc/profile配置文 件                          
set user path                                                                    
set search library path                                                          
set PS1 


lingd@ubuntu:~/arm2410s/rootfs/mnt/etc$ ls
init.d  inittab  profile  rc.local

3.7、/etc/fstab
文件/etc/fstab存放的是系统中的文件系统信息。当正确的设置了该 文件,则可以通过'mount /directoryname'命令来加载一个文件系统,或mount -a来加载该文件中所有文件系统。每种文件系统都对应一个独立的行,每行中的字段都有空格或tab键分开。同时fsck、mount、umount的等命 令都利用该程序

lingd@ubuntu:~/arm2410s/rootfs/mnt/etc$ vi fstab

fstab文件内容如下:
#/etc/fstab: static file system information.
#                 
proc  /proc proc  defaults 0 0
sysfs /sys  sysfs defaults 0 0
mdev  /dev  ramfs defaults 0 0
none  /tmp  ramfs defaults 0 0
注意: 已单独mount了的文件系统,就不要出现在/etc/fstab文件中,以免使用mount -a时把先前已经mount上的文件系统被覆盖了。

 

3.8、/etc/passwd

/etc/passwd文件存放着所有用户的信息,包括账号和密码。内容如下:

#username:password:User ID:Group ID:comment:home directory:shell

root:x:0:0:root:/root:/bin/sh

 


4、编译busybox

BusyBox下载地址:http://www.busybox.net/
lingd@ubuntu:~/arm2410s$ tar xjvf busy-1.11.1.tar.bz2
lingd@ubuntu:~/arm2410s$ cd busybox-1.11.1
lingd@ubuntu:~/arm2410s/busybox-1.11.1$ vi Makefile
首先修改 Makefile ,将以下两项改为
CROSS_COMPILE = arm-linux-
ARCH      = arm

配置busybox,修改以下选项(其他选项默认就可 以了,或者根据需要再裁减一下):
lingd@ubuntu:~/arm2410s/busybox-1.11.1$ make menuconfig
Busybox Settings  --->
Build Options  --->
     [*] Build BusyBox as a static binary (no shared libs)
     [ ] Build with Large File Support (for accessing files > 2 GB)
Installation Options  --->
     [*] Don't use /usr        #这项必选选上,否则BusyBox默认安装路径是/usr,原/usr下的东西可能会被覆盖了
        Applets links (as soft-links)  ---> 
     (./_install) BusyBox installation prefix
Busybox Library Tuning  --->
     [*] Command line editing
     (1024) Maximum length of input                  
     [*]   vi-style line editing commands              
     (15)  History size                   
     [*]   History saving                                    
     [*]   Tab completion                                     
     [*]     Username completion                              
     [*]   Fancy shell prompts

这两项必须选上,不然BusyBox将无法识别环境变量PS1里的参数。
Linux Module Utilities  ---> 
     [*] insmod                                                        
     [*]   Enable load map (-m) option                                  
     [*]     Symbols in load map                                         
     [*] rmmod                                                          
     [*] lsmod                                             
     [*]   Pretty output for 2.6.x Linux kernels                     
     [*] modprobe
     [ ]   Multiple options parsing                                 
     [ ]   Fancy alias parsing                                           
     [ ]   Blacklist support                                        
     ---   Options common to multiple modutils                   
     [ ] Support tainted module checking with new kernels            
     [ ] Support version 2.2.x to 2.4.x Linux kernels               
     [*] Support version 2.6.x Linux kernels                  
     (/lib/modules) Default directory containing modules             
     (modules.dep) Default name of modules.dep

保存退出 Busybox
lingd@ubuntu:~/arm2410s/busybox-1.11.1$ make
lingd@ubuntu:~/arm2410s/busybox-1.11.1$ make install

[1] [2] [3] [4]
关键字:BusyBox  linux  根文件系统 引用地址:使用BusyBox制作linux根文件系统(CramFS+mdev)

上一篇:常用 U-boot命令详解
下一篇:使用Busybox制作CRAMFS文件系统成功

小广播
最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

厂商技术中心

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

电子工程世界版权所有 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2026 EEWORLD.com.cn, Inc. All rights reserved