2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-11-26 19:29:04 +00:00
xNBA/contrib/bochs
2006-04-26 00:40:27 +00:00
..
.cvsignore Initial revision 2005-05-17 16:44:57 +00:00
bochsrc.txt Hardcoded paths to ../../src/bin avoid one step in the instructions. 2006-04-26 00:31:04 +00:00
Makefile Initial revision 2005-05-17 16:44:57 +00:00
README Updated instructions to reflect current reality. 2006-04-26 00:40:27 +00:00
serial-console Updated to syntax required by latest bochs CVS. 2006-04-26 00:14:19 +00:00
serial-console.1 Initial revision 2005-05-17 16:44:57 +00:00

Running Etherboot within Bochs
==============================

Michael Brown <mbrown@fensystems.co.uk>
Based on an idea suggested by H. Peter Anvin <hpa@zytor.com>.

$Id$

Bochs is a program that simulates a complete Intel x86 computer,
including hardware.  It can be used to test Etherboot.  There is a
special pseudo NIC ("pnic") implemented in Bochs, with a corresponding
driver in Etherboot.  (There is also an NE2000 ISA driver in Bochs,
but it doesn't seem to quite work.)

To get bochs running is fairly simple:

1.  Get the bochs source code:
      cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/bochs login
      cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/bochs co bochs

2.  Configure bochs with
      pushd bochs
      ./configure --enable-all-optimisations --enable-pci --enable-pnic
                  --enable-debugger --enable-magic-breakpoints --enable-disasm
      popd

3.  Build bochs:
      make -C bochs

4.  Set up a TAP virtual network device:
      modprobe tun
      tunctl -u <username> -t tap0
      ifconfig tap0 up 10.254.254.2 netmask 255.255.255.0

5.  Add the following fragment to /etc/dhcpd.conf:
      subnet 10.254.254.0 netmask 255.255.255.252 {
        range dynamic-bootp 10.254.254.1 10.254.254.1;
      }
    You will also need to add in any of your usual declarations for
    Etherboot, e.g. 'filename "vmlinuz.ltsp";'.  Note that this setup
    assumes that your DHCP server, TFTP server etc. all live on the
    machine you are using for running Bochs.  If not, then you're on
    your own.

6.  Restart dhcpd
      /etc/init.d/dhcpd restart

7.  Build Etherboot images
      pushd ../../src
      make bin/pnic.dsk
      popd

8.  Start Bochs
      ./bochs/bochs -q
    You should get to the debugger prompt "<bochs:1>".  Type "c" to
    start running Bochs.

You should see Bochs start up, load up Etherboot and attempt to boot
from the network.



Serial console
==============

You can use the program "serial-console" to obtain a virtual serial
console for Etherboot running within Bochs.  Simply run
"./serial-console" on a spare tty (e.g. a separate xterm window)
before starting Bochs, and ensure that you have compiled Etherboot
with appropriate settings such as
  CFLAGS+= -DCONSOLE_DUAL -DCOMCONSOLE=0x3F8 -DCONSPEED=9600

There is a manual page for "serial-console"; use
"man ./serial-console.1" to view it.



TODO
====

Packet forwarding/masquerading - document what must be set up.

Mention possibility of using RFB as the display device - in
conjunction with the serial console, gives you a test facility that
can be accessed remotely.

Mention use of BOCHSBP instruction (xchgw %bx,%bx) to avoid need to
calculate breakpoints.