This project builds and runs Linux 0.01 on the Bochs emulator to analyze the entire kernel from source. Detailed analysis is documented on my blog.
The modern Linux kernel is too large to trace end-to-end. Linux 0.01 fits the entire kernel — bootloader, scheduler, filesystem, and more — into just a few thousand lines, making it possible to follow exactly how each component works and how they fit together. Running it on an emulator makes the analysis even more practical. Bochs has a built-in debugger that lets you inspect CPU registers, memory, and interrupt flow in ways that simply aren't possible on real hardware.
The Linux 0.01 source in this repository is based on a version patched for modern compilers.
- Original reference: https://github.com/mariuz/linux-0.01
.
├── bochsrc.txt # Bochs configuration file
├── create_hdb.sh # Script to create the Minix disk image (hdb.img)
├── hdb.img.tar.gz # Pre-built disk image (ready to use)
├── commands.tar.gz # Linux 0.01-compatible command binaries (echo, pwd, etc.)
├── sh.tar.gz # Linux 0.01-compatible shell binary
└── linux-0.01/ # Linux 0.01 source code
├── boot/ # Boot sector and kernel initialization
├── kernel/ # Interrupts, traps, system calls
├── mm/ # Memory management
├── fs/ # Minix filesystem
├── init/ # Kernel entry point (main.c)
├── include/ # Header files
├── lib/ # Utilities
└── tools/ # Boot image generation tools
hdb.img.tar.gz is a pre-built disk image that already includes the shell and command binaries from sh.tar.gz and commands.tar.gz.
You can use it directly without building anything.
The binaries in
commands.tar.gzandsh.tar.gzare sourced from draconux.free.fr.
| Version | |
|---|---|
| OS | Ubuntu 22.04 / 24.04 |
| GCC | 11.04 or later |
| Bochs | 2.6.11 |
sudo apt install -y \
build-essential \
gcc-multilib \
libc-dev \
bin86 \
util-linuxsudo apt install -y \
libsdl2-dev \
libx11-dev \
bison \
nasm \
flex \
pkg-config \
libreadline-dev \
bcc./configure \
--enable-debugger \
--enable-show-ips \
--with-sdl2 --with-x --with-x11 \
--enable-cpu-level=6 \
--enable-all-optimizationscd linux-0.01
make
cd ..make generates an Image file inside linux-0.01/, which is used as the floppy disk image by Bochs.
Using the pre-built image:
tar xzf hdb.img.tar.gzBuilding from scratch:
sudo ./create_hdb.shbochs -q -f bochsrc.txt