Development/SettingUpBochs

From Syslinux Wiki
Jump to: navigation, search

Build

Download the latest sources at Sourceforge.

./configure --enable-all-optimisations \
            --enable-pci \
            --enable-ne2000 \
            --enable-pnic \
            --with-term \
            --enable-disasm \
            --enable-debugger \
            --disable-acpi

Configure

Save the following in a bochsrc file:

vgaromimage: file=/path/to/bochs/bios/VGABIOS-elpin-2.40
vga: extension=none
romimage: file=/path/to/bochs/bios/BIOS-bochs-latest    
cpu: count=1, ips=10000000, reset_on_triple_fault=0
megs: 32    
optromimage1: file=/path/to/gpxe/src/bin/pnic.rom, address=0xd0000
ne2k: ioaddr=0x280, irq=10, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=/dev/net/tun
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata0-master: type=disk, path=/path/to/disk.img, mode=flat, translation=none
log: bochsout.txt
debugger_log: bochsdbg.txt
panic: action=ask
error: action=report
info: action=report
debug: action=ignore
mouse: enabled=0
display_library: term
boot: network

Disk image

To create a disk image, checkout here or here.

See also What_is_a_SYSLINUX_disk_? and Hard_disk_images

In a nutshell:

  1. Create a disk image using bximage
  2. Setup the partition table with fdisk
  3. Install the Master boot record (when using losetup to create a device, don't specify any offset)
  4. Format the disk (make sure to set the right offset when using losetup)
  5. Run extlinux
  6. Create a Syslinux configuration file and install necessary modules

There is a ready to use image available on github.

Run

./bochs -q -f /path/to/bochsrc

PXELINUX

bochs provides 3 different NICs, ne2k-isa, ne2k-pci and pnic. The only difference between ne2k-isa and ne2k-pci is inserting the ne2k NIC into a PCI slot (thereby ignoring the ioaddr and irq settings).

PXE-VNET

The BOCHS ethmod vnet has the advantage of not requiring elevated privileges (a la root) but the disadvantage of only providing DHCP, read-only TFTP and ICMP echo support (possibly a little more but not much)

PXE-VNET-GPXE

So far, I haven't been able to get gPXE and the BOCHS DHCP server to like each other using BOCHS's vnet ethmod. However, vnet is a fixed IP configuration.

#!gpxe
ifopen net0
# either gPXE or the BOCHS DHCP doesn't like this:
# dhcp net0

set net0/ip 192.168.10.2
set net0/netmask 255.255.255.0
set net0/dns 192.168.10.1
set net0/gateway ${net0/dns}
set net0/next-server ${net0/dns}
set net0/filename pxelinux.0
# Verify settings with user
config net0

chain ${net0/filename}

To create an image:

  • Save the script into bochs.gpxe
  • Clone the gpxe tree: git://git.etherboot.org/scm/gpxe.git
  • make EMBEDDED_IMAGE=/path/to/bochs.gpxe ISOLINUX_BIN=/path/to/syslinux/core/isolinux.bin
  • OR: make ne2k-isa.dsk EMBEDDED_IMAGE=/path/to/bochs.gpxe (or gpxe.dsk instead of ne2k-isa.dsk)

PXE-VNET-NE2K-ISA

I had to alter the default IRQ as 9 was taken by the PCI bridge. The MAC is a special MAC address that BOCHS uses for certain ethmod networks. Replace "/tftpboot" with your appropriate TFTP root directory.

ne2k: enabled=1, ioaddr=0x300, irq=10, mac=fe:fd:00:00:00:01, ethmod=vnet, ethdev=/tftpboot, script=none

I've been able to get this to work with my gPXE script embedded into a floppy image with the ne2k-isa gPXE driver (feel free to use all-drivers if you like).

To boot it via a floppy drive, add the following to your bochsrc:

floppya: 1_44="/path/to/gpxe/src/bin/gpxe.dsk", status=inserted
boot: floppy

PXE-VNET-PNIC

So far, I haven't been successful with the PNIC psuedo NIC on the vnet ethmod. gPXE reports PCI 10ec:8029 as ns8390 but didn't seem to take (even with all-drivers; full ID: 10ec:8029 0000:0000).