<HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Author" CONTENT="Kevin Lawton"> <TITLE>Compiling and Installing Bochs</TITLE> </HEAD> <BODY TEXT="#000000" BGCOLOR="#ececec" LINK="#3333cc" VLINK="#666666"> <H1>Compiling and Installing Bochs</H1> <UL> <LI> <A HREF="#Getting current source code">Getting current source code</A> </LI> <LI> <A HREF="#Compiling source code">Compiling source code</A> </LI> <LI> <A HREF="#Setting up environment">Setting up environment before running</A> </LI> <LI> <A HREF="#Bochsrc file options">Bochsrc file options</A> </LI> <LI> <A HREF="#Command line options">Bochs command line options</A> </LI> <LI> <A HREF="#Installing an OS">Installing an OS (DOS/Win'95/Minix/Linux) within Bochs</A> </LI> <LI> <A HREF="changelog.html">ChangeLog</A> </LI> <LI> <A HREF="debugger.html">Optional command line debugger</A> </LI> <LI> <A HREF="cosimulation.html">Optional cosimulation debugger</A> </LI> <LI> <A HREF="instrumentation.html">Instrumentation</A> </LI> <LI> <A HREF="mtools.html">mtools: utilities to access DOS disks in Unix</A> </LI> </UL> <BR> <UL> <LI> <A HREF="http://www.gnu.org/copyleft/lesser.html">LGPL License</A> </LI> <LI> <A HREF="3rdparty.license.html">3rd Party Software Licensing and Temporary Files</A> </LI> <LI> <A HREF="developers.html">Bochs source code developers email mailing list</A></LI> <LI> <A HREF="features.html">Summary of current Bochs supported features</A></LI> <LI> <A HREF="#Keyboard Hacks">X11 Keyboard Hacks</A></LI> </UL> <HR WIDTH="100%"> <H2> <A NAME="Getting current source code"></A>Getting current source code </H2> Source code for Bochs, is available from the Bochs home page at <a href="http://bochs.sourceforge.net">bochs.sourceforge.net</a>. You can download the most recent release, or use CVS to check out the latest sources. The releases are the most likely to compile and run without modification, but if you want the very newest features try CVS instead. <HR WIDTH="100%"> <H2> <A NAME="Compiling source code"></A>Compiling source code </H2> All releases are gzip'd tar files. That means the whole Bochs source code directory has been consolidated into one file using the Unix command 'tar', then compressed to save space with GNU 'gzip'. To extract the source code, you'll need both 'tar' and 'gzip/gunzip'. All files are contained within one subdirectory named 'bochs-YYMMDDv'. <PRE> cd /path/parent-directory gzip -dc bochs-YYMMDDv.tar.gz | tar -xvf - cd bochs-YYMMDDv </PRE> Before compiling, you'll need to run the configure script, which will configure source code to run on your system, and with your chosen options. There are many options to 'configure', and you probably don't need any of them. For example, if you run BeOS, specify '--with-beos' to configure. To see a complete list: <PRE> unix-> ./configure --help </PRE> For more complete documentation of options available to configure, click on <a href="configure.html">this link</a>. <p> You will also need to set environment variables to tell configure what compiler and options to use. Check out <a href="configure.html">this link</a>. It's the same as the one above. <p> Now run configure, be it manually or by way of a script file. <PRE> unix-> ./configure -or- unix-> ./.conf.x86 </PRE> <P>If the configure script bombs, check 'config.log'. Specifically, look for errors returned by the compiler. You may have options incompatible with your compiler. See the link on setting the environment variables above. <P> Assuming at this point all went well with the configure command, edit the file 'config.h', which was generated by ./configure. Look for the USER CONFIGURABLE OPTIONS section. Each parameter available for editing is documented. Generally the defaults are fine for typical users. Please read about each parameter and edit carefully. <B>NOTE:</B> This file is generated, and will be deleted if you run 'make dist-clean'. <P> You may now compile the source. <PRE> unix-> make </PRE> <p> There are <a href="win32.html">separate instructions</a> for compiling in Windows. <p> <HR WIDTH="100%"> <H2> <A NAME="Setting up environment"></A>Setting up environment before running </H2> In text mode, Bochs requires your X server to have access to the VGA font. If you don't already have it, you must install it from one of the font files in bochs-yymmdd/font. <P> There are two options; you may install the VGA font in a global place, or in a local directory. You may need to install it locally if you don't have root access. If the VGA font is not installed properly, you will get the error, "Could not open vga font". <P> <B>Option 1: installing VGA font in global font directory</B> <PRE> # NOTE1: Make sure your DISPLAY variable points to local machine. # NOTE2: These steps require root privileges. # NOTE3: Your X11 fonts path will vary on different systems. For example: # Solaris 2.x /usr/openwin/lib/X11/fonts # Linux /usr/lib/X11/fonts/ root-> cp font/vga.pcf font-path-here/misc root-> compress font-path-here/misc/vga.pcf root-> mkfontdir font-path-here/misc root-> xset fp rehash root-> /etc/rc.d/init.d/xfs restart (Restart your X font server) </PRE> The command to restart the X font server is given for Redhat systems, but it will vary between different machines, and might not even be necessary at all. If you cannot figure out how to restart your font server, you can just reboot. <p> <B>Option 2: installing VGA font in local font directory</B> <PRE> # NOTE1: Make sure your DISPLAY variable points to local machine. # NOTE2: The "xset" command needs to be run for each X session. user-> mkfontdir bochs-YYMMDD/font user-> xset fp+ [full-path]/bochs-YYMMDD/font </PRE> <A NAME="Creating a hard disk image file"></A> <B>Hard Drive Image File: </B> Bochs emulates a hard drive by using a large Unix file, which you must create. The size of the hard drive is dependent upon the number of cylinders, heads, and sectors-per-track that you would like to emulate. Here are some examples of possible drive geometries: <BR> <BR> <TABLE BORDER COLS=5 WIDTH="100%" > <TR> <TH>Size</TH> <TH>Cylinders</TH> <TH>Heads</TH> <TH>Sectors/Track</TH> <TH>Sectors Total</TH> </TR> <TR> <TD>10MB</TD> <TD>306</TD> <TD>4</TD> <TD>17</TD> <TD>20808</TD> </TR> <TR> <TD>20MB</TD> <TD>615</TD> <TD>4</TD> <TD>17</TD> <TD>41820</TD> </TR> <TR> <TD>30MB</TD> <TD>615</TD> <TD>6</TD> <TD>17</TD> <TD>62730</TD> </TR> <TR> <TD>46MB</TD> <TD>940</TD> <TD>6</TD> <TD>17</TD> <TD>95880</TD> </TR> <TR> <TD>62MB</TD> <TD>940</TD> <TD>8</TD> <TD>17</TD> <TD>127840</TD> </TR> <TR> <TD>112MB</TD> <TD>900</TD> <TD>15</TD> <TD>17</TD> <TD>229500</TD> </TR> <TR> <TD>126MB</TD> <TD>256</TD> <TD>16</TD> <TD>63</TD> <TD>258048</TD> </TR> <TR> <TD>483MB</TD> <TD>1024</TD> <TD>15</TD> <TD>63</TD> <TD>967680</TD> </TR> <TR> <TD>504MB</TD> <TD>1024</TD> <TD>16</TD> <TD>63</TD> <TD>1032192</TD> </TR> <TR> <TD>640MB</TD> <TD>1300</TD> <TD>16</TD> <TD>63</TD> <TD>1310400</TD> </TR> <TR> <TD>886MB</TD> <TD>1800</TD> <TD>16</TD> <TD>63</TD> <TD>1814400</TD> </TR> <TR> <TD>1280MB</TD> <TD>2600</TD> <TD>16</TD> <TD>63</TD> <TD>2620800</TD> </TR> <TR> <TD>2215MB</TD> <TD>4500</TD> <TD>16</TD> <TD>63</TD> <TD>4536000</TD> </TR> <TR> <TD>3495MB</TD> <TD>7100</TD> <TD>16</TD> <TD>63</TD> <TD>7156800</TD> </TR> <TR> <TD>5020MB</TD> <TD>10200</TD> <TD>16</TD> <TD>63</TD> <TD>10281600</TD> </TR> <TR> <TD>7088MB</TD> <TD>14400</TD> <TD>16</TD> <TD>63</TD> <TD>14515200</TD> </TR> <TR> <TD>10041MB</TD> <TD>20400</TD> <TD>16</TD> <TD>63</TD> <TD>20563200</TD> </TR> <TR> <TD>12206MB</TD> <TD>24800</TD> <TD>16</TD> <TD>63</TD> <TD>24998400</TD> </TR> <TR> <TD>16045MB</TD> <TD>32600</TD> <TD>16</TD> <TD>63</TD> <TD>32860800</TD> </TR> <TR> <TD>20672MB</TD> <TD>42000</TD> <TD>16</TD> <TD>63</TD> <TD>42336000</TD> </TR> <TR> <TD>25003MB</TD> <TD>50800</TD> <TD>16</TD> <TD>63</TD> <TD>51206400</TD> </TR> <TR> <TD>29974MB</TD> <TD>60900</TD> <TD>16</TD> <TD>63</TD> <TD>61387200</TD> </TR> <TR> <TD>32238MB</TD> <TD>65500</TD> <TD>16</TD> <TD>63</TD> <TD>66024000</TD> </TR> </TABLE> <BR> For hard disk sizes larger than 528MB, be sure that newharddrivesupport is enabled. This will be the compiled default in a future release, but for now your .bochsrc still needs the line "newharddrivesupport: enabled=1" in order to support >1024 cylinders. <p> Pick the size of the hard drive you want to emulate, and create a blank file according to the parameters in the table. If you have the 'dd' command, you can use it to create the file. Keeping in mind that there are 512 bytes in a sector, just use the number of "Sectors Total" from the table as the 'count=' option to dd, and tell dd to use a block size ('bs=') the same as a disk sector size (512). For example, for a 112MB drive, there are 229500 (900*15*17) sectors. <PRE> unix-> dd if=/dev/zero of=112M bs=512 count=229500 </PRE> <A NAME="Creating a floppy image file"></A> <B>Floppy Disk Image File:</B> Bochs emulates a floppy drive/disk using either a Unix file, or a real floppy drive Unix device. To use either, you will need an entry in your '.bochsrc' file pointing to the regular or device file. Use the 'floppya:' and 'floppyb:' directives. If you are starting out, you will need to make a copy of an <I>existing</I> bootable floppy. Otherwise, you may create a <I>blank</I> image file, if you intend on formatting it using the OS you boot within Bochs. <BR> <BR> <TABLE BORDER COLS=5 WIDTH="100%" > <TR> <TH>Size</TH> <TH>Cylinders</TH> <TH>Heads</TH> <TH>Sectors/Track</TH> <TH>Sectors Total</TH> </TR> <TR> <TD>0.720MB</TD> <TD>80</TD> <TD>2</TD> <TD>9</TD> <TD>1440</TD> </TR> <TR> <TD>1.2MB</TD> <TD>80</TD> <TD>2</TD> <TD>15</TD> <TD>2400</TD> </TR> <TR> <TD>1.44MB</TD> <TD>80</TD> <TD>2</TD> <TD>18</TD> <TD>2880</TD> </TR> <TR> <TD>1.680MB</TD> <TD>80</TD> <TD>2</TD> <TD>21</TD> <TD>3360</TD> </TR> </TABLE> <BR> <BR> To create a <I>blank floppy image file</I>, you can use the same concept as above for creating blank hard disk image files. For example, to create a blank 1.44MB floppy image file: <PRE> unix-> dd if=/dev/zero of=1.44M bs=512 count=2880 </PRE> To create a <I>copy of an existing floppy disk</I>, granted you have a floppy disk drive on your workstation, you can use one of the following commands, where '/dev/fd0' would be the path to your floppy drive device name. <P><B>NOTE:</B> If your system uses a form of volume management to automount your floppy drive, you may have to tell it you popped in a new floppy, and use an alternative device name to access it. </P> <PRE> # Linux, direct use of floppy drive using 'dd' unix-> dd if=/dev/fd0 ibs=512 of=1.44M --or-- # Linux, direct use of floppy drive using 'cp' unix-> cp /dev/fd0 1.44M --or-- # With Volume Management handling floppy drive Solaris 2.x-> volcheck Solaris 2.x-> dd if=/vol/dev/aliases/floppy0 ibs=512 of=1.44M </PRE> <HR WIDTH="100%"> <H2> <A NAME="Bochsrc file options"></A> Bochsrc file options </H2> There are many options which you can change, to alter the behaviour of bochs, enable features, etc. You can set values for these options in a file called <B>".bochsrc"</B>. There should be a reference file with this name, that comes with the source code distribution. As, it's easier to maintain documenting possible commands in the file itself, look in the reference file for more info. <P> Search Order: <UL> <LI>bochs first tries to find this file in your current directory <LI>bochs then tries to find this file in your home directory <LI>bochs then gives up and doesn't use one. </UL> <B>Note:</B> These options are overridden by any command line options you provide <HR WIDTH="100%"> <H2> <A NAME="Command line options"></A> Bochs command line options </H2> You may now pass all options available in the ".bochsrc" file, to bochs on the command line. Syntax for command line options is now identical to directives in ".bocshrc". Old command line options, such as <B>-bootC</B> are no longer valid. Bochs expects that each option is passed as a single argument, so if you need to use spaces, surround the option in quotes. For example: <PRE> bochs boot:c bochs "boot: c" "diskc: file=../10M.vga, cyl=306, heads=4, spt=17" bochs romimage:/tmp/someimage </PRE> <B>Note:</B> Look in the reference ".bochsrc" for syntax <HR WIDTH="100%"> <H2> <A NAME="Installing an OS"></A> Installing an OS (DOS/Win'95/Minix/Linux) within Bochs </H2> The goal of Bochs is to emulate the components of a basic PC (CPU, BIOS, disk drive, floppy, keyboard, VGA, and other chipsets) well enough to allow for multiple Operating Systems to run within the emulator. So far, Bochs has been successful in running several OS's at one time or the other. Follow the link of your choice to learn how to install the OS of your interest. <UL> <!-- <LI> <A HREF="DOS.html">DOS</A> </LI> <LI> <A HREF="Windows31.html">Windows 3.1</A> </LI> --> <LI> <A HREF="Windows95.html">Windows '95</A> </LI> <LI> <A HREF="Minix.html">Minix</A> </LI> <LI> <A HREF="Linux.html">Linux</A> </LI> <LI> <A HREF="OldWindows95.html">Deprecated Win95 install instructions</A> </LI> <LI> <A HREF="guestNT.html">WinNT 4.0</A> </LI> <LI> <A HREF="hurd.html">Hurd</A> </LI> </UL> <HR WIDTH="100%"> <H2> <A NAME="Keyboard Hacks">X11 Keyboard Hacks</A> </H2> <PRE> NOTE: your backspace key may not work properly. You may have to source the file 'misc/xmods' in the main distribution directory. I need to look at this problem a little more. Using Ctrl-h always seems to work for me. <PRE </BODY> </HTML>