目标板挂载根文件系统的方法有两种(这里所说的服务端就是ubuntu,Ubuntu已经成功安装了nfs服务,并且保证服务端与目标板ping 通)

第一种:等待开发板启动之后去挂载,此时文件系统从Flash中启动,然后手动的通过命令去挂载服务端的文件系统

首先修改配置文件/etc/export,在export文件中最后一行加入:[文件系统的目录]  *(rw,sync,no_subtree_check,no_root_squash)

/home/linux/root_fs/first_fs/  *(rw,sync,no_subtree_check,no_root_squash)///home/linux/root_fs/first_fs/ 为文件系统的目录

整个export文件为

# /etc/exports: the access control list for filesystems which may be exported
#        to NFS clients.  See exports().
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
/source/rootfs *(rw,sync,no_subtree_check,no_root_squash)
/home/linux/root_fs/first_fs/  *(rw,sync,no_subtree_check,no_root_squash)

export文件

设置好之后,重新启动nfs服务

sudo /etc/init.d/nfs-kernel-server restart

在服务器段自己测试挂载是否成功

sudo mount -t nfs 192.168.1.24:/home/linux/root_fs/first_fs/ /mnt/

在服务端/mnt/目录下查看挂载到的文件,在服务端调通之后,就进行重要环节,

在目标板上通过nfs进行挂载,命令如下:

mount -t nfs -o nolock 192.168.1.24:/home/linux/root_fs/first_fs/ /mnt/

第二种方法:直接从nfs启动,这样服务端所生成的目标文件,目标端可以直接执行,不需要挂载

这种做法就是在u-boot启动之后,设置nfs挂载参数。首先必须掌握nfs命令,

root=/dev/nfs

  This is necessary to enable the pseudo-NFS-device. Note that it's not a
  real device but just a synonym to tell the kernel to use NFS instead of
  a real device.

nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]

  If the `nfsroot' parameter is NOT given on the command line,
  the default "/tftpboot/%s" will be used.

  <server-ip>    Specifies the IP address of the NFS server.
        The default address is determined by the `ip' parameter
        (see below). This parameter allows the use of different
        servers for IP autoconfiguration and NFS.

  <root-dir>    Name of the directory on the server to mount as root.
        If there is a "%s" token in the string, it will be
        replaced by the ASCII-representation of the client's
        IP address.

  <nfs-options>    Standard NFS options. All options are separated by commas.
        The following defaults are used:
            port        = as given by server portmap daemon
            rsize        =
            wsize        =
            timeo        =
            retrans        =
            acregmin    =
            acregmax    =
            acdirmin    =
            acdirmax    =
            flags        = hard, nointr, noposix, cto, ac

ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>

  This parameter tells the kernel how to configure IP addresses of devices
  and also how to set up the IP routing table. It was originally called
  `nfsaddrs', but now the boot-time IP configuration works independently of
  NFS, so it was renamed to `ip' and the old name remained as an alias for
  compatibility reasons.

  If this parameter is missing from the kernel command line, all fields are
  assumed to be empty, and the defaults mentioned below apply. In general
  this means that the kernel tries to configure everything using
  autoconfiguration.

  The <autoconf> parameter can appear alone as the value to the `ip'
  parameter (without all the ':' characters before) in which case auto-
  configuration is used.

  <client-ip>    IP address of the client.

          Default:  Determined using autoconfiguration.

  <server-ip>    IP address of the NFS server. If RARP is used to determine
        the client address and this parameter is NOT empty only
        replies from the specified server are accepted.

        Only required for for NFS root. That is autoconfiguration
        will not be triggered if it is missing and NFS root is not
        in operation.

        Default: Determined using autoconfiguration.
                 The address of the autoconfiguration server is used.

  <gw-ip>    IP address of a gateway if the server is on a different subnet.

        Default: Determined using autoconfiguration.

  <netmask>    Netmask for local network interface. If unspecified
        the netmask is derived from the client IP address assuming
        classful addressing.

        Default:  Determined using autoconfiguration.

  <hostname>    Name of the client. May be supplied by autoconfiguration,
          but its absence will not trigger autoconfiguration.

          Default: Client IP address is used in ASCII notation.

  <device>    Name of network device to use.

        Default: If the host only has one device, it is used.
             Otherwise the device is determined using
             autoconfiguration. This is done by sending
             autoconfiguration requests out of all devices,
             and using the device that received the first reply.

  <autoconf>    Method to use for autoconfiguration. In the case of options
                which specify multiple autoconfiguration protocols,
        requests are sent using all protocols, and the first one
        to reply is used.

        Only autoconfiguration protocols that have been compiled
        into the kernel will be used, regardless of the value of
        this option.

                  off or none: don't use autoconfiguration (default)
          on or any:   use any protocol available in the kernel
          dhcp:        use DHCP
          bootp:       use BOOTP
          rarp:        use RARP
          both:        use both BOOTP and RARP but not DHCP
                       (old option kept for backwards compatibility)

                Default: any

nfs命令格式

在u-boot界面,输入print就可以显示如下参数

bootargs=noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0 

然后根据nfs命令格式,具体格式解析要看nfs命令介绍。

nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]  ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>

将启动参数设置为

set bootargs noinitrd root=/dev/nfs nfsroot=192.168.1.24:/home/linux/root_fs/first_fs/ ip=192.168.1.12:192.168.1.24:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0

当文件系统启动之后,服务器端的文件会共享过来。

目标板通过nfs挂载根文件系统的更多相关文章

  1. 用Qemu模拟vexpress-a9 (四) --- u-boot引导kernel,用nfs挂载根文件系统

    环境介绍 Win7 64 + Vmware 11 + ubuntu14.04 32 u-boot 版本:u-boot-2015-04 Linux kernel版本:linux-3.16.y busyb ...

  2. NFS挂载根文件系统

    当NFS跟文件系统挂载不上的时候原因很多,但有一个原因不可忽略,那就是目标板内核支持的NFS版本以及默认版本,我吃过亏,特意做个笔记: setenv bootargs console=ttySAC0  ...

  3. 根文件系统制作、NFS配置与安装及利用NFS挂载根文件系统

    最近打算从头开始制作根文件系统,下面是开发过程. 一.根文件系统的制作 0.FHS(Filesystem Hierarchy Standard)标准介绍 该标准规定了根目录下各个子目录的名称及其存放的 ...

  4. ARM9通过NFS挂载根文件系统

    当开发板启动以后可以通过在超级终端发送命令来配置NFS. 首先得给开发板一个IP地址,用下面的命令配置即可: #ifconfig 192.168.0.10 经过上面的配置以后在各自的终端中应该都能PI ...

  5. 配置uboot指定nfs挂载根文件系统

    背景: 文件系统的调试也建议在 网络中进行. 概念: NFS是Network File System的缩写及网络文件系统. 要功能是通过局域网络让不同的主机系统之间可以共享文件或目录. NFS系统和W ...

  6. Qemu搭建ARM vexpress开发环境(三)----NFS网络根文件系统

    Qemu搭建ARM vexpress开发环境(三)----NFS网络根文件系统 标签(空格分隔): Qemu ARM Linux 经过上一篇<Qemu搭建ARM vexpress开发环境(二)- ...

  7. NFS挂载Android文件系统

    NFS挂载Android文件系统 [日期:2012-02-14] 来源:Linux社区  作者:cjok376240497 [字体:大 中 小]     1.安装NFS服务 $sudo apt-get ...

  8. mini6410基于linux2.6.36内核通过NFS启动根文件系统总结(四制作根文件系统及通过NFS挂载文件系统)

    http://blog.csdn.net/yinjiabin/article/details/7489563 根文件系统一般包括: 1)基本的文件系统结构,包含一些必须的目录,比如:/dev,/pro ...

  9. 【原创】-- nfs安装配置及使用,挂载根文件系统

    环境:ubuntu14.04(非虚拟机),OK6410 环境搭建: (1) #sudo apt-get install nfs-kernel-server 如果已经是最新版本了,无需安装 (2) 建立 ...

随机推荐

  1. Harbor快速部署到Kubernetes集群及登录问题解决

    Harbor(https://goharbor.io)是一个功能强大的容器镜像管理和服务系统,用于提供专有容器镜像服务.随着云原生架构的广泛使用,原来由VMWare开发的Harbor也加入了云原生基金 ...

  2. SpringBoot入门系列HelloWorld

    根据咱们程序员学习的惯例,学习一门新技术都是从HelloWorld开始的. 感觉编程是一件非常富有意义的事情,程序员也是一群可爱的人,渴望被关怀和关注,因为我们总在和世界say Hi. 好了进入正题 ...

  3. 【BZOJ4059】Non-boring sequences

    Solution 记序列为\(a\),计算出与\(a_i\)相等的前一个元素的位置\(pre_i\),以及后一个元素的位置\(nex_i\),显然,对于那些左端点处于\((pre_i,i]\)以及右端 ...

  4. BZOJ3601 一个人的数论 【数论 + 高斯消元】

    题目链接 BZOJ3601 题解 挺神的 首先有 \[ \begin{aligned} f(n) &= \sum\limits_{x = 1}^{n} x^{d} [(x,n) = 1] \\ ...

  5. Java考试题之四

    QUESTION 73 Given: 10: public class Hello { 11: String title; 12: int value; 13: public Hello() { 14 ...

  6. Java之JDBC连接池

    数据库连接池 连接池的概述 概念:其实就是一个容器(集合),存放数据库连接的容器. 当系统初始化好后,容器被创建,容器中会申请一些连接对象,当用户来访问数据库时, 从容器中获取连接对象,用户访问完之后 ...

  7. Android L开发指南

    导语:Android下一代操作系统“ L”对开发者意味着什么?ART模式能否让应用的体验超越苹果? 刚刚结束的 Google I/O大会上,Android下一代操作系统“ L”带来不少惊喜.新系统运行 ...

  8. Android Layout: TableLayout

    TableLayout<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" andr ...

  9. Autolayout下使用代码改变frame无效

    在使用自动布局的情况下,子视图的边框无法改变.就算调用setFrame方法也不会有效果.自动布局引擎对于子视图的大小和位置有最终的决定权.如果你需要在运行时改变边框,那就得用NSLayoutConst ...

  10. windows之tracert命令

    tracert命令是使用从本地到目标网站所在网络服务器的一系列网络节点的访问速度, 网络节点最多支持显示30个.命令格式是tracert加空格加目标网站名称(也可以输入目标网站的IP地址). 先以百度 ...