tiny6410nfs挂载问题


一、制作根文件系统

1.下载最新版的 busybox 地址:http://www.busybox.net/downloads/

2、编译busybox。先make menuconfig ,修改以下:
Busybox Settings --->
    Build Options --->

    Build BusyBox as a static binary 
         //我们使用动态链接的方式生成需要的命令,所以不选
    (arm-linux-) Cross Compiler prefix
        //这里和Makefile里保持一致,应该写一处就行了

Busybox Settings --->
    Installation Options--->

     (./_install)Busybox Installation Prefix
       //安装路径前缀,可以保留默认路径(./_install)

Busybox Settings --->
    Installation Options--->

    Fancy shell prompts
       //选中可以使我们在profile这个中设置的命令行提示符PS1中的转义字符生效。
   Tab completion也选上

Init Utilities--->
    Support reading an inittab file
      //选中可以使我们放在/etc下的inittab这个文件被busybox的init进程解析

保存退出,直接make,make install。
 
 3、用shell脚本创建根文件系统的目录结构,并在想要建立根文件系统的地方运行此脚本。我是用root用户登陆的,直接创建了设备节点。
root@li-ace:/# vim makedir.sh
#!/bin/sh
  echo "makeing rootdir"
  cd /home/li
  mkdir rootfs
  cd rootfs
  echo "makeing dir: bin dev etc lib proc sbin sys usr mnt tmp var home root ..."
  mkdir bin dev etc lib proc sbin sys usr mnt tmp var home root #13 dirs
  mkdir usr/bin usr/lib usr/sbin usr/share lib/modules
#Don't use mknod, unless you run this Script as
  mknod -m 777 dev/console c 5 1
  mknod -m 777 dev/null c 1 3
  echo "done"
执行这个sh:
root@li-ace:/# sh makedir.sh
创建出一个主文件夹rootfs,里面有一批文件:
root@li-ace:/home/li/rootfs:/# ls
bin  dev  etc  home  lib  mnt  proc  root  sbin  sys  tmp  usr  var

PS:
mknod -m 777 dev/console c 5 1
mknod -m 777 dev/null c 1 3
//这两个节点文件一定要全部解开,不然挂载时就会出现下面的错误
Freeing init memory: 1428K                                                                                                                    
mount: RPC: Remote system error - No route to host                                                                                            
/init: line 103: can't open /r/dev/console: no such file                                                                                      
Kernel panic - not syncing: Attempted to kill init!   

4、 把busybox源码目录下的etc的内容拷贝到这里的etc下
root@li-ace:/# cd etc/
root@ etc:/# cp -a /home/li/busybox-1.17.2/examples/bootfloppy/etc
                 
TCP cubic registered                                                                                                                         
NET: Registered protocol family 17                                                                                                           
VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5                                                                      
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)                                                                                      
dm9000 dm9000: eth0: link down                                                                                                               
IP-Config: Guessing netmask 255.255.255.0                                                                                                    
IP-Config: Complete:                                                                                                                         
     device=eth0, addr=192.168.1.230, mask=255.255.255.0, gw=255.255.255.255,                                                                
     host=192.168.1.230, domain=, nis-domain=(none)                                                                                          
dm9000 dm9000: eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1                                                                               
,                                                                                                                                            
     bootserver=255.255.255.255, rootserver=192.168.1.101, rootpath=                                                                         
Freeing init memory: 1428K                                                                                                                   
                                                                                                                                             
Please press Enter to activate this console.                                                                                                 
[root@Enjoylinux /]#

OK,这样就启动完成了,ls查看下可以看到文件系统里的目录

Please press Enter to activate this console.                                                                                                 
[root@Enjoylinux /]# ls                                                                                                                      
bin      etc      lib      mnt      root     sys      usr                                                                                    
dev      home     linuxrc  proc     sbin     tmp      var                                                                                    
[root@Enjoylinux /]#

原文地址:https://www.cnblogs.com/zxouxuewei/p/4945124.html