Skip to content

Latest commit

 

History

History
136 lines (110 loc) · 2.62 KB

README.md

File metadata and controls

136 lines (110 loc) · 2.62 KB

Setting up xv6-labs-2020 Development Environment

Prerequisites

Before starting, ensure you have:

  • Git installed
  • A Unix-like environment (Linux, macOS, or WSL for Windows)
  • At least 1GB of free disk space
  • Internet connection

Required Packages

For Ubuntu/Debian:

sudo apt-get update
sudo apt-get install git build-essential gdb-multiarch qemu-system-misc gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu

For macOS (using Homebrew):

brew tap riscv/riscv
brew install riscv-tools
brew install qemu

Setup Steps

  1. Clone the Repository

    git clone git://g.csail.mit.edu/xv6-labs-2020
    cd xv6-labs-2020
  2. Switch to the Initial Lab Branch (util)

    git checkout util
  3. Test the Installation

    make qemu

    This command will:

    • Compile the xv6 operating system
    • Start QEMU emulator
    • Boot xv6

    If successful, you should see the xv6 boot sequence and a prompt that looks like this:

    xv6 kernel is booting
    
    hart 1 starting
    hart 2 starting
    init: starting sh
    $
    
  4. Exit QEMU

    • Press Ctrl-a then x to exit QEMU
console        3 21 0
$ QEMU: Terminated
(base) ➜  xv6-labs-2020 git:(util) ✗

Development Tips

  1. Using GDB for Debugging In one terminal:

    make qemu-gdb

    In another terminal:

    gdb kernel/kernel
  2. Useful Make Commands

    make clean     # Clean build files
    make           # Build xv6
    make qemu      # Run xv6 in QEMU
    make grade     # Test your implementation (when working on labs)
  3. File Organization

    • kernel/: Kernel source files
    • user/: User programs
    • Makefile: Build configuration

Working on Labs

  1. Each lab has its own branch. To switch to a different lab:

    git fetch
    git checkout [lab-name]
  2. Common lab branches:

    • util
    • syscall
    • pgtbl
    • traps
    • lazy
    • cow
    • thread
    • lock
    • fs
    • mmap
  3. Before starting each lab, make sure to:

    git checkout [lab-name]
    make clean

Submitting Changes

  1. Make your changes in the appropriate files
  2. Test your implementation:
    make grade
  3. Commit your changes:
    git add [modified-files]
    git commit -m "Descriptive message about changes"

Additional Resources