![]() |
CS 235 Advanced Operating Systems, Fall 2005ToolsYou'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. Using SEASnetAdd the directory Downloading Your Own CopiesThe 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. Compiler ToolchainFirst, 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.16.1 ./configure --target=i386-jos-elf --prefix=PFX make make install cd ../gcc-3.4.4 ./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" ;; Bochs EmulatorNext, download, compile, and install Bochs from the source archive. (If you download a prebuilt version of Bochs, it will not be compiled with the same options as we use for the class.) Download Bochs 2.2.1 from the Bochs download page; a copy is also available here. Also download this patch file, which will let you set memory watch points in device memory. Save the patch file as ~/bochs-watch.patch . Configure and install as follows: gzcat bochs-2.2.1.tar.gz | tar xf - cd bochs-2.2.1 patch -p0 < ~/bochs-watch.patch ./configure --enable-disasm \ --enable-debugger --enable-x86-debugger \ --enable-iodebug --enable-instrumentation \ --enable-new-pit --disable-reset-on-triple-fault \ --enable-4meg-pages --enable-pae --enable-global-pages \ --enable-all-optimizations --with-all-libs \ --prefix=PFX make make install You may also want to run ./configure --help and look at the available options. Mac OS X note: Try the following
./configure line instead:
./configure --with-x11 --with-nogui --disable-cdrom \ --enable-disasm \ --enable-debugger --enable-x86-debugger \ --enable-iodebug --enable-instrumentation \ --enable-new-pit --disable-reset-on-triple-fault \ --enable-4meg-pages --enable-pae --enable-global-pages \ --enable-all-optimizations --with-all-libs \ --prefix=PFXI had problems getting Bochs to compile. If you see many errors in a file like wx.cc or wxdialogs.cc, then you must edit the configure script. Look for a line that says "with_wx=yes", and change it to say "with_wx=no". Then run ./config.status --recheck, ./config.status, and make clean, and try again to make. Other
./configure flags: Some of our
challenge problems may require adding other flags to Bochs's
./configure line. For instance, to add VGA support, configure
with --enable-vbe .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. QEMU EmulatorThe QEMU Emulator is much, much faster than bochs, and has a slightly slicker GUI. However, it is not quite as mature, and may have problems with our kernel depending on your platform. The QEMU command line that most resembles our bochs setup is this: qemu -hda obj/kernel.img -parallel stdio (In later labs, you'll add an -hdb obj/fs.img argument.) The QEMU monitor, which is like the Bochs internal debugger, is accessible by pressing Ctrl-Alt-2 inside the QEMU window; return to normal display with Ctrl-Alt-1. QEMU tends to take control of your mouse given any opportunity. If you can't find a mouse pointer, check the QEMU title bar for text like "Press Ctrl-Alt to exit grab"; if it's there, press Ctrl-Alt to regain control. |