Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to the project.
Before contributing, ensure you have:
-
Rust Nightly Toolchain
The repo contains a
rust-toolchain.tomlfile that pins the exact nightly version. Running anycargocommand will automatically install and use the correct toolchain — no manualrustup overrideneeded. -
Target Architecture
rustup target add x86_64-unknown-none
-
LLVM Tools
rustup component add llvm-tools-preview
-
Bootimage Tool
cargo install bootimage --version "^0.10" -
QEMU (for testing)
# Ubuntu/Debian sudo apt-get install qemu-system-x86 # macOS brew install qemu # Windows # Download from https://www.qemu.org/download/
-
Fork the repository
-
Clone your fork:
git clone https://github.com/DakodaStemen/RustOS.git cd RustOS -
Verify setup:
make check make build
-
Create a branch for your feature:
git checkout -b feature/your-feature-name
-
Make your changes
-
Test locally:
make build make run # Or make test for curses display -
Ensure code quality:
cargo fmt cargo clippy --target x86_64-unknown-none
We follow standard Rust conventions:
- Formatting: Use
cargo fmtto format code - Linting: Fix all
cargo clippywarnings - Documentation: Document all public APIs
- Safety Comments: Document all
unsafeblocks with safety justifications
unsafe {
// SAFETY: 0xb8000 is the standard VGA text buffer address in x86_64.
// This address is guaranteed to be valid and writable in the bootloader
// environment. We use write_volatile via addr_of_mut! to avoid creating
// an intermediate reference and to prevent the compiler from optimizing
// away the write to this memory-mapped I/O region.
let ptr = core::ptr::addr_of_mut!(*(0xb8000 as *mut ScreenChar));
core::ptr::write_volatile(ptr, screen_char);
}Before submitting a pull request:
-
Build Test: Ensure code compiles
cargo build --target x86_64-unknown-none --release
-
Boot Test: Verify kernel boots in QEMU
make run
-
Visual Test: Check output appears correctly
- Text is readable
- Colors work as expected
- Keyboard input echoes correctly (if testing keyboard driver)
- Keep it Minimal: This is a minimal kernel - avoid unnecessary complexity
- Document Everything: Add comments explaining design decisions
- Safety First: All
unsafecode must have safety comments - Heap is available: The kernel has a working heap allocator; heap allocations are acceptable
- Test Thoroughly: Test in QEMU before submitting
Good first issues for new contributors:
- Text Scrolling: Improve scrolling behavior
- Color Schemes: Add preset color combinations
- Clear Screen: Add explicit clear screen function
- Backspace: Implement backspace functionality
- File System: Begin work on a simple file system driver
- Plan: Document what you want to add
- Implement: Write the code following style guidelines
- Test: Verify it works in QEMU
- Document: Update relevant documentation
- Submit: Create a pull request
- Code compiles without warnings
- Code is formatted with
cargo fmt - All
unsafeblocks have safety comments - Changes tested in QEMU
- Documentation updated if needed
- Commit messages are clear and descriptive
When creating a PR, include:
- Description: What does this PR do?
- Changes: List of changes made
- Testing: How was it tested?
- Screenshots: If visual changes (optional)
Example:
## Description
Adds keyboard input support using PS/2 controller.
## Changes
- Added PS/2 keyboard driver
- Implemented key press detection
- Added echo of typed characters to screen
## Testing
Tested in QEMU - keyboard input works correctly and characters appear on screen.All contributions require code review. Reviewers will check:
- Code correctness and safety
- Adherence to style guidelines
- Documentation quality
- Test coverage
Be open to feedback and willing to make changes!
When reporting a bug, include:
- Description: What went wrong?
- Steps to Reproduce: How to trigger the bug
- Expected Behavior: What should happen?
- Actual Behavior: What actually happened?
- Environment: Rust version, OS, QEMU version
- Screenshots: If applicable
For feature requests, include:
- Description: What feature do you want?
- Use Case: Why is this useful?
- Proposed Implementation: How would it work? (optional)
- Open an issue for questions
- Check TROUBLESHOOTING.md for common issues
- Review docs/ARCHITECTURE.md for technical details
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing! 🦀