在 BeagleBone 上启动 Linux 内核时挂载 NFS
NFS mounting while booting Linux kernel on BeagleBone
我正在尝试在引导我的 beaglebone 开发板时挂载 NFS。
我在船上使用以太网 over usb。
我已经完成了这些步骤:
- 设置uboot设置:
=> env default -f -a
=> setenv ipaddr 192.168.0.100
=> setenv serverip 192.168.0.1
=> setenv ethact usb_ether
=> setenv usbnet_devaddr f8:dc:7a:00:00:02
=> setenv usbnet_hostaddr f8:dc:7a:00:00:01
=> setenv bootcmd 'tftp 0x81000000 zImage; tftp 0x82000000 am335x-boneblack.dtb; bootz 0x81000000 - 0x82000000'
=> saveenv
- 工作站上的设置界面:
nmcli con add type ethernet ifname enxf8dc7a000001 ip4 192.168.0.1/24
- 在工作站上安装
/etc/exports
文件:
/home/anisyan/proj/learn-embedded-linux/linux-kernel-labs/modules/nfsroot/ 192.168.0.100(rw,no_root_squash,no_subtree_check)
- 尝试从 uboot ping 主机(它还活着):
=> 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
但是我不能在uboot中使用nfs
命令。它产生错误:
=> 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
- 设置内核bootargs:
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
我的内核在安装 FS 时产生错误:
------
[ 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] [<c03128b4>] (unwind_backtrace) from [<c030cb64>] (show_stack+0x10/0x14)
[ 111.386385] [<c030cb64>] (show_stack) from [<c0eeaf70>] (dump_stack+0xc0/0xd4)
[ 111.393651] [<c0eeaf70>] (dump_stack) from [<c0347d90>] (panic+0x110/0x328)
[ 111.400654] [<c0347d90>] (panic) from [<c1601484>] (mount_block_root+0x184/0x234)
[ 111.408173] [<c1601484>] (mount_block_root) from [<c160179c>] (mount_root+0x124/0x140)
[ 111.416124] [<c160179c>] (mount_root) from [<c1601934>] (prepare_namespace+0x17c/0x1b8)
[ 111.424167] [<c1601934>] (prepare_namespace) from [<c0f02c3c>] (kernel_init+0x8/0x10c)
[ 111.432122] [<c0f02c3c>] (kernel_init) from [<c03010e8>] (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) ]---
谁能帮我解决一下?
更新:
我可以在 help
的帮助下从 uboot 控制台挂载 NFS(仅用于网络测试)
=> nfs 0x81000000 192.168.0.1:/mnt/share/file
然后我使用 TFTP 和 运行 boot
从 uboot 下载我的内核映像和 DTB。
我认为内核应该设置 eternet-over-usb 设备然后挂载 nfs。我为此将此标志添加到 kernek 配置中:
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
但是我在启动过程中仍然出现错误。
我决定了这个问题:
我不应该手动编辑 .config
文件。我应该只在帮助 make menuconfig
的情况下这样做,因为任何 CONFIG_*
标志都可以有一些依赖项。 make menuconfig
可以解决
我们可以在bootargs中显式指向init
程序:
init=/absolete/path/to/init/program
我正在尝试在引导我的 beaglebone 开发板时挂载 NFS。 我在船上使用以太网 over usb。 我已经完成了这些步骤:
- 设置uboot设置:
=> env default -f -a
=> setenv ipaddr 192.168.0.100
=> setenv serverip 192.168.0.1
=> setenv ethact usb_ether
=> setenv usbnet_devaddr f8:dc:7a:00:00:02
=> setenv usbnet_hostaddr f8:dc:7a:00:00:01
=> setenv bootcmd 'tftp 0x81000000 zImage; tftp 0x82000000 am335x-boneblack.dtb; bootz 0x81000000 - 0x82000000'
=> saveenv
- 工作站上的设置界面:
nmcli con add type ethernet ifname enxf8dc7a000001 ip4 192.168.0.1/24
- 在工作站上安装
/etc/exports
文件:
/home/anisyan/proj/learn-embedded-linux/linux-kernel-labs/modules/nfsroot/ 192.168.0.100(rw,no_root_squash,no_subtree_check)
- 尝试从 uboot ping 主机(它还活着):
=> 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
但是我不能在uboot中使用nfs
命令。它产生错误:
=> 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
- 设置内核bootargs:
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
我的内核在安装 FS 时产生错误:
------
[ 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] [<c03128b4>] (unwind_backtrace) from [<c030cb64>] (show_stack+0x10/0x14)
[ 111.386385] [<c030cb64>] (show_stack) from [<c0eeaf70>] (dump_stack+0xc0/0xd4)
[ 111.393651] [<c0eeaf70>] (dump_stack) from [<c0347d90>] (panic+0x110/0x328)
[ 111.400654] [<c0347d90>] (panic) from [<c1601484>] (mount_block_root+0x184/0x234)
[ 111.408173] [<c1601484>] (mount_block_root) from [<c160179c>] (mount_root+0x124/0x140)
[ 111.416124] [<c160179c>] (mount_root) from [<c1601934>] (prepare_namespace+0x17c/0x1b8)
[ 111.424167] [<c1601934>] (prepare_namespace) from [<c0f02c3c>] (kernel_init+0x8/0x10c)
[ 111.432122] [<c0f02c3c>] (kernel_init) from [<c03010e8>] (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) ]---
谁能帮我解决一下?
更新: 我可以在 help
的帮助下从 uboot 控制台挂载 NFS(仅用于网络测试)=> nfs 0x81000000 192.168.0.1:/mnt/share/file
然后我使用 TFTP 和 运行 boot
从 uboot 下载我的内核映像和 DTB。
我认为内核应该设置 eternet-over-usb 设备然后挂载 nfs。我为此将此标志添加到 kernek 配置中:
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
但是我在启动过程中仍然出现错误。
我决定了这个问题:
我不应该手动编辑
.config
文件。我应该只在帮助make menuconfig
的情况下这样做,因为任何CONFIG_*
标志都可以有一些依赖项。make menuconfig
可以解决我们可以在bootargs中显式指向
init
程序:
init=/absolete/path/to/init/program