# valera1w21/mr-minus-os architecture

> Architecture diagram of the GitHub repository valera1w21/mr-minus-os, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/valera1w21/mr-minus-os
- Repository: https://github.com/valera1w21/mr-minus-os

## Overview

Minus is an early, minimal Linux-based userspace for the Samsung Galaxy S3, not a replacement kernel. The main workflow is boot handoff to PID 1, system setup, then a restarted shell on tty1; a background keyboard converts touchscreen input into virtual key events. The README also describes cat, grep, and wc implementations, but says they are not in the image yet. Their possible dispatch is therefore not shown. Runtime wiring is based on the README and sampled C files; unsampled subsystems are represented only where documented.

Main entry points: [`moy_init.c`](https://github.com/valera1w21/mr-minus-os/blob/main/moy_init.c) (PID 1 init), [`moy_kbd.c`](https://github.com/valera1w21/mr-minus-os/blob/main/moy_kbd.c) (On-screen keyboard), [`moy_shell.c`](https://github.com/valera1w21/mr-minus-os/blob/main/moy_shell.c) (moysh shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Boot and runtime"]
  node_init["PID 1 init<br/>[moy_init.c]"]
  node_mounts["System mounts<br/>[moy_init.c]"]
  node_modules["Kernel modules<br/>[moy_init.c]"]
end

subgraph group_interaction["User interaction"]
  node_keyboard["On-screen keyboard<br/>[moy_kbd.c]"]
  node_shell["moysh shell<br/>[moy_shell.c]"]
end

subgraph group_tools["Standalone tools"]
  node_cat["cat utility<br/>[moy_cat.c]"]
  node_grep["grep utility<br/>[moy_grep.c]"]
  node_wc["wc utility<br/>[moy_wc.c]"]
end

node_bootloader(("Samsung bootloader"))
node_kernel["Linux kernel"]
node_devices["Phone devices"]
node_framebuffer["Framebuffer"]
node_touchscreen["Touchscreen"]
node_uinput["Virtual keyboard input"]
node_tty["tty1 terminal"]
node_user(("Phone user"))

node_bootloader -->|"starts"| node_kernel
node_kernel -->|"starts PID 1"| node_init
node_init -->|"mounts"| node_mounts
node_init -->|"loads"| node_modules
node_init -->|"waits for framebuffer"| node_devices
node_init -->|"starts in background"| node_keyboard
node_init -->|"forks and execs"| node_shell
node_keyboard -->|"draws keys"| node_framebuffer
node_keyboard -->|"reads events"| node_touchscreen
node_keyboard -->|"emits key events"| node_uinput
node_uinput -->|"types into"| node_tty
node_user -->|"touches"| node_touchscreen
node_user -->|"enters commands"| node_shell
node_shell -->|"reads and writes"| node_tty

click node_init "https://github.com/valera1w21/mr-minus-os/blob/main/moy_init.c"
click node_mounts "https://github.com/valera1w21/mr-minus-os/blob/main/moy_init.c"
click node_modules "https://github.com/valera1w21/mr-minus-os/blob/main/moy_init.c"
click node_keyboard "https://github.com/valera1w21/mr-minus-os/blob/main/moy_kbd.c"
click node_shell "https://github.com/valera1w21/mr-minus-os/blob/main/moy_shell.c"
click node_cat "https://github.com/valera1w21/mr-minus-os/blob/main/moy_cat.c"
click node_grep "https://github.com/valera1w21/mr-minus-os/blob/main/moy_grep.c"
click node_wc "https://github.com/valera1w21/mr-minus-os/blob/main/moy_wc.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_init,node_mounts,node_modules,node_touchscreen,node_user toneBlue
class node_keyboard,node_shell toneAmber
class node_cat,node_grep,node_wc toneMint
class node_bootloader,node_kernel,node_devices,node_framebuffer,node_uinput,node_tty toneIndigo
```

## Components

### Boot and runtime

- [PID 1 init](https://github.com/valera1w21/mr-minus-os/blob/main/moy_init.c): `moy_init.c`
- [System mounts](https://github.com/valera1w21/mr-minus-os/blob/main/moy_init.c): `moy_init.c`
- [Kernel modules](https://github.com/valera1w21/mr-minus-os/blob/main/moy_init.c): `moy_init.c`

### User interaction

- [On-screen keyboard](https://github.com/valera1w21/mr-minus-os/blob/main/moy_kbd.c): `moy_kbd.c`
- [moysh shell](https://github.com/valera1w21/mr-minus-os/blob/main/moy_shell.c): `moy_shell.c`

### Standalone tools

- [cat utility](https://github.com/valera1w21/mr-minus-os/blob/main/moy_cat.c): `moy_cat.c`
- [grep utility](https://github.com/valera1w21/mr-minus-os/blob/main/moy_grep.c): `moy_grep.c`
- [wc utility](https://github.com/valera1w21/mr-minus-os/blob/main/moy_wc.c): `moy_wc.c`

### Other components

- **Samsung bootloader**
- **Linux kernel**
- **Phone devices**
- **Framebuffer**
- **Touchscreen**
- **Virtual keyboard input**
- **tty1 terminal**
- **Phone user**

## Connections

- Samsung bootloader → Linux kernel: starts
- Linux kernel → PID 1 init: starts PID 1
- PID 1 init → System mounts: mounts
- PID 1 init → Kernel modules: loads
- PID 1 init → Phone devices: waits for framebuffer
- PID 1 init → On-screen keyboard: starts in background
- PID 1 init → moysh shell: forks and execs
- On-screen keyboard → Framebuffer: draws keys
- On-screen keyboard → Touchscreen: reads events
- On-screen keyboard → Virtual keyboard input: emits key events
- Virtual keyboard input → tty1 terminal: types into
- Phone user → Touchscreen: touches
- Phone user → moysh shell: enters commands
- moysh shell → tty1 terminal: reads and writes
