Difference between revisions of "Talk:386BSD"
Line 166: | Line 166: | ||
echo "mget *tar" >>.netrc | echo "mget *tar" >>.netrc | ||
echo "!echo odin |extract bin01" >>.netrc | echo "!echo odin |extract bin01" >>.netrc | ||
− | echo "!csh -c \"limit openfiles 512; extract src01 ; extract etc01 ; tar -cf /dist.tar /tmp/ ; sync ; sync ; sync ; /sbin/shutdown -r now\"" >>.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 "quit" >>.netrc | ||
echo "#newl" >>.netrc | echo "#newl" >>.netrc |
Revision as of 13:06, 4 April 2010
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! Dugo
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.
The tiny 386BSD kernel keeps kprinting `startartstartart' to your screen once network is up and running. This can get on your nerves, so try to do as much as possible with shell scripts. In this case everything just goes into .netrc.
Extract will complain about something being missing, according to an ancient FAQ this is a joke from Jolitz. Extract also opens more files than tiny 386BSD sh can handle, hence the use csh.
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 # .netrc is now ready to do the installaion # fire up the network and go, go go ifconfig ne0 192.168.1.2 netmask 255.255.255.0 up route add default 192.168.1.1 ftp 10.0.0.1
When all goes well bochs crashes when 386BSD shuts down. Restart twice and 386BSD should greet you with a login prompt and scold you for loging in as root (no password) when you do. Next up, patch the system and do a buildworld. Dugo