S3C2440 nfs 文件系统启动构建

上次刚把cs8900驱动移植好,笔者迫不及待的开始nfs启动的构建,参考网上的文章,经过昨晚的努力(一点多才睡),终于差不多了,现环顾走过的路程,记录如下。

#sudo apt-get install nfs-kernel-server

打开/etc/exports文件,在末尾加入:

/home/sxbg/NFS/rootfs *(rw,sync,no_root_squash)

注:nfs允许挂载的目录及权限,在文件/etc/exports中进行定义,各字段含义如下:

/home/sxbg/NFS/rootfs:要共享的目录

* :允许所有的网段访问

rw :读写权限

sync:资料同步写入内在和硬盘

no_root_squash:nfs客户端共享目录使用者权限

重启服务:
#sudo /etc/init.d/portmap restart                  <---重启portmap,
#sudo /etc/init.d/nfs-kernel-server restart      <---重启nfs服务
#showmount -e                                          <---显示共享出的目录

注:nfs是一个RPC程序,使用它前,需要映射好端口,通过portmap设定

配置内核开启nfs服务(默认配置是开启的)

    File systems  --->

[*] Network File Systems  ---> 

--- Network File Systems                                                              
                 <*>   NFS client support                                                              
                  [*]     NFS client support for NFS version 3                                          
                  [*]       NFS client support for the NFSv3 ACL protocol extension                      
                   [*]     NFS client support for NFS version 4 (EXPERIMENTAL)                            
                   [ ]       NFS client support for NFSv4.1 (DEVELOPER ONLY)                              
                  [*]     Root file system on NFS                                                        
                 < >   NFS server support                                                              
                 -*-   Secure RPC: Kerberos V mechanism (EXPERIMENTAL)                                  
                < >   Secure RPC: SPKM3 mechanism (EXPERIMENTAL)                                        
                 < >   SMB file system support (OBSOLETE, please use CIFS)                              
                 < >   CIFS support (advanced network filesystem, SMBFS successor)                      
                 < >   NCP file system support (to mount NetWare volumes)                              
                 < >   Coda file system support (advanced network fs)                                    
                  < >   Andrew File System support (AFS) (EXPERIMENTAL)

  然后

make zImage -j3 #多线程编译                                                

先配置好开发板的ip,现在可以在本机上试一下:
#sudo mount -t nfs localhost:/home/sxbg/NFS/rootfs  /mnt

注:localhost为本机linux的IP地址

这样就把共享目录挂到了/mnt目录,取消挂载用:
#sudo umount /mnt

如果用在嵌入式设备上挂载,要加上参数-o nolock

我在开发板上使用的挂载命令:

mount -t nfs -o nolock 192.168.0.105:/home/sxbg/NFS/rootfs    /mnt

正常的话进入mnt可以看到PC机共享的文件内容

接下来我们实现启动自动挂载。

设置uboot引导参数

"noinitrd console=ttySAC0 root=/dev/nfs nfsroot=192.168.0.105:

/home/sxbg/NFS/rootfs  ip=192.168.0.100:192.168.0.105:

192.168.0.1:255.255.255.0:fz2440.arm9.net:eth0:off"

其中 ,param set linux_cmd_line 是设置启动 linux 时的命令参数。其各参数的含义

如下:

nfsroot 是自己开发主机的IP 地址。

“ip=”后面:

第一项(192.168.0.100)是目标板的临时IP(注意不要和局域网内其他IP 冲突);

第二项(192.168.0.105)是开发主机的IP;

第三项(192.168.1.1)是目标板上网关(GW)的设置;

第四项(255.255.255.0)是子网掩码;

第五项是开发主机的名字(一般无关紧要,可随便填写)

eth0 是网卡设备的名称。

笔者的uboot设置如下[0] Set the boot parameters======》[1] Set NFS boot parameter======》

Enter the PC IP address:(xxx.xxx.xxx.xxx)
192.168.0.105
Enter the GT2440 IP address:(xxx.xxx.xxx.xxx)
192.168.0.100
Enter the Mask IP address:(xxx.xxx.xxx.xxx)
255.255.255.0
Enter NFS directory:(eg: /opt/GTStudio/root_nfs)
/home/sxbg/NFS/rootfs
bootargs: console=ttySAC0 root=/dev/nfs 

nfsroot=192.168.0.105:/home/sxbg/NFS/rootfs 

ip=192.168.0.100:192.168.0.105:192.168.0.100:255.255.255.0

:fz2440.GTStudio.net:eth0:off


===========》[s] Save the parameters to Nand Flash

重启开发板,从PC机的挂载目录启动

Copy linux kernel from 0x00240000 to 0x30008000, size = 0x00200000 ... Copy Kernel to SDRAM done,NOW, Booting Linux......
Uncompressing Linux........................................................................................................................ done, booting the kernel.
Linux version 2.6.32.2 (root@ubuntu) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #4 Tue Apr 23 00:21:28 CST 2013
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: FZ2440 development board
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: console=ttySAC0 root=/dev/nfs nfsroot=192.168.0.105:/home/sxbg/NFS/rootfs ip=192.168.0.100:192.168.0.105:192.168.0.100:255.255.255.0:GT2440.GTStudio.net:eth0:off
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60896KB available (3360K code, 367K data, 132K init, 0K highmem)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
NR_IRQS:85
irq: clearing pending ext status 00000200
irq: clearing subpending status 00000002
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop... 199.47 BogoMIPS (lpj=498688)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 97 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
yaffs Apr 23 2013 00:20:03 Installing. 
msgmni has been set to 119
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 40x15
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=2, 20ns Twrph0=6 60ns, Twrph1=2 20ns
s3c24xx-nand s3c2440-nand: NAND ECC disabled
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
NAND_ECC_NONE selected by board driver. This is not recommended !!
Scanning device for bad blocks
Bad eraseblock 1136 at 0x000008e00000
Bad eraseblock 1262 at 0x000009dc0000
Bad eraseblock 1282 at 0x00000a040000
Bad eraseblock 1842 at 0x00000e640000
Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000080000 : "uboot"
0x000000240000-0x000000440000 : "kernel"
0x000000440000-0x00000ff80000 : "yaffs2"
allocate cs8900 device ok.
Cirrus Logic CS8900A driver for Linux (Modified for fz2440)
debug:[cs8900_probe-491]
debug:[cs8900_probe-500]
debug:[cs8900_probe-506]
eth0: CS8900A rev D at 0xe0000300 irq=53, addr: X: 0:X:3E:X: A
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
cpuidle: using governor ladder
Advanced Linux Sound Architecture Driver Version 1.0.21.
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
S3C24XX_UDA134X SoC Audio driver
UDA134X SoC Audio Codec
asoc: UDA134X <-> s3c24xx-i2s mapping ok
ALSA device list:
  #0: S3C24XX_UDA134X (UDA134X)
TCP cubic registered
NET: Registered protocol family 17
s3c2410-rtc s3c2410-rtc: hctosys: invalid date/time
IP-Config: Complete:
     device=eth0, addr=192.168.0.100, mask=255.255.255.0, gw=192.168.0.100,
     host=GT2440, domain=, nis-domain=GTStudio.net,
     bootserver=192.168.0.105, rootserver=192.168.0.105, rootpath=
Looking up port of RPC 100003/2 on 192.168.0.105
Looking up port of RPC 100005/1 on 192.168.0.105
VFS: Mounted root (nfs filesystem) on device 0:13.
Freeing init memory: 132K
Mount all(/proc,/tmp....)
Now,on nfs ....
Kernel version:linux-2.6.32.2
Support by sxbg(835304205@qq.com)
Date:2013.4.23
***********************************************

Please press Enter to activate this console. 

至此nfs文件系统构建完成。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值