Search code examples
linux-kernelembedded-linuxnfsu-boot

NFS rootfs for Wandboard


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

Solution

  • 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'