Welcome! Log In Create A New Profile

Advanced

NFS client on U-boot , launched on ARM board emulated by QEMU, launched on Debian(WSL)

Posted by Spekkio 
Hi,

I'm trying to follow a training on Linux embedded (https://bootlin.com/doc/training/embedded-linux-qemu/).
I generated the crosstool chain for an ARM target, then I compiled U-boot and a Linux Kernel.
Uboot starts, I can send it the kernel, and the dtb file of the emulated target, by a tftp server.

(the command to start my QEMU :
sudo qemu-system-arm -M vexpress-a9 -m 128M -nographic -kernel u-boot -sd sd.img -nic user,hostfwd=tcp::5022-:22,tftp=.)

I edited the bootargs and bootcmd variables in order to load automaticaly the kernel image and dtb file. It seems it works.
The network is configured by dhcp protocol (and u-boot command so).
The ip address of my target is 10.0.2.15. And the server adress (it's a WSL system with Debian) is 10.0.2.2.
Not sure where dhcp command of u-boot got this address.
The real adress of the WSL system is 172.23.78.41 (I made a command, I don't remember which one, to have also the adress 10.0.2.2)

During this training, I have to create a rootfs for my Linux Kernel. The training want we use a NFS server to handle the rootfs.

The NFS is server is configured so (in /etc/exports):

# /etc/exports: the access control list for filesystems which may be exported
#               to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
#/home/alex/embedded-linux-qemu-labs/tinysystem/nfsroot 172.23.78.42(rw,no_root_squash,no_subtree_check)
#/home/alex/embedded-linux-qemu-labs/tinysystem/nfsroot 127.0.0.1(rw,no_root_squash,no_subtree_check,insecure)
#/home/alex/embedded-linux-qemu-labs/tinysystem/nfsroot *(rw,sync,no_subtree_check)
/home/alex/embedded-linux-qemu-labs/tinysystem/nfsroot 10.0.2.15(rw,sync,no_subtree_check)

(As you can see, i made some tries, before coming ...)


But, I'm not able to reach NSF server from U-boot, I have this error VFS: Unable to mount root fs via NFS.

The current values of bootargs and bootcmd :
bootargs=console=ttyAMA0,115200 root=/dev/nfs ip=10.0.2.15::::::eth0 nfsroot=10.0.2.2:/home/alex/embedded-linux-qemu-labs/tinysystem/nfsroot,nfsvers=3,tcp rw
bootcmd=run distro_bootcmd; tftp 0x61000000 zImage;tftp 0x62000000 vexpress-v2p-ca9.dtb; bootz 0x61000000 - 0x62000000

Not sure if useful, but here the complete printenv values:

arch=arm
baudrate=38400
board=vexpress
board_name=vexpress
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr -q ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
boot_efi_bootmgr=if fdt addr -q ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc1 mmc0 pxe dhcp
bootargs=console=ttyAMA0,115200 root=/dev/nfs ip=10.0.2.15::::::eth0 nfsroot=10.0.2.2:/home/alex/embedded-linux-qemu-labs/tinysystem/nfsroot,nfsvers=3,tcp rw
bootargs_tmp=root=/dev/sda1 rw console=ttyAMA0,38400n8 mem=1024M mtdparts=armflash:1M@0x800000(uboot),7M@0x1000000(kernel),24M@0x2000000(initrd) mmci.fmax=190000 devtmpfs.mount=0 vmalloc=256M
bootcmd=run distro_bootcmd;  tftp 0x61000000 zImage;tftp 0x62000000 vexpress-v2p-ca9.dtb; bootz 0x61000000 - 0x62000000
bootcmd_dhcp=devtype=dhcp; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00010:UNDI:003000;setenv bootp_arch 0xa;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr -q ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_pxe=dhcp; if pxe get; then pxe boot; fi
bootdelay=2
bootfile=boot.scr.uimg
bootflash=run flashargs; cp ${ramdisk_addr} ${ramdisk_addr_r} ${maxramdisk}; bootm ${kernel_addr} ${ramdisk_addr_r}
bootfstype=fat
console=ttyAMA0,38400n8
cpu=armv7
disable_ipv6=1
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
distro_bootpart_uuid=af3731d1-01
dnsip=10.0.2.3
dram=1024M
efi_dtb_prefixes=/ /dtb/ /dtb/current/
env=bootcmd tftp 0x61000000 zImage
ethact=ethernet@3,02000000
ethaddr=52:54:00:12:34:56
fdt_addr_r=0x60000000
fdtcontroladdr=6087ff30
fdtfile=vexpress-v2p-ca9.dtb
fileaddr=62000000
filesize=3701
flashargs=setenv bootargs root=${root} console=${console} mem=${dram} mtdparts=${mtd} mmci.fmax=190000 devtmpfs.mount=0  vmalloc=256M
foo=bar
gatewayip=10.0.2.2
ipaddr=10.0.2.15
kernel_addr_r=0x60100000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0x60100000
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
mtd=armflash:1M@0x800000(uboot),7M@0x1000000(kernel),24M@0x2000000(initrd)
netmask=255.255.255.0
nfsroot=172.23.78.41:/home/alex/embedded-linux-qemu-labs/tinysystem/nfsroot
root=/dev/sda1 rw
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then part uuid ${devtype} ${devnum}:${distro_bootpart} distro_bootpart_uuid ; run scan_dev_for_boot; fi; done; setenv devplist
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;run boot_efi_bootmgr;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootarm.efi; then echo Found EFI removable media binary efi/boot/bootarm.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo EXTLINUX FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
serverip=10.0.2.2
stderr=uart@9000
stdin=uart@9000
stdout=uart@9000
ubifs_boot=if ubi part ${bootubipart} ${bootubioff} && ubifsmount ubi0:${bootubivol}; then devtype=ubi; devnum=ubi0; bootfstype=ubifs; distro_bootpart=${bootubivol}; run scan_dev_for_boot; ubifsumount; fi
vendor=armltd

Environment size: 5048/262140 bytes

I see 1 error during copy/past variables :
nfsroot=172.23.78.41:/home/alex/embedded-linux-qemu-labs/tinysystem/nfsroot which should be nfsroot=10.0.2.2:/home/alex/embedded-linux-qemu-labs/tinysystem/nfsroot

I corrected it now ... same issue :-(

Can you help to have a functionnal NFS server ( WSL Debian tells me servir is ok , see attached file)
By advance, thank you for your answers :-)

More infos:

Im able ton ping "server" from U-boot, with "ping 10.0.2.2".
But no response from target, when I do "ping 10.0.2.15".

When I used a static IP, with 172.23.78.41 for server and 172.23.78.42 for client ( The emulated target by QEmu), I was able to ping from both direction.
I made :
setenv ipdaddr 172.23.78.42
setenv serverip 172.23.78.41
saveenv

But to be honest, I thought the static adress were erased by the macro "run distro_boot" in bootcmd variables, which launch dhcp command.

With the value bootcmd=tftp 0x61000000 zImage;tftp 0x62000000 vexpress-v2p-ca9.dtb; bootz 0x61000000 - 0x62000000, the TFTP server wasn't reachable.




Edited 2 time(s). Last edit at 01/02/2025 06:47PM by Spekkio.
Attachments:
open | download - VFS.png (205.7 KB)
open | download - ip_a.png (34.9 KB)
open | download - NFS_OK.png (81.4 KB)
Re: NFS client on U-boot , launched on ARM board emulated by QEMU, launched on Deboian(WSL)
January 02, 2025 06:41PM
Spekkio,

See these 2 threads in the forum Wiki page about how to boot with NFS rootfs:

Quote

NFS

NFS - HowTo set up NFS shares (and boot NFS rootfs), see also Debian 12 (bookworm) settings
Boot your Dockstar (and other plugs) using NFS rootfs, see also Debian 12 (bookworm) settings

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
thank you for these fast answer.
I check it now.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: