天嵌 ARM开发社区

 找回密码
 注册
查看: 3252|回复: 1

ubuntu 搭配nfs服务器

[复制链接]
TQ-lkp 发表于 2013-8-28 17:46:53 | 显示全部楼层 |阅读模式
本帖最后由 TQ-lkp 于 2013-8-28 18:23 编辑

配置 NFS 文件系统



本文以TQ3358为例,讲解NFS配置的过程。
先将光盘中的 Linux 文件系统源文件(在光盘的“TQ3358_CD\Linux 资源\Linux 源码包\”目录下,为 rootfs_linux_v1.0.tar.bz2)拷贝到 PC 的 linux 系统的目录(这里说的目录是笔者操作和截图所拷贝的地方,实际操作可以拷贝到任意目录下)下,然后使用命令#tar xvfj rootfs_linux_v1.0.tar.bz2 -C /,解压源码,解压后会在/opt/EmbedSky/TQ3358/目录下得到名为 rootfs_linux_V1.0/的目标目录。
操作如下图所示:
(下图中的路径和文件名仅供参考)


解压后使用 mv 命令将解压得到的文件系统源码及的目录名改为:root_TQ3358_linux_nfs,使用命令
如下:mv -f rootfs_linux_V1.0 rootfs_TQ3358_linux_nfs,操作后的截图如下所示:



然后修改 rootfs_TQ3358_linux_nfs/etc/init.d/rcS 文件的 29 行(使用命令见上图)
,将 net_set &修改为
#net_set &,修改后的文件截图如下:



然 后 安 装 PC 端 所 需 的 NFS 服 务 器 , 使 用 命 令 : echo y|apt-get install nfs-kernel-server portmapnfs-common,安装结束后系统会在/etc/目录下创建名为 exports 的文件。
然后修改/etc/exports 文件,添加 NFS 路径和相关配置,内容大致如下:
/opt/EmbedSky/TQ3358/rootfs_TQ3358_linux_nfs*(rw,async,no_subtree_check,no_root_squash)
前面是路径(路径中的 rootfs_TQ3358_linux_nfs 这个目录名要和前面解压后得到的目录名相同),后面是配置。



然后使用命令/etc/init.d/nfs-kernel-server start 启动 nfs 服务器,可以自己挂载自己试试:mount -t nfs192.168.1.7:/opt/EmbedSky/TQ3358/rootfs_TQ3358_linux_nfs aaa , 挂 载 成 功 后 aaa 目 录 下 的 内 容 和
/opt/EmbedSky/TQ3358/rootfs_TQ3358_linux_nfs 的内容相同,操作如下所示:


设置NFS参数:
为了讲解的连贯性将命令 1~4 都贴出来了,
实际操作时设置何种类型就用对应命令+s 保存即可。
#####
Boot for TQ3358 Main Menu
#####
#####
EmbedSky SD download mode
#####
[1] Download u-boot.img to Nand Flash
[2] Download MLO to Nand Flash
[3] Download Linux Kernel (uImage.bin) to Nand Flash
[4] Download LOGO Picture (logo.bin) to Nand Flash
[5] Download UBIFS image (root.bin) to Nand Flash
[6] Download YAFFS image (root.bin) to Nand Flash
[7] Download Program to SDRAM and Run it
[8] Boot the system
[9] Format the Nand Flash
[0] Set the boot parameters
[a] Download User Program
[n] Enter TFTP download mode menu
[r] Reboot u-boot
[t] Test kernel Image (uImage)
Enter your selection: 0
#进入参数设置界面
##### Parameter Menu #####
[1] Set NFS boot parameter
[2] Set Yaffs boot parameter for Android or Standard Linux
[3] Set UBIfs boot parameter for Android or Standard Linux
[4] Set EXT4fs boot parameter for Android or Standard Linux
[5] Set boot parameter
[c] Choice lcd type.
[d] select driver and init
Save the parameters to Nand Flash
[q] Return main Menu
Enter your selection: 1
#设置 Linux 启动时挂载 NFS 文件系统的启动参数
Enter the NFS Server(PC) IP address:(xxx.xxx.xxx.xxx)
192.168.1.32
#设置存放有 NFS 文件系统的 PC 的 IP
Enter the TQ3358 IP address:(xxx.xxx.xxx.xxx)
192.168.1.33
#设置板子挂载 NFS 时的 IPEnter the Mask IP address:(xxx.xxx.xxx.xxx)
255.255.255.0
#设置板子挂载 NFS 时的掩码
Enter NFS directory:(eg: /opt/EmbedSky/root_nfs)
/opt/EmbedSky/TQ3358/rootfs_TQ3358_linux_nfs
#设置 NFS 在 PC 中的路径
bootargs=console=ttyO0,115200n8 androidboot.console=ttySAC0 nfsroot=192.168.1.32:/opt/EmbedSky/TQ3358/rootfs_TQ3358_linux_nfs rootwait=1 ip=192.168.1.33:192.168.1.32:192.168.1.33:255.255.255.0:www.embedsky.net:eth0:off

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-6-17 17:51 , Processed in 1.062500 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表