使用U-Boot的TFTP(远程/网络内核)
前提条件
假设您的主机PC运行的是Ubuntu 14.04.1 LTS或更高版本,并且与您的开发平台在同一个本地网络上;为了简单起见,我们假设网络上也有DHCP服务器。
如果使用Juno,请确保使用的是前端以太网端口。
设置TFTP服务器
在您的主机PC上安装以下软件包:
1 | $ sudo apt-get update && sudo apt-get install xinetd tftpd tftp |
创建文件/etc/xinetd.d/tftp,内容如下:
1 2 3 4 5 6 7 8 9 10 11 | service tftp { protocol = udp port = 69 socket_type = dgram wait = yes user = nobody server = /usr/sbin/in .tftpd server_args = /tftpboot disable = no } |
创建目录'/tftpboot/'(与上面的' server-args'匹配)并设置其权限:
1 2 3 | $ sudo mkdir /tftpboot/ $ sudo chmod -R 777 /tftpboot/ $ sudo chown -R nobody /tftpboot/ |
重新启动xinetd的服务:
1 | $ sudo service xinetd restart |
通过在'/tftpboot/'中创建一个简单的' test '文件来测试服务器:
1 2 3 4 | $ cd /tftpboot/ $ echo "this is a test" > test $ cat test this is a test |
通过' ifconfig'获取主机的IP地址,然后从另一个系统:
1 2 3 4 5 6 | $ tftp <host_pc_ip_address> tftp> get test Sent 159 bytes in 0.0 seconds tftp> quit $ cat test this is a test |
确认TFTP服务器工作正常后,将内核映像、设备树blob和ramdisk(如果合适的话)复制到' /tftpboot/'。本例期望路径如下:
- Kernel image: `/tftpboot/Image'
- Device tree blob:`/tftpboot/juno/juno.dtb'
U-Boot TFTP
打开Juno板并中断U-Boot的默认启动选择:
1 | The default boot selection will start in 3 seconds |
将主机PC的IP地址保存到“serverip”环境变量:
1 2 | VExpress64 # set serverip <host_pc_ip_address> VExpress64 # saveenv |
下一步修改U-Boot的引导命令,通过TFTP引导:
1 2 3 | VExpress64 # set origbootcmd "$bootcmd" VExpress64 # set bootcmd "dhcp: tftp ${kernel_addr} ${serverip}:Image; tftp ${fdt_addr} ${serverip}:juno/juno.dtb; booti ${kernel_addr} - ${fdt_addr}" VExpress64 # saveenv |
重新启动juno板,现在应该通过TFTP引导。
这是一个永久的更改,即Juno将通过TFTP在每次电源启动时启动。恢复到默认启动行为:
1 | VExpress64 # set bootcmd "$origbootcmd" |
本文来自博客园,作者:闹闹爸爸,转载请注明原文链接:https://www.cnblogs.com/wanglouxiaozi/p/9578166.html
分类:
arm-linux
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)