Table of Contents
Boot linux over NFS
The following text describes on how to use NFS for the root filesystem. For the rest of this text 'client' means the diskless system, and 'server' means the NFS server.
NFS server settings
Install nfs pakages.
sudo apt-get install nfs-kernel-server nfs-common
After insert your eMMC or SD card, copy the Root File System.
# The trusty folder is mounted your RFS by SD card. sudo cp -rp /media/$USER/trusty /home/$USER/
Add following line in “/etc/exports”
/home/$USER/trusty *(rw,sync,no_root_squash,no_subtree_check)
Restart NFS service.
sudo service nfs-kernel-server restart
Modify /home/$USER/trusty/etc/network/interfaces
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface, commented out for NFS root #auto eth0 #iface eth0 inet dhcp iface eth0 inet manual
Kernel configuration
To use Ethernet and NFS on initramfs you need to change module to built-in.
C1/C2 kernel configuration
The C1 Ethernet driver was already built-in.
Location:
-> File systems -> Network File Systems <*> NFS client support <*> NFS client support for NFS version 3
U3 kernel configuration
Location:
-> Device Drivers -> Network device support -> USB Network Adapters <*> Multi-purpose USB Networking Framework <*> SMSC LAN95XX based USB 2.0 10/100 ethernet devices
-> File systems -> Network File Systems <*> NFS client support <*> NFS client support for NFS version 3
Then, Update your ODROID's kernel.
Refer to the following links How to kernel update.
NFS Client(ODROIDs) settings
Append following line to the boot argument.
boot=nfs root=/dev/nfs ip=dhcp nfsroot=${rfspath} rw
How to add the boot argument
You should modify boot.ini file or compile to a u-boot script.
e.g. ODROID-C1.
Modify “/media/boot/boot.ini”
setenv rfspath 192.168.0.22:/home/john/trusty setenv bootargs "boot=nfs root=/dev/nfs ip=dhcp nfsroot=${rfspath} rw rootwait ro ${condev} no_console_suspend vdaccfg=0xa000 logo=osd1,loaded,0x7900000,720p,full dmfc=3 cvbsmode=576cvbs hdmimode=${m} m_bpp=${m_bpp} vout=${vout_mode} ${disableuhs}"
Reboot.
sudo reboot
e.g. ODROID-U3.
Copy the existing boot script
cd /media/boot cp boot.txt boot-nfs.txt
Modify boot-nfs.txt.
setenv initrd_high "0xffffffff" setenv fdt_high "0xffffffff" setenv rfspath 192.168.0.22:/home/john/trusty setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x42000000 uInitrd; bootm 0x40008000" setenv bootargs "boot=nfs root=/dev/nfs ip=dhcp nfsroot=${rfspath} console=tty1 console=ttySAC1,115200n8 rootwait mem=2047M" boot
Install uboot-mkimage package.
sudo apt-get install uboot-mkimage
Compile to a u-boot script.
mkimage -T script -A arm -C none -n 'ODROID-U3.Boot NFS-mounted RFS' -d boot-nfs.txt boot-nfs.scr
Copy.
mv boot.scr boot.scr.orig cp boot-nfs.scr boot.scr
Reboot.
sudo reboot.
Nice to have a lot of disk space:
root@odroid:~# df -h Filesystem Size Used Avail Use% Mounted on 192.168.0.22:/home/john/trusty 909G 177G 687G 21% / none 4.0K 0 4.0K 0% /sys/fs/cgroup udev 420M 4.0K 420M 1% /dev tmpfs 425M 4.0K 425M 1% /tmp tmpfs 85M 2.6M 83M 3% /run none 5.0M 0 5.0M 0% /run/lock none 425M 76K 425M 1% /run/shm none 100M 24K 100M 1% /run/user /dev/mmcblk0p1 129M 7.4M 122M 6% /media/boot