嵌入式远程加载linux系统

📅 发布时间:2026/7/15 19:48:10 👁️ 浏览次数:
嵌入式远程加载linux系统
文章目录准备工作配置uboot环境变量bootargs命令分析bootcmd命令分析内存地址映射表内存分布解析网络加载Linux系统的方式不会影响MMC设备原有的Linux系统适合于linux系统移植调试场景准备工作准备uImage、stm32mp157a-fsmp1a.dtb、和rootfs.tar安装配置tftp和nfs服务环境将rootfs.tar解压到/nfs/rootfsuImage和stm32mp157a-fsmp1a.dtb拷贝到/tftpboot下配置、连接电脑和开发板设备连接示意图----------------- | Internet | ----------------- | ------------------ | Router | ------------------ / ----------- --------- | Computer | | ARM Dev | | (PC) |----| Board | ----------- ---------第一种方案电脑wifi连接外网电脑有线网卡配置为静态ip通过网线连接开发板USB连接串口第二种方案虚拟机Ubuntu虚拟外部网络选用NAT模式新增一个虚拟网卡桥接模式之电脑有线网卡设置为静态ip通过网线连接开发板USB连接串口配置uboot环境变量使用串口工具进入uboot模式配置以下环境变量结合自己的情况配置可参考本人其他文章envdefault-asetenv ethaddr 00:1B:44:11:3A:B7 setenv serverip192.168.9.120 setenv netmask255.255.255.0 setenv ipaddr192.168.9.210 setenv gatewayip192.168.9.1 setenv bootargsroot/dev/nfsnfsroot192.168.9.120:/nfs/rootfs,prototcp,nfsvers3rw clk_ignore_unusedconsolettySTM0,115200 /init/linuxrcip192.168.9.210 setenv bootcmd tftp 0xc2000000 uImage\;tftp 0xc4000000 stm32mp157a-fsmp1a.dtb\;bootm 0xc2000000 - 0xc4000000 saveenv重启自动加载系统FSMP1Aresetbootargs命令分析setenv bootargs root/dev/nfs nfsroot192.168.9.120:/nfs/rootfs, prototcp, ----使用TCP协议 nfsvers3 ----使用第三个版本 rw -------------读写权限 clk_ignore_unused ---------忽略未使用的时钟源 consolettySTM0,115200 ----控制台与波特率 /init/linuxrc ip192.168.9.210 ----开发板的IPconsolettySTM0,115200指定系统控制台为ttySTM0波特率为115200。# ls /dev/ttySTM0/dev/ttySTM0/init/linuxrc指定初始化进程为/linuxrc。# ls /linuxrc/linuxrcip192.168.9.210设置设备的IP地址为192.168.9.210。# ipaddr1: lo:LOOPBACK,UP,LOWER_UPmtu65536qdisc noqueue qlen1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet127.0.0.1/8 scopehostlo valid_lft forever preferred_lft forever2: eth0:BROADCAST,MULTICAST,UP,LOWER_UPmtu1500qdisc mq qlen1000link/ether 2a:c9:1f:22:38:7a brd ff:ff:ff:ff:ff:ff inet192.168.9.210/24 brd192.168.9.255 scope global eth0 valid_lft forever preferred_lft foreverbootcmd命令分析setenv bootcmd tftp 0xc2000000 uImage\;tftp 0xc4000000 stm32mp157a-fsmp1a.dtb\;bootm 0xc2000000 - 0xc4000000和开发板内存地址相关内存地址映射表内存分布解析0xFFFFFFFF -------------------- | ... | -------------------- | stm32mp157a.dtb | 0xC4000000 -------------------- | uImage | 0xC2000000 -------------------- | ..... | | ..... | | peripherals | | ROM code | 0x00000000 --------------------$lsuImage-l-rwxrw-rw-1linux linux73618646月1113:44 uImage|0x705548 0xC4000000-0xC20000000x20000000x705548 ---------------------------------....|uImage||stm32mp157a.dtb|....--------------------------------- 0xC2000000 0xC4000000