S3C2440 nfs 的使用

Linux主机需要先安装并开启 NFS 服务, NFS 服务的安装配置启动参考http://blog.csdn.net/u011641885/article/details/47696143 中 的安装 nfs服务。

使用 uboot 上的 nfs 命令替代 tftp 下载 根文件系统

nfs 30000000 192.168.1.106:/work/nfs_root/tmp/fs.yaffs2 

后面的操作步骤与 tftp 下载文件系统一样,擦除 Nand Flash, 写入 Nand Flash。

还有一种用法,就是将 nfs 当类似 U盘之类的存储设备用(开发板进入根文件系统后,手动挂载 nfs)。命令如下:

mount -t nfs -o nolock,vers=2 192.168.1.106:/work/nfs_root /mnt

设置开发板从 NFS 启动(使用NFS作为开发板的根文件系统)

  • 进入uboot
  • 修改启动参数 bootargs
    set bootargs noinitrd root=/dev/nfs nfsroot=192.168.1.106:/work/nfs_root/tmp/fs_mini_mdev ip=192.168.1.11:192.168.1.106:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0

nfsroot 为 nfs服务的根目录,设置格式如下

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

ip 参数设置格式如下,其中device为对应网卡,autoconf是否开启自动配置,我这里设置的是关闭

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

关于挂载nfs跟文件的更多说明参考如下文档:

Mounting the root filesystem via NFS (nfsroot)
===============================================

Written 1996 by Gero Kuhlmann <[email protected]>
Updated 1997 by Martin Mares <[email protected]>
Updated 2006 by Nico Schottelius <[email protected]>
Updated 2006 by Horms <[email protected]>

In order to use a diskless system, such as an X-terminal or printer server
for example, it is necessary for the root filesystem to be present on a
non-disk device. This may be an initramfs (see Documentation/filesystems/
ramfs-rootfs-initramfs.txt), a ramdisk (see Documentation/initrd.txt) or a
filesystem mounted via NFS. The following text describes on how to use NFS
for the root filesystem. For the rest of this text 'client' means the
diskless system, and 'server' means the NFS server.

1.) Enabling nfsroot capabilities
    -----------------------------

In order to use nfsroot, NFS client support needs to be selected as
built-in during configuration. Once this has been selected, the nfsroot
option will become available, which should also be selected.

In the networking options, kernel level autoconfiguration can be selected,
along with the types of autoconfiguration to support. Selecting all of
DHCP, BOOTP and RARP is safe.

2.) Kernel command line
    -------------------

When the kernel has been loaded by a boot loader (see below) it needs to be
told what root fs device to use. And in the case of nfsroot, where to find
both the server and the name of the directory on the server to mount as root.
This can be established using the following kernel command line parameters:

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		= 4096
			wsize		= 4096
			timeo		= 7
			retrans		= 3
			acregmin	= 3
			acregmax	= 60
			acdirmin	= 30
			acdirmax	= 60
			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

3.) Boot Loader
    ----------

To get the kernel into memory different approaches can be used.
They depend on various facilities being available:

3.1)  Booting from a floppy using syslinux

	When building kernels, an easy way to create a boot floppy that uses
	syslinux is to use the zdisk or bzdisk make targets which use
      	and bzimage images respectively. Both targets accept the
     	FDARGS parameter which can be used to set the kernel command line.

	e.g.
	   make bzdisk FDARGS="root=/dev/nfs"

   	Note that the user running this command will need to have
     	access to the floppy drive device, /dev/fd0

     	For more information on syslinux, including how to create bootdisks
     	for prebuilt kernels, see http://syslinux.zytor.com/

	N.B: Previously it was possible to write a kernel directly to
	     a floppy using dd, configure the boot device using rdev, and
	     boot using the resulting floppy. Linux no longer supports this
	     method of booting.

3.2) Booting from a cdrom using isolinux

     	When building kernels, an easy way to create a bootable cdrom that
     	uses isolinux is to use the isoimage target which uses a bzimage
     	image. Like zdisk and bzdisk, this target accepts the FDARGS
     	parameter which can be used to set the kernel command line.

	e.g.
	  make isoimage FDARGS="root=/dev/nfs"

     	The resulting iso image will be arch/<ARCH>/boot/image.iso
     	This can be written to a cdrom using a variety of tools including
     	cdrecord.

	e.g.
	  cdrecord dev=ATAPI:1,0,0 arch/i386/boot/image.iso

     	For more information on isolinux, including how to create bootdisks
     	for prebuilt kernels, see http://syslinux.zytor.com/

3.2) Using LILO
	When using LILO all the necessary command line parameters may be
	specified using the 'append=' directive in the LILO configuration
	file.

	However, to use the 'root=' directive you also need to create
	a dummy root device, which may be removed after LILO is run.

	mknod /dev/boot255 c 0 255

	For information on configuring LILO, please refer to its documentation.

3.3) Using GRUB
	When using GRUB, kernel parameter are simply appended after the kernel
	specification: kernel <kernel> <parameters>

3.4) Using loadlin
	loadlin may be used to boot Linux from a DOS command prompt without
	requiring a local hard disk to mount as root. This has not been
	thoroughly tested by the authors of this document, but in general
	it should be possible configure the kernel command line similarly
	to the configuration of LILO.

	Please refer to the loadlin documentation for further information.

3.5) Using a boot ROM
	This is probably the most elegant way of booting a diskless client.
	With a boot ROM the kernel is loaded using the TFTP protocol. The
	authors of this document are not aware of any no commercial boot
	ROMs that support booting Linux over the network. However, there
	are two free implementations of a boot ROM, netboot-nfs and
	etherboot, both of which are available on sunsite.unc.edu, and both
	of which contain everything you need to boot a diskless Linux client.

3.6) Using pxelinux
	Pxelinux may be used to boot linux using the PXE boot loader
	which is present on many modern network cards.

	When using pxelinux, the kernel image is specified using
	"kernel <relative-path-below /tftpboot>". The nfsroot parameters
	are passed to the kernel by adding them to the "append" line.
	It is common to use serial console in conjunction with pxeliunx,
	see Documentation/serial-console.txt for more information.

	For more information on isolinux, including how to create bootdisks
	for prebuilt kernels, see http://syslinux.zytor.com/

4.) Credits
    -------

  The nfsroot code in the kernel and the RARP support have been written
  by Gero Kuhlmann <[email protected]>.

  The rest of the IP layer autoconfiguration code has been written
  by Martin Mares <[email protected]>.

  In order to write the initial version of nfsroot I would like to thank
  Jens-Uwe Mager <[email protected]> for his help.

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-10-08 21:28:05

S3C2440 nfs 的使用的相关文章

开发板S3C2440挂起NFS步骤

第一.安装.配置.启动FTP.SSH或NFS服务 参考韦东山的嵌入式linux应用开发完全手册 http://pan.baidu.com/s/1o79h3n0 第二.windows.linux以及开发板需要三者ping通 参考资料:http://pan.baidu.com/s/1o8Uw0vo 注:开发板上ping虚拟机是在根文件系统下,修改ip,掩码号可以在u-boot里修改set ipaddr <开发板ip号>      set serverip <虚拟机linux ip号>.

s3c2440 移值u-boot-2016.03 第6篇 支持mtd yaffs 烧写

1, 解决启动时的错误 Warning - bad CRC, using default environment 搜索发现 在 /tools/env/fw_env.c 中 /* 放在NAND FLASH 中 大小 128K 开始地址 */ #define CONFIG_ENV_IS_IN_NAND #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) #define CONFIG_ENV_OFFSET (256<<10) #define CONF

S3C2440 nand_flash驱动程序

20150418 S3C2440 nand_flash驱动程序 2015-04-18 Lover雪儿 一.一个简单的nand_flash驱动 1.定义nand_chip.mtd_info两个结构体 如上图所示: nand_chip 结构体:是给nand_scan函数用的,而nand_scan函数提供了选中nand.发出命令.发出地址.发出数据.读取数据.判断状态等功能,所以nand_chip结构体上必须定义一系列实现上面功能能的函数,包括选中函数,负责发地址与命令的函数,以及判断状态的函数,最重

S3C2440 nor_flash驱动程序

20150418 S3C2440 nor_flash驱动程序 2015-04-18 Lover雪儿 和前面的nandflash差不多,我们此处来重新学习一下norflash驱动. 1 /* 2 * 参考 drivers\mtd\maps\Physmap.c 3 */ 4 5 #include <linux/module.h> 6 #include <linux/types.h> 7 #include <linux/kernel.h> 8 #include <lin

Android for S3C2440

转载: http://blog.csdn.net/blest/article/details/6215600 本人尚未尝试,先转载,以后再看. 1.移植基本环境: 我用的还是win的平台,所以使用了虚拟机:Vmware workstation 6.5.0 +ubuntu9.10: 交叉编译工具包EABI——4.3.3: 做好的镜像都是在win平台上使用串口烧录的 用到软件DNM: 启动之类的都用超级终端进行控制. 提示:TQ2440所附带的光盘中有很多有用的东西,建议大家看一下,所用的工具除了虚

s3c2440 LED驱动分析

这个开发板已经很久没有动了,这一次辞职后想来想去还是选择去做驱动吧.以前写的那些驱动代码早就不知道哪里去了,当然更不记得了.所以现在从头开始学习,也顺便记录下笔记: 原理 首先看看LED的电路图: 不难看出,LED1==GPB5   LED2==GPB6   LED3==GPB7    LED4==GPB8 然后就去看看IO端口图: 要设置的非常简单,就是把GPBCON设置为输出,GPBDAT设置为0时,则灯亮:设置为1时,则灯灭: 相关知识点 其实上一篇中s3c2440系统自带的管脚宏和函数已

第1个linux驱动___投靠NFS网络文件系统

之前我们一直是在虚拟机ubuntu环境中测试我们的first_drv驱动模块,但是这不是我们的开发方向,在刚开始的学习中我们避免搭建过多的环境,因此选择了只在ubuntu中测试驱动. 我们的模式是: [first_drv.c]-->[使用ubuntu内核源码编译]-->[first_drv.ko(可运行于虚拟机)]--> [ 安装到虚拟机中 ]-->[ hello world! ]-->[ 从虚拟机中卸载 ]-->[ goodbye world... ] 但是我们的最终

uboot在s3c2440上的移植(6)

一.移植环境 主  机:VMWare--Fedora 9 开发板:Mini2440--64MB Nand,Kernel:2.6.30.4 编译器:arm-linux-gcc-4.3.2.tgz u-boot:u-boot-2009.08.tar.bz2 二.移植步骤 10)u-boot利用tftp服务下载内核和利用nfs服务挂载nfs文件系统. 知识点: tftp服务的安装与配置及测试: nfs服务的安装与配置及测试: u-boot到kernel的参数传递(重点). 我们知道使用tftp下载内核

s3c2440 移植linux内核 添加网卡支持 yaffs2文件系统支持

三.内核的移植 说明:针对的是百问网的jz2440 gcc:4.9.1 1.移植内核 首先,下载源码包:https://www.kernel.org/ 现在时间为2014年12月20日其主界面截图为: 在此,就在下较新的稳定的版本作为尝试.在这里有个命名问题需要说明一下,最前面的2.6或者3.18是主版本号码,后面的次版本号是比如2.6.32.65中的32,再后面的比如2.6.32.65中的65是升级版本号,主版本号为奇数的是开发本比如3.17,主版本号为偶数的为稳定版比如3.18,一般情况下名