This is my solution to labs of 6.828 MIT Operating System Engineering course.
GCC 4.5.1
binutils 2.20.1
GDB 6.8
QEMU 0.12.5(patched, see below)
Most modern Linuxes and BSDs have an ELF toolchain compatible with the 6.828 labs. That is, the system-standard gcc, as, ld and objdump should just work. The 6.828 lab makefile should automatically detect this. However, if your machine is in this camp and the makefile fails to detect this, you can override it by adding the following line to conf/env.mk:
GCCPREFIX=
If you are using something other than standard x86 Linux or BSD, you will need the GNU C compiler toolchain, configured and built as a cross-compiler for the target 'i386-jos-elf', as well as the GNU debugger, configured for the i386-jos-elf toolchain. You can download the specific versions we used via these links, although any recent versions of gcc, binutils, and GDB should work:
Once you've unpacked these archives, run the following commands as root:
# cd binutils-2.20.1 # ./configure --target=i386-jos-elf --disable-nls # make # make install # cd ../gcc-4.5.1 # ./configure --target=i386-jos-elf --disable-nls --without-headers \ --with-newlib --disable-threads --disable-shared \ --disable-libmudflap --disable-libssp # make # make install # cd ../gdb-6.8 # ./configure --target=i386-jos-elf --program-prefix=i386-jos-elf- \ --disable-werror # make # make install
Then you'll have in /usr/local/bin a bunch of binaries with names like i386-jos-elf-gcc. The lab makefile should detect this toolchain and use it in preference to your machine's default toolchain. If this doesn't work, there are instructions on how to override the toolchain inside the GNUmakefile in the labs.
QEMU is a modern and fast PC emulator. QEMU version 0.12.5 is set up on Athena for x86 machines in the 6.828 locker.
Unfortunately, QEMU's debugging facilities, while powerful, are somewhat immature, so we highly recommend you use our patched version of QEMU instead of the stock version that may come with your distribution. The version installed on Athena is already patched. To build your own patched version of QEMU:
./configure [--prefix=PFX] [--target-list="i386-softmmu x86_64-softmmu"]
./configure --disable-sdl [--prefix=PFX] [--target-list="i386-softmmu x86_64-softmmu"]
prefix
argument specifies where to install QEMU;
without it QEMU will install to /usr/local by default. The
target-list
argument simply slims down the
architectures QEMU will build support for.
make && make install
Alternatively, you can download the official 0.12.5 source tarball from the QEMU homepage and apply the following patch series:
debug-seg | Use DS-relative virtual addresses instead of linear addresses in the GDB stub. |
info-mem | Fix "info mem" in the QEMU monitor to not skip the last mapped memory range. |
info-pg | Add "info pg" to the QEMU monitor that prints the page table. |
e100 | Fixes bugs in QEMU's simulated E100 and adds E100 debugging. |
pcap | Adds packet capture support. |
triple | On triple fault, dump state and halt for inspection instead of resetting. |
The MIT License
Copyright (c) <2010> <Bo Xiao>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Bo Xiao
Bo Xiao (mail.xiaobo@gmail.com)
You can download this project in either zip or tar formats.
You can also clone the project with Git by running:
$ git clone git://github.com/imxiaobo/JOS