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:
|
|
|
|
|
2006-05-18 13:22:32 +00:00
|
|
|
1. Build the utilities in this directory:
|
2006-05-13 09:27:54 +00:00
|
|
|
make
|
|
|
|
|
|
|
|
2. Get the bochs source code:
|
2006-05-18 13:22:32 +00:00
|
|
|
cvs -d:pserver:anonymous@bochs.cvs.sourceforge.net:/cvsroot/bochs \
|
|
|
|
login
|
|
|
|
cvs -d:pserver:anonymous@bochs.cvs.sourceforge.net:/cvsroot/bochs \
|
|
|
|
co bochs
|
2005-05-17 16:44:57 +00:00
|
|
|
|
2006-05-13 09:27:54 +00:00
|
|
|
3. Configure bochs with
|
2006-04-26 00:40:27 +00:00
|
|
|
pushd bochs
|
2008-09-07 10:31:42 +00:00
|
|
|
./configure --enable-all-optimisations --enable-show-ips \
|
|
|
|
--enable-cpu-level=6 \
|
|
|
|
--enable-pci --enable-pnic --enable-ne2000 \
|
|
|
|
--enable-debugger --enable-disasm
|
2006-04-26 00:40:27 +00:00
|
|
|
popd
|
2005-05-17 16:44:57 +00:00
|
|
|
|
2006-05-13 09:27:54 +00:00
|
|
|
4. Build bochs:
|
2006-04-26 00:40:27 +00:00
|
|
|
make -C bochs
|
2005-05-17 16:44:57 +00:00
|
|
|
|
2006-05-18 13:22:32 +00:00
|
|
|
5. As root, set up a TAP virtual network device:
|
|
|
|
/sbin/modprobe tun
|
2006-05-26 08:15:31 +00:00
|
|
|
chmod o+rw /dev/net/tun
|
2006-05-13 09:27:54 +00:00
|
|
|
./tunctl -u <username> -t tap0
|
2006-05-18 13:22:32 +00:00
|
|
|
/sbin/ifconfig tap0 up 10.254.254.2 netmask 255.255.255.0
|
2005-05-17 16:44:57 +00:00
|
|
|
|
2006-05-18 13:22:32 +00:00
|
|
|
6. As root, add the following fragment to /etc/dhcpd.conf:
|
2005-05-17 16:44:57 +00:00
|
|
|
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.
|
|
|
|
|
2006-05-18 13:22:32 +00:00
|
|
|
7. As root, restart dhcpd
|
2006-04-26 00:40:27 +00:00
|
|
|
/etc/init.d/dhcpd restart
|
2005-05-17 16:44:57 +00:00
|
|
|
|
2006-05-13 09:27:54 +00:00
|
|
|
8. Build Etherboot images
|
2006-04-26 00:40:27 +00:00
|
|
|
pushd ../../src
|
|
|
|
make bin/pnic.dsk
|
|
|
|
popd
|
2005-05-17 16:44:57 +00:00
|
|
|
|
2006-05-13 09:27:54 +00:00
|
|
|
9. Start Bochs
|
2006-04-26 00:40:27 +00:00
|
|
|
./bochs/bochs -q
|
|
|
|
You should get to the debugger prompt "<bochs:1>". Type "c" to
|
|
|
|
start running Bochs.
|
2005-05-17 16:44:57 +00:00
|
|
|
|
2006-04-26 00:40:27 +00:00
|
|
|
You should see Bochs start up, load up Etherboot and attempt to boot
|
|
|
|
from the network.
|
2005-05-17 16:44:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
2006-08-09 03:25:11 +00:00
|
|
|
before starting Bochs, and ensure that you have enabled CONSOLE_SERIAL
|
|
|
|
in config.h.
|
2005-05-17 16:44:57 +00:00
|
|
|
|
|
|
|
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.
|