# bean1310/rikan architecture

> Architecture diagram of the GitHub repository bean1310/rikan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bean1310/rikan
- Repository: https://github.com/bean1310/rikan

## Overview

##### Project Type and Purpose
- This project is an OS implementation in Rust, based on MikanOS.
- Its purpose is to provide a lightweight operating system with a bootloader that initializes the hardware and loads the kernel, which then implements various OS functionalities such as console output, graphics, and font rendering.

##### File Structure
- There are two main directories: “bootloader” and “kernel”. Each has its own Cargo configuration files, Rust source files, and Makefiles.
- The “bootloader” directory contains source files like console.rs, elf.rs, uefi.rs, and uefi_alloc.rs, indicating that it handles system startup, UEFI-related memory allocation, and early initialization.
- The “kernel” directory includes components like graphics.rs, font.rs, and main.rs, showing that it contains the core OS functionality and UI/graphics management.
- There’s also a “tools” directory with a makefont.py script, which is likely used to generate font data (hankaku.txt is present in the kernel directory) – emphasizing custom asset generation.
- The presence of several .cargo directories and rust-toolchain files confirms the reliance on Rust’s build ecosystem.
- The root-level configuration (Makefile, .env file, and .github/workflows) indicates standard build and CI/CD integration.

##### Insights from the README
- The README clearly instructs how to build using an external dependency: “mikanos-build”. This dependency is essential for bootstrapping the build process and might include scripts or tools to facilitate OS-specific build steps.
- The “Build” and “Run” commands show integration with both Makefile automation and environment configuration.

##### Specific Elements
- Clear Labels – Name each component (e.g., “Bootloader”, “Kernel”, “Build System”, “Tools/Utilities”).
- Annotations – Briefly annotate each component with its role (e.g., “Handles UEFI initialization”, “Manages system graphics and fonts”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    F["Firmware/UEFI"]:::firmware
    BL["Bootloader\n(UEFI init, ELF loading)"]:::runtime
    K["Kernel\n(Graphics, Fonts, OS)"]:::runtime
    BS["Build System\n(Makefiles, mikanos-build)"]:::build
    TU["Tools/Utilities\n(makefont.py)"]:::tools
    CI["CI/CD Integration\n(GitHub Actions)"]:::integration

    F -->|"boot_process"| BL
    BL -->|"handover"| K
    BS -->|"builds"| BL
    BS -->|"builds"| K
    CI -->|"triggers"| BS
    TU -->|"generates_assets"| K

    click BL "https://github.com/bean1310/rikan/tree/main/bootloader/"
    click K "https://github.com/bean1310/rikan/tree/main/kernel/"
    click BS "https://github.com/bean1310/rikan/tree/main/Makefile"
    click TU "https://github.com/bean1310/rikan/blob/main/tools/makefont.py"
    click CI "https://github.com/bean1310/rikan/tree/main/.github/workflows/"

    classDef firmware fill:#f9c74f,stroke:#333,stroke-width:2px;
    classDef runtime fill:#90be6d,stroke:#333,stroke-width:2px;
    classDef build fill:#577590,stroke:#333,stroke-width:2px;
    classDef tools fill:#f9844a,stroke:#333,stroke-width:2px;
    classDef integration fill:#9d4edd,stroke:#333,stroke-width:2px;
```
