Talk:386BSD

From Computer History Wiki
Revision as of 11:56, 4 April 2010 by Dugo (talk | contribs)
Jump to: navigation, search

You can get 386BSD to run in a patched bochs 2.4.2, full blown with all the patches, triple make world, the works. Ok, ok, try to compile perl-5.10.1 and the compiler segfaults, but what is in the distro works. Everything works. There exists a broken (in a mere two pieces) shell script that reproduces a bochs image and environment on an AWS default fedora server. The script is of such questionable and perverted command line art that it is deemed unredistributable in its current form. It can be done!


Can you give more details? Suddenly this is interesting again... !

neozeed 17:57, 3 April 2010 (UTC)

Ok here goes. Take a eg. Basic Fedora Core 8 box and install required software.

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

The 386BSD bootflop does something odd. The workaround is to patch bochs to ignore it instead of panic when 386BSD tries to write 0x02 to port 20h.

# get bochs
cd /usr/local/src
wget http://downloads.sourceforge.net/project/bochs/bochs/2.4.2/bochs-2.4.2.tar.gz?use_mirror=kent
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

During installation the 386BSD distribution files can be fetched with ftp. To facilitate this set up an anon ftpd that serves up the files. There is a catch 22. 386BSD comes without gzip, but the patches are gzipped, 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

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

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

bochs -q -f bochsrc

Bochs will come up booting a tiny 386BSD from floppy, this needs to go to disk, which can be done with a simple

(echo y; echo y)|install

Now try to reboot with..:

shutdown -r now

..this will go horribly wrong but don't panic. Boch will probably crash, just fire it up with..:

bochs -q -f bochsrc

386BSD comes up and shuts down immediately causing bochs to crash again. This is a reoccuring theme, don't worry about it and fire bochs up again anytime this happens. Next, the real work, installing the distro.

Dugo