xv6 Operating System Setup
An enterprise-grade, comprehensive guide to configuring, compiling, and running MIT's Unix-like teaching operating system (RISC-V architecture) on modern Linux distributions (Ubuntu 24.04/26.04, Fedora, Debian, Arch) within VMware Workstation Pro and QEMU.
Introduction
xv6 is a modern re-implementation of Dennis Ritchie's and Ken Thompson's Unix Version 6 (v6) written in ANSI C for modern multi-core RISC-V and x86 architectures. Developed by MIT for pedagogical use in courses such as 6.S081 / 6.828 (Operating System Engineering), xv6 preserves the clean, elegant structure of original Unix while adopting modern concurrency primitives, page tables, and virtual memory management.
This documentation provides an end-to-end blueprint for building a completely virtualized build and runtime environment from scratch.
System Requirements
- Host OS: Windows 10/11, macOS (Intel/Apple Silicon), or Linux
- CPU: 64-bit x86-64 or ARM64 processor with Virtualization (VT-x/AMD-V/SVM) enabled in BIOS
- RAM: Minimum 8 GB total system RAM (4 GB allocated to Linux Guest)
- Disk Space: 30 GB free storage (SSD strongly recommended)
- Internet: Active connection for downloading dependencies and cross-compilers
Broadcom Licensing Update & Download Link
Broadcom made VMware Workstation Pro 100% FREE for personal, educational, and commercial evaluation use without requiring a paid commercial license key! You no longer need to settle for basic Player builds.
Official VMware Workstation Pro Download Links
Download directly from the official Broadcom Desktop Hypervisor Portal:
- Broadcom Official Downloads Portal: vmware.com/products/desktop-hypervisor/workstation-and-fusion
- Windows Package Manager (CLI): Run
winget install VMware.WorkstationProin Windows PowerShell.
Best Settings Guidance for VMware Workstation Pro
For maximum performance when running QEMU and compiling kernel source code inside the VM, configure these optimal settings:
- • Processors: Allocate 4 Cores (1 Socket x 4 Cores or 2 Sockets x 2 Cores)
- • Nested Virtualization: Check Virtualize Intel VT-x/EPT or AMD-V/RVI
- • CPU Counters: Check Virtualize CPU Performance Counters
- Why: Enables full hardware speed inside QEMU emulator.
- • Minimum Allocation: 4096 MB (4 GB)
- • Recommended Allocation: 8192 MB (8 GB) if host has 16GB+ RAM
- • Memory Management: Enable "Fit all virtual machine memory into reserved host RAM"
- • Disk Capacity: 30 GB minimum (SSD host location)
- • Virtual Disk Type: NVMe or SCSI (Faster I/O)
- • Disk Format: "Store virtual disk as a single file" (30% faster build compilation)
- • Network Adapter: NAT Mode (Simplest for internet updates without IP conflicts)
- • Display / GPU: Accelerate 3D Graphics (Allocate 2GB VRAM) for fluid window management
- • Guest Isolation: Enable Copy/Paste & Drag-and-Drop via
open-vm-tools-desktop
Supported Linux Distributions & Version Choices
While Ubuntu Desktop LTS is the recommended standard for MIT xv6 development, you can use any modern 64-bit Linux distribution:
Ubuntu 24.04 / 26.04 LTS
Recommended. Pre-packaged RISC-V cross-compilers available via default apt repos.
Fedora 40 / 41 / 42
Latest toolchain binaries available via dnf. Fast compilation performance.
Debian 12 / 13 (Bookworm/Trixie)
Ultra-stable minimal environment. Uses identical apt toolchain packages as Ubuntu.
Step-by-Step Creation Wizard
- Open VMware Workstation Pro and click File -> New Virtual Machine (Ctrl+N).
- Select Typical (Recommended) wizard mode.
- Choose Installer disc image file (iso) and browse to your downloaded ISO file.
- Enter your Full Name, Username, and Password in the Easy Install prompt.
- Assign 30 GB disk space and choose Store virtual disk as a single file.
- Click Customize Hardware and apply the recommended settings (4 CPU Cores, VT-x enabled, 4-8 GB RAM).
OS Installation Flow
Boot the Virtual Machine, select Install Ubuntu / Fedora, choose "Minimal Installation" to conserve space and reduce background package telemetry, check "Download updates while installing", and complete setup.
Refresh local package indexes and upgrade system libraries to prevent broken toolchain dependencies.
Multi-Distro Package Installation Guide
Select the exact installation command according to your installed Linux distribution:
Fetch official source tree from MIT's PDOS GitHub account.
Compilation Process & Compiler Flags
Executing make initiates the Makefile build process:
- GCC Cross Compilation: `.c` and `.S` files are compiled into RISC-V object (`.o`) files.
- Linking (`ld`): Linked into kernel ELF image
kernel/kernel. - User FS Image (`mkfs`): Packages user utilities into
fs.imgdisk image.
Crucial Fix for Modern GCC (Ubuntu 24.04 / GCC 13+)
Newer GCC compilers (GCC 13, 14, 15) trigger strict warnings that fail compilation due to -Werror in MIT's Makefile. If standard make fails, pass TOOLPREFIX and disable error-on-warning:
make TOOLPREFIX=riscv64-linux-gnu- CFLAGS="-Wall -O -fno-omit-frame-pointer -ggdb -mno-relax -mcmodel=medany -Wno-error"
Boot Sequence & Virtualization Mechanics
When running make qemu, QEMU boots OpenSBI firmware, loads the xv6 kernel into RAM at 0x80000000, initializes drivers, and starts user shell (`sh`).
Exit Shortcut
To exit QEMU back to Linux terminal, press: Ctrl + A followed immediately by X.
Execute standard system calls and user programs inside the running xv6 shell prompt (`$`):
Troubleshooting & Distro Errors (30+ Failure Cases)
Search or expand common failure cases across installation, modern GCC versions (GCC 13/14/15), distro package differences, and QEMU setup:
Cause: Modern GCC compilers shipped in Ubuntu 24.04/26.04 apply strict static analysis. Warnings like infinite recursion or array-bounds fail the build due to -Werror in Makefile.
Fix: Execute build with -Wno-error or modify CFLAGS in Makefile:
make CFLAGS="-Wall -O -fno-omit-frame-pointer -ggdb -mno-relax -mcmodel=medany -Wno-error"
Cause: Ubuntu/Debian packages name the compiler binary riscv64-linux-gnu-gcc instead of riscv64-unknown-elf-gcc.
Fix: Pass the TOOLPREFIX variable when invoking make:
make TOOLPREFIX=riscv64-linux-gnu-
Cause: Ubuntu 24.04 restricts unprivileged user namespaces by default, which can block QEMU tap interfaces or sandboxing.
Fix: Temporarily disable restriction in sysctl:
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
Cause: Default Wayland desktop session in Ubuntu 24.04 blocks VMware Tools clipboard sync.
Fix: Install open-vm-tools-desktop and log in choosing "Ubuntu on Xorg" at the gear icon on login screen:
sudo apt install -y open-vm-tools-desktop
Frequently Asked Questions (20+)
Yes! Broadcom updated VMware Workstation Pro licensing to make it 100% free for personal, educational, and commercial evaluation use without requiring a commercial license key.
Original xv6 was written for 32-bit x86 Intel architectures. MIT updated xv6 to 64-bit RISC-V (`rv64gc`) because RISC-V features a clean, reduced instruction set without legacy x86 debt.
About xv6 Subsystem Architecture
The xv6 kernel source code is deliberately kept under 10,000 lines of clean C code divided into modular core subsystems:
Virtual Memory
Sv39 MMU page tables, Kernel page table creation, and user space copyin/copyout routines.
Processes & Traps
Process lifecycle management, trap handling vectors, timer interrupts, and context switching (swtch.S).
File System
5-layer file system: Buffer Cache -> Logging -> Inodes -> Directories -> File Descriptors.