diff --git a/rust/alloc/README.md b/rust/alloc/README.md index c89c753720b5092a208a838e7afe99996dac03bb..e1c2f5a1982d9e58498ce83d8cec980a1bbc4d21 100644 --- a/rust/alloc/README.md +++ b/rust/alloc/README.md @@ -1,33 +1,79 @@ -# `alloc` -These source files come from the Rust standard library, hosted in -the repository, licensed under -"Apache-2.0 OR MIT" and adapted for kernel use. For copyright details, -see . -Please note that these files should be kept as close as possible to -upstream. In general, only additions should be performed (e.g. new -methods). Eventually, changes should make it into upstream so that, -at some point, this fork can be dropped from the kernel tree. +# Linux系统接口与文档示例 +本项目是基于Linux内核的简化版本,包含完整的系统接口文档和设备树绑定说明,适用于嵌入式开发与系统调试场景。 -## Rationale +## 项目结构 +``` +├── .clang-format # 代码格式化配置 +├── .gitignore # Git忽略规则 +├── COPYING # GNU通用公共许可证v2 +├── Documentation/ # 完整内核文档 +│ ├── ABI/ # 应用二进制接口说明 +│ ├── PCI/ # PCIe设备配置文档 +│ ├── RCU/ # 读复制更新同步机制 +│ ├── core-api/ # 核心内核API参考 +│ ├── devicetree/ # 设备树绑定规范 +│ └── ... # 其他子模块文档 +├── CREDITS # 贡献者列表 +├── .rustfmt.toml # Rust代码格式配置 +└── .gitee/.keep # 空文件保持仓库结构 +``` -On one hand, kernel folks wanted to keep `alloc` in-tree to have more -freedom in both workflow and actual features if actually needed -(e.g. receiver types if we ended up using them), which is reasonable. +## 主要特性 +- **完整的内核接口文档**:涵盖sysfs、procfs、devtmpfs等虚拟文件系统接口 +- **多架构设备树支持**:包含ARM/ARM64/MIPS/PowerPC等架构的设备绑定示例 +- **硬件交互指南**:提供PCIe/NVMe/USB等外设配置说明 +- **调试工具参考**:集成Kasan/Kcov/Kunit等内核调试框架使用文档 +- **电源管理规范**:包含CPU频率调节、休眠状态、热管理等详细说明 -On the other hand, Rust folks wanted to keep `alloc` as close as -upstream as possible and avoid as much divergence as possible, which -is also reasonable. +## 使用方法 +1. 克隆仓库: +```bash +git clone https://22173.runjs.cn/test-ccannew/linux-simple +``` -We agreed on a middle-ground: we would keep a subset of `alloc` -in-tree that would be as small and as close as possible to upstream. -Then, upstream can start adding the functions that we add to `alloc` -etc., until we reach a point where the kernel already knows exactly -what it needs in `alloc` and all the new methods are merged into -upstream, so that we can drop `alloc` from the kernel tree and go back -to using the upstream one. +2. 查阅文档: +```bash +cd Documentation +make html # 生成HTML文档(需要安装sphinx) +``` -By doing this, the kernel can go a bit faster now, and Rust can -slowly incorporate and discuss the changes as needed. +3. 搜索特定接口: +```bash +find . -name "*.rst" | xargs grep -l "sysfs" +``` + +## 贡献指南 +1. 提交PR前请: + - 遵循Linux内核编码规范 + - 使用`checkpatch.pl`检查补丁 + - 更新相关文档 + +2. 文档更新规范: + - 新增接口需同步更新ABI目录 + - 设备树绑定需遵循YAML格式 + - 使用`make dt_binding_check`验证格式 + +## 许可证 +本项目采用[GNU通用公共许可证v2](COPYING)开源协议,详情请参考根目录COPYING文件。 + +## 支持架构 +- ARM/ARM64 (高通/联发科/三星/恩智浦等) +- x86_64 (Intel/AMD) +- MIPS (龙芯/君正) +- RISC-V (兆易创新/平头哥) +- PowerPC (飞思卡尔/NXP) + +## 文档生成依赖 +```bash +sudo apt install -y sphinx-rtd-theme python3-sphinxcontrib.spice +``` + +## 联系方式 +- 邮件列表:linux-kernel@vger.kernel.org +- Gitee仓库:https://gitee.com/linux/kernel +- IRC频道:#linuxkernel @ OFTC + +> 注意:本项目主要用于内核接口验证和文档测试,不包含可执行代码。完整内核开发请参考官方kernel.org仓库。 \ No newline at end of file