How to Remotely Boot PcDuino From a NFS Server

by Linksprite in Circuits > Linux

2772 Views, 8 Favorites, 0 Comments

How to Remotely Boot PcDuino From a NFS Server

x-directory-nfs-server.png

In cases, we would like pcDuino to boot from a network hosted file
system. In this tutorial, we will explain how to make this happen.

NFS Server

nfs_directory.jpg

We will first set up a NFS server. The following command will be used on a X86 server, and starts with the character ‘#’.
To install NFS server, we type the following command:

#sudo apt-get install nfs-kernel-server

Configure the root directory of the network file system:

#sudo vim /etc/exports

The following is the content:

# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5). # # Example for NFSv2 and NFSv3: # /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check) # # Example for NFSv4: # /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check) # /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check) # /home/pillar/rootfs *(rw,sync,no_root_squash,no_subtree_check)

In the above, we set the directory ‘/home/pillar/rootfs’ as the root directory of the file system.
To make the setting valid, we need to the following:

#sudo /etc/init.d/portmap restart
#sudo /etc/init.d/nfs-kernel-server restart

We can use the following command to show the shared directory:

#showmount -e

To mount the rootfs, we need to copy the pcDuino rootfs file
“pcduino_ubuntu_20131126.img” or new rootfs image to the nfs server, and mount the image to rootfs:

#sudo mount -t ext3 -o loop pcduino_ubuntu_20131126.img  rootfs/

To check the mounted content,

To see photo:

When we reboot the ubuntu nfs server, it will get IP address by DHCP. As
pcDuino replies on the server to boot, we need to configure a static IP address:

#sudo vim rootfs/etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo iface lo inet loopback auto eth0 iface eth0 inet static

Modify Kernel

We need to modify the kernel in two places to support nfs.
1. Uncheck initramfs:

General setup  --->
[ ] Initial RAM filesystem and RAM disk (initramfs/initrd) support

2. Check NSF support:

File systems  --->
[*] Network File Systems ---> [*] Root file system on NFS

After finishing the build process, flash the kernel to the board. We don’t need to flash the rootfs.
We provide a copy of finished kernel. The built kernel can be downloaded at here.

Configure U-boot

uboot_1.jpg
uboot_2.jpg

We also need to configure u-boot to support network boot. After reboot,
the booting information will be displayed on the debug terminal (which is accessed from the debug serial port using a serial USB debug cable):

to see photo:

When the uboot is starting, we need to press any key, and stop the booting. Then we type the following:

>setenv setargs setenv bootargs  root=/dev/nfs ip=192.168.2.7:196.168.2.1:255.255.255.0:::eth0 nfsroot=192.168.2.19:/home/pillar/rootfs console=${console}  init=${init} loglevel=${loglevel}
>saveenv >printenv sun4i#printenv boot_fastboot=fastboot boot_normal=fatload nand 0 0x48000000 uImage; bootm 0x48000000 boot_recovery=nand read 40007800 recovery;boota 40007800 bootcmd=run setargs load_script boot_normal bootdelay=1 console=ttyS0,115200 ethact=emac ethaddr=00:11:22:33:44:55 fastboot_key_value_max=0x8 fastboot_key_value_min=0x2 init=/init load_script=fatload nand 0 43000000 script.bin loglevel=8 mmc_root=/dev/mmcblk0p7 nand_root=/dev/nandd recovery_key_value_max=0x13 recovery_key_value_min=0x10 setargs=setenv bootargs root=/dev/nfs ip=192.168.2.7:196.168.2.1:255.255.255.0:::eth0 nfsroot=192.168.2.19:/home/pillar/rootfs console=ttyS0,115200 init=/init loglevel=8 stderr=serial stdin=serial stdout=serial Environment size: 736/131068 bytes

192.168.2.19 is the IP of the NFS server.
Reboot the board, we can see the board boots from the server:

to see photo

via :

http://learn.linksprite.com/pcduino/pcduino-embedd...