Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcdostone/nom-config-in
A config.in parser written in Rust.
https://github.com/mcdostone/nom-config-in
config-in linux-kernel nom parsing rust
Last synced: about 1 month ago
JSON representation
A config.in parser written in Rust.
- Host: GitHub
- URL: https://github.com/mcdostone/nom-config-in
- Owner: Mcdostone
- Created: 2023-07-20T16:08:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-20T18:42:50.000Z (about 1 year ago)
- Last Synced: 2024-04-23T15:22:15.588Z (7 months ago)
- Topics: config-in, linux-kernel, nom, parsing, rust
- Language: Rust
- Homepage: https://crates.io/crates/nom-config-in
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A Config.in parser written in rust.
**This parser is not actively maintained** since it has been replaced by [Kconfig](https://www.kernel.org/doc/html/next/kbuild/kconfig-language.html). This library has been tested from linux kernel [1.0](https://cdn.kernel.org/pub/linux/kernel/v1.0/) to [2.5.44](https://cdn.kernel.org/pub/linux/kernel/v2.5/) (542 versions).
A Config.in file looks like this:
```
# 2.5.0/arch/i386/config.in
mainmenu_name "Linux Kernel Configuration"define_bool CONFIG_X86 y
define_bool CONFIG_ISA y
define_bool CONFIG_SBUS ndefine_bool CONFIG_UID16 y
mainmenu_option next_comment
comment 'Code maturity level options'
bool 'Prompt for development and/or incomplete code/drivers' CONFIG_EXPERIMENTAL
endmenu
```## Getting started
```bash
cargo add nom-config-in
``````
```rust
use nom_config_in::{parse_config_in, ConfigInFile, ConfigInInput};
use std::path::PathBuf;// curl https://cdn.kernel.org/pub/linux/kernel/v2.5/linux-2.5.0.tar.xz | tar -xJ -C /tmp/
fn main() -> Result<(), Box> {
let config_in_file = ConfigInFile::new(
PathBuf::from("/tmp/linux/"),
PathBuf::from("/tmp/linux/arch/i386/config.in"),
);
let input = config_in_file.read_to_string().unwrap();
let config_in = parse_config_in(ConfigInInput::new_extra(&input, config_in_file));
println!("{:?}", config_in);
Ok(())
}
```## Resources
- https://lwn.net/Articles/8117/
- https://os.inf.tu-dresden.de/l4env/doc/html/bid-spec/node36.html
- https://github.com/xfguo/menuconfig/blob/master/config-language.txt