Skip to content

fix(ostool): harden local U-Boot TFTP staging lifecycle#156

Merged
ZR233 merged 1 commit into
drivercraft:mainfrom
YanLien:fix/uboot-local-tftp
Jul 23, 2026
Merged

fix(ostool): harden local U-Boot TFTP staging lifecycle#156
ZR233 merged 1 commit into
drivercraft:mainfrom
YanLien:fix/uboot-local-tftp

Conversation

@YanLien

@YanLien YanLien commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix local U-Boot network configuration handling and make Linux TFTP staging shorter, safer, and automatically cleaned after each run.

Changes

  • Make the TOML [net] section work directly with LocalBackend, including settings such as interface and tftp_dir.
  • Replace the full artifact directory hierarchy with a shorter generated TFTP path:
    ostool/<pid>-<timestamp>-<counter>/<fit-image>
    
  • Track and remove staged FIT images after the U-Boot run.
  • Roll back the staging directory when copying the FIT image fails.
  • Reject unsafe TFTP roots, parent segments, fabricated paths, and symlinked namespace directories.
  • Ensure console cleanup, TFTP cleanup, and board power-off handling still run when an earlier operation fails.
  • Preserve the original run error when additional cleanup errors occur.
  • Document the user-group permissions required to clean /srv/tftp/ostool without sudo rmdir.

Compatibility

The existing TOML format remains unchanged:

[net]
interface = "eth0"

Remote board execution is unaffected because its network configuration continues to come from the server boot profile.

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本 PR 将 Linux 系统 tftpd-hpa 的 FIT 暂存改为受限的 ostool/<唯一目录> 命名空间,并在本地 U-Boot 运行收尾阶段清理文件和目录;同时把网络配置归入本地配置结构,并补充了中英文权限配置说明。改动影响本地 Linux 的 U-Boot/TFTP 启动与清理路径;远程开发板上传路径保持独立,未发现共享 API 或配置契约回归。

审查结论:暂存路径验证、冲突处理、失败回滚及清理错误聚合均有针对性测试覆盖;未发现未解决问题或额外测试缺口。未发现既有审查意见或讨论需要跟进;相似 PR 搜索未发现重叠项。

验证:GitHub Actions check (stable, x86_64-unknown-linux-gnu) 已成功(包含 CI 的格式化、clippy、构建和测试流程)。本地已通过 git diff --check 并复核目标 HEAD;本地环境未安装 cargo,因此无法在此环境重跑 cargo fmt --checkcargo clippy --manifest-path ostool/Cargo.toml --all-features -- -D warningscargo test --manifest-path ostool/Cargo.toml --all-features。CI 无由本 PR 引起的失败。

Powered by gpt-5.6-terra

@ZR233
ZR233 merged commit 4e39db9 into drivercraft:main Jul 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants