title: NFS mounting while booting Linux kernel on BeagleBone
body: <p>I am trying to mount NFS while booting my beaglebone board.
  I use ethernet over usb on board. 
  I have done this steps:</p>
  
  <ol>
  <li>Setup uboot settings:</li>
  </ol>
  
  <pre><code>=&gt; env default -f -a
  =&gt; setenv ipaddr 192.168.0.100
  =&gt; setenv serverip 192.168.0.1
  =&gt; setenv ethact usb_ether
  =&gt; setenv usbnet_devaddr f8:dc:7a:00:00:02
  =&gt; setenv usbnet_hostaddr f8:dc:7a:00:00:01
  =&gt; setenv bootcmd 'tftp 0x81000000 zImage; tftp 0x82000000 am335x-boneblack.dtb; bootz 0x81000000 - 0x82000000'
  =&gt; saveenv
  </code></pre>
  
  <ol start="2">
  <li>Setup interface on workstation:</li>
  </ol>
  
  <pre><code>nmcli con add type ethernet ifname enxf8dc7a000001 ip4 192.168.0.1/24
  </code></pre>
  
  <ol start="3">
  <li>Setup <code>/etc/exports</code> file on workstation:</li>
  </ol>
  
  <pre><code>/home/anisyan/proj/learn-embedded-linux/linux-kernel-labs/modules/nfsroot/ 192.168.0.100(rw,no_root_squash,no_subtree_check)
  </code></pre>
  
  <ol start="4">
  <li>Try ping the host from uboot (It's alive):</li>
  </ol>
  
  <pre><code>=&gt; ping 192.168.0.1
  using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
  MAC f8:dc:7a:00:00:02
  HOST MAC f8:dc:7a:00:00:01
  RNDIS ready
  musb-hdrc: peripheral reset irq lost!
  high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
  USB RNDIS network up!
  Using usb_ether device
  host 192.168.0.1 is alive
  </code></pre>
  
  <p>But I can't use <code>nfs</code> command in uboot. It generates the error:</p>
  
  <pre><code>=&gt; nfs
  
  Warning: usb_ether using MAC address from ROM
  using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
  MAC f8:dc:7a:00:00:02
  HOST MAC f8:dc:7a:00:00:01
  RNDIS ready
  musb-hdrc: peripheral reset irq lost!
  high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
  USB RNDIS network up!
  Using usb_ether device
  File transfer via NFS from server 192.168.0.1; our IP address is 192.168.0.100
  Filename 'zImage/�zImage'.
  Load address: 0x82000000
  Loading: *** ERROR: Cannot mount
  </code></pre>
  
  <ol start="5">
  <li>setup kernel bootargs:</li>
  </ol>
  
  <pre><code>setenv bootargs root=/dev/nfs rw ip=192.168.0.100:::::usb0 console=ttyO0,115200n8 g_ether.dev_addr=f8:dc:7a:00:00:02 g_ether.host_addr=f8:dc:7a:00:00:01 nfsroot=192.168.0.1:/home/anisyan/proj/learn-embedded-linux/linux-kernel-labs/modules/nfsroot/ ,nfsvers=3
  </code></pre>
  
  <p>And my kernel generates the error while mounting FS:</p>
  
  <pre><code>------
  [    2.545318] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
  [    2.570464] hctosys: unable to open rtc device (rtc0)
  [  111.202637] VFS: Unable to mount root fs via NFS, trying floppy.
  [  111.209241] VFS: Cannot open root device "nfs" or unknown-block(2,0): error -6
  [  111.216571] Please append a correct "root=" boot option; here are the available partitions:
  [  111.225000] 0100           65536 ram0 
  [  111.225004]  (driver?)
  [  111.231133] 0101           65536 ram1 
  [  111.231135]  (driver?)
  [  111.237282] 0102           65536 ram2 
  [  111.237284]  (driver?)
  [  111.243425] 0103           65536 ram3 
  [  111.243427]  (driver?)
  [  111.249552] 0104           65536 ram4 
  [  111.249554]  (driver?)
  [  111.255696] 0105           65536 ram5 
  [  111.255698]  (driver?)
  [  111.261823] 0106           65536 ram6 
  [  111.261825]  (driver?)
  [  111.267966] 0107           65536 ram7 
  [  111.267968]  (driver?)
  [  111.274107] 0108           65536 ram8 
  [  111.274110]  (driver?)
  [  111.280236] 0109           65536 ram9 
  [  111.280239]  (driver?)
  [  111.286389] 010a           65536 ram10 
  [  111.286392]  (driver?)
  [  111.292620] 010b           65536 ram11 
  [  111.292622]  (driver?)
  [  111.298834] 010c           65536 ram12 
  [  111.298836]  (driver?)
  [  111.305064] 010d           65536 ram13 
  [  111.305066]  (driver?)
  [  111.311277] 010e           65536 ram14 
  [  111.311280]  (driver?)
  [  111.317507] 010f           65536 ram15 
  [  111.317510]  (driver?)
  [  111.323745] b300        15267840 mmcblk0 
  [  111.323749]  driver: mmcblk
  [  111.330574]   b301          101376 mmcblk0p1 614bbe6e-01
  [  111.330577] 
  [  111.337416]   b302        15164416 mmcblk0p2 614bbe6e-02
  [  111.337418] 
  [  111.344260] b310         3735552 mmcblk1 
  [  111.344262]  driver: mmcblk
  [  111.351084]   b311         3731456 mmcblk1p1 18ac3061-01
  [  111.351086] 
  [  111.357929] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
  [  111.366232] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.5.0-rc6 #1
  [  111.372435] Hardware name: Generic AM33XX (Flattened Device Tree)
  [  111.378595] [&lt;c03128b4&gt;] (unwind_backtrace) from [&lt;c030cb64&gt;] (show_stack+0x10/0x14)
  [  111.386385] [&lt;c030cb64&gt;] (show_stack) from [&lt;c0eeaf70&gt;] (dump_stack+0xc0/0xd4)
  [  111.393651] [&lt;c0eeaf70&gt;] (dump_stack) from [&lt;c0347d90&gt;] (panic+0x110/0x328)
  [  111.400654] [&lt;c0347d90&gt;] (panic) from [&lt;c1601484&gt;] (mount_block_root+0x184/0x234)
  [  111.408173] [&lt;c1601484&gt;] (mount_block_root) from [&lt;c160179c&gt;] (mount_root+0x124/0x140)
  [  111.416124] [&lt;c160179c&gt;] (mount_root) from [&lt;c1601934&gt;] (prepare_namespace+0x17c/0x1b8)
  [  111.424167] [&lt;c1601934&gt;] (prepare_namespace) from [&lt;c0f02c3c&gt;] (kernel_init+0x8/0x10c)
  [  111.432122] [&lt;c0f02c3c&gt;] (kernel_init) from [&lt;c03010e8&gt;] (ret_from_fork+0x14/0x2c)
  [  111.439721] Exception stack(0xdb0b1fb0 to 0xdb0b1ff8)
  [  111.444794] 1fa0:                                     00000000 00000000 00000000 00000000
  [  111.453007] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  [  111.461218] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
  [  111.467876] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0) ]---
  </code></pre>
  
  <p>Could anyone help me please with it?</p>
  
  <p><strong>UPD:</strong>
  I can mount NFS from uboot console(just for network test) with help</p>
  
  <pre><code>=&gt; nfs 0x81000000 192.168.0.1:/mnt/share/file
  </code></pre>
  
  <p>Then I downloaded my kernel image and DTB with help TFTP and run <code>boot</code> from uboot.</p>
  
  <p>I have thought that the kernel should setup eternet-over-usb device and then mount nfs. I added this flags to kernek config for it:</p>
  
  <pre><code>CONFIG_USB_GADGET=y
  CONFIG_USB_MUSB_HDRC=y
  CONFIG_USB_MUSB_GADGET=y
  CONFIG_USB_MUSB_DSPS=y
  CONFIG_AM335X_PHY_USB=y
  CONFIG_USB_ETH=y
  CONFIG_ROOT_NFS=y 
  </code></pre>
  
  <p>But I still get error during booting.</p>