-1

My first time working on the Uboot and Serial Port. I am trying to mount my /nfsroot from my ubuntu host to the wandboard target so that I can boot up the board with TFTP in Kernel and NFS as rootfs.

Been getting error here and there and do not know what they mean.

Please advice.

This is the complete Error Log with root=/dev/nfs

This is the error I have when I try to mount the nfs to one of my SDCard's partition (mmcblk2p2). root=/dev/mmcblk2p2

It mounted but then devtmpfs return error mounting -2.

EXT3-fs (mmcblk2p2): error: couldn't mount because of unsupported optional features (240)
EXT2-fs (mmcblk2p2): error: couldn't mount because of unsupported optional features (244)
EXT4-fs (mmcblk2p2): recovery complete
EXT4-fs (mmcblk2p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:2.
devtmpfs: error mounting -2
Freeing unused kernel memory: 328K (80d22000 - 80d74000)
Failed to execute /sbin/init (error -2).  Attempting defaults...
Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
CPU1: stopping

And this is my printenv

=> printenv
baudrate=115200
boot_fdt=try
bootargs=console=ttymxc0,115200 root=/dev/mmcblk0p2 rw nfsroot=192.168.0.227:/nfsroot,v3,tcp
bootcmd=mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi
bootdelay=5
bootfile=zImage-wandboard-quad.bin
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc0
ethact=FEC
ethaddr=00:1f:7b:b4:14:ce
ethprime=FEC
fdt_addr=0x18000000
fdt_file=zImage-imx6q-wandboard.dtb
fdt_high=0xffffffff
get_cmd=dhcp
image=zImage-wandboard-quad.bin
initrd_high=0xffffffff
ip_dyn=yes
loadaddr=0x12000000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}; run videoargs
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; e;
mmcdev=0
mmcpart=1
mmcroot=/dev/mmcblk2p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} ${smp} root=/dev/mmcblk2p2 rw ip={ipaddr} nfsroot=${serverip}:${nfsroot},v3,tcp init=/sbin/init
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; th;
nfsroot=/nfsroot
script=boot.scr
serverip=192.168.0.227
splashpos=m,m
update_sd_firmware=if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; if mmc dev ${mmcdev}; then if ${get_cmd} ${update_sd_firmware_filename}; then setexpr fw_sz ${filesize} /i
update_sd_firmware_filename=u-boot.imx
videoargs=setenv nextcon 0; if hdmidet; then setenv bootargs ${bootargs} video=mxcfb${nextcon}:dev=hdmi,1280x720M@60,if=RGB24; setenv fbmen fbmem=28M; setexpr nextcon ${nextcon} + 1; else echo - no HDMI mo}

Environment size: 2810/8188 bytes
Charles C.
  • 3,725
  • 4
  • 28
  • 50
  • Can you put your full bootlog, or atleast kernel commandline parameters. – ART Jan 18 '16 at 05:58
  • I have updated the the boot log, thanks. https://docs.google.com/document/d/1LNYQEbWb9ZGuy1UJHVeLmKTZT2uYlZCEPOV30Az7bWk/edit?usp=sharing. Thanks – Charles C. Jan 22 '16 at 23:03
  • 1
    Your boot log indicates that (1) the kernel command line does not properly specify (for early initialization) the network interface required for a NFS rootfs, (2) the `nfsroot=` parameter is malformed (the server IP address appears twice?), and (3) no network interface (e.g. eth0) has been initialized by the kernel prior to mounting a rootfs. You seem to have an empty `ip=` parameter in the command line. Try a proper parameter per the [documentation](http://lxr.free-electrons.com/source/Documentation/filesystems/nfs/nfsroot.txt), something like `ip=192.168.0.99,192.168.0.227::::eth0:on` – sawdust Jan 23 '16 at 21:13
  • @sawdust thank you, I have got the machine to mount the /nfsroot, However, segmentation fault comes up when I try to run Qt program, do you know what is going on? – Charles C. Jan 25 '16 at 18:20

2 Answers2

0

On the host (Ubuntu):

  • sudo apt-get install nfs-kernel-server
  • sudo mkdir /nfsroot
  • Add the /nfsroot directory to the /etc/exports file:

    /nfsroot    *(rw,sync,no_root_squash)
    
  • sudo /etc/init.d/nfs-common start or sudo /etc/init.d/nfs-kernel-server start

On the target (Wandboard):

  • Root filesystem on NFS must have been enabled when compiling the kernel (hopefully, it was, otherwise you'll need to recompile the Linux kernel)
  • Add root=/dev/nfs rw ip=target_IP nfsroot=NFS_server_IP>:/nfsroot/ to U-Boot's bootargs variable, where target_IP is the static IP address for the target and NFS_server_IP is the host IP address.
Claudio
  • 10,614
  • 4
  • 31
  • 71
  • I have followed all those instructions but NFS still does not work. Root cannot find the drive for `root=/dev/nfs` so I change to mmcblk2p2 (ext4 partition from the sd card). I checked the Kernel recipe and found that `CONFIG_NFS_FS=y` `CONFIG_NFS_V3_ACL=y` `CONFIG_NFS_V4=y` and `CONFIG_ROOT_NFS=y`, so pretty sure it has NFS support on the kernel. – Charles C. Jan 12 '16 at 17:29
0

It turns out that I need to set the client IP parameter after I got the IP from DHCP. I thought that DHCP will handle all the IP configuration for the netboot arguments but I was wrong;

setenv ip 192.168.0.172:192.168.0.227::::eth0:on

setenv ipaddr 192.168.0.172

setenv netargs 'setenv bootargs console=${console},${baudrate} ${smp} root=/dev/nfs ip=${ipaddr} nfsroot=${serverip}:${nfsroot},v3,tcp'

Charles C.
  • 3,725
  • 4
  • 28
  • 50