You'll use two sets of tools in this class: an x86 emulator, Bochs, for running your kernel; and a compiler toolchain, including assembler, linker, C compiler, and so forth, for compiling your kernel. Here's the information you'll need to use the versions on SEASnet, or to download and install your own copies. This class assumes familiarity with Unix commands throughout.
Add the directory
Downloading Your Own Copies
The process is pretty easy if you have access to a Unix or Mac OS X machine. It should be possible under Windows, too, with the help of Cygwin. Install cygwin, and be sure to install the flex and bison packages (they are under the development header).
First, choose a prefix, or directory, you'll use for storing the tools.
Good choices include
Before you go any further, make sure that your
The class tools are pretty large. You'll need around 500 MB of space to compile all the tools, but after deleting the sources, the installed executables and libraries take up less than 100 MB. Your mileage may vary.
First, check whether you need to build a GNU C compiler toolchain. If
your native GNU binutils and GCC compiler build for an i386 ELF target
(like most standard Linux and BSD systems), and your GCC is version 3.0 or
higher, you should be able to use the native compiler. To check, run
Otherwise, configure and build the GNU C compiler toolchain as a
cross-compiler for the target '
Unpack these archives, using "
cd binutils-2.15 ./configure --target=i386-jos-elf --prefix=PFX make make install cd ../gcc-3.4.2 ./configure --target=i386-jos-elf --enable-languages=c --prefix=PFX make make install
Depending on the prefix, you may need to be root to run '
You can also download and configure the full
i*86-jos-*) noconfigdirs="$noconfigdirs target-libstdc++-v3" ;;
Next, download, compile, and install Bochs from the source archive. This is the only option if you want to run Bochs under a different OS or on a different architecture; if you download a prebuilt version of Bochs, it will not be compiled with the same options as we use for the class.
The latest stable version of Bochs is 2.1.1, which can be downloaded from the Bochs downoad page. However, this version has some issues where triple faults will cause Bochs to hang. We're currently using a CVS snapshot instead. If you choose to use the CVS snapshot on your home machine, you will need to update the instructions accordingly.
You may also want to run ./configure --help and look at the available options.
tar xzvf bochs-2.1.1.tar.gz cd bochs-2.1.1 ./configure --enable-disasm \ --enable-debugger \ --enable-new-pit \ --enable-all-optimizations \ --enable-4meg-pages \ --enable-global-pages \ --enable-pae \ --disable-reset-on-triple-fault \ --with-all-libs \ --prefix=PFX make make install
Mac OS X note: You may want to run "
ln -sf PFX/share/bochs/BIOS-bochs-latest PFX ln -sf PFX/share/bochs/VGABIOS-lgpl-latest PFX
If you wish to use a different UI than the default one, modify your .bochsrc file accordingly. See the bochsrc documentation. It should also be possible to just run man bochsrc.
If you are compiling on a non-x86 platform or on windows, it may be necessary to remove the --enable-all-optimizations flag.