Difference between revisions of "Installing 386BSD on BOCHS"

From Computer History Wiki
Jump to: navigation, search
Line 1: Line 1:
 
{{newpage}}
 
{{newpage}}
 
<br>
 
<br>
This is the procedure that I have used to install [[386BSD]] onto a patched version of the Bochs IA-32 emulator. This is based on ancient FAQs and trial & error. It is assumed you use a modern Linux with a kernel that features the ip_tables packet filter and TUN/TAP as host OS. If you want to use a different platform you can still follow the tutorial as a guideline but you are on your own figuring out how to get the emulator networked. A good starting point is http://bochs.sourceforge.net/doc/docbook/user/bochsrc.html#AEN1831
+
This is the procedure that was used to install [[386_BSD]] onto a patched version of the Bochs IA-32 emulator. This is based on ancient FAQs and trial & error. It is assumed you use a modern Linux with a kernel that features the ip_tables packet filter and TUN/TAP as host OS. If you want to use a different platform you can still follow the tutorial as a guideline but you are on your own figuring out how to get the emulator networked. A good starting point is http://bochs.sourceforge.net/doc/docbook/user/bochsrc.html#AEN1831
  
Special attention has been given to the ability to run the emulator in the background.  
+
Special attention has been given to the ability to run the emulator in a terminal and in the background.  
  
 
== Requirements ==
 
== Requirements ==
Line 25: Line 25:
 
</pre>
 
</pre>
  
You also need
+
We will get to this later in the tutorial, but for those attempting to install on a different platform or those using this tutorial as a guide, you also need:
 +
 
 
*The bochs 2.4.2 sources
 
*The bochs 2.4.2 sources
 
*A patched pic.cc
 
*A patched pic.cc
 
*The 386BSD distribution and patchkits
 
*The 386BSD distribution and patchkits
but we will get to that later in the tutorial.
 
 
For those attempting to install on a different platform:
 
  
 
<br>You can download the Bochs sources from sourceforge
 
<br>You can download the Bochs sources from sourceforge
 
*http://downloads.sourceforge.net/project/bochs/bochs/2.4.2/bochs-2.4.2.tar.gz
 
*http://downloads.sourceforge.net/project/bochs/bochs/2.4.2/bochs-2.4.2.tar.gz
  
<br>A patched pic.cc can be found at http://www.xs4all.nl/~dugo/pic.cc
+
<br>A patched pic.cc can be found at
*http://sourceforge.net/projects/bsd42/files/Install%20tapes/32v/32v.tap.bz2/download
+
*http://www.xs4all.nl/~dugo/pic.cc
  
 
<br>The 386BSD 1.0 distribution and patchkits can be found at
 
<br>The 386BSD 1.0 distribution and patchkits can be found at
Line 45: Line 43:
  
 
== Preparing for installation ==
 
== Preparing for installation ==
 +
 +
=== Get, patch, configure and compile Bochs ===
 +
 +
The Tiny 386BSD boot floppy does something odd. It writes 0x02 to port 20h of the emulated PIC. This causes Bochs to panic. The patch enables Bochs to continue if this happens.
 +
 +
<pre>
 +
cd /usr/local/src
 +
wget http://downloads.sourceforge.net/project/bochs/bochs/2.4.2/bochs-2.4.2.tar.gz
 +
gunzip -c bochs-2.4.2.tar.gz |tar -xvf -
 +
wget http://www.xs4all.nl/~dugo/pic.cc
 +
mv -f pic.cc ./bochs-2.4.2/iodev/pic.cc
 +
cd bochs-2.4.2
 +
./configure --enable-cpu-level=3 \
 +
            --enable-ne2000 \
 +
            --with-term \
 +
            --with-nogui \
 +
            --enable-all-optimizations \
 +
            --enable-docbook=no
 +
make && make install
 +
</pre>
 +
 +
=== Get and serve the 386BSD distribution and patches ===
 +
 +
During installation the 386BSD distribution files and patches can be fetched with ftp. To facilitate this set up an anon ftpd that serves up the files. It should be possible to obtain these directly from minnie during install, but there are two problems. From the looks of it Warren Toomey never intended minnie to be a reliable 386BSD install server. There is also a catch 22 in using the famous patchkits. Stock 386BSD 1.0 comes without gzip, the patches are gzipped, so here your chance to get around that.
 +
 +
<pre>
 +
echo listen=YES >> /etc/vsftpd/vsftpd.conf
 +
vsftpd
 +
cd /var/ftp
 +
wget -r -np ftp://minnie.tuhs.org/BSD/386bsd-0.1/
 +
wget -r -np ftp://minnie.tuhs.org/BSD/386bsd-patchkits/
 +
mv minnie.tuhs.org/BSD ./
 +
rmdir ./minnie.tuhs.org
 +
cd /var/ftp/BSD/386bsd-patchkits
 +
gunzip *gz
 +
</pre>
 +
 +
 +
BLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
 +
To make bochs' ne2k work without a spare NIC in your host you need to set up tunneling.
 +
 +
<pre>
 +
echo alias char-major-10-200 tun >>/etc/modprobe.d/modprobe.conf.dist
 +
depmod -a
 +
ln -s /dev/net/tun /dev/net/tun0
 +
</pre>
 +
 +
Make a tunconfig script for bochs to fire off when the ne2k comes up. In this example 192.168.1.1 becomes the gw and you can pick an ip in 192.168.1.0/24 for the guest later.
 +
 +
<pre>
 +
# set up the bsd dir w/ tunconfig
 +
cd; mkdir bsd; cd bsd
 +
printf '#!/bin/bash\n/sbin/ifconfig ${1##/*/} 192.168.1.1\n' >tunconfig
 +
printf 'date; echo ${1##/*/} >/tmp/x'  >>tunconfig
 +
cat >>tunconfig <<__EOF
 +
# carnival, put your masks on and go
 +
/sbin/iptables -D POSTROUTING -t nat -s 192.168.1.0/24 -d ! 192.168.1.0/24 -j MASQUERADE >& /dev/null
 +
/sbin/iptables -t nat -s 192.168.1.0/24 -d ! 192.168.1.0/24 -A POSTROUTING -j MASQUERADE
 +
echo 1 > /proc/sys/net/ipv4/ip_forward
 +
__EOF
 +
chmod +x tunconfig
 +
</pre>
 +
 +
The 386BSD installation fails on a box with a lot of mem, hence the `megs: 8' stanza in the bochs configuration.
 +
 +
<pre>
 +
cat >bochsrc <<__EOF
 +
config_interface: textconfig
 +
display_library: term
 +
romimage: file=/usr/local/share/bochs/BIOS-bochs-legacy
 +
cpu: count=1, ips=80000000, reset_on_triple_fault=0
 +
megs: 8
 +
vgaromimage: file=/usr/local/share/bochs/VGABIOS-lgpl-latest
 +
vga: extension=none
 +
floppya: 1_44=boot.img, status=inserted
 +
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
 +
ata0-master: type=disk, path="disk.img", mode=flat, cylinders=1024, heads=16, spt=63, translation=none, model=generic
 +
boot: disk, floppy
 +
floppy_bootsig_check: disabled=0
 +
log: bochsout.txt
 +
panic: action=ask
 +
error: action=report
 +
info: action=report
 +
debug: action=ignore
 +
vga_update_interval: 400000
 +
keyboard_serial_delay: 250
 +
keyboard_paste_delay: 1000000
 +
mouse: enabled=0
 +
private_colormap: enabled=0
 +
keyboard_mapping: enabled=0, map=
 +
i440fxsupport: enabled=0
 +
ne2k: ioaddr=0x300, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=/dev/net/tun0, script=/root/bsd/tunconfig
 +
com1: enabled=0
 +
__EOF
 +
</pre>
 +
 +
Prepare the 386BSD boot floppy for our box with a fancy 1.44MB floppy drive.
 +
 +
<pre>
 +
(cat /var/ftp/BSD/386bsd-0.1/bootable/dist.fs;dd if=/dev/zero bs=1 count=245760)>boot.img
 +
</pre>
 +
 +
Make a hard drive for the installation.
 +
 +
<pre>
 +
rm disk.img; printf "hd\nflat\n504\ndisk.img\n" |bximage
 +
</pre>
 +
  
 
==  Boot 1. ==
 
==  Boot 1. ==

Revision as of 21:06, 8 April 2010

Template:Newpage
This is the procedure that was used to install 386_BSD onto a patched version of the Bochs IA-32 emulator. This is based on ancient FAQs and trial & error. It is assumed you use a modern Linux with a kernel that features the ip_tables packet filter and TUN/TAP as host OS. If you want to use a different platform you can still follow the tutorial as a guideline but you are on your own figuring out how to get the emulator networked. A good starting point is http://bochs.sourceforge.net/doc/docbook/user/bochsrc.html#AEN1831

Special attention has been given to the ability to run the emulator in a terminal and in the background.

Requirements

You will need the following to get a 386BSD system patched and installed:

  • A modern linux system with iptables
  • A working copy of gunzip
  • An http/ftp client like wget
  • An acceptable C compiler like gcc to compile Bochs
  • The curses/ncurses library for Bochs to simulate a monitor in a terminal
  • An ftp server for the distribution files

On a stock Basic Fedora Core 8 box you have these in no time with

yum -y install wget
yum -y install gcc
yum -y install gcc-c++
yum -y install ncurses-devel
yum -y install vsftpd

We will get to this later in the tutorial, but for those attempting to install on a different platform or those using this tutorial as a guide, you also need:

  • The bochs 2.4.2 sources
  • A patched pic.cc
  • The 386BSD distribution and patchkits


You can download the Bochs sources from sourceforge


A patched pic.cc can be found at


The 386BSD 1.0 distribution and patchkits can be found at


Preparing for installation

Get, patch, configure and compile Bochs

The Tiny 386BSD boot floppy does something odd. It writes 0x02 to port 20h of the emulated PIC. This causes Bochs to panic. The patch enables Bochs to continue if this happens.

cd /usr/local/src
wget http://downloads.sourceforge.net/project/bochs/bochs/2.4.2/bochs-2.4.2.tar.gz
gunzip -c bochs-2.4.2.tar.gz |tar -xvf -
wget http://www.xs4all.nl/~dugo/pic.cc
mv -f pic.cc ./bochs-2.4.2/iodev/pic.cc
cd bochs-2.4.2
./configure --enable-cpu-level=3 \
            --enable-ne2000 \
            --with-term \
            --with-nogui \
            --enable-all-optimizations \
            --enable-docbook=no
make && make install

Get and serve the 386BSD distribution and patches

During installation the 386BSD distribution files and patches can be fetched with ftp. To facilitate this set up an anon ftpd that serves up the files. It should be possible to obtain these directly from minnie during install, but there are two problems. From the looks of it Warren Toomey never intended minnie to be a reliable 386BSD install server. There is also a catch 22 in using the famous patchkits. Stock 386BSD 1.0 comes without gzip, the patches are gzipped, so here your chance to get around that.

echo listen=YES >> /etc/vsftpd/vsftpd.conf
vsftpd
cd /var/ftp
wget -r -np ftp://minnie.tuhs.org/BSD/386bsd-0.1/
wget -r -np ftp://minnie.tuhs.org/BSD/386bsd-patchkits/
mv minnie.tuhs.org/BSD ./
rmdir ./minnie.tuhs.org
cd /var/ftp/BSD/386bsd-patchkits
gunzip *gz


BLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH To make bochs' ne2k work without a spare NIC in your host you need to set up tunneling.

echo alias char-major-10-200 tun >>/etc/modprobe.d/modprobe.conf.dist
depmod -a
ln -s /dev/net/tun /dev/net/tun0

Make a tunconfig script for bochs to fire off when the ne2k comes up. In this example 192.168.1.1 becomes the gw and you can pick an ip in 192.168.1.0/24 for the guest later.

# set up the bsd dir w/ tunconfig
cd; mkdir bsd; cd bsd
printf '#!/bin/bash\n/sbin/ifconfig ${1##/*/} 192.168.1.1\n' >tunconfig
printf 'date; echo ${1##/*/} >/tmp/x'  >>tunconfig
cat >>tunconfig <<__EOF
# carnival, put your masks on and go
/sbin/iptables -D POSTROUTING -t nat -s 192.168.1.0/24 -d ! 192.168.1.0/24 -j MASQUERADE >& /dev/null
/sbin/iptables -t nat -s 192.168.1.0/24 -d ! 192.168.1.0/24 -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
__EOF
chmod +x tunconfig

The 386BSD installation fails on a box with a lot of mem, hence the `megs: 8' stanza in the bochs configuration.

cat >bochsrc <<__EOF
config_interface: textconfig
display_library: term
romimage: file=/usr/local/share/bochs/BIOS-bochs-legacy
cpu: count=1, ips=80000000, reset_on_triple_fault=0
megs: 8
vgaromimage: file=/usr/local/share/bochs/VGABIOS-lgpl-latest
vga: extension=none
floppya: 1_44=boot.img, status=inserted
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="disk.img", mode=flat, cylinders=1024, heads=16, spt=63, translation=none, model=generic
boot: disk, floppy
floppy_bootsig_check: disabled=0
log: bochsout.txt
panic: action=ask
error: action=report
info: action=report
debug: action=ignore
vga_update_interval: 400000
keyboard_serial_delay: 250
keyboard_paste_delay: 1000000
mouse: enabled=0
private_colormap: enabled=0
keyboard_mapping: enabled=0, map=
i440fxsupport: enabled=0
ne2k: ioaddr=0x300, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=/dev/net/tun0, script=/root/bsd/tunconfig
com1: enabled=0
__EOF

Prepare the 386BSD boot floppy for our box with a fancy 1.44MB floppy drive.

(cat /var/ftp/BSD/386bsd-0.1/bootable/dist.fs;dd if=/dev/zero bs=1 count=245760)>boot.img

Make a hard drive for the installation.

rm disk.img; printf "hd\nflat\n504\ndisk.img\n" |bximage


Boot 1.