Skip to content

feat(ostool): 添加 Cargo 二进制目标选择#97

Open
MRNIU wants to merge 2 commits intodrivercraft:mainfrom
MRNIU:feature/cargo-bin-selector
Open

feat(ostool): 添加 Cargo 二进制目标选择#97
MRNIU wants to merge 2 commits intodrivercraft:mainfrom
MRNIU:feature/cargo-bin-selector

Conversation

@MRNIU
Copy link
Copy Markdown

@MRNIU MRNIU commented May 6, 2026

概要

  • 增加可选的 system.Cargo.bin 配置,让 OSTool 在同一个 package 暴露多个二进制时可以明确选择目标 artifact。
  • ostool buildostool run qemuostool run ubootostool board run 增加 --package / --bin 临时覆盖参数。
  • Cargo JSON artifact 解析改为显式匹配,多个二进制但未指定目标时返回明确错误,并同步更新中英文 README 用法说明。
  • 补充 SimpleKernel 迁移计划,说明 PR-02 为什么只做 binary artifact 选择,并把 command selector、语义检查和多 binary 配置策略拆清楚。

验证

  • cargo fmt --all -- --check
  • cargo check -p ostool
  • git diff --staged --check

兼容性

@MRNIU MRNIU force-pushed the feature/cargo-bin-selector branch from 0922e26 to 35bc562 Compare May 6, 2026 12:54
@MRNIU MRNIU changed the title feat(ostool): add Cargo binary target selector feat(ostool): 添加 Cargo 二进制目标选择 May 6, 2026
OSTool 需要在同一个 Cargo package 暴露多个二进制时,能够明确选择本次构建和运行使用的目标,而不是复制多份配置或依赖 artifact 猜测。

- 为 `system.Cargo` 增加可选的 `bin` 字段,并在 `build`、`run qemu`、`run uboot`、`board run` 中支持 `--package` / `--bin` 临时覆盖。
- Cargo 构建器按 package 和 bin 精确匹配 executable artifact;多二进制未指定时返回明确的歧义错误。
- 更新中文和英文 README,说明配置项、命令行参数和多二进制项目的用法。
- 补充 SimpleKernel 迁移计划中的 PR-02 实现取舍,明确 command selector、语义检查和多 binary 配置的边界。
@MRNIU MRNIU force-pushed the feature/cargo-bin-selector branch from 35bc562 to 504bdc0 Compare May 6, 2026 13:03
--package/--bin 覆盖原本只更新局部 build config,导致后续加载 .board.toml 时,${package} 仍可能按旧 Tool context 解析。

- 将 selector 应用后的 build config 写回 Tool 上下文。

- 更新 SimpleKernel 迁移计划,记录 board run 对 package-local 路径的要求。

验证:git diff --check
@MRNIU MRNIU force-pushed the feature/cargo-bin-selector branch from 8dfff51 to f29bdb7 Compare May 6, 2026 13:26
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.

1 participant