[System transplantation] Linux mounts nfs file system

Hardware environment: 100ask stm32mp157 development board
Ubuntu18.4

After building the file system with busybox or buildroot, put the file system in the nfs folder

cp rootfs.tar ~/nfs_rootfs/rootfs/
sudo tar -xvf rootfs.tar

After decompression is as follows

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-OFli9sSC-1681999848065)(image/system transplant/1681998416030.png)]

After the Linux kernel is started, the root file system is required. Where the root file system exists is specified by the uboot bootargs environment variable, which will be passed to the Linux kernel as a command line parameter.

bootargs saves the parameters passed by uboot to the Linux kernel, such as specifying the console used by the Linux kernel, specifying the partition where the root file system is located, etc., as shown in the following bootargs environment variable values: console=ttySTM0,115200 root=
/dev/mmcblk2p3 rootwait rw

The bootargs setting format is

setenv bootargs ‘console=开发板串口号,波特率
root=挂载方式
nfsroot=nfs服务器ip地址:nfs文件系统路径,proto=传输协议 读写权限
ip=开发板ip地址:nfs服务器ip地址:网关:子网掩码::开发板网口:off’ 

This article sets bootargs in uboot as

setenv bootargs 'root=/dev/nfs nfsroot=192.168.31.143:/home/book/nfs_rootfs/rootfs,vers=3 rw ip=dhcp'  
saveenv

Execute run bootcmd to start the Linux system, and successfully mount the root file system of the server, as follows

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-w7qnEhzQ-1681999848067)(image/system transplant/1681999151327.png)]

Guess you like

Origin blog.csdn.net/m0_61737429/article/details/130277053