mirror of
https://github.com/ipxe/ipxe
synced 2026-02-14 02:31:26 +03:00
Initial revision
This commit is contained in:
5
contrib/bochs/.cvsignore
Normal file
5
contrib/bochs/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
bochsout.txt
|
||||
parport.out
|
||||
ne2k-tx.log
|
||||
ne2k-txdump.txt
|
||||
|
||||
7
contrib/bochs/Makefile
Normal file
7
contrib/bochs/Makefile
Normal file
@@ -0,0 +1,7 @@
|
||||
all : serial-console.1
|
||||
|
||||
%.1 : %
|
||||
pod2man $< > $@
|
||||
|
||||
clean :
|
||||
rm -f serial-console.1
|
||||
121
contrib/bochs/README
Normal file
121
contrib/bochs/README
Normal file
@@ -0,0 +1,121 @@
|
||||
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:
|
||||
a) cvs -d:pserver:anonymous:@cvs.sourceforge.net:/cvsroot/bochs login
|
||||
b) cvs -d:pserver:anonymous:@cvs.sourceforge.net:/cvsroot/bochs co bochs
|
||||
|
||||
2. Configure bochs with
|
||||
./configure --enable-all-optimisations --enable-pci \
|
||||
--enable-ne2000 --enable-pnic
|
||||
Other potentially useful configure options:
|
||||
--prefix=/usr
|
||||
to force use of standard file locations
|
||||
--enable-debugger
|
||||
to enable the internal debugger
|
||||
|
||||
3. Build bochs:
|
||||
make
|
||||
|
||||
4. Configure Etherboot with CONFIG_PCI_DIRECT: add the line
|
||||
CFLAGS += -DCONFIG_PCI_DIRECT
|
||||
to the end of src/arch/i386/Config.
|
||||
|
||||
5. Build bin/pnic.zrom:
|
||||
make bin/pnic.zrom
|
||||
|
||||
6. Load the TUN/TAP kernel module:
|
||||
modprobe tun
|
||||
You should see the device /dev/net/tun is created automatically if
|
||||
you're using devfs, otherwise you may have to create it by hand with:
|
||||
mknod /dev/net/tun c 10 200
|
||||
|
||||
7. Grant yourself write access to /dev/net/tun:
|
||||
su -c 'chown <your user id> /dev/net/tun'
|
||||
The alternative to this is to run Bochs as root. Don't do that.
|
||||
|
||||
8. 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.
|
||||
|
||||
9. Change back to this directory and run bochs from your Bochs source tree:
|
||||
cd /path/to/Etherboot/contrib/bochs
|
||||
/path/to/bochs/source/tree/bochs
|
||||
|
||||
10. Select option 5 (Begin simulation). You will be prompted for your
|
||||
root password. This is required in order to configure the tun1
|
||||
network interface and to restart the DHCP server.
|
||||
|
||||
11. You should see Bochs start up and attempt to boot from the network,
|
||||
with a screen that looks like:
|
||||
|
||||
VGA BIOS - Version 2.40
|
||||
Copyright (C) 1990-2000 Elpin Systems, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Licensed for use with bochs, courtesy of MandrakeSoft.
|
||||
|
||||
For information on this or other VGA development products, contact
|
||||
Elpin Systems at: (800) 723-9038 or www.elpin.com
|
||||
|
||||
Bochs BIOS, 1 cpu, $Revision$ $Date$
|
||||
|
||||
|
||||
Etherboot 5.3.6 (GPL) http://etherboot.org Tagged ELF for [PNIC]
|
||||
Relocating _text from: [00091020,0009fb50) to [01ef14d0,01f00000)
|
||||
Boot from (N)etwork or (Q)uit?
|
||||
|
||||
Probing pci nic...
|
||||
[pnic] - Detected Bochs Pseudo NIC MAC FE:FD:00:00:00:01 (API v1.0) at 0xdc00
|
||||
Searching for server (DHCP)...
|
||||
..Me: 10.254.254.1, Server: 10.254.254.2
|
||||
Loading 10.254.254.2:/tftpboot/kernel
|
||||
|
||||
|
||||
|
||||
|
||||
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.
|
||||
658
contrib/bochs/bochsrc.txt
Normal file
658
contrib/bochs/bochsrc.txt
Normal file
@@ -0,0 +1,658 @@
|
||||
# You many now use double quotes around pathnames, in case
|
||||
# your pathname includes spaces.
|
||||
|
||||
#=======================================================================
|
||||
# CONFIG_INTERFACE
|
||||
#
|
||||
# The configuration interface is a series of menus or dialog boxes that
|
||||
# allows you to change all the settings that control Bochs's behavior.
|
||||
# There are two choices of configuration interface: a text mode version
|
||||
# called "textconfig" and a graphical version called "wx". The text
|
||||
# mode version uses stdin/stdout and is always compiled in. The graphical
|
||||
# version is only available when you use "--with-wx" on the configure
|
||||
# command. If you do not write a config_interface line, Bochs will
|
||||
# choose a default for you.
|
||||
#
|
||||
# NOTE: if you use the "wx" configuration interface, you must also use
|
||||
# the "wx" display library.
|
||||
#=======================================================================
|
||||
#config_interface: textconfig
|
||||
#config_interface: wx
|
||||
|
||||
#=======================================================================
|
||||
# DISPLAY_LIBRARY
|
||||
#
|
||||
# The display library is the code that displays the Bochs VGA screen. Bochs
|
||||
# has a selection of about 10 different display library implementations for
|
||||
# different platforms. If you run configure with multiple --with-* options,
|
||||
# the display_library command lets you choose which one you want to run with.
|
||||
# If you do not write a display_library line, Bochs will choose a default for
|
||||
# you.
|
||||
#
|
||||
# The choices are:
|
||||
# x use X windows interface, cross platform
|
||||
# win32 use native win32 libraries
|
||||
# carbon use Carbon library (for MacOS X)
|
||||
# beos use native BeOS libraries
|
||||
# macintosh use MacOS pre-10
|
||||
# amigaos use native AmigaOS libraries
|
||||
# sdl use SDL library, cross platform
|
||||
# svga use SVGALIB library for Linux, allows graphics without X11
|
||||
# term text only, uses curses/ncurses library, cross platform
|
||||
# rfb provides an interface to AT&T's VNC viewer, cross platform
|
||||
# wx use wxWindows library, cross platform
|
||||
# nogui no display at all
|
||||
#
|
||||
# NOTE: if you use the "wx" configuration interface, you must also use
|
||||
# the "wx" display library.
|
||||
#=======================================================================
|
||||
#display_library: amigaos
|
||||
#display_library: beos
|
||||
#display_library: carbon
|
||||
#display_library: macintosh
|
||||
#display_library: nogui
|
||||
#display_library: rfb
|
||||
#display_library: sdl
|
||||
#display_library: term
|
||||
#display_library: win32
|
||||
#display_library: wx
|
||||
#display_library: x
|
||||
|
||||
#=======================================================================
|
||||
# ROMIMAGE:
|
||||
# You now need to load a ROM BIOS into F0000-FFFFF. I've wiped
|
||||
# out most of the BIOS hooks, and replace them with real BIOS
|
||||
# support. Normally, you can use a precompiled BIOS in the bios/
|
||||
# directory, named BIOS-bochs-latest.
|
||||
#=======================================================================
|
||||
#romimage: bios/BIOS-bochs-970717a
|
||||
#romimage: file=bios/BIOS-bochs-latest, address=0xf0000
|
||||
romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
|
||||
#romimage: file=bios/BIOS-bochs-2-processors, address=0xf0000
|
||||
#romimage: file=bios/BIOS-bochs-4-processors, address=0xf0000
|
||||
#romimage: file=bios/rombios.bin, address=0xf0000
|
||||
|
||||
#=======================================================================
|
||||
# MEGS
|
||||
# set this to the default number of Megabytes of memory you want
|
||||
# to emulate. You may also pass the '-megs xyz' option to bochs
|
||||
#
|
||||
# The default is 32MB, most OS's won't need more than that.
|
||||
#=======================================================================
|
||||
#megs: 256
|
||||
#megs: 128
|
||||
#megs: 64
|
||||
megs: 32
|
||||
#megs: 16
|
||||
#megs: 8
|
||||
|
||||
#=======================================================================
|
||||
# OPTROMIMAGE[1-4]:
|
||||
# You may now load up to 4 optional ROM images. Be sure to use a
|
||||
# read-only area, typically between C8000 and EFFFF. These optional
|
||||
# ROM images should not overwrite the rombios (located at
|
||||
# F0000-FFFFF) and the videobios (located at C0000-C7FFF).
|
||||
# Those ROM images will be initialized by the bios if they contain
|
||||
# the right signature (0x55AA).
|
||||
# It can also be a convenient way to upload some arbitary code/data
|
||||
# in the simulation, that can be retrieved by the boot loader
|
||||
#=======================================================================
|
||||
#optromimage1: file=optionalrom.bin, address=0xd0000
|
||||
#optromimage2: file=optionalrom.bin, address=0xd1000
|
||||
#optromimage3: file=optionalrom.bin, address=0xd2000
|
||||
#optromimage4: file=optionalrom.bin, address=0xd3000
|
||||
#optromimage1: file=../../src/bin/ne.zrom, address=0xd0000
|
||||
optromimage1: file=../../src/bin/pnic.zrom, address=0xd0000
|
||||
|
||||
#=======================================================================
|
||||
# VGAROMIMAGE
|
||||
# You now need to load a VGA ROM BIOS into C0000.
|
||||
#=======================================================================
|
||||
#vgaromimage: bios/VGABIOS-lgpl-latest
|
||||
#vgaromimage: bios/VGABIOS-elpin-2.40
|
||||
vgaromimage: $BXSHARE/VGABIOS-elpin-2.40
|
||||
|
||||
#=======================================================================
|
||||
# FLOPPYA:
|
||||
# Point this to pathname of floppy image file or device
|
||||
# This should be of a bootable floppy(image/device) if you're
|
||||
# booting from 'a'.
|
||||
#
|
||||
# You can set the initial status of the media to 'ejected' or 'inserted'.
|
||||
# floppya: 2_88=path, status=ejected (2.88M 3.5" floppy)
|
||||
# floppya: 1_44=path, status=inserted (1.44M 3.5" floppy)
|
||||
# floppya: 1_2=path, status=ejected (1.2M 5.25" floppy)
|
||||
# floppya: 720k=path, status=inserted (720K 3.5" floppy)
|
||||
# floppya: 360k=path, status=inserted (360K 5.25" floppy)
|
||||
#
|
||||
# The path should be the name of a disk image file. On unix, you can use
|
||||
# a raw device name such as /dev/fd0 on Linux. On WinNT and Win2k, use
|
||||
# drive letters such as a: or b: as the path. Raw floppy access is not
|
||||
# supported on Windows 95 and 98.
|
||||
#=======================================================================
|
||||
floppya: 1_44=/dev/fd0, status=inserted
|
||||
#floppya: file=../1.44, status=inserted
|
||||
#floppya: 1_44=/dev/fd0H1440, status=inserted
|
||||
#floppya: 1_2=../1_2, status=inserted
|
||||
#floppya: 1_44=a:, status=inserted
|
||||
#floppya: 1_44=a.img, status=inserted
|
||||
|
||||
#=======================================================================
|
||||
# FLOPPYB:
|
||||
# See FLOPPYA above for syntax
|
||||
#=======================================================================
|
||||
#floppyb: 1_44=b:, status=inserted
|
||||
floppyb: 1_44=b.img, status=inserted
|
||||
|
||||
#=======================================================================
|
||||
# ATA0, ATA1, ATA2, ATA3
|
||||
# ATA controller for hard disks and cdroms
|
||||
#
|
||||
# ata[0-3]: enabled=[0|1], ioaddr1=addr, ioaddr2=addr, irq=number
|
||||
#
|
||||
# These options enables up to 4 ata channels. For each channel
|
||||
# the two base io address and the irq must be specified.
|
||||
#
|
||||
# ata0 is enabled by default, with ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
|
||||
#
|
||||
# Examples:
|
||||
# ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
|
||||
# ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
|
||||
# ata2: enabled=1, ioaddr1=0x1e8, ioaddr2=0x3e8, irq=11
|
||||
# ata3: enabled=1, ioaddr1=0x168, ioaddr2=0x368, irq=9
|
||||
#=======================================================================
|
||||
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
|
||||
ata1: enabled=0, ioaddr1=0x170, ioaddr2=0x370, irq=15
|
||||
ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e8, irq=11
|
||||
ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x368, irq=9
|
||||
|
||||
#=======================================================================
|
||||
# ATA[0-3]-MASTER, ATA[0-3]-SLAVE
|
||||
#
|
||||
# This defines the type and characteristics of all attached ata devices:
|
||||
# type= type of attached device [disk|cdrom]
|
||||
# path= path of the image
|
||||
# cylinders= only valid for disks
|
||||
# heads= only valid for disks
|
||||
# spt= only valid for disks
|
||||
# status= only valid for cdroms [inserted|ejected]
|
||||
# biosdetect= type of biosdetection [none|auto], only for disks on ata0 [cmos]
|
||||
# translation=type of transation of the bios, only for disks [none|lba|large|rechs|auto]
|
||||
# model= string returned by identify device command
|
||||
#
|
||||
# Point this at a hard disk image file, cdrom iso file, or physical cdrom
|
||||
# device. To create a hard disk image, try running bximage. It will help you
|
||||
# choose the size and then suggest a line that works with it.
|
||||
#
|
||||
# In UNIX it may be possible to use a raw device as a Bochs hard disk,
|
||||
# but WE DON'T RECOMMEND IT. In Windows there is no easy way.
|
||||
#
|
||||
# In windows, the drive letter + colon notation should be used for cdroms.
|
||||
# Depending on versions of windows and drivers, you may only be able to
|
||||
# access the "first" cdrom in the system. On MacOSX, use path="drive"
|
||||
# to access the physical drive.
|
||||
#
|
||||
# The path, cylinders, heads, and spt are mandatory for type=disk
|
||||
# The path is mandatory for type=cdrom
|
||||
#
|
||||
# Default values are:
|
||||
# biosdetect=auto, translation=auto, model="Generic 1234"
|
||||
#
|
||||
# The biosdetect option has currently no effect on the bios
|
||||
#
|
||||
# Examples:
|
||||
# ata0-master: type=disk, path=10M.sample, cylinders=306, heads=4, spt=17
|
||||
# ata0-slave: type=disk, path=20M.sample, cylinders=615, heads=4, spt=17
|
||||
# ata1-master: type=disk, path=30M.sample, cylinders=615, heads=6, spt=17
|
||||
# ata1-slave: type=disk, path=46M.sample, cylinders=940, heads=6, spt=17
|
||||
# ata2-master: type=disk, path=62M.sample, cylinders=940, heads=8, spt=17
|
||||
# ata2-slave: type=disk, path=112M.sample, cylinders=900, heads=15, spt=17
|
||||
# ata3-master: type=disk, path=483M.sample, cylinders=1024, heads=15, spt=63
|
||||
# ata3-slave: type=cdrom, path=iso.sample, status=inserted
|
||||
#=======================================================================
|
||||
#ata0-master: type=disk, path="30M.sample", cylinders=615, heads=6, spt=17
|
||||
#ata0-slave: type=cdrom, path=D:, status=inserted
|
||||
#ata0-slave: type=cdrom, path=/dev/cdrom, status=inserted
|
||||
#ata0-slave: type=cdrom, path="drive", status=inserted
|
||||
|
||||
#=======================================================================
|
||||
#
|
||||
# The DISKC option is deprecated. Use ATA* options instead.
|
||||
#
|
||||
# DISKC: file=, cyl=, heads=, spt=
|
||||
# Point this at a hard disk image file. To create
|
||||
# a hard disk image, try running bximage. It will help you choose the
|
||||
# size and then suggest a diskc line that works with it.
|
||||
#
|
||||
# In UNIX it may be possible to use a raw device as a Bochs hard disk,
|
||||
# but WE DON'T RECOMMEND IT. In Windows there is no easy way.
|
||||
#
|
||||
# Examples:
|
||||
# diskc: file=10M.sample, cyl=306, heads=4, spt=17
|
||||
# diskc: file=20M.sample, cyl=615, heads=4, spt=17
|
||||
# diskc: file=30M.sample, cyl=615, heads=6, spt=17
|
||||
# diskc: file=46M.sample, cyl=940, heads=6, spt=17
|
||||
# diskc: file=62M.sample, cyl=940, heads=8, spt=17
|
||||
# diskc: file=112M.sample, cyl=900, heads=15, spt=17
|
||||
# diskc: file=483M.sample, cyl=1024, heads=15, spt=63
|
||||
#=======================================================================
|
||||
#diskc: file="30M.sample", cyl=615, heads=6, spt=17
|
||||
|
||||
#=======================================================================
|
||||
#
|
||||
# The DISKD option is deprecated. Use ATA* options instead.
|
||||
#
|
||||
# DISKD:
|
||||
# See DISKC above for syntax
|
||||
#
|
||||
# NOTE: diskd and cdromd must not be used together!
|
||||
#=======================================================================
|
||||
#diskd: file="diskd.img", cyl=615, heads=6, spt=17
|
||||
|
||||
#=======================================================================
|
||||
#
|
||||
# The CDROMD option is deprecated. Use ATA* options instead.
|
||||
#
|
||||
# CDROMD:
|
||||
#
|
||||
# cdromd: dev=/dev/cdrom, status=inserted
|
||||
# cdromd: dev=/dev/cdrom, status=ejected
|
||||
# cdromd: dev=e:, status=ejected
|
||||
#
|
||||
# In windows, the drive letter + colon notation should be used for cdroms.
|
||||
# Depending on versions of windows and drivers, you may only be able to
|
||||
# access the "first" cdrom in the system. On MacOSX, use path="drive"
|
||||
# to access the physical drive.
|
||||
#
|
||||
# NOTE: diskd and cdromd must not be used together!
|
||||
#=======================================================================
|
||||
#cdromd: dev=D:, status=inserted
|
||||
#cdromd: dev=/dev/cdrom, status=inserted
|
||||
#cdromd: dev="drive", status=inserted
|
||||
|
||||
#=======================================================================
|
||||
# NEWHARDDRIVESUPPORT: enabled=[0|1]
|
||||
# As of cvs version on 5/17/2001, newharddrivesupport is on by default.
|
||||
#=======================================================================
|
||||
#newharddrivesupport: enabled=1
|
||||
|
||||
#=======================================================================
|
||||
# BOOT:
|
||||
# This defines your boot drive.
|
||||
# You can either boot from 'floppy', 'disk' or 'cdrom'
|
||||
# legacy 'a' and 'c' are also supported
|
||||
# Examples:
|
||||
# boot: floppy
|
||||
# boot: disk
|
||||
# boot: cdrom
|
||||
# boot: c
|
||||
# boot: a
|
||||
#=======================================================================
|
||||
#boot: floppy
|
||||
#boot: disk
|
||||
|
||||
#=======================================================================
|
||||
# FLOPPY_BOOTSIG_CHECK: disabled=[0|1]
|
||||
# Enables or disables the 0xaa55 signature check on boot floppies
|
||||
# Defaults to disabled=0
|
||||
# Examples:
|
||||
# floppy_bootsig_check: disabled=0
|
||||
# floppy_bootsig_check: disabled=1
|
||||
#=======================================================================
|
||||
#floppy_bootsig_check: disabled=1
|
||||
floppy_bootsig_check: disabled=0
|
||||
|
||||
#=======================================================================
|
||||
# LOG:
|
||||
# Give the path of the log file you'd like Bochs debug and misc. verbage
|
||||
# to be written to. If you really don't want it, make it /dev/null. :^(
|
||||
#
|
||||
# Examples:
|
||||
# log: ./bochs.out
|
||||
# log: /dev/tty
|
||||
#=======================================================================
|
||||
#log: /dev/null
|
||||
log: bochsout.txt
|
||||
|
||||
#=======================================================================
|
||||
# LOGPREFIX:
|
||||
# This handles the format of the string prepended to each log line.
|
||||
# You may use those special tokens :
|
||||
# %t : 11 decimal digits timer tick
|
||||
# %i : 8 hexadecimal digits of cpu0 current eip
|
||||
# %e : 1 character event type ('i'nfo, 'd'ebug, 'p'anic, 'e'rror)
|
||||
# %d : 5 characters string of the device, between brackets
|
||||
#
|
||||
# Default : %t%e%d
|
||||
# Examples:
|
||||
# logprefix: %t-%e-@%i-%d
|
||||
# logprefix: %i%e%d
|
||||
#=======================================================================
|
||||
#logprefix: %t%e%d
|
||||
|
||||
#=======================================================================
|
||||
# LOG CONTROLS
|
||||
#
|
||||
# Bochs now has four severity levels for event logging.
|
||||
# panic: cannot proceed. If you choose to continue after a panic,
|
||||
# don't be surprised if you get strange behavior or crashes.
|
||||
# error: something went wrong, but it is probably safe to continue the
|
||||
# simulation.
|
||||
# info: interesting or useful messages.
|
||||
# debug: messages useful only when debugging the code. This may
|
||||
# spit out thousands per second.
|
||||
#
|
||||
# For events of each level, you can choose to crash, report, or ignore.
|
||||
# TODO: allow choice based on the facility: e.g. crash on panics from
|
||||
# everything except the cdrom, and only report those.
|
||||
#
|
||||
# If you are experiencing many panics, it can be helpful to change
|
||||
# the panic action to report instead of fatal. However, be aware
|
||||
# that anything executed after a panic is uncharted territory and can
|
||||
# cause bochs to become unstable. The panic is a "graceful exit," so
|
||||
# if you disable it you may get a spectacular disaster instead.
|
||||
#=======================================================================
|
||||
panic: action=ask
|
||||
error: action=report
|
||||
info: action=report
|
||||
debug: action=ignore
|
||||
|
||||
#=======================================================================
|
||||
# DEBUGGER_LOG:
|
||||
# Give the path of the log file you'd like Bochs to log debugger output.
|
||||
# If you really don't want it, make it /dev/null or '-'. :^(
|
||||
#
|
||||
# Examples:
|
||||
# debugger_log: ./debugger.out
|
||||
#=======================================================================
|
||||
#debugger_log: /dev/null
|
||||
#debugger_log: debugger.out
|
||||
debugger_log: -
|
||||
|
||||
#=======================================================================
|
||||
# com1:
|
||||
# This defines a serial (COM) port. You can specify a device to use as com1.
|
||||
# This can be a real serial line, or a pty. To use a pty (under X/Unix),
|
||||
# create two windows (xterms, usually). One of them will run bochs, and the
|
||||
# other will act as com1. Find out the tty the com1 window using the `tty'
|
||||
# command, and use that as the `dev' parameter. Then do `sleep 1000000' in
|
||||
# the com1 window to keep the shell from messing with things, and run bochs in
|
||||
# the other window. Serial I/O to com1 (port 0x3f8) will all go to the other
|
||||
# window.
|
||||
#=======================================================================
|
||||
#com1: enabled=1, dev=/dev/ttyp9
|
||||
#com1: enabled=1, dev=/tmp/serial.log
|
||||
|
||||
|
||||
#=======================================================================
|
||||
# PARPORT1:
|
||||
# This defines a parallel (printer) port. When turned on and an output file is
|
||||
# defined the emulated printer port sends characters printed by the guest OS
|
||||
# into the output file. On some platforms a device filename can be used to
|
||||
# send the data to the real parallel port (e.g. "/dev/lp0" on Linux, "lpt1" on
|
||||
# win32 platforms).
|
||||
#
|
||||
# Examples:
|
||||
# parport1: enabled=1, file="parport.out"
|
||||
# parport1: enabled=1, file="/dev/lp0"
|
||||
# parport1: enabled=0
|
||||
#=======================================================================
|
||||
parport1: enabled=1, file="parport.out"
|
||||
|
||||
#=======================================================================
|
||||
# SB16:
|
||||
# This defines the SB16 sound emulation. It can have several of the
|
||||
# following properties.
|
||||
# All properties are in the format sb16: property=value
|
||||
# midi: The filename is where the midi data is sent. This can be a
|
||||
# device or just a file if you want to record the midi data.
|
||||
# midimode:
|
||||
# 0=no data
|
||||
# 1=output to device (system dependent. midi denotes the device driver)
|
||||
# 2=SMF file output, including headers
|
||||
# 3=output the midi data stream to the file (no midi headers and no
|
||||
# delta times, just command and data bytes)
|
||||
# wave: This is the device/file where wave output is stored
|
||||
# wavemode:
|
||||
# 0=no data
|
||||
# 1=output to device (system dependent. wave denotes the device driver)
|
||||
# 2=VOC file output, incl. headers
|
||||
# 3=output the raw wave stream to the file
|
||||
# log: The file to write the sb16 emulator messages to.
|
||||
# loglevel:
|
||||
# 0=no log
|
||||
# 1=only midi program and bank changes
|
||||
# 2=severe errors
|
||||
# 3=all errors
|
||||
# 4=all errors plus all port accesses
|
||||
# 5=all errors and port accesses plus a lot of extra info
|
||||
# dmatimer:
|
||||
# microseconds per second for a DMA cycle. Make it smaller to fix
|
||||
# non-continous sound. 750000 is usually a good value. This needs a
|
||||
# reasonably correct setting for IPS.
|
||||
#
|
||||
# For an example look at the next line:
|
||||
#=======================================================================
|
||||
|
||||
#sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, loglevel=2, log=sb16.log, dmatimer=600000
|
||||
|
||||
#=======================================================================
|
||||
# VGA_UPDATE_INTERVAL:
|
||||
# Video memory is scanned for updates and screen updated every so many
|
||||
# virtual seconds. The default is 300000, about 3Hz. This is generally
|
||||
# plenty. Keep in mind that you must tweak the 'ips:' directive
|
||||
# to be as close to the number of emulated instructions-per-second
|
||||
# your workstation can do, for this to be accurate.
|
||||
#
|
||||
# Examples:
|
||||
# vga_update_interval: 250000
|
||||
#=======================================================================
|
||||
vga_update_interval: 300000
|
||||
|
||||
# using for Winstone '98 tests
|
||||
#vga_update_interval: 100000
|
||||
|
||||
#=======================================================================
|
||||
# KEYBOARD_SERIAL_DELAY:
|
||||
# Approximate time in microseconds that it takes one character to
|
||||
# be transfered from the keyboard to controller over the serial path.
|
||||
# Examples:
|
||||
# keyboard_serial_delay: 200
|
||||
#=======================================================================
|
||||
keyboard_serial_delay: 250
|
||||
|
||||
#=======================================================================
|
||||
# KEYBOARD_PASTE_DELAY:
|
||||
# Approximate time in microseconds between attempts to paste
|
||||
# characters to the keyboard controller. This leaves time for the
|
||||
# guest os to deal with the flow of characters. The ideal setting
|
||||
# depends on how your operating system processes characters. The
|
||||
# default of 100000 usec (.1 seconds) was chosen because it works
|
||||
# consistently in Windows.
|
||||
#
|
||||
# If your OS is losing characters during a paste, increase the paste
|
||||
# delay until it stops losing characters.
|
||||
#
|
||||
# Examples:
|
||||
# keyboard_paste_delay: 100000
|
||||
#=======================================================================
|
||||
keyboard_paste_delay: 100000
|
||||
|
||||
#=======================================================================
|
||||
# FLOPPY_COMMAND_DELAY:
|
||||
# Time in microseconds to wait before completing some floppy commands
|
||||
# such as read/write/seek/etc, which normally have a delay associated.
|
||||
# I had this hardwired to 50,000 before.
|
||||
#
|
||||
# Examples:
|
||||
# floppy_command_delay: 50000
|
||||
#=======================================================================
|
||||
floppy_command_delay: 500
|
||||
|
||||
#=======================================================================
|
||||
# IPS:
|
||||
# Emulated Instructions Per Second. This is the number of IPS that bochs
|
||||
# is capable of running on your machine. Read the note in config.h
|
||||
# on how to find this. Make sure to recompile after.
|
||||
#
|
||||
# IPS is used to calibrate many time-dependent events within the bochs
|
||||
# simulation. For example, changing IPS affects the frequency of VGA
|
||||
# updates, the duration of time before a key starts to autorepeat, and
|
||||
# the measurement of BogoMips and other benchmarks.
|
||||
#
|
||||
# Examples:
|
||||
# Machine Mips
|
||||
# ________________________________________________________________
|
||||
# 650Mhz Athlon K-7 with Linux 2.4.4/egcs-2.91.66 2 to 2.5 Mips
|
||||
# 400Mhz Pentium II with Linux 2.0.36/egcs-1.0.3 1 to 1.8 Mips
|
||||
# 166Mhz 64bit Sparc with Solaris 2.x approx 0.75 Mips
|
||||
# 200Mhz Pentium with Linux 2.x approx 0.5 Mips
|
||||
#
|
||||
#=======================================================================
|
||||
ips: 1000000
|
||||
|
||||
#=======================================================================
|
||||
# PIT:
|
||||
# The PIT is the programmable interval timer. It has an option that tries to
|
||||
# keep the PIT in sync with real time. This feature is still experimental,
|
||||
# but it may be useful if you want to prevent Bochs from running too fast, for
|
||||
# example a DOS video game. Be aware that with the realtime pit option, your
|
||||
# simulation will not be repeatable; this can a problem if you are debugging.
|
||||
#=======================================================================
|
||||
#pit: realtime=1
|
||||
|
||||
#=======================================================================
|
||||
# mouse: Not used in any of the GUI specific modules, but the option
|
||||
# bx_options.mouse_enabled is set to this value. The idea,
|
||||
# is that the GUI code should not generate mouse events when
|
||||
# not enabled. The hardware emualation itself is not disabled
|
||||
# by this. This is to facilitate deterministic runs of bochs.
|
||||
#
|
||||
# Examples:
|
||||
# mouse: enabled=1
|
||||
# mouse: enabled=0
|
||||
#
|
||||
# I wouldn't recommend enabling the mouse by default, unless you have a
|
||||
# really good reason to do so.
|
||||
#=======================================================================
|
||||
mouse: enabled=0
|
||||
|
||||
#=======================================================================
|
||||
# private_colormap: Request that the GUI create and use it's own
|
||||
# non-shared colormap. This colormap will be used
|
||||
# when in the bochs window. If not enabled, a
|
||||
# shared colormap scheme may be used. Not implemented
|
||||
# on all GUI's.
|
||||
#
|
||||
# Examples:
|
||||
# private_colormap: enabled=1
|
||||
# private_colormap: enabled=0
|
||||
#=======================================================================
|
||||
private_colormap: enabled=0
|
||||
|
||||
#=======================================================================
|
||||
# fullscreen: ONLY IMPLEMENTED ON AMIGA
|
||||
# Request that Bochs occupy the entire screen instead of a
|
||||
# window.
|
||||
#
|
||||
# Examples:
|
||||
# fullscreen: enabled=0
|
||||
# fullscreen: enabled=1
|
||||
#=======================================================================
|
||||
fullscreen: enabled=0
|
||||
screenmode: name="sample"
|
||||
|
||||
#=======================================================================
|
||||
# ne2k: NE2000 compatible ethernet adapter
|
||||
#
|
||||
# Examples:
|
||||
# ne2k: ioaddr=IOADDR, irq=IRQ, mac=MACADDR, ethmod=MODULE, ethdev=DEVICE, script=SCRIPT
|
||||
#
|
||||
# ioaddr, irq: You probably won't need to change ioaddr and irq, unless there
|
||||
# are IRQ conflicts.
|
||||
#
|
||||
# mac: The MAC address MUST NOT match the address of any machine on the net.
|
||||
# Also, the first byte must be an even number (bit 0 set means a multicast
|
||||
# address), and you cannot use ff:ff:ff:ff:ff:ff because that's the broadcast
|
||||
# address. For the ethertap module, you must use fe:fd:00:00:00:01. There may
|
||||
# be other restrictions too. To be safe, just use the b0:c4... address.
|
||||
#
|
||||
# ethdev: The ethdev value is the name of the network interface on your host
|
||||
# platform. On UNIX machines, you can get the name by running ifconfig. On
|
||||
# Windows machines, you must run niclist to get the name of the ethdev.
|
||||
# Niclist source code is in misc/niclist.c and it is included in Windows
|
||||
# binary releases.
|
||||
#
|
||||
# script: The script value is optionnal, and is the name of a script that
|
||||
# is executed after bochs initialize the network interface. You can use
|
||||
# this script to configure this network interface, or enable masquerading.
|
||||
# This is mainly useful for the tun/tap devices that only exist during
|
||||
# Bochs execution. The network interface name is supplied to the script
|
||||
# as first parameter
|
||||
#=======================================================================
|
||||
# ne2k: ioaddr=0x280, irq=9, mac=b0:c4:20:00:00:00, ethmod=fbsd, ethdev=xl0
|
||||
# ne2k: ioaddr=0x280, irq=9, mac=b0:c4:20:00:00:00, ethmod=linux, ethdev=eth0
|
||||
# ne2k: ioaddr=0x280, irq=9, mac=b0:c4:20:00:00:01, ethmod=win32, ethdev=MYCARD
|
||||
# ne2k: ioaddr=0x280, irq=9, mac=fe:fd:00:00:00:01, ethmod=tap, ethdev=tap0
|
||||
# ne2k: ioaddr=0x280, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=tun0, script=./ifup.tun
|
||||
# ne2k: ioaddr=0x280, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=tun0
|
||||
|
||||
# Pseudo NIC adaptor. The way bochs is structured at the moment means
|
||||
# that you need to enable ne2k support in order to compile in any of
|
||||
# the networking code.
|
||||
pnic: ioaddr=0xdc00, irq=11, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=tun1, script=./ifup.tun
|
||||
|
||||
#=======================================================================
|
||||
# KEYBOARD_MAPPING:
|
||||
# This enables a remap of a physical localized keyboard to a
|
||||
# virtualized us keyboard, as the PC architecture expects.
|
||||
# If enabled, the keymap file must be specified.
|
||||
#
|
||||
# Examples:
|
||||
# keyboard_mapping: enabled=1, map=gui/keymaps/x11-pc-de.map
|
||||
#=======================================================================
|
||||
keyboard_mapping: enabled=0, map=
|
||||
|
||||
#=======================================================================
|
||||
# KEYBOARD_TYPE:
|
||||
# Type of keyboard return by a "identify keyboard" command to the
|
||||
# keyboard controler. It must be one of "xt", "at" or "mf".
|
||||
# Defaults to "mf". It should be ok for almost everybody. A known
|
||||
# exception is french macs, that do have a "at"-like keyboard.
|
||||
#
|
||||
# Examples:
|
||||
# keyboard_type: mf
|
||||
#=======================================================================
|
||||
#keyboard_type: mf
|
||||
|
||||
#=======================================================================
|
||||
# USER_SHORTCUT:
|
||||
# This defines the keyboard shortcut to be sent when you press the "user"
|
||||
# button in the headerbar. The shortcut string can be a combination of
|
||||
# these key names: "alt", "ctrl", "del", "esc", "f1", "f4", "tab", "win".
|
||||
# Up to 3 keys can be pressed at a time.
|
||||
#
|
||||
# Example:
|
||||
# user_shortcut: keys=ctrlaltdel
|
||||
#=======================================================================
|
||||
user_shortcut: keys=ctrlaltdel
|
||||
|
||||
#=======================================================================
|
||||
# other stuff
|
||||
#=======================================================================
|
||||
magic_break: enabled=1
|
||||
|
||||
#load32bitOSImage: os=nullkernel, path=../kernel.img, iolog=../vga_io.log
|
||||
#load32bitOSImage: os=linux, path=../linux.img, iolog=../vga_io.log, initrd=../initrd.img
|
||||
i440fxsupport: enabled=1
|
||||
#time0: 938581955
|
||||
|
||||
#=======================================================================
|
||||
# for Macintosh, use the style of pathnames in the following
|
||||
# examples.
|
||||
#
|
||||
# vgaromimage: :bios:VGABIOS-elpin-2.20
|
||||
# romimage: file=:bios:BIOS-bochs-981222a, address=0xf0000
|
||||
# floppya: 1_44=[fd:], status=inserted
|
||||
#=======================================================================
|
||||
|
||||
21
contrib/bochs/ifup.tun
Executable file
21
contrib/bochs/ifup.tun
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT=$0
|
||||
INTERFACE=$1
|
||||
|
||||
if [ `id -u` != 0 ]; then
|
||||
echo ""
|
||||
echo "Enter root password for configuring network interface $INTERFACE"
|
||||
echo "(To avoid this prompt, make the script $SCRIPT setuid-root)"
|
||||
/bin/su -c "$SCRIPT $INTERFACE" || exit 1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
/sbin/ifconfig $INTERFACE 10.254.254.2 netmask 255.255.255.252
|
||||
|
||||
# Force dhcpd to notice the new network interface
|
||||
if [ -x /etc/init.d/dhcpd ]; then
|
||||
/etc/init.d/dhcpd reload # Redhat
|
||||
elif [ -x /etc/init.d/dhcp ]; then
|
||||
/etc/init.d/dhcp restart # Debian
|
||||
fi
|
||||
278
contrib/bochs/serial-console
Executable file
278
contrib/bochs/serial-console
Executable file
@@ -0,0 +1,278 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
=head1 NAME
|
||||
|
||||
serial-console
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
serial-console [options]
|
||||
|
||||
Options:
|
||||
|
||||
-h,--help Display brief help message
|
||||
-v,--verbose Increase verbosity
|
||||
-q,--quiet Decrease verbosity
|
||||
-l,--log FILE Log output to file
|
||||
-r,--rcfile FILE Modify specified bochsrc file
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
C<serial-console> provides a virtual serial console for use with
|
||||
Bochs. Running C<serial-console> creates a pseudo-tty. The master
|
||||
side of this pty is made available to the user for interaction; the
|
||||
slave device is written to the Bochs configuration file
|
||||
(C<bochsrc.txt>) for use by a subsequent Bochs session.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 4
|
||||
|
||||
=item C<serial-console>
|
||||
|
||||
Create a virtual serial console for Bochs, modify C<bochsrc.txt>
|
||||
appropriately.
|
||||
|
||||
=item C<serial-console -r ../.bochsrc -l serial.log>
|
||||
|
||||
Create a virtual serial console for Bochs, modify C<../.bochsrc>
|
||||
appropriately, log output to C<serial.log>.
|
||||
|
||||
=back
|
||||
|
||||
=head1 INVOCATION
|
||||
|
||||
Before starting Bochs, run C<serial-console> in a different session
|
||||
(e.g. a different xterm window). When you subsequently start Bochs,
|
||||
anything that the emulated machine writes to its serial port will
|
||||
appear in the window running C<serial-console>, and anything typed in
|
||||
the C<serial-console> window will arrive on the emulated machine's
|
||||
serial port.
|
||||
|
||||
You do B<not> need to rerun C<serial-console> afresh for each Bochs
|
||||
session.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<-l,--log FILE>
|
||||
|
||||
Log all output (i.e. everything that is printed in the
|
||||
C<serial-console> window) to the specified file.
|
||||
|
||||
=item B<-r,--rcfile FILE>
|
||||
|
||||
Modify the specified bochsrc file. The file will be updated to
|
||||
contain the path to the slave side of the psuedo tty that we create.
|
||||
The original file will be restored when C<serial-console> exits. The
|
||||
default is to modify the file C<bochsrc.txt> in the current directory.
|
||||
|
||||
To avoid modifying any bochsrc file, use C<--norcfile>.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
use IO::Pty;
|
||||
use IO::Select;
|
||||
use File::Spec::Functions qw ( :ALL );
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use POSIX qw ( :termios_h );
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $o;
|
||||
my $restore_file = {};
|
||||
my $restore_termios;
|
||||
use constant BLOCKSIZE => 8192;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Parse command line options into options hash ($o)
|
||||
#
|
||||
# $o = parse_opts();
|
||||
|
||||
sub parse_opts {
|
||||
# $o is the hash that will hold the options
|
||||
my $o = {
|
||||
verbosity => 1,
|
||||
rcfile => 'bochsrc.txt',
|
||||
};
|
||||
# Special handlers for some options
|
||||
my $opt_handlers = {
|
||||
verbose => sub { $o->{verbosity}++; },
|
||||
quiet => sub { $o->{verbosity}--; },
|
||||
help => sub { pod2usage(1); },
|
||||
norcfile => sub { delete $o->{rcfile}; },
|
||||
};
|
||||
# Merge handlers into main options hash (so that Getopt::Long can find them)
|
||||
$o->{$_} = $opt_handlers->{$_} foreach keys %$opt_handlers;
|
||||
# Option specifiers for Getopt::Long
|
||||
my @optspec = ( 'help|h|?',
|
||||
'quiet|q+',
|
||||
'verbose|v+',
|
||||
'log|l=s',
|
||||
'rcfile|r=s',
|
||||
'norcfile',
|
||||
);
|
||||
# Do option parsing
|
||||
Getopt::Long::Configure ( 'bundling' );
|
||||
pod2usage("Error parsing command-line options") unless GetOptions (
|
||||
$o, @optspec );
|
||||
# Clean up $o by removing the handlers
|
||||
delete $o->{$_} foreach keys %$opt_handlers;
|
||||
return $o;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Modify bochsrc file
|
||||
|
||||
sub patch_bochsrc {
|
||||
my $active = shift;
|
||||
my $pty = shift;
|
||||
|
||||
# Rename active file to backup file
|
||||
( my $vol, my $dir, my $file ) = splitpath ( $active );
|
||||
$file = '.'.$file.".serial-console";
|
||||
my $backup = catpath ( $vol, $dir, $file );
|
||||
rename $active, $backup
|
||||
or die "Could not back up $active to $backup: $!\n";
|
||||
|
||||
# Derive line to be inserted
|
||||
my $patch = "com1: enabled=1, dev=$pty\n";
|
||||
|
||||
# Modify file
|
||||
open my $old, "<$backup" or die "Could not open $backup: $!\n";
|
||||
open my $new, ">$active" or die "Could not open $active: $!\n";
|
||||
print $new <<"EOF";
|
||||
##################################################
|
||||
#
|
||||
# This file has been modified by serial-console.
|
||||
#
|
||||
# Do not modify this file; it will be erased when
|
||||
# serial-console (pid $$) exits and will be
|
||||
# replaced with the backup copy held in
|
||||
# $backup.
|
||||
#
|
||||
##################################################
|
||||
|
||||
|
||||
EOF
|
||||
my $patched;
|
||||
while ( my $line = <$old> ) {
|
||||
if ( $line =~ /^\s*\#?\s*com1:\s*\S/ ) {
|
||||
if ( ! $patched ) {
|
||||
$line = $patch;
|
||||
$patched = 1;
|
||||
} else {
|
||||
$line = '# '.$line unless $line =~ /^\s*\#/;
|
||||
}
|
||||
}
|
||||
print $new $line;
|
||||
}
|
||||
print $new $patch unless $patched;
|
||||
close $old;
|
||||
close $new;
|
||||
|
||||
return $backup;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Attach/detach message printing and terminal settings
|
||||
|
||||
sub bochs_attached {
|
||||
print STDERR "Bochs attached.\n\n\n"
|
||||
if $o->{verbosity} >= 1;
|
||||
}
|
||||
|
||||
sub bochs_detached {
|
||||
print STDERR "\n\nWaiting for bochs to attach...\n"
|
||||
if $o->{verbosity} >= 1;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Main program
|
||||
|
||||
$o = parse_opts();
|
||||
pod2usage(1) if @ARGV;
|
||||
|
||||
# Catch signals
|
||||
my $sigdie = sub { die "Exiting via signal\n"; };
|
||||
$SIG{INT} = $sigdie;
|
||||
|
||||
# Create Pty, close slave side
|
||||
my $pty = IO::Pty->new();
|
||||
$pty->close_slave();
|
||||
$pty->set_raw();
|
||||
print STDERR "Slave pty is ".$pty->ttyname."\n" if $o->{verbosity} >= 1;
|
||||
|
||||
# Open logfile
|
||||
my $log;
|
||||
if ( $o->{log} ) {
|
||||
open $log, ">$o->{log}" or die "Could not open $o->{log}: $!\n";
|
||||
}
|
||||
|
||||
# Set up terminal
|
||||
my $termios;
|
||||
if ( -t STDIN ) {
|
||||
$termios = POSIX::Termios->new;
|
||||
$restore_termios = POSIX::Termios->new;
|
||||
$termios->getattr ( fileno(STDIN) );
|
||||
$restore_termios->getattr ( fileno(STDIN) );
|
||||
$termios->setlflag ( $termios->getlflag &
|
||||
~(ICANON) & ~(ECHO) );
|
||||
$termios->setattr ( fileno(STDIN), TCSANOW );
|
||||
}
|
||||
|
||||
# Modify bochsrc file
|
||||
$restore_file = { $o->{rcfile} =>
|
||||
patch_bochsrc ( $o->{rcfile}, $pty->ttyname ) }
|
||||
if $o->{rcfile};
|
||||
|
||||
# Start character shunt
|
||||
my $attached = 1;
|
||||
my $select = IO::Select->new ( \*STDIN, $pty );
|
||||
while ( 1 ) {
|
||||
my %can_read = map { $_ => 1 }
|
||||
$select->can_read ( $attached ? undef : 1 );
|
||||
if ( $can_read{\*STDIN} ) {
|
||||
sysread ( STDIN, my $data, BLOCKSIZE )
|
||||
or die "Cannot read from STDIN: $!\n";
|
||||
$pty->syswrite ( $data );
|
||||
}
|
||||
if ( $can_read{$pty} ) {
|
||||
if ( $pty->sysread ( my $data, BLOCKSIZE ) ) {
|
||||
# Actual data available
|
||||
bochs_attached() if $attached == 0;
|
||||
$attached = 1;
|
||||
syswrite ( STDOUT, $data );
|
||||
$log->syswrite ( $data ) if $log;
|
||||
} else {
|
||||
# No data available but select() says we can read. This almost
|
||||
# certainly indicates that nothing is attached to the slave.
|
||||
bochs_detached() if $attached == 1;
|
||||
$attached = 0;
|
||||
sleep ( 1 );
|
||||
}
|
||||
} else {
|
||||
bochs_attached() if $attached == 0;
|
||||
$attached = 1;
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
# Restore bochsrc file if applicable
|
||||
if ( ( my $orig_file, my $backup_file ) = %$restore_file ) {
|
||||
unlink $orig_file;
|
||||
rename $backup_file, $orig_file;
|
||||
}
|
||||
# Restore terminal settings if applicable
|
||||
if ( $restore_termios ) {
|
||||
$restore_termios->setattr ( fileno(STDIN), TCSANOW );
|
||||
}
|
||||
}
|
||||
191
contrib/bochs/serial-console.1
Normal file
191
contrib/bochs/serial-console.1
Normal file
@@ -0,0 +1,191 @@
|
||||
.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
|
||||
.\"
|
||||
.\" Standard preamble:
|
||||
.\" ========================================================================
|
||||
.de Sh \" Subsection heading
|
||||
.br
|
||||
.if t .Sp
|
||||
.ne 5
|
||||
.PP
|
||||
\fB\\$1\fR
|
||||
.PP
|
||||
..
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
.if t .sp .5v
|
||||
.if n .sp
|
||||
..
|
||||
.de Vb \" Begin verbatim text
|
||||
.ft CW
|
||||
.nf
|
||||
.ne \\$1
|
||||
..
|
||||
.de Ve \" End verbatim text
|
||||
.ft R
|
||||
.fi
|
||||
..
|
||||
.\" Set up some character translations and predefined strings. \*(-- will
|
||||
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
||||
.\" double quote, and \*(R" will give a right double quote. | will give a
|
||||
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
|
||||
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
|
||||
.\" expand to `' in nroff, nothing in troff, for use with C<>.
|
||||
.tr \(*W-|\(bv\*(Tr
|
||||
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
||||
.ie n \{\
|
||||
. ds -- \(*W-
|
||||
. ds PI pi
|
||||
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
||||
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
||||
. ds L" ""
|
||||
. ds R" ""
|
||||
. ds C` ""
|
||||
. ds C' ""
|
||||
'br\}
|
||||
.el\{\
|
||||
. ds -- \|\(em\|
|
||||
. ds PI \(*p
|
||||
. ds L" ``
|
||||
. ds R" ''
|
||||
'br\}
|
||||
.\"
|
||||
.\" If the F register is turned on, we'll generate index entries on stderr for
|
||||
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
|
||||
.\" entries marked with X<> in POD. Of course, you'll have to process the
|
||||
.\" output yourself in some meaningful fashion.
|
||||
.if \nF \{\
|
||||
. de IX
|
||||
. tm Index:\\$1\t\\n%\t"\\$2"
|
||||
..
|
||||
. nr % 0
|
||||
. rr F
|
||||
.\}
|
||||
.\"
|
||||
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
||||
.\" way too many mistakes in technical documents.
|
||||
.hy 0
|
||||
.if n .na
|
||||
.\"
|
||||
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
||||
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
||||
. \" fudge factors for nroff and troff
|
||||
.if n \{\
|
||||
. ds #H 0
|
||||
. ds #V .8m
|
||||
. ds #F .3m
|
||||
. ds #[ \f1
|
||||
. ds #] \fP
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
||||
. ds #V .6m
|
||||
. ds #F 0
|
||||
. ds #[ \&
|
||||
. ds #] \&
|
||||
.\}
|
||||
. \" simple accents for nroff and troff
|
||||
.if n \{\
|
||||
. ds ' \&
|
||||
. ds ` \&
|
||||
. ds ^ \&
|
||||
. ds , \&
|
||||
. ds ~ ~
|
||||
. ds /
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
||||
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
||||
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
||||
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
||||
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
||||
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
||||
.\}
|
||||
. \" troff and (daisy-wheel) nroff accents
|
||||
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
||||
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
||||
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
||||
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
||||
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
||||
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
||||
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
||||
.ds ae a\h'-(\w'a'u*4/10)'e
|
||||
.ds Ae A\h'-(\w'A'u*4/10)'E
|
||||
. \" corrections for vroff
|
||||
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
||||
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
||||
. \" for low resolution devices (crt and lpr)
|
||||
.if \n(.H>23 .if \n(.V>19 \
|
||||
\{\
|
||||
. ds : e
|
||||
. ds 8 ss
|
||||
. ds o a
|
||||
. ds d- d\h'-1'\(ga
|
||||
. ds D- D\h'-1'\(hy
|
||||
. ds th \o'bp'
|
||||
. ds Th \o'LP'
|
||||
. ds ae ae
|
||||
. ds Ae AE
|
||||
.\}
|
||||
.rm #[ #] #H #V #F C
|
||||
.\" ========================================================================
|
||||
.\"
|
||||
.IX Title "SERIAL-CONSOLE 1"
|
||||
.TH SERIAL-CONSOLE 1 "2004-03-10" "perl v5.8.0" "User Contributed Perl Documentation"
|
||||
.SH "NAME"
|
||||
serial\-console
|
||||
.SH "SYNOPSIS"
|
||||
.IX Header "SYNOPSIS"
|
||||
serial-console [options]
|
||||
.PP
|
||||
Options:
|
||||
.PP
|
||||
.Vb 5
|
||||
\& -h,--help Display brief help message
|
||||
\& -v,--verbose Increase verbosity
|
||||
\& -q,--quiet Decrease verbosity
|
||||
\& -l,--log FILE Log output to file
|
||||
\& -r,--rcfile FILE Modify specified bochsrc file
|
||||
.Ve
|
||||
.SH "DESCRIPTION"
|
||||
.IX Header "DESCRIPTION"
|
||||
\&\f(CW\*(C`serial\-console\*(C'\fR provides a virtual serial console for use with
|
||||
Bochs. Running \f(CW\*(C`serial\-console\*(C'\fR creates a pseudo\-tty. The master
|
||||
side of this pty is made available to the user for interaction; the
|
||||
slave device is written to the Bochs configuration file
|
||||
(\f(CW\*(C`bochsrc.txt\*(C'\fR) for use by a subsequent Bochs session.
|
||||
.SH "EXAMPLES"
|
||||
.IX Header "EXAMPLES"
|
||||
.ie n .IP """serial\-console""" 4
|
||||
.el .IP "\f(CWserial\-console\fR" 4
|
||||
.IX Item "serial-console"
|
||||
Create a virtual serial console for Bochs, modify \f(CW\*(C`bochsrc.txt\*(C'\fR
|
||||
appropriately.
|
||||
.ie n .IP """serial\-console \-r ../.bochsrc \-l serial.log""" 4
|
||||
.el .IP "\f(CWserial\-console \-r ../.bochsrc \-l serial.log\fR" 4
|
||||
.IX Item "serial-console -r ../.bochsrc -l serial.log"
|
||||
Create a virtual serial console for Bochs, modify \f(CW\*(C`../.bochsrc\*(C'\fR
|
||||
appropriately, log output to \f(CW\*(C`serial.log\*(C'\fR.
|
||||
.SH "INVOCATION"
|
||||
.IX Header "INVOCATION"
|
||||
Before starting Bochs, run \f(CW\*(C`serial\-console\*(C'\fR in a different session
|
||||
(e.g. a different xterm window). When you subsequently start Bochs,
|
||||
anything that the emulated machine writes to its serial port will
|
||||
appear in the window running \f(CW\*(C`serial\-console\*(C'\fR, and anything typed in
|
||||
the \f(CW\*(C`serial\-console\*(C'\fR window will arrive on the emulated machine's
|
||||
serial port.
|
||||
.PP
|
||||
You do \fBnot\fR need to rerun \f(CW\*(C`serial\-console\*(C'\fR afresh for each Bochs
|
||||
session.
|
||||
.SH "OPTIONS"
|
||||
.IX Header "OPTIONS"
|
||||
.IP "\fB\-l,\-\-log \s-1FILE\s0\fR" 4
|
||||
.IX Item "-l,--log FILE"
|
||||
Log all output (i.e. everything that is printed in the
|
||||
\&\f(CW\*(C`serial\-console\*(C'\fR window) to the specified file.
|
||||
.IP "\fB\-r,\-\-rcfile \s-1FILE\s0\fR" 4
|
||||
.IX Item "-r,--rcfile FILE"
|
||||
Modify the specified bochsrc file. The file will be updated to
|
||||
contain the path to the slave side of the psuedo tty that we create.
|
||||
The original file will be restored when \f(CW\*(C`serial\-console\*(C'\fR exits. The
|
||||
default is to modify the file \f(CW\*(C`bochsrc.txt\*(C'\fR in the current directory.
|
||||
.Sp
|
||||
To avoid modifying any bochsrc file, use \f(CW\*(C`\-\-norcfile\*(C'\fR.
|
||||
Reference in New Issue
Block a user