explaingit

s-matyukevich/raspberry-pi-os

13,817CAudience · developerComplexity · 4/5Setup · hard

TLDR

A step-by-step tutorial in C and assembly that teaches you how to build a simple operating system kernel from scratch for the Raspberry Pi 3, comparing each feature to how the real Linux kernel implements it.

Mindmap

mindmap
  root((raspberry-pi-os))
    What it does
      OS from scratch
      Linux internals guide
      Step by step lessons
    Hardware
      Raspberry Pi 3
      ARM processor
      Bare metal
    Topics covered
      Interrupt handling
      Scheduler
      User processes
      Virtual memory
    Learning approach
      Per-lesson snapshots
      Linux comparison
      No prior OS needed
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Follow the numbered lessons to build a mini OS kernel step by step and understand how interrupts and memory management really work.

USE CASE 2

Compare the simplified RPi OS version of scheduling or virtual memory to the real Linux kernel code to understand both at once.

USE CASE 3

Use the per-lesson source snapshots as a reference checkpoint when building your own bare-metal Raspberry Pi project.

Tech stack

CAssembly

Getting it running

Difficulty · hard Time to first run · 1day+

Requires cross-compiling a C and assembly kernel for ARM and running on Raspberry Pi 3 hardware or a compatible emulator. Assembly familiarity is helpful.

License is not stated in the available content.

In plain English

This repository is a teaching project, not a finished product. It is a step-by-step guide that shows you how to build a simple operating system kernel from scratch, written for the Raspberry Pi 3, a small inexpensive computer. The author calls the result Raspberry Pi OS, or RPi OS. An operating system kernel is the core program that sits between the hardware and everything else and manages things like memory and running programs. The teaching approach is the interesting part. The code is loosely based on the Linux kernel, the same core used in Android and most servers, but stripped down to a very limited version so it is possible to follow. Each lesson first explains how RPi OS implements a particular feature, then shows how the much larger Linux kernel does the same thing. This lets a reader see a simple version first and then connect it to how real-world systems work. The repository is organized so you can track progress. Every lesson has its own folder under a src directory that holds a snapshot of the source code as it stood when that lesson was finished. That way you can watch the operating system grow piece by piece instead of facing the whole thing at once. The author states that you do not need any prior operating-system development experience to follow along. The table of contents lays out the curriculum. Early lessons cover starting the kernel and initializing the processor. Later ones move into interrupt handling, scheduling which program runs next, user processes and system calls, and virtual memory management. Several further topics, including signals, file systems, executable files, device drivers, and networking, are listed as still to be done, so the project is openly a work in progress. The README also links to an introduction, a list of prerequisites, and a contribution guide, and it points to community channels on Twitter, Facebook, and Slack. In plain terms, this is an educational resource in C and assembly that walks a curious reader through writing a tiny operating system, using real Linux internals as the reference point throughout.

Copy-paste prompts

Prompt 1
I'm following the raspberry-pi-os tutorial and just finished the processor initialization lesson. Help me understand how ARM exception levels work and why the kernel drops from EL2 to EL1 at boot.
Prompt 2
I want to implement a simple round-robin scheduler for the raspberry-pi-os kernel. What do I need to add on top of the existing lesson 6 scheduling code?
Prompt 3
Explain how the raspberry-pi-os kernel sets up page tables for virtual memory and why user processes need a separate address space from the kernel.
Prompt 4
I cloned raspberry-pi-os and want to run it on real hardware. What do I need besides the compiled kernel image to boot on a Raspberry Pi 3?
Open on GitHub → Explain another repo

← s-matyukevich on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.