├── .gitmodules ├── Dockerfile └── README.md /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "xv6-public"] 2 | path = xv6-public 3 | url = https://github.com/mit-pdos/xv6-public 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | RUN apt-get -qq update && \ 4 | apt-get install -yq tzdata && \ 5 | ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \ 6 | dpkg-reconfigure -f noninteractive tzdata 7 | 8 | RUN apt-get install -y \ 9 | build-essential \ 10 | gdb \ 11 | gcc-multilib-x86-64-linux-gnu \ 12 | tmux \ 13 | qemu-system-x86 \ 14 | gawk \ 15 | expect 16 | 17 | ADD ./xv6-public /xv6-public 18 | 19 | WORKDIR /xv6-public 20 | 21 | ENV TOOLPREFIX=x86_64-linux-gnu- 22 | 23 | CMD ["/bin/bash"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WARNING: This repo still uses the (now deprecated) x86 version of xv6. It was developed to make playing around with the code a bit easier for Mac users, but the riscv version of xv6 can be run much more easily on Mac now than the x86 version. 2 | 3 | 4 | # xv6-docker 5 | Follow along with the MIT Operating Systems course (https://pdos.csail.mit.edu/6.828/2017/) for learning more about kernel and os development. This repo contains a dockerized environment for developing and debugging to xv6 kernel, with a few utilities to make things easier to get started. 6 | 7 | ## Getting Started 8 | 9 | I've created a fork of the os source and linked as a submodule. To grab the source, update this dependency: 10 | ```bash 11 | git submodule update --init --recursive 12 | ``` 13 | The next step is to build the docker image. This will pull the required dependencies for compiling the xv6 source, grab/build the patched version of qemu for running the kernel and copy the linked source files into the container. Installing all the dependencies and compiling qemu takes a while, but it only has to be done once. 14 | 15 | ```bash 16 | docker build -t xv6 . 17 | ``` 18 | 19 | There are a few ways to run the kernel, depending on how you want to edit the source, run qemu, etc. 20 | 21 | To just run the image, without mounting any of the source for local editing, do the following: 22 | 23 | ```bash 24 | docker run --rm -it xv6 25 | ``` 26 | 27 | This will launch a shell inside the container connected to your terminal. Note that any changes you make to the source code will not be persisted across container re-starts. To edit the files locally, run the following: 28 | 29 | ```bash 30 | docker run --rm -it -v $PWD/xv6-public:/xv6-public xv6 31 | ``` 32 | 33 | You'll notice from the Dockerfile that tmux was added as an extra utility. This facilitates launching both qemu and gdb from seperate windows/panes for quickly inspecting instructions as the kernel is running. 34 | 35 | 36 | ## TODO 37 | - Add support for qemu graphical display (low priority) 38 | - Remove tmux from the container and run locally, connected to the container for persisting sessions 39 | 40 | 41 | 42 | 43 | 44 | --------------------------------------------------------------------------------