标签:powerpc freescale linux nfs p1010
继PowerPC平台 Linux移植二,实现单板挂载nfs网络文件系统。
1.ubuntu安装 配置 启动nfs服务
详细过程见 http://blog.csdn.net/u010216127/article/details/8825735
=> nfs 0x3000000 10.3.56.9:/home/freescale/work/nfs_root/hello
Speed: 100, full duplex
Using eTSEC2 device
File transfer via NFS from server 10.3.56.9; our IP address is 10.3.56.242
Filename ‘/home/freescale/work/nfs_root/hello‘.
Load address: 0x3000000
Loading: ##T T *** ERROR: Cannot umount
解决方法:
要在主机的/etc/hosts文件中加入
你的开发板ip nfs目录(Ubuntu),eg
10.3.56.242 /home/freescale/work/nfs_root
=> nfs 0x3000000 10.3.56.9:/home/freescale/work/nfs_root/hello
Speed: 100, full duplex
Using eTSEC2 device
File transfer via NFS from server 10.3.56.9; our IP address is 10.3.56.242
Filename ‘/home/freescale/work/nfs_root/hello‘.
Load address: 0x3000000
Loading: ##
done
Bytes transferred = 7920 (1ef0 hex)
=>
2.烧写uImage dtb
=> setenv ethact eTSEC2
=> tftp 0x1000000 uImage
Speed: 100, full duplex
Using eTSEC2 device
TFTP from server 192.168.2.242; our IP address is 192.168.2.21
Filename ‘uImage‘.
Load address: 0x1000000
Loading: #################################################################
#################################################################
#################################################################
####
done
Bytes transferred = 2907800 (2c5e98 hex)
=> erase 0xee080000 0xee37ffff
........................ done
Erased 24 sectors
=> cp.b 0x1000000 0xee080000 0x300000
Copy to Flash... 9....8....7....6....5....4....3....2....1....done
=> md 0xee080000
ee080000: 27051956 2899922f 55640aa4 002c5e58 ‘..V(../Ud...,^X
ee080010: 00000000 00000000 06436151 05070201 .........CaQ....
ee080020: 4c696e75 782d322e 362e3335 00000000 Linux-2.6.35....
烧写 dtb
=> tftp 0xc00000 p1010rdb.dtb
Speed: 100, full duplex
Using eTSEC2 device
TFTP from server 192.168.2.242; our IP address is 192.168.2.21
Filename ‘p1010rdb.dtb‘.
Load address: 0xc00000
Loading: #
done
Bytes transferred = 11988 (2ed4 hex)
=> erase 0xee040000 0xee07ffff
.. done
Erased 2 sectors
=> cp.b 0xc00000 0xee040000 0x40000
Copy to Flash... 9....8....7....6....5....4....3....2....1....done
=> md 0xee040000
ee040000: d00dfeed 00002ed4 00000038 00002778 ...........8..‘x
ee040010: 00000028 00000011 00000010 00000000 ...(............
ee040020: 0000035c 00002740 00000000 00000000 ...\..‘@........
ee040030: 00000000 00000000 00000001 00000000 ................
ee040040: 00000003 0000000a 00000000 66736c2c ............fsl,
ee040050: 50313031 30000000 00000003 0000000d P1010...........
ee040060: 00000006 66736c2c 50313031 30524442 ....fsl,P1010RDB
3.实现nfs挂载文件系统
setenv nfsargs ‘setenv bootargs root=/dev/nfs rw nfsroot=10.3.56.9:/home/freescale/work/source/fs_mini nolock ip=10.3.56.242:10.3.56.9:10.3.57.255:255.255.0.0::eth1:off init=/linuxrc console=ttyS0,115200‘
setenv bootcmd ‘run nfsargs; bootm 1000000 - c00000‘
=> setenv bootargs root=/dev/nfs nfsroot=10.3.56.9:/home/freescale/work/source/fs_mini nolock ip=10.3.56.242:10.3.56.9:10.3.57.255:255.255.0.0::eth1:off init=/linuxrc \
> console=ttyS0,115200
ALSA device list:
No soundcards found.
IPv4 over IPv4 tunneling driver
GRE over IPv4 tunneling driver
TCP cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
NET: Registered protocol family 15
turn off boot console udbg0
出现这个halt是因为$consoledev is not set,重新修改参数即可
=> setenv ethact eTSEC2
=> setenv nfsargs ‘setenv bootargs root=/dev/nfs nfsroot=10.3.56.9:/home/freescale/work/source/fs_mini nolock ip=10.3.56.242:10.3.56.9:10.3.57.255:255.255.0.0::eth1:off \
> init=/linuxrc console=ttyS0,115200‘
=> setenv bootcmd ‘run nfsargs; bootm 1000000 - c00000‘
=> tftp 0x1000000 uImage
Speed: 100, full duplex
Using eTSEC2 device
TFTP from server 192.168.2.242; our IP address is 192.168.2.21
Filename ‘uImage‘.
Load address: 0x1000000
Loading: #################################################################
#################################################################
#################################################################
########
done
Bytes transferred = 2969010 (2d4db2 hex)
=> tftp 0xc00000 p1010rdb.dtb
Speed: 100, full duplex
Using eTSEC2 device
TFTP from server 192.168.2.242; our IP address is 192.168.2.21
Filename ‘p1010rdb.dtb‘.
Load address: 0xc00000
Loading: #
done
Bytes transferred = 11988 (2ed4 hex)
=> setenv ipaddr 10.3.56.242
=> set serverip 10.3.56.9
Unknown command ‘set‘ - try ‘help‘
=> setenv serverip 10.3.56.9
=> ping $serverip
Speed: 100, full duplex
Using eTSEC2 device
host 10.3.56.9 is alive
=> boot
........
NET: Registered protocol family 17
NET: Registered protocol family 15
eth1: attached PHY driver [Generic PHY] (mii_bus:phy_addr=mdio@ffe24000:06, id=4dd074)
IP-Config: Complete:
device=eth1, addr=10.3.56.242, mask=255.255.0.0, gw=10.3.57.255,
host=10.3.56.242, domain=, nis-domain=(none),
bootserver=10.3.56.9, rootserver=10.3.56.9, rootpath=
Looking up port of RPC 100003/2 on 10.3.56.9
Looking up port of RPC 100005/1 on 10.3.56.9
VFS: Mounted root (nfs filesystem) readonly on device 0:15.
devtmpfs: mounted
Freeing unused kernel memory: 212k init
nfs: server 10.3.56.9 not responding, still trying
4.继续修改文件系统
原因是挂载系统时改变了开发板的ip,修改Ip即可。
eth1: attached PHY driver [Generic PHY] (mii_bus:phy_addr=mdio@ffe24000:06, id=4dd074)
IP-Config: Complete:
device=eth1, addr=10.3.56.242, mask=255.255.0.0, gw=10.3.57.255,
host=10.3.56.242, domain=, nis-domain=(none),
bootserver=10.3.56.9, rootserver=10.3.56.9, rootpath=
Looking up port of RPC 100003/2 on 10.3.56.9
Looking up port of RPC 100005/1 on 10.3.56.9
VFS: Mounted root (nfs filesystem) readonly on device 0:15.
devtmpfs: mounted
Freeing unused kernel memory: 212k init
can‘t open /dev/ttySAC0: No such file or directory
can‘t open /dev/ttySAC0: No such file or directory
can‘t open /dev/ttySAC0: No such file or directory
can‘t open /dev/ttySAC0: No such file or directory
can‘t open /dev/ttySAC0: No such file or directory
can‘t open /dev/ttySAC0: No such file or directory
5.继续修改文件系统
修改inittab文件
ttyS0::askfirst:-/bin/sh
6.最终成功挂载
eth1: attached PHY driver [Generic PHY] (mii_bus:phy_addr=mdio@ffe24000:06, id=4dd074)
IP-Config: Complete:
device=eth1, addr=10.3.56.242, mask=255.255.0.0, gw=10.3.57.255,
host=10.3.56.242, domain=, nis-domain=(none),
bootserver=10.3.56.9, rootserver=10.3.56.9, rootpath=
Looking up port of RPC 100003/2 on 10.3.56.9
Looking up port of RPC 100005/1 on 10.3.56.9
VFS: Mounted root (nfs filesystem) readonly on device 0:15.
devtmpfs: mounted
Freeing unused kernel memory: 212k init
Please press Enter to activate this console.
# ls
bin etc linuxrc proc sbin tmp
dev lib mnt root sys usr
#
7.解决只读文件系统
# mkdir test1
mkdir: cannot create directory ‘test1‘: Read-only file system
# ls
bin etc linuxrc proc sbin test usr
dev lib mnt root sys tmp
# mount
rootfs on / type rootfs (rw)
/dev/root on / type nfs (ro,relatime,vers=2,rsize=4096,wsize=4096,namlen=255,hard,nolock,proto=udp,port=65535,timeo=11,retrans=3,sec=sys,mountport=65535,mountproto=,addr=10.3.56.9)
devtmpfs on /dev type devtmpfs (rw,relatime,size=516660k,nr_inodes=129165,mode=755)
proc on /proc type proc (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime)
然后就是挂载nfs目录后只读不可写问题了,折腾半天,
后面发现是要求UID,GID与服务器一致
于是在服务器上用id命令一查
# id
uid=0 gid=0
# id
uid=0 gid=0
#
修改/etc/exports 文件
/home/freescale/work/source/fs_mini *(rw,sync,no_root_squash,anonuid=0,anongid=0)
sudo service nfs-kernel-server restart
setenv nfsargs ‘setenv bootargs root=/dev/nfs rw nfsroot=10.3.56.9:/home/freescale/work/source/fs_mini nolock ip=10.3.56.242:10.3.56.9:10.3.57.255:255.255.0.0::eth1:off init=/linuxrc console=ttyS0,115200‘
setenv bootcmd ‘run nfsargs; bootm 1000000 - c00000‘
8.重新挂载nfs文件系统,读写正常
# mkdir test1
# ls
bin etc linuxrc proc sbin test tmp
dev lib mnt root sys test1 usr
# rmdir test1
# ls
bin etc linuxrc proc sbin test usr
dev lib mnt root sys tmp
# ping 10.3.56.9
PING 10.3.56.9 (10.3.56.9): 56 data bytes
64 bytes from 10.3.56.9: seq=0 ttl=64 time=1.042 ms
64 bytes from 10.3.56.9: seq=1 ttl=64 time=0.429 ms
^C
--- 10.3.56.9 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.429/0.735/1.042 ms
#
标签:powerpc freescale linux nfs p1010
原文地址:http://blog.csdn.net/u010216127/article/details/46051041