Install Dependencies
Run the following command to install all required build tools and libraries:
sudo apt-get install -y build-essential libtool* libglib2.0-dev libpixman-1-dev zlib1g-dev git libfdt-dev gcc-multilib gdb python2.7
Install MIT 6.828 Custom QEMU
QEMU is a full-system emulator that can simulate multiple CPU architectures, similar to tools like Bochs or PearPC. For MIT's 6.828 course, we use a customized QEMU variant optimized for the curriculum.
Clone the Custom Repository
git clone https://github.com/mit-pdos/6.828-qemu.git qemu-6.828
Compile and Install
First, navigate into the cloned directory:
cd qemu-6.828
Configure the build to disable strict error checking (to avoid common compilation issues), target only x86-based system emulatosr, and specify Python 2.7 as the required runtime:
./configure --disable-werror --target-list="i386-softmmu x86_64-softmmu" --python=python2.7
Compile and install QEMU using parallel builds for faster execution:
make -j$(nproc) && sudo make install
Troubleshooting Common Issues
- Python 2.7 Missing Error: If you see
ERROR: Python not found. Use --python=/path/to/python, ensure Python 2.7 is installed (included in the initial dependency command) and that the--python=python2.7flag is included in the configure step. - Libtool Build Errors: The
libtool*package in the dependency install covers all required libtool components. If you encounter "disabling libtool due to broken toolchain suppport", re-run the initial apt command to ensure full libtool installation. - Format Truncation Warnings: To suppress
format-truncationerrors during copmilation, use the--disable-werrorflag in the configure command (as included above) or manually remove the-Werrorflag from theconfig-host.makfile in the QEMU directory if needed. - Missing Header in QGA: If compilation fails due to a missing
sys/sysmacros.h, add#include <sys/sysmacros.h>immediately after#include <sys/types.h>in theqga/commands-posix.cfile.
Test the Setup (Optional)
For MIT 6.828 course usage, verify your setup with the course's JOS framework:
git clone https://pdos.csail.mit.edu/6.828/2018/jos.git lab-jos
cd lab-jos
make && make qemu
A successful launch will open the QEMU emulator with the JOS kernel running.