Skip to content

feat(ostool): 支持显式配置 Cargo 构建 profile#96

Open
MRNIU wants to merge 1 commit intodrivercraft:mainfrom
MRNIU:feature/cargo-build-profile
Open

feat(ostool): 支持显式配置 Cargo 构建 profile#96
MRNIU wants to merge 1 commit intodrivercraft:mainfrom
MRNIU:feature/cargo-build-profile

Conversation

@MRNIU
Copy link
Copy Markdown

@MRNIU MRNIU commented May 6, 2026

摘要

  • system.Cargo 中增加可选 profile 字段,支持显式选择 DebugRelease
  • 将 Cargo profile 选择从 QEMU --debug 中解耦;未配置 profile 时保持旧行为。
  • 让 log level feature 跟随实际 Cargo profile,并同步更新中英文 README 示例。

原因

Cargo 的 Debug/Release 会影响优化级别、debug assertions 和最终代码形态;QEMU debug 只应该控制 GDB 等运行时调试参数。此前 OSTool 通过 QEMU --debug 隐式推导 Cargo profile,导致这两个维度无法独立表达。

这个 PR 增加最小配置面:只允许 DebugRelease 两个 Cargo profile 标签,不引入自定义 named profile 或新的 CLI 覆盖参数。

验证

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

Cargo 的 Debug/Release 会影响优化级别、debug assertions 和最终代码形态,而 QEMU debug 只应该控制 GDB 等运行时调试参数。此前 ostool 通过 QEMU --debug 隐式推导 Cargo profile,导致这两个维度无法独立表达。

- 在 system.Cargo 中增加可选 profile 字段,支持 Debug 和 Release。

- 未配置 profile 时保留旧行为,避免影响现有 .build.toml。

- 让 log feature 的 release/debug 选择跟随 Cargo profile。

- 更新中英文 README,建议用 profile 表达 release 构建。
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