ARM-LINUX基础
+ -

nfs内存烧写kernel

2025-07-31 16 0

安装nfs

sudo apt-get install nfs-kernel-server
sudo systemctl enable nfs-kernel-server
sudo systemctl start nfs-kernel-server

修改配置

#vi /etc/exports
/home/zzmt/nfs *(rw,sync,no_root_squash)
#chmod 777 /home/zzmt/Desktop/nfs
#sudo systemctl start nfs-kernel-server

查看主机NFS共享文件夹

zzmt@zzmt:~/Desktop/kernel$ showmount -e
Export list for zzmt:
/home/zzmt/Desktop/nfs *

文件下载

从主机下载文件到下位机开发板

nfs 80800000 192.168.1.3:/home/zzmt/Desktop/nfs/zImage
nfs 83000000 192.168.1.3:/home/zzmt/Desktop/nfs/imx6ull-alientek-emmc.dtb
bootz 80800000 – 83000000

测试示例

=> nfs 80800000 192.168.0.3:/home/zzmt/Desktop/nfs/zImage
Using FEC1 device
File transfer via NFS from server 192.168.0.3; our IP address is 192.168.0.66
Filename '/home/zzmt/Desktop/nfs/zImage'.
Load address: 0x80800000
Loading: #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     ##################################################T T T T T T T T T 
done
Bytes transferred = 5577664 (551bc0 hex)

不知道为什么会有长时间的延迟TTTTT,别人的板子就没有,也可能与自己的路由器相关,也许网线直连会好吧。


LINUX嵌入式板下位机NFS映射

挂载

mkdir get
mount -t nfs -o nolock,nfsvers=3 192.168.0.3:/home/zzmt/Desktop/nfs get/

查看挂载信息

root@ATK-IMX6U:~# df
Filesystem                         1K-blocks     Used Available Use% Mounted on
/dev/root                            7350760   592408   6361912   9% /
devtmpfs                              187632        4    187628   1% /dev
tmpfs                                     40        0        40   0% /mnt/.psplash
tmpfs                                 253432      168    253264   1% /run
tmpfs                                 253432      128    253304   1% /var/volatile
/dev/mmcblk1p1                         32248     6902     25347  22% /run/media/mmcblk1p1
192.168.0.3:/home/zzmt/Desktop/nfs  51474432 14791680  34044928  31% /home/root/get

卸载

umount get

uboot使用NFS挂载根文件系统

setenv bootargs 'console=ttymxc0,115200 root=/dev/nfs \
nfsroot=192.168.0.3:/home/zzmt/Desktop/nfs/rootfs,proto=tcp rw \
ip=192.168.0.66:192.168.0.3:192.168.0.1:255.255.255.0::eth0:off '
saveenv
  • 192.168.0.3:是远程主机IP
  • 192.168.0.66:是开发板IP
  • /home/zzmt/Desktop/nfs/rootfs:是tar vxjf rootfs.tar.bz2之后的目录

格式

setenv bootargs 'console=开发板串口,波特率 root=挂载方式 \
nfsroot=虚拟机 IP 地址:文件系统路径,proto=传输协议 读写权限 \
ip=开发板 IP 地址:虚拟机 IP 地址:网关地址:子网掩码::开发板网口:off'
saveenv

注意:
rootfs需要解压到指定目录

mkdir rootfs
zzmt@zzmt:~/Desktop/nfs$ tar -xvjf rootfs.tar.bz2  -C rootfs

0 篇笔记 写笔记

关注公众号
取消
感谢您的支持,我会继续努力的!
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

您的支持,是我们前进的动力!