211bsd-pidp11 icon indicating copy to clipboard operation
211bsd-pidp11 copied to clipboard

2.11BSD distribution and tools for the PiDP-11

  • 211bsd-pidp11 ** Patch level 481

This is a testing distribution of 2.11BSD for the PiDP-11. There is a drop-in replacement disk image for the BSD system included in Oscar Vermeulen's ~systems.tar.gz~. The source code for the programs here, including ~httpd~, are also included in the disk image under ~/home/user/src/~.

I try to keep this distribution up to date with the latest patches, which are available at ftp://ftp.update.uu.se/pub/pdp11/2.11BSD/Patches/

  • For more information on the PiDP-11, see: https://obsolescence.wixsite.com/obsolescence/pidp-11

  • For more useful tools and guides for 2.11BSD: https://github.com/rricharz/pidp11-2.11bsd

** Getting started

Please refer to the excellent PiDP-11 manual, especially the section titled "A Quick Tour of 2.11BSD", to get the system set up:

  • http://www3.ispnet.net/pidp11/PiDP-11%20Manual%20v0.2.odt

If you're using the PiDP-11 distribution, unpack ~2.11BSD_rq.dsk.xz~ with ~unxz~ and put the disk image in ~/opt/pidp11/systems/211bsd/~. Boot BSD in the normal way (i.e., set the panel switches to 0102 octal and press the address rotary switch to reboot the emulator). Press enter at the boot prompt.

The system now starts in multi-user mode by default. Johnny Billquist's patch 456 implemented a "clean" flag in the filesystem, which allows ~fsck~ to skip the boot-time check if the system was previously shut down cleanly. This cuts a lot of time off the boot sequence and makes it more practical to boot directly into multi-user mode.

Since this is the first boot and you have not yet configured networking on the system, it will appear to hang for a few minutes as the services try to use the network. See below for instructions on configuring networking.

If you want to boot into single-user mode, see the section at the end of this document.

** Things to try once the system is up

*** Set a password for the user accounts on the system

You can log in as ~root~, ~user~, and ~tektronix~ with no password. It's a good idea to set passwords for these accounts using ~passwd~, especially if you plan to connect the system to a network. A lot of network services are enabled by default, including ftp, telnet, rsh, and rlogin.

Optionally, you can change the name of ~user~ to your preferred user name. Use ~vipw~ to edit the passwd file (~/etc/master.passwd~). Don't forget to move the home directory if you change it in the passwd file. You can also add your user name to the ~wheel~ group in ~/etc/group~, which will allow you to ~su~ to ~root~ while logged in as your user.

*** Set up networking

You will need to edit ~/etc/hosts~, ~/etc/netstart~, and ~/etc/resolv.conf~ with the correct IP addresses. You can also change the hostname if you want. If you're a vi user, this is a great opportunity to use the original BSD ~vi~. It's not as fancy as vim but it works fine. If you like emacs, ~jove~ is an emacs clone that comes installed.

*** Display high-resolution graphics with the Tektronix 4010 terminal emulator

Log in as user ~tektronix~. The directories under ~/home/tektronix/~ contain example programs and plot files for use with Rene Richarz' Tektronix 4010 graphics terminal emulator.

See the following pages for instructions:

  • https://github.com/rricharz/pidp11-2.11bsd/blob/master/Tek.pdf
  • https://github.com/rricharz/pidp11-2.11bsd/blob/master/Tek.odt

Tek4010 terminal emulator for Linux/X:

  • https://github.com/rricharz/Tek4010

*** Set up a web server

Aaron Jackson wrote a simple web server, which I added a few features to, including logging and basic CGI support. It's running by default; once you have networking set up, point a web browser to your 2.11BSD IP address and you should see a default ~index.html~. The document root is ~/home/www/~. More documentation and the source code are available in ~/home/user/src/httpd/~.

There is an example CGI program in ~/home/user/src/weather/~. It prints the output of two commands, ~welcome_html~ and ~weather~. ~weather~ itself relies on ~read_sensors~, which reads temperature and pressure sensor data from a memory-mapped sensor device; see https://obsolescence.wixsite.com/obsolescence/pidp-11-temp-barometer-hack for further information. Source for all these programs is also included in ~/home/user/src/~.

You can see the web server with CGI in action (assuming my PiDP-11 is up) at http://chasecovello.ddns.net/.

*** Set up printing

You can set up a print server on Raspbian (or anywhere else, really), and then configure 2.11BSD ~lpd~ to send print jobs to the remote ~lpd~ server.

First, here's what you need to do to set up the cups-lpd server on the host:

Install cups (and optionally the graphical configuration utility) on Raspbian:

#+BEGIN_SRC sudo apt install cups system-config-printer #+END_SRC

Create ~/lib/systemd/system/cups-lpd.socket~ with the following:

#+BEGIN_SRC [Unit] Description=CUPS LPD Server Socket PartOf=cups-lpd.service

[Socket] ListenStream=515 Accept=true

[Install] WantedBy=sockets.target #+END_SRC

Create ~/lib/systemd/system/[email protected]~ with the following:

#+BEGIN_SRC [Unit] Description=CUPS LPD server Documentation=man:cups-lpd(8)

[Service] ExecStart=/usr/lib/cups/daemon/cups-lpd -n -o job-sheets=none,none -o document-format=application/octet-stream StandardInput=socket

[Install] WantedBy=multi-user.target #+END_SRC

Enable ~cups-lpd~:

#+BEGIN_SRC sudo systemctl enable cups-lpd.socket sudo systemctl start cups-lpd.socket #+END_SRC

Then use the printer setup tool to set up your printer, make sure it's set as shared, and take note of the name of the printer assigned by CUPS; you will be adding it to the ~printcap~ file on BSD.

~cups-lpd~ doesn't appear to do any authentication, so it's probably also a good idea to set up a firewall to only accept incoming connections to port 515/tcp from your 2.11BSD IP.

Finally, return to 2.11BSD and make sure you've set up networking above. ~lpd~ expects to connect to a print server host called 'rpi', and ~/etc/hosts~ should point to its IP. You will also need to edit the name of the CUPS printer in ~/etc/printcap~.

After that, you can try printing a file:

#+BEGIN_SRC man printcap | lpr #+END_SRC

** Single-user mode

If you want to boot into single-user mode (to perform system maintenance, or to have the maximum amount of memory available for, say, a kernel recompile), press a key at the bootloader prompt, then type:

#+BEGIN_SRC unix -s #+END_SRC

If you do this, it's still a good idea to check the filesystems before doing anything else:

#+BEGIN_SRC fsck -p -t scratch #+END_SRC

As noted above, this will be fast if the system was shut down cleanly last time. If not, it may take 10 minutes or so (on a Raspberry Pi 3B+). It's worth the time -- not checking a dirty filesystem is a good way to end up with filesystem corruption.

If you're in single-user mode, the terminal isn't yet set up correctly, so ~vi~ won't work. If you don't want to be stuck with ~ed~, you can set up the terminal manually:

#+BEGIN_SRC TERM=vt100 export TERM stty rows 24 #+END_SRC

(Replace ~24~ with the number of rows in your terminal)

Press ~Ctrl-D~ to bring up multi-user mode and start networking and default system services.

*** How to rebuild the bootloader to boot into single-user mode by default

Traditionally, 2.11BSD booted into single-user mode, where the administrator could perform manual system maintenance before bringing the system up in multi-user mode. See

  • https://github.com/rricharz/pidp11-2.11bsd/blob/master/Maintenance.pdf
  • https://github.com/rricharz/pidp11-2.11bsd/blob/master/Maintenance.odt for a quick overview of Unix system maintenance tasks.

The 2.11BSD bootloader was recently updated to allow booting directly into multi-user mode, and this has been enabled by default. However, if you want to have an installation that's both less convenient and less anachronistic, you can rebuild the bootloader to bring back the old behavior.

This is also a great introduction to the ~/usr/src/~ tree, and how easy it is to rebuild the entire system from the included source. Here's how to do it (instructions adapted from Johnny Billquist's original):

  1. cd to ~/usr/src/sys/pdpstand/~
  2. Edit ~boot.c~. Look for a line that says:

#+BEGIN_SRC #define AUTOMULTIUSER 1 /* 0 = old behaviour, !0 = new (automatic) behaviour */ #+END_SRC

  1. Change the define to a 0.
  2. ~make install~
  3. Reboot.

** Kernel compiling hints:

  1. Copy PIDP11 to a new config filename in ~/usr/src/sys/conf/~
  2. ~./config NEWCONFIGNAME~
  3. ~cd /usr/src/sys/NEWCONFIGNAME ; make~

If you get a ~ld: too big for type 431~ error while building a new kernel, you will need to move object files into different overlays in the Makefile. http://www.dnull.com/bsd/oldnews/bsdnew62161.html fully explains why this is so and how to make the modifications, but tl;dr:

~size unix.o~. If any overlay is bigger than 8192, move one of the ~OV1~ through ~OV9~ .o files into a smaller overlay. If ~text~ is bigger than 57344, move one of the ~BASE~ .o files into an overlay. Run ~make~ and ~size unix.o~ until you have the base and overlay size situation rebalanced. Then proceed with ~make install~.

The kernel used for this distribution is PIDP11. For that kernel both ~BASE~ and ~OV6~ are too big; moving ~lp.o~ from ~BASE~ to ~OV5~ and ~init_main.o~ from ~OV6~ to ~OV5~ will allow it to build successfully.