Get QNX 2 running on Bochs under QNX 6

Submitted by newsagent on

Robert Krten recently got QNX 2 running on Bochs under QNX 6 and he shares with us the list of gotchas and tricks.Compilation:
Bochs will not compile out of the box. You need to perform the following
hacks:
i) add -lsocket to the top level Makefile
ii) gui/gui.cc procedure bx_gui_c::snapshot_handler(void), you need
to comment out the code that does the strcmp() against the "wx"
string; else it will SIGSEGV when you take a snapshot
iii) gui/textconfig.cc you need to remove the extern "C" {} stuff
around the system headers
iv) same thing in top-level bochs.h

Environment and bootup procedure:
The main trick to booting bochs off the hard disk is the hard disk
geometry and the hard disk driver.

I used the option "2" driver, rather than the option "3" driver
from the QNX 2 installation menu (option "3" says "recommended for
IDE drives"; I used the older one).

(This is the driver invoked by the line "mount disk 3 /drivers/disk.at")

The hard disk needs to be created with something like "dd".

I created a 51.6MB disk by:

dd if=/dev/zero of=disk_3 count=100800

Then you need to point the bochs emulator at the floppy disk image
and the hard disk image.

Here's the configuration file I use, I saved it to "bochs-qnx2.rc":

# configuration file generated by Bochs
config_interface: textconfig
display_library: x
megs: 32
romimage: file=/usr/local/share/bochs/BIOS-bochs-latest, address=0xf0000
vgaromimage: /usr/local/share/bochs/VGABIOS-lgpl-latest
boot: disk
floppya: 1_44="/root/bochs-qnx2.floppy", status=inserted
floppyb: 1_44="none", status=inserted
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, mode=flat, translation=none,
path="/data/static/images/qnx220/disks/drive_3", cylinders=100, heads=16,
spt=63, biosdetect=auto, model="Generic 1234"
ata1: enabled=0
ata2: enabled=0
ata3: enabled=0
parport1: enabled=1, file=""
com1: enabled=1, dev=""
usb1: enabled=1, ioaddr=0xff80, irq=10
# no sb16
floppy_bootsig_check: disabled=0
vga_update_interval: 300000
keyboard_serial_delay: 250
keyboard_paste_delay: 100000
floppy_command_delay: 500
ips: 1000000
text_snapshot_check: 0
mouse: enabled=0
private_colormap: enabled=0
i440fxsupport: enabled=0
clock: sync=realtime, time0=local
# no ne2k
newharddrivesupport: enabled=1
# no loader
log: /root/bochs-qnx2.log
logprefix: %t%e%d
debugger_log: -
panic: action=report
error: action=report
info: action=report
debug: action=ignore
pass: action=fatal
keyboard_mapping: enabled=0, map=
keyboard_type: mf
user_shortcut: keys=none
# no cmosimage

The floppy lives in /root/bochs-qnx2.floppy, and the 51.6MB disk lives in the
/data/static/images... path. BE CAREFFUL WITH THE HEADS and SPT values!
This took me about an hour to figure out; I naively used an incorrect value
and there was grief.

Anyway, once you get this configured, run bochs, and go into the edit menu
to boot off the floppy (the configuration file above is set to book off the
hard disk, 'cuz that's what you'll be doing 99.999% of the time after).

Finally, you might want to create a /usr/local/bin/ script called "qnx2":

#! /bin/sh
nice bochs -f /root/bochs-qnx2.rc

Run bochs, install qnx2, and then reboot onto the hard disk.

Enjoy!

-RK