Mastering-Embedded-Linux-Programming-Second-Edition
Mastering-Embedded-Linux-Programming-Second-Edition copied to clipboard
Issue mounting rootfs via NFS
I have this issue for QEMU (Chapter Testing with QEMU) and BBB (Testing with the BeagleBone Black) . I am able to start the kernel but I don't get access to a command prompt to actually test things out. This is the last output on QEMU
IP-Config: Guessing netmask 255.255.255.0
IP-Config: Complete:
device=eth0, hwaddr=52:54:00:12:34:56, ipaddr=192.168.1.101, mask=255.255.255.0, gw=255.255.255.255
host=192.168.1.101, domain=, nis-domain=(none)
bootserver=255.255.255.255, rootserver=192.168.1.1, rootpath=
random: fast init done
This is the last output on the beagle bone black (similar)
[ 7.937753] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 7.967759] IP-Config: Guessing netmask 255.255.255.0
[ 7.972854] IP-Config: Complete:
[ 7.976107] device=eth0, hwaddr=64:33:db:2a:38:9c, ipaddr=192.168.1.101, mask=255.255.255.0, gw=255.255.255.255
[ 7.986738] host=192.168.1.101, domain=, nis-domain=(none)
do I need to pass a special flag to the commands to get access to a shell prompt?
UPDATE: Actually, the eventually there is output the BBB
[ 7.992715] bootserver=255.255.255.255, rootserver=192.168.1.1, rootpath=
[ 474.087947] VFS: Unable to mount root fs via NFS.
[ 474.100304] devtmpfs: mounted
[ 474.113848] Freeing unused kernel memory: 2048K
[ 474.128613] Run /sbin/init as init process
[ 474.133092] Run /etc/init as init process
[ 474.137276] Run /bin/init as init process
[ 474.141878] Run /bin/sh as init process
[ 474.146088] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
Similar error in QEMU. I guess something is not working yet. The rootpath appears to be empty as well
UPDATE2: I rechecked the steps in the previous chapter again, making sure that nfs-kernel-server
is running as well. I still get the same issues that mounting fails with VFS: Unable to mount root fs via NFS.
..
I was able to solve the issue for QEMU by adding the v3
option to the nfsroot
argument, so the QEMU commands looks like this:
QEMU_AUDIO_DRV=none \
qemu-system-arm -m 256M -nographic -M versatilepb -kernel \
${KERNEL} -append "console=ttyAMA0,115200 root=/dev/nfs rw \
nfsroot=${HOST_IP}:${ROOTDIR},v3 ip=${TARGET_IP}" -dtb ${DTB} -net \
nic -net tap,ifname=tap0,script=no
Maybe the issue is that version 4 is used by default and the exports
file needs to look different but I am not entirely sure.
The solution was taken from here .
I still have the issue with the BeagleBoneBlack, even when passing v3
as an option
Alright, I was able to mount via NFS in the beagle bone black as well, but I used DHCP and other commands.
Those are the commands I used, assuming the host IP address is known (can be tested with ping <hostIp>
in U-Boot) :
dhcp
setenv serverip <hostIp>
setenv npath <pathToRootfsOnHost>
setenv bootargs console=ttyO0,115200n8 root=/dev/nfs rw nfsroot=${serverip}:${npath},v3 ip=dhcp
fatload mmc 0:1 0x80200000 zImage
fatload mmc 0:1 0x80f00000 am335x-boneblack.dtb
bootz 0x80200000 - 0x80f00000