How to Set Up and Run
The Bochs Emulator
on a Windows PC
This Page is New and
Under Contruction !!!
Almost a decade ago, we explained how BOCHS could be used to learn Linux commands on a Windows PC. Well,
we're far overdue in helping our readers learn how to use the Bochs Emulator to understand Master Boot Records!
Although the Bochs Emulator has binaries and source code for a number of different OS Platforms (such as Linux), the following describes how Microsoft® Windows users in particular can set up and run various image files of other operating systems under the Bochs Emulator. First, download the latest Windows 32-bit Bochs install file. This Sourceforge page will automatically find it on a site near you:
Our copy of the Bochs-2.5.1.exe download file is 4,001,273 bytes (3.81 MiB; which can also be opened by the free 7-Zip program to inspect its contents). Bochs is easy on the Registry when installed, setting only an uninstall and file association for its ".bxrc" Configuration files; which then have a little 'box' icon next to them). The default install location: "C:\Program Files\Bochs-2.5.1\" has a number of subdirs, but it defaults to not installing 'dlxlinux,' so make sure you check the box for DLX part way through the install process, since we'll be using DLX to check your Bochs install. Its 'docs' folder includes HTML documentation, of which only parts of the "User Guide" will likely be helpful. You can read more about Bochs here: http://bochs.sourceforge.net/.
After you install Bochs, click on the new "Linux Demo in Bochs 2.5.1" icon (a 'shortcut' to run.bat in the dlxlinux subfolder under Bochs-2.5.1). This will open both the "Bochs for Windows - Console" and the "Bochs for Windows - Display" in which you'll see the Bochs Emulator run through its own BIOS code similar to a real PC:
If you pressed the F12 key soon enough (start right after clicking on the icon to be sure), you would see the following appear in the Bochs for Windows Display:
Press F12 for boot menu.
Select boot device:
2. Hard Disk
This can be useful if you include a Floppy diskette image file in the Configuration file. Of course, without it, or a CD-ROM image file referenced there, pressing a '1' or '3' will simply result in an error message before Bochs moves on to booting from the hard disk. After Bochs starts booting from the DLX disk image file, you'll see the following scroll by on the display:
LILO boot: Loading linux...... Uncompressing Linux...done. Now booting the kernel Console: 16 point font, 400 scans Console: colour VGA+ 80x25, 1 virtual console (max 63) Calibrating delay loop.. ok - 3.97 BogoMIPS Memory: 31168k/32768k available (612k kernel code, 384k reserved, 604k data) Swansea University Computer Society NET3.034 for Linux 1.3.77 NET3: Unix domain sockets 0.12 for Linux NET3.033. Swansea University Computer Society TCP/IP for NET3.034 IP Protocols: ICMP, UDP, TCP Checking 386/387 coupling... Ok, fpu using exception 16 error reporting. Checking 'hlt' instruction... Ok. Linux version 1.3.89 (root@merlin) (gcc version 2.7.2) #1 Mon Apr 15 19:46:15 ME T DST 1996 Serial driver version 4.11a with no serial options enabled tty00 at 0x03f8 (irq = 4) is a 16550A PS/2 auxiliary pointing device detected -- driver installed. loop: registered device at major 7 hda: Generic 1234, 10MB w/256kB Cache, LBA, CHS=306/4/17 ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 Floppy drive(s): fd0 is 1.44M, fd1 is 1.44M Started kswapd v 188.8.131.52 FDC 0 is a 8272A Partition check: hda: hda1 VFS: Mounted root (ext2 filesystem) readonly. Apr 28 10:21:38 init: version 2.4 booting EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended Mounting remote file systems... INET: syslogd Apr 28 10:21:40 init: Entering runlevel: 4 Welcome to DLX V1.0 (C) 1995-96 Erich Boehm (C) 1995 Hannes Boehm dlx login: _
Quick Guide to Using Bochs
(beginning with 'dlx linux'):
Note: It's perfectly normal for the 'dlxlinux' emulation screen to go completely 'blank' (all black) after a short time... unless you keep typing data into it. (Pressing the 'SHIFT' key will cause it to reappear; as will many other keys, but SHIFT is very safe, since it doesn't enter anything on the command line.)
Holding down the 'SHIFT' key and pressing the 'PageUp' key, one time only, will allow you to scroll back up towards the beginning of the screen output. For each key press, it will scroll about 1/2 (one half) the number of lines in a full screen. This is a very common linux/Unix keyboard function. The 'SHIFT + PageDown' key combination will scroll back down towards the current command line.
Under dlx you only need to ENTER the word 'root' at the command line to login as the "root" user. Once you have logged in, ENTER the following commands to see the common linux exectuables included with 'DLX' :
ls /bin, ls /sbin, ls /usr/bin, ls /usr/sbin
Note: You'll also find a halt command in /etc that was barely started (it's only one line: #!/bin/sh).
If you'd like learn more about Linux commmands using DLX or Tom's RTBT and how create and install more elaborate Linux OS distributions under Bochs, such as Ubuntu, then read our Linux Page here.
For the complete User Guide to Bochs, this file should open up in your PC's web browser: Bochs User Manual (if you installed Bochs as instructed to do so above). Below is a quick guide (with notes) to the most commonly used Bochs Windows Display buttons (they're all explained in detail here: 5.3.2. The Bochs headerbar).
|USER||Allows user to enter a keystroke (or combination of keystrokes) directly into the Bochs Emulator without the Host OS intercepting them. For example, you can send the "CRTL + ALT + DEL" combination to the emulated OS and the Host OS will do nothing. Only one keystroke line is allowed in the Configuration File, but you can edit it in the pop-up box before pressing the 'OK' button (or even change the stored line using the CONFIG button; see below, in its Misc section).|
|Copy||Places all the text characters from current view of the Bochs Emulator screen into your Windows Clipboard.|
|Paste||Emulates keystroke entries for whatever characters are in the Clipboard; do not use this button on a Command Line without first being sure of what's in the Clipboard!|
|snapshot||Saves the same text data as the "Copy" button does, but to a file of your choice and location (default name: 'snapshot.txt'); this can be very useful.|
|CONFIG||This stops the running simulation and puts it into "Runtime Configuration" mode. When you use this, do not click the "Quit" button under the "Simulation" section, unless you want to power-off the Bochs emulator! Instead, use the "Continue" button. (See Bochs User guide here for more.)|
|Reset||Does the same as a PC: Powers-off the Bochs Emulator and then turns it back ON again! Don't use this unless you're running a rather simple OS emulation (like DLX or DOS); unless your OS is 'hung'.|
|SUSPEND||Supposed to save the simulation in its current state, but functionality is limited (should not be used with hard disk image files). Read section 5.4 Save and restore simulation.|
|Power||Will immediately power off the emulated computer... so do not use this until after you have tried entering the halt or the poweroff commands under a more complex Linux OS (or shutting down a Windows OS correctly). (Note: We've been unable to get any of the switches for "shutdown" to function under this 'dlx' version; it only prints the same help message! And if you ENTER: shutdown now (not even listed), you'll still be disappointed, since that simply results in the message: "shutdown: cannot get into single user mode" (So you must use the 'Power button' to turn off Bochs with the Demo 'dlx' linux version running.)|
Using Bochs to Learn Exactly How a PC Boots Up
For most of you who read our pages here at The Starman's Realm, the debugger program that comes with the Bochs Windows install package will be more important than simply running another OS in its Emulator! After you've become somewhat familiar with Bochs, our next page will show you how to set up, start and run debug sessions to learn how a computer's Master Boot Record or other initial programs function step by step!
Revised: March 28, 2012 (28.03.12).
Updated: May 2, 2012 (02.05.2012).
Last Update: May 10, 2012. (10.05.2012)
You can write to me using this:
online reply form.
(It opens in a new window.)
The Starman's x86 ASSEMBLY Pages
The Starman's Realm Index Page