-
Install Docker Desktop for your platform.
-
Instructions are available here.
-
Make sure that the Docker Engine/daemon is updated and running.
-
Make these OS-specific configuration changes:
- On macOS: enable the VirtioFS file sharing implementation in the settings
- On Windows: enable the WSL2 engine in the settings
-
-
Install Dev Containers extension for VSCode.
-
Further reading on developing inside a container can be found on VSCode's official documentation.
-
This is also a part of the Remote Development extension pack for VSCode, which you may find useful.
-
-
Obtain a compatible Docker container for your system, by either:
-
Recommended: Use one of the pre-built Docker containers provided by the course:
-
X86_64:
ubuntu_i386cross-x86_64.tar.xz -
ARM64:
ubuntu_i386cross-arm64.tar.gz
-
-
Alternatively: Build your own container from the
Dockerfileprovided in this repository, instructions available below.
-
-
Load the Docker container tarball using a command like this:
-
For Intel x86 platform:
docker load --input ubuntu_i386cross-x86_64.tgz -
For ARM-based platform:
docker load --input ubuntu_i386cross-arm64.tgz
You can run
docker image lsto check that the image is correctly loaded. Check for a tag that saysubuntu_i386cross...; this will be relevant when setting up a Dockerfile for your development container.Once you load the tarball, you can delete it to reclaim storage space.
-
-
In the root folder of your checked-out Pintos Git repository
cs124-YYYYsp-TEAMNAMEfolder (the folder that contains./specs,./src,./tests,LICENSE, etc.), create two new files:-
File
.devcontainer/Dockerfilewith contents:FROM ubuntu_i386cross -
File
.devcontainer/devcontainer.jsonwith contents:{ "name": "Ubuntu", "build": { "dockerfile": "Dockerfile" } }
-
-
Using the VSCode Dev Containers plugin, reopen the project in the container. If you have completed the previous steps before opening the project in VSCode, you may be prompted to do this automatically.
-
You can use the blue remote button
><on the bottom left of the VSCode window, or open up theView > Command Paletteand search forDev Containers: Reopen in Container. -
When this is successfully done and you are inside the Docker container in VSCode, you will see
Dev Container: Ubuntuin the blue ribbon on the bottom left.
-
-
You can now open a Terminal window in VSCode, and you should see a prompt like
root@<somehash>:/workspaces/<your_project_path>. -
Inside your Docker container instance (i.e. in this Terminal window), edit your
~/.bashrcfile such that the PATH includes your project’ssrc/utilsfolder. An example of doing that would to be append this to your~/.bashrcfile:export PATH=$PATH:/workspaces/<your_project_path>/src/utils
(Replace
<your_project_path>with whatever your repository name is.After this, reload your
~/.bashrcusing the commandsource ~/.bashrc. -
From now on, you can do all your testing in the container. Try
make checkorpintoscommands to make sure it works.NOTE: Use the non-GUI invocation of
pintoswithin the container to avoid confusing output. For example, to run thealarm-multipletest, usepintos -v -- run alarm-multiple, notpintos run alarm-multiple.-
The provided container only has the minimum necessary tools to compile and test PintOS. You may want to install other useful system tools such as
git,vim,hh, etc. in the container. This can be done withapt install gitfor example. If you believe that we should bundle other packages in the image, please let us know. -
To make sure everything works fine, you should
cd src/threadsand runmake check.
-
| Tools | Version |
|---|---|
| Binutils | 2.38 |
| GCC | 12.1.0 |
| GDB | 12.1.0 |
| Bochs | 2.6.11 + Patches |
This repository includes a Dockerfile that is used to build the container.
-
You can build it using this command. Keep in note that the corresponding
Dockerfilemust be in the.(current) directory.docker build -t ubuntu_i386cross --progress=plain .This can take up to 20 minutes or longer to build (i9-9880H CPU @ 2.30GHz, 16GB RAM) and can take up to 3GB of storage. The build process requires 7GB of storage. Docker will build the tools in 2 stages:
-
Build the cross-compilation tools to the
i386-elfarchitecture with all of the dependencies. -
Transfer only the build artifacts and installs the necessary tools for development (
build-essentialandqemu-system-i386).
-
-
Once it is complete, you should run
docker image lsto find an entry with the nameubuntu_i386cross. (NOTE: The "IMAGE ID" value will be different.)REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu_i386cross latest 1d5542e7ef09 11 seconds ago 2.27GB -
The image can be saved into a compressed tarball using the following command. Note the use of
uname -mto incorporate the machine architecture into the generated filename; you can rununame -mby itself first to see if it generates reasonable and expected output.# Create a gzipped tarball (worse compression ratio, faster) docker save ubuntu_i386cross | gzip > ubuntu_i386cross-`uname -m`.tgz
Gzip is fast and achieves a reasonable compression level; if you want to achieve higher compression rates then use the
xzcompression utility.# Create a xz-compressed tarball (high compression ratio, slower, requires xz-tools) docker save ubuntu_i386cross | xz > ubuntu_i386cross-`uname -m`.txz
-
You can then integrate the container into your workflow of choice.