在通过nfs启动文件系统过程中会遇到下面的问题,记录下来防止忘掉
[ 100.338146] VFS: Unable to mount root fs via NFS, trying floppy.
[ 100.345728] VFS: Cannot open root device "nfs" or unknown-block(2,0): error -6
[ 100.353202] Please append a correct "root=" boot option; here are the available partitions:
u-boot配置
bootargs=console=ttyO0,115200n8 root=/dev/nfs nfsroot=192.168.2.4:/home/server/nfs/rootfs,nolock rw ip=192.168.2.5
问题描述是没有挂载成功,所以到内核源码根目录
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
打开配置菜单查看是否启动了NFS启动项如下图
发现NFS选项是开着的,如果没开按图片选择打开,主机的nfs服务也是开着的配置也都正确,也可以mount上,如果没有配置按照下下面的方法配置
https://www.cnblogs.com/pipci/p/9935572.html
但是还是不能正常启动系统,所以问题关键应该不是在配置问题,因为我用的debian9服务器,网上说debian9的nfs挂载有不兼容,所以将bootargs改成指定NFSv4
set bootargs console=ttyO0,115200n8 root=/dev/nfs nfsroot=192.168.2.4:/home/server/nfs/rootfs,nolock,proto=tcp,nfsvers=4 rw ip=192.168.2.5
成功
## Flattened Device Tree blob at 80000000
Booting using the fdt blob at 0x80000000
Loading Device Tree to 8fff4000, end 8ffff7dd ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.19.3 (server@debian) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 79
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: TI AM335x BeagleBone Black
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] cma: Reserved 16 MiB at 0x9e800000
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] AM335X ES2.1 (sgx neon)
[ 0.000000] random: get_random_bytes called from start_kernel+0x8c/0x498 with crng_init=0
[ 0.000000] percpu: Embedded 18 pages/cpu @(ptrval) s42088 r8192 d23448 u73728
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129412
[ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/nfs nfsroot=192.168.2.4:/home/server/nfs/rootfs,nolock,proto=tcp