Standardize .config format: int/hex without quotes, proper type generation - #3
Merged
Merged
Conversation
- Part 1: Update ConfigWriter to handle Int/Hex/String types - Int values: NO quotes, decimal format (MAX_CPUS=102) - Hex values: NO quotes, 0x format (MEMORY_BASE=0x80000000) - String values: Keep quotes (KERNEL_VERSION="0.0.1") - Part 2: Update cargo-kbuild for standardized format - parse_config: Remove quotes for backward compatibility - generate_config_rs: Correct type detection (i64/u64/&str) - Part 3: Add comprehensive tests - Test int/hex/string format handling - Test backward compatibility with quoted values - Verify generated config.rs has correct Rust types Co-authored-by: guoweikang <18571063+guoweikang@users.noreply.github.com>
…rder - Simplify hex handling: use u64 instead of i64 (negative hex not standard) - Fix parsing order in generate_config_rs: check u64 before i64 - Avoid duplicate parsing by using match instead of is_ok() Co-authored-by: guoweikang <18571063+guoweikang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update ConfigWriter to save int and hex values without quotes
Standardize .config format: int/hex without quotes, proper type generation
Feb 10, 2026
guoweikang
marked this pull request as ready for review
February 10, 2026 08:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Int and hex values were written with quotes in
.configfiles, causing cargo-kbuild to incorrectly generate string types instead of numeric types for constants.Changes
ConfigWriter (
xtask/xconfig/src/config/writer.rs)MAX_CPUS=102)MEMORY_BASE=0x80000000)KERNEL_VERSION="0.0.1")cargo-kbuild (
xtask/cargo-kbuild/src/main.rs)parse_config(): strips quotes for backward compatibility with old configsgenerate_config_rs(): enhanced type detection0xprefix →u64u64i64&strTests (
xtask/xconfig/tests/config_tests.rs)Impact
Before:
After:
Old
.configfiles with quotes continue to work via quote-stripping in the parser.Original prompt
Problem: Int and Hex values need proper format in .config for cargo-kbuild integration
Currently:
MAX_CPUS="102"MEMORY_BASE="2147483648"Goal
Standardize .config format for seamless cargo-kbuild integration:
MAX_CPUS=102MEMORY_BASE=0x80000000KERNEL_VERSION="0.0.1"Part 1: Update ConfigWriter to save int/hex without quotes
File:
xtask/xconfig/src/config/writer.rsReplace lines 18-37 with:
Part 2: Update cargo-kbuild to handle standardized format
File:
xtask/cargo-kbuild/src/main.rsChange 1: Update
parse_configfunction (around line 275-293)Replace with:
Change 2: Update
generate_config_rsfunction (around line 310-353)Replace with: