制作根文件系统

4、创建根文件系统目录

在nfs服务器根目录:nfsroot下,创建rootfs目录,以及根文件系统的各个目录。

  1. [root@www nfsroot]# mkdir -p /nfsroot/rootfs  
  2. [root@www nfsroot]# cd /nfsroot/rootfs  
  3. [root@www rootfs]# mkdir bin dev etc lib proc sbin sys usr mnt tmp var  
  4. [root@www rootfs]# mkdir usr/bin usr/lib usr/sbin lib/modules

 内核在引导根文件系统时候,需要用到设备节点console和null,因此,在这里还要创建设备文件。

  1. [root@www rootfs]# cd dev/  
  2. [root@www dev]# mknod -m 666 console c 5 1  
  3. [root@www dev]# mknod -m 666 null c 1 3 

 将etc包(上面的地址有)安装到/nfsroot/rootfs里面

  1. [root@www dev]# cd /home/guoqian/4-3-2/  
  2. [root@www 4-3-2]# tar -xvz -f etc.tar.gz -C /nfsroot/rootfs  
  3. [root@www 4-3-2]# ls /nfsroot/rootfs/etc/  
  4. fstab  init.d  inittab  profile

 7、编译内核模块,将内核模块安装到根文件系统(我用的是友善提供的内核linux-2.6.32.2)

 pasting

  1. [root@www 4-3-2]# cd /arm/Friendly_Linux/linux-2.6.32.2/                                  //进入内核根目录  
  2. [root@www linux-2.6.32.2]# make modules_install ARCH=arm INSTALL_MOD_PATH=/nfsroot/rootfs  
  3. [root@www linux-2.6.32.2]# cd /nfsroot/rootfs/lib/modules/              //这是为了查看内核模块是否安装在lib/modules下  
  4. [root@www modules]# ls  
  5. 2.6.32.2-FriendlyARM                         //成功安装   

 

8、配置busybox

[root@www modules]# cd /home/guoqian/4-3-2/
[root@www 4-3-2]# tar -xvz -f busybox-1.13.3
[root@www 4-3-2]# cd busybox-1.13.3

 

[root@www busybox-1.13.3]# make menuconfig

进入图形化配置界面后:

1)、进入"Busybox Settings"-->"Build Options ",选中“Build Busybox as a static binary”(直接按键盘空格键到“*”)。注意:这里是静态链接。

2)、同时在“Build Busybox as a static binary”同一个页面的下面“ Cross Compiler prefix”,按键盘Enter键进入,然后输入:“arm-linux-” ,这时出现如下的图示:

 

 3)、进入"Busybox Settings"-->"Installation Options",选中“Don‘t use /user”(这是为了不将busybox安装在/usr/sbin目录下);同时,在同一个页面下的“ BusyBox installation prefix ”添加安装路径:“/nfsroot/rootfs”,如下图所示

 

 

9、编译和安装busybox。

 

[root@www busybox-1.13.3]# make ARCH=arm CROSS_COMPILE=arm-linux-

[root@www busybox-1.13.3]# make install

10、检查busybox是否安装好

具体方法为:查看/nfsroot/rootfs/sbin目录下是否有init存在。注意:如果init不存在说明busybox没有安装好,那么根文件系统是不能用的,这个时候,可以换个busybox试试。

 


  1. [root@www busybox-1.13.3]# cd /nfsroot/rootfs/sbin/  
  2. [root@www sbin]# ls  
  3. adjtimex  dhcprelay    fsck.minix  ifup      lpd         pivot_root   route              svlogd       vconfig  
  4. arp       dnsd         getty       inetd     lsmod       popmaildir   runlevel           swapoff      watchdog  
  5. blkid     fakeidentd   halt        <span style="color:#ff0000;">init</span>      makedevs    poweroff     sendmail           swapon       zcip  
  6. brctl     fbset        hdparm      insmod    man         raidautorun  setconsole         switch_root  
  7. chpasswd  fbsplash     httpd       klogd     mdev        rdate        setfont            sysctl  
  8. chroot    fdisk        hwclock     loadfont  mkfs.minix  rdev         setlogcons         syslogd  
  9. crond     findfs       ifconfig    loadkmap  mkswap      readprofile  slattach           telnetd  
  10. depmod    freeramdisk  ifdown      logread   modprobe    reboot       start-stop-daemon  udhcpc  
  11. devmem    fsck         ifenslave   losetup   nameif      rmmod        sulogin            udhcpd  

 

同时我们可以看到bin目录下很多命令。

11、启动开发板、测试根文件系统是否可用

 

 

转载于:https://www.cnblogs.com/liuchengchuxiao/p/4332375.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值