Difference between revisions of "Installing 386BSD on BOCHS"

From Computer History Wiki
Jump to: navigation, search
Line 1: Line 1:
{{newpage}}
+
THIS IS WORK IN PROGRESS
<br>
 
 
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
 
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.  
 
Special attention has been given to the ability to run the emulator in a terminal and in the background.  
 +
 +
Watch out for leading spaces if you copy/paste anything from the boxes below, they tend to break here-documents.
  
 
== Requirements ==
 
== Requirements ==
Line 37: Line 38:
 
*http://www.xs4all.nl/~dugo/pic.cc
 
*http://www.xs4all.nl/~dugo/pic.cc
  
<br>The 386BSD 1.0 distribution and patchkits can be found at
+
<br>The 386BSD 0.1 distribution and patchkits can be found at
 
*ftp://minnie.tuhs.org/BSD/
 
*ftp://minnie.tuhs.org/BSD/
 
*http://www.oldlinux.org/Linux.old/distributions/386BSD/  
 
*http://www.oldlinux.org/Linux.old/distributions/386BSD/  
Line 46: Line 47:
 
=== Get, patch, configure and compile Bochs ===
 
=== 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.
+
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 in CLI mode. The available windows binary for Bochs comes up with a msgbox.
  
 
<pre>
 
<pre>
Line 66: Line 67:
 
=== Get and serve the 386BSD distribution and patches ===
 
=== 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.
+
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 386BSD install server. There is also a catch 22 in using the famous patchkits. Stock 386BSD 0.1 comes without gzip, the patches are gzipped, so here your chance to get around that.
  
 
<pre>
 
<pre>
Line 80: Line 81:
 
</pre>
 
</pre>
  
 +
=== Prepare the host for networking Bochs ===
  
BLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
+
To make Bochs' ne2k work without a spare NIC in your host you need to set up tunneling.
To make bochs' ne2k work without a spare NIC in your host you need to set up tunneling.
 
  
 
<pre>
 
<pre>
Line 96: Line 97:
 
cd; mkdir bsd; cd bsd
 
cd; mkdir bsd; cd bsd
 
printf '#!/bin/bash\n/sbin/ifconfig ${1##/*/} 192.168.1.1\n' >tunconfig
 
printf '#!/bin/bash\n/sbin/ifconfig ${1##/*/} 192.168.1.1\n' >tunconfig
printf 'date; echo ${1##/*/} >/tmp/x'  >>tunconfig
 
 
cat >>tunconfig <<__EOF
 
cat >>tunconfig <<__EOF
 
# carnival, put your masks on and go
 
# carnival, put your masks on and go
Line 105: Line 105:
 
chmod +x tunconfig
 
chmod +x tunconfig
 
</pre>
 
</pre>
 +
 +
=== Configure Bochs ===
  
 
The 386BSD installation fails on a box with a lot of mem, hence the `megs: 8' stanza in the bochs configuration.
 
The 386BSD installation fails on a box with a lot of mem, hence the `megs: 8' stanza in the bochs configuration.
Line 139: Line 141:
 
</pre>
 
</pre>
  
Prepare the 386BSD boot floppy for our box with a fancy 1.44MB floppy drive.
+
=== Create Tiny 386BSD floppy ===
 +
 
 +
Prepare the 386BSD boot floppy to work on our emulated box that has a fancy 1.44MB floppy drive. The original floppy was intended for 1.2MB floppys, but who wants to be caught dead using these nowadays?
  
 
<pre>
 
<pre>
Line 145: Line 149:
 
</pre>
 
</pre>
  
Make a hard drive for the installation.
+
=== Create a disk image ===
 +
 
 +
Make a disk that has the same geometry as in the configuration file, in this case 1024 cylinders, 16 heads and 63 sectors per track. This gets you a about 500 megabytes, go larger and you get yourself in heaps of trouble.
 +
 
 +
<pre>
 +
printf "hd\nflat\n504\ndisk.img\n" |bximage
 +
</pre>
 +
 
 +
 
 +
 
 +
==  First boot, Tiny 386BSD ==
 +
 
 +
=== Start up Bochs ===
 +
 
 +
You should now be ready to fire up bochs in your terminal and start your journey back in time.
 +
 
 +
<pre>
 +
bochs -q -f bochsrc
 +
</pre>
 +
 
 +
You should get the following output:
 +
 
 +
 
 +
{|
 +
|-
 +
| style="border:1px solid #000000; padding:1em; margin:auto; background:#000000;line-height:9px"| <font color="aqua" size="-1" face="Courier">
 +
Plex86/Bochs VGABios 0.6c 08 Apr 2009<br>
 +
This VGA/VBE Bios is released under the GNU LGPL<br>
 +
<br>
 +
Please visit :<br><nowiki>
 +
&nbsp;. http://bochs.sourceforge.net
 +
</nowiki>
 +
<br>
 +
<nowiki>
 +
&nbsp;. http://www.nongnu.org/vgabios
 +
</nowiki>
 +
<br>
 +
 
 +
NO Bochs VBE Support available!<br></font><font color="LightGrey" size="-1" face="Courier">
 +
<br>
 +
Bochs BIOS - build: 09/28/09<br>
 +
$Revision: 1.235 $ $Date: 2009/09/28 16:36:02 $<br>
 +
Options: apmbios pcibios eltorito<br>
 +
<br>
 +
ata0 master: generic ATA-6 Hard-Disk ( 504 MBytes)<br>
 +
<br>
 +
Press F12 for boot menu.<br>
 +
<br>
 +
Booting from Hard Disk...<br>
 +
Boot failed: not a bootable disk<br>
 +
<br>
 +
Booting from Floppy...<br>
 +
386BSD Release 0.1 by William and Lynne Jolitz. [0.1.24  07/14/92 19:07]<br>
 +
Copyright (c) 1989,1990,1991,1992 William F. Jolitz. All rights reserved.<br>
 +
Based in part on work by the 386BSD User Community and the<br>
 +
BSD Networking Software, Release 2 by UCB EECS Department.<br>
 +
pc0<color> at 0x60 irq 1 on isa<br>
 +
wd0 <generic> at 0x1f0 irq 14 on isa<br>
 +
fd0 drives 0: 1.44M at 0x3f0 irq 6 drq 2 on isa<br>
 +
ne0 ethernet address fe:fd:00:00:00:01 at 0x300 irq 9 on isa<br>
 +
npx0 at 0xf0 irq 13 on isa<br>
 +
changing root device to fd0a<br>
 +
<br>
 +
warning: no swap space present (yet)<br>
 +
386BSD Distribution Installation Floppy (Tiny 386BSD) Release 0.1<br>
 +
<br>
 +
Please read the installation notes (type 'zmore INSTALL.NOTES')<br>
 +
and registration information (type 'more REGISTRATION') before use.<br>
 +
To install on hard disk drive, type 'install'.<br>
 +
<br>
 +
erase ^?, werase ^H, kill ^U, intr ^C<br>
 +
<nowiki>
 +
# </nowiki></font>|| style="background:#000000;"| &#160;
 +
|}
 +
 
 +
=== Format drive and install the distribution utilities ===
 +
 
 +
At he promt give:
 +
 
 +
<pre>
 +
(echo y; echo y)|install
 +
</pre>
 +
 
 +
This will cause the installer to format the entire drive as it sees fit and install the distribution utilities on it. When the installer is finished Tiny 386BSD and Bochs will go down gracelessly.
 +
 
 +
== Second boot, Base System ==
 +
 
 +
=== Finnish the installation.
 +
 
 +
==== Restart Bochs ====
 +
 
 +
Give another:
 +
<pre>
 +
bochs -q -f bochsrc
 +
</pre>
 +
..to boot the base system. After it finds the devices it will greet you with the following:
 +
 
 +
{|
 +
|-
 +
| style="border:1px solid #000000; padding:1em; margin:auto; background:#000000;line-height:9px"| <font color="LightGrey" size="-1" face="Courier"><TT>
 +
386BSD Base System Release 0.1<br>
 +
<br>
 +
Congratulations, you've got 386BSD on the hard disk!<br>
 +
Please read the file REGISTRATION (e.g. type 'more REGISTRATION')<br>
 +
to discover how to become a part of the 386BSD user group.<br>
 +
<br>
 +
To finish the installation, load the remaining distribution files into /tmp<br>
 +
and type 'extract' . To load the files from DOS floppies, type 'mread a:*.* /tmp.<br>
 +
'<br>
 +
<br>
 +
If you should wish to uninstall 386BSD, delete the partition by using the<br>
 +
&nbsp;DOS 5 FDISK program. If installed on the entire drive, use the FDISK/MBR<br>
 +
&nbsp;to remove the 386BSD bootstrap from the drive.<br>
 +
<br>
 +
erase ^?, werase ^H, kill ^U, intr ^C<br>
 +
<nowiki>
 +
# </nowiki></TT></font>|| style="background:#000000;"| &#160;
 +
|}
 +
 
 +
==== Write an installer ====
 +
 
 +
The installed 386BSD kernel keeps kprinting `startartstartart' to your screen once network is up and running. This can get on your nerves, to work around this you can write an instsaller in a .netrc macro.
 +
 
 +
Change the ips below, 10.0.0.1 to where your ftpd lives, 192.168.1.1 to your gw and 192.168.1.2 to the ip you want to give the guest. Change odin into the name you want to give the guest.
 +
 
 +
<pre>
 +
echo "machine 10.0.0.1" >.netrc
 +
echo "login ftp" >>.netrc
 +
echo "password news@EU.net" >>.netrc
 +
echo "macdef init" >>.netrc
 +
echo "#" >>.netrc
 +
echo "pasv" >>.netrc
 +
echo "prompt" >>.netrc
 +
echo "bin" >>.netrc
 +
echo "lcd /tmp" >>.netrc
 +
echo "cd BSD/386bsd-0.1/bindist/" >>.netrc
 +
echo "mget *" >>.netrc
 +
echo "cd ../etcdist/" >>.netrc
 +
echo "mget *" >>.netrc
 +
echo "cd ../srcdist/" >>.netrc
 +
echo "mget *" >>.netrc
 +
echo "cd ../../386bsd-patchkits" >>.netrc
 +
echo "mget *tar" >>.netrc
 +
echo "!echo odin |extract bin01" >>.netrc
 +
echo "!csh -c \"limit openfiles 512; extract src01 ; extract etc01 ; tar -cf /dist.tar /tmp/ ; cp pk023.tar /pk023.tar ; cp pk023024.tar /pk023024.tar ; sync ; sync ; sync ; /sbin/shutdown -r now\"" >>.netrc
 +
echo "quit" >>.netrc
 +
echo "#newl" >>.netrc
 +
echo "" >>.netrc
 +
chmod 400 .netrc
 +
</pre>
 +
 
 +
==== Configure the network ====
 +
 
 +
Watch out for the startarts.
 +
 
 +
<pre>
 +
ifconfig ne0 192.168.1.2 netmask 255.255.255.0 up
 +
route add default 192.168.1.1
 +
</pre>
 +
 
 +
==== Start the installation ====
 +
 
 +
Extract will complain about something being missing, according to an ancient FAQ this is a joke from Jolitz.
 +
 
 +
Extract (or cat) also opens more files than the base sh can handle in case you were wondering about the use of csh.
  
 
<pre>
 
<pre>
rm disk.img; printf "hd\nflat\n504\ndisk.img\n" |bximage
+
ftp 10.0.0.1
 
</pre>
 
</pre>
  
  
==  Boot 1. ==
+
TO BE CONTINUED

Revision as of 15:33, 9 April 2010

THIS IS WORK IN PROGRESS 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.

Watch out for leading spaces if you copy/paste anything from the boxes below, they tend to break here-documents.

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 0.1 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 in CLI mode. The available windows binary for Bochs comes up with a msgbox.

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 386BSD install server. There is also a catch 22 in using the famous patchkits. Stock 386BSD 0.1 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

Prepare the host for networking Bochs

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
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

Configure Bochs

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

Create Tiny 386BSD floppy

Prepare the 386BSD boot floppy to work on our emulated box that has a fancy 1.44MB floppy drive. The original floppy was intended for 1.2MB floppys, but who wants to be caught dead using these nowadays?

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

Create a disk image

Make a disk that has the same geometry as in the configuration file, in this case 1024 cylinders, 16 heads and 63 sectors per track. This gets you a about 500 megabytes, go larger and you get yourself in heaps of trouble.

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


First boot, Tiny 386BSD

Start up Bochs

You should now be ready to fire up bochs in your terminal and start your journey back in time.

bochs -q -f bochsrc

You should get the following output:


Plex86/Bochs VGABios 0.6c 08 Apr 2009
This VGA/VBE Bios is released under the GNU LGPL

Please visit :
 . http://bochs.sourceforge.net
 . http://www.nongnu.org/vgabios

NO Bochs VBE Support available!

Bochs BIOS - build: 09/28/09
$Revision: 1.235 $ $Date: 2009/09/28 16:36:02 $
Options: apmbios pcibios eltorito

ata0 master: generic ATA-6 Hard-Disk ( 504 MBytes)

Press F12 for boot menu.

Booting from Hard Disk...
Boot failed: not a bootable disk

Booting from Floppy...
386BSD Release 0.1 by William and Lynne Jolitz. [0.1.24 07/14/92 19:07]
Copyright (c) 1989,1990,1991,1992 William F. Jolitz. All rights reserved.
Based in part on work by the 386BSD User Community and the
BSD Networking Software, Release 2 by UCB EECS Department.
pc0<color> at 0x60 irq 1 on isa
wd0 <generic> at 0x1f0 irq 14 on isa
fd0 drives 0: 1.44M at 0x3f0 irq 6 drq 2 on isa
ne0 ethernet address fe:fd:00:00:00:01 at 0x300 irq 9 on isa
npx0 at 0xf0 irq 13 on isa
changing root device to fd0a

warning: no swap space present (yet)
386BSD Distribution Installation Floppy (Tiny 386BSD) Release 0.1

Please read the installation notes (type 'zmore INSTALL.NOTES')
and registration information (type 'more REGISTRATION') before use.
To install on hard disk drive, type 'install'.

erase ^?, werase ^H, kill ^U, intr ^C
#
|| style="background:#000000;"|  

Format drive and install the distribution utilities

At he promt give:

(echo y; echo y)|install

This will cause the installer to format the entire drive as it sees fit and install the distribution utilities on it. When the installer is finished Tiny 386BSD and Bochs will go down gracelessly.

Second boot, Base System

=== Finnish the installation.

Restart Bochs

Give another:

bochs -q -f bochsrc

..to boot the base system. After it finds the devices it will greet you with the following:

386BSD Base System Release 0.1

Congratulations, you've got 386BSD on the hard disk!
Please read the file REGISTRATION (e.g. type 'more REGISTRATION')
to discover how to become a part of the 386BSD user group.

To finish the installation, load the remaining distribution files into /tmp
and type 'extract' . To load the files from DOS floppies, type 'mread a:*.* /tmp.
'

If you should wish to uninstall 386BSD, delete the partition by using the
 DOS 5 FDISK program. If installed on the entire drive, use the FDISK/MBR
 to remove the 386BSD bootstrap from the drive.

erase ^?, werase ^H, kill ^U, intr ^C
#
|| style="background:#000000;"|  

Write an installer

The installed 386BSD kernel keeps kprinting `startartstartart' to your screen once network is up and running. This can get on your nerves, to work around this you can write an instsaller in a .netrc macro.

Change the ips below, 10.0.0.1 to where your ftpd lives, 192.168.1.1 to your gw and 192.168.1.2 to the ip you want to give the guest. Change odin into the name you want to give the guest.

echo "machine 10.0.0.1" >.netrc
echo "login ftp" >>.netrc
echo "password news@EU.net" >>.netrc
echo "macdef init" >>.netrc
echo "#" >>.netrc
echo "pasv" >>.netrc
echo "prompt" >>.netrc
echo "bin" >>.netrc
echo "lcd /tmp" >>.netrc
echo "cd BSD/386bsd-0.1/bindist/" >>.netrc
echo "mget *" >>.netrc
echo "cd ../etcdist/" >>.netrc
echo "mget *" >>.netrc
echo "cd ../srcdist/" >>.netrc
echo "mget *" >>.netrc
echo "cd ../../386bsd-patchkits" >>.netrc
echo "mget *tar" >>.netrc
echo "!echo odin |extract bin01" >>.netrc
echo "!csh -c \"limit openfiles 512; extract src01 ; extract etc01 ; tar -cf /dist.tar /tmp/ ; cp pk023.tar /pk023.tar ; cp pk023024.tar /pk023024.tar ; sync ; sync ; sync ; /sbin/shutdown -r now\"" >>.netrc
echo "quit" >>.netrc
echo "#newl" >>.netrc
echo "" >>.netrc
chmod 400 .netrc

Configure the network

Watch out for the startarts.

ifconfig ne0 192.168.1.2 netmask 255.255.255.0 up
route add default 192.168.1.1

Start the installation

Extract will complain about something being missing, according to an ancient FAQ this is a joke from Jolitz.

Extract (or cat) also opens more files than the base sh can handle in case you were wondering about the use of csh.

ftp 10.0.0.1


TO BE CONTINUED