Skip to content

Repository files navigation

linux-0.01

Build and run Linus Torvalds's Linux 0.01 kernel on a modern macOS or Linux host with Docker and QEMU.

Linux 0.01 booted to an interactive shell in QEMU

Linux 0.01 booted successfully and reached an interactive shell in QEMU.

Why use this project?

  • Small and approachable: the generated bootable image is only about 108 KiB (110,721 bytes), making it practical to inspect an early kernel without navigating a modern multi-million-line source tree.
  • One-command build and run: make -f mvp.mk build creates the image and make -f mvp.mk run starts it in QEMU.
  • Modern-host friendly: the Docker workflow works on modern Linux and on macOS, including Apple Silicon hosts with linux/amd64 emulation.
  • Minimal, reviewable compatibility work: the build applies a separate compatibility patch to a temporary copy instead of hiding extensive changes throughout the historical source tree.
  • Verifiable inputs: the Ubuntu base image, compatibility source revision, and runtime filesystem checksum are recorded explicitly.
  • Observable result: the kernel boots to an interactive shell rather than stopping at a successful compiler exit code.

Suitable use cases

  • Learning early x86 boot, memory management, process scheduling, system calls, terminal handling, and filesystem implementation from a compact codebase.
  • Classroom demonstrations and operating-system workshops.
  • Linux kernel history and source-code archaeology.
  • Studying how old C and assembly code can be adapted to modern compilers, containers, and emulators with a constrained compatibility layer.
  • Reproducible demonstrations of a complete build-to-boot workflow.

This project is intended for education and historical study. It is not a modern operating system, a secure runtime, or a base for production workloads.

Origin and change policy

Linux 0.01 was written by Linus Torvalds and published in 1991. This repository began in 2012 as a copy of that source. The 88 program files in the initial source import match the official linux-0.01.tar.gz archive byte for byte.

The repository maintainer recalls copying the source from a CD bundled with a Chinese-language book. The exact edition has not been verified; one likely candidate is Lu Jun's 2004 book Linux 0.01内核分析与操作系统设计——创造你自己的操作系统, which was sold with a CD-ROM.

Whatever the physical source, the file comparison establishes that the initial program files came from the official Linux 0.01 source release.

The repository was originally named linux-0.0.1; it was later renamed to linux-0.01 to match the official release number. After the initial import, a small 2012 compatibility commit changed six tracked files. The current Docker workflow leaves those tracked files untouched during each build and applies further GCC-compatible changes as a separate patch to a temporary copy. This project does not attempt to modernize Linux 0.01 or claim a bit-for-bit reproduction of its original GCC 1.40/Minix build environment.

Historical references

Reproducible MVP build and run

The following compatibility path lets modern macOS and Linux hosts build and run the historical source tree with Docker.

Requirements

  • Docker with linux/amd64 emulation enabled (Docker Desktop or OrbStack on Apple Silicon)
  • make

Build

make -f mvp.mk build

The bootable kernel image is written to build/Image.

Run

make -f mvp.mk run

QEMU opens in the current terminal. To stop it, run make -f mvp.mk stop in a second terminal. Linux 0.01 uses a Finnish keyboard map; some punctuation keys differ from a modern US keyboard.

Why a compatibility patch is needed

The 1991 Makefile expects Minix, GCC 1.40, 16-bit as86/ld86, and an i386 host. A direct build on an Apple Silicon host sends i386 assembly to the ARM assembler and fails immediately.

The container applies compat/linux-0.01-gcc-port.patch to a temporary copy of this source tree. The tracked source files are not overwritten. The patch is derived from the GCC-compatible port at commit 13b1afcf93135ee72e5feb8c2d64fb086e40c029 of OS-LAB-DaejinUniv/oslab-linux. The runtime root filesystem is fetched from that same revision and verified with SHA-256 1c4ac3fc6e38ab55731b2e1c1ec268c095cdd4c1329f6e523606483510b76078.

This is a practical, modified Linux 0.01 build—not a bit-for-bit reproduction of Linus Torvalds's original GCC 1.40/Minix build environment.

About

Build and run Linus Torvalds's Linux 0.01 on modern macOS and Linux using Docker and QEMU.

Topics

Resources

Stars

91 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages