boot Mini2440 via NFS

Share files with NFS

NFS stands for Network File System, which allows host PC can share data to mini2440 board and vice versa. It is extremely comfortable when you develop program because you don't need using SD-Card, or FTP way to copy data from host PC to mini2440 board.
NFS will help you make a folder of mini2440 but in your host PC. It means that, you copy file into folder in host PC, the file will immediately exist in mini2440 board.




First, the mini2440 board should be connected to internet switch and PC also connect to that internet switch


On host PC:
Start NFS service on PC
$service nfs-kernel-server start
The PC will reply you a successful message like this


If your PC don't have NFS service already, it will show you some error messages. Then you should install it by this command
$apt-get install nfs-kernel-server

Edit the file exports
$vi /etc/exports

type
/opt 192.168.1.*(rw,no_root_squash)

in which:
/opt is folder on host PC that you want to share to mini2440
192.168.1.* is IP address of mini2440 (find ip address of mini2440 by going to console of mini2440 and type command: ifconfig). In this case, it will allow any access from client owning IP address with 192.162.1.(any number)

$chmod 777 /opt
This will change permission of directory /opt, otherwise, mini2440 can not access this sharing directory

$sudo ufw disable
Disable your firewall

On client mini2440 board
$mount -t nfs 192.168.1.4:/opt /mnt/ -o udp,nolock
in which:
192.168.1.4 is IP address of host PC
/opt is folder in host PC that you want to share to mini2440 board
/mnt is folder in mini2440 board that you want to link to /opt folder on host PC
If there is no error message, then you success. If not, it was something wrong :)

Okay, now you make some files in folder /opt in host PC, for example, make file as name "example" in /opt. Then, go to mini2440's console panel, type
$ls /opt
then it will show file "example" here.
In order to stop sharing by NFS, just simply type command:
$umount -t /mnt/

Boot via NFS

 After setting up and running NFS service, the user can set the NFS as the root file system to boot the board mini2440. By booting via NFS, the board can fully utilize a "big" hard disk because the user can use the host PC's hard disk. This way is widely used in Linux development
First, in host PC, copy the linux Root File System into directory /opt/FriendlyARM/mini2440/root_qtopia. The file system is in compressed file named "root_qtopia-20100108.tar.gz" in CD's document coming with the board mini2440. So, extract the file into /opt/FriendlyARM/mini2440/, you will get something like this:
Go into board mini2440, switch the mini2440 board's boot mode into the "NOR Flash" side, open minicom, got to Supervivi by press [q]
Type command on minicom console:
$param set linux_cmd_line "console=ttySAC0 root=/dev/nfs nfsroot=192.168.1.4:/opt/FriendlyARM/mini2440/root_qtopia ip=192.168.1.230:192.168.1.4:192.168.1.4:255.255.255.0:MINI2440.arm9.net:eth0:off"

192.168.1.4 is an IP of host PC
192.168.1.230 is an IP of board mini2440
/opt/FriendlyARM/mini2440/root_qtopia is directory of Root File System

Boot the board by:
$boot

Okay, now the board will loading linux as normally as the Root File System is stalled in NAND Flash. However, this way will help you could access the file of mini2440 in directory /opt/FriendlyARM/mini2440/root_qtopia (which is located in host PC).

1 comment:

  1. This blog is nice and very informative. I like this blog Please keep it up.

    ReplyDelete