Adding Networking to 2.11BSD pl 195
So, now that I have an auto-installer, it would be nice, sometimes, to have networking. It also gives us a chance to push the envelop a little and learn about kernel builds. These instructions are for FreeBSD, alas, and other system may differ. However, the first section is the only part that's FreeBSD specific.
Simh config changes
I added the following to my simh.ini file:
SET XQ ENABLEDSET XQ TYPE=DEQNASET XQ MAC=08-00-4b-13-37-12ATTACH XQ tap:tap0
and I also have the following in my /etc/rc.conf file:
cloned_interfaces="tap0 bridge0"ifconfig_bridge0="addm em0 addm tap0 up"ifconfig_tap0="up"
and the following in my /etc/sysctl.conf file:
These create a tap0 device, add it to the bridge0 device along with em0. em0 is my ethernet device, configured elsewhere.
For other OSes, you'll need to do something different for this section, but the rest of the blog is still useful.
Building a Networking Kernel
The GENERIC kernel that's installed lacks networking. It works on a wide variety of machines, but since the installation is from tape, there's no networking support (it's too big). So you'll need to build a networking kernel. This can be a bit tricky in the general case. However, given the machines selected, there's a close match to the SMS kernel. The instructions in the installation guide, however are a bit off. Well, not wrong, per se, but configuring kernels on 2.11BSD can be tricky. The documented instructions are straight forward enough;
# cd /usr/src/sys/conf
# ./config KERNEL
# cd ../KERNEL
# make all# make install
which are familiar to old-time BSD hackers. Configure the kernel, cd to the build dir, then build and install it. However, with 2.11BSD, space is at a premium. This means that sometimes the make all will fail. if something is too big it will fail. The instructions for this are vague (move things around until it works, here's a few constraints to work with).
2.11BSD uses overlays to fit into the 64kB address space that the kernel has to work with. Well, on the PDP-11 that 2.11BSD runs on, there's actually 128kB of address space: 64k for instructions and 64k for data. These machines have separate I&D spaces, as this is called, managed by the MMU. And since things are managed by a MMU, there's an overlay scheme the kernel uses to fit that maps the upper 8kB into an 'overlay' region that the linker arranges to flip between as needed using one of the MMU segments. So this limits the 'base' part of the kernel to 56kB, and the overlays to 8kB. You can have many overlays (the kernel has 8 predefined). There's a small performance hit for calling routines in an overlay,
but it's not too bad unless the routine is called all the time. Think of it as a fairly static form of dynamic paging the VAX and others would introduce later. Finally, data isn't overlaid: the sum of the Data and the BSS sections have to be strictly less than 64kB. Many changes in the 469 patches concern saving space in the kernel in different ways. For a primer on details of text, data and bss, you can see traditional toolchain blog.
So the trouble comes when you configure too many things into the kernel (or the options align just so in a bad way to create a base > 56kB or any one overlay > 8kB). So, when this happens, you have to move things around a little (or a lot0. The canonical way to do that is to edit the /usr/src/sys/KERNEL/Makefile to move different .o files around so things fit. And when I've done this movement, I've had to do a make clean and start over to get the kernel to link properly (some of the helper programs built aren't properly rebuilt). Oh, and if the overflow is really big, the build stops at a stop where you think there's undefined symbols. But they are just from the network stack. I'll explain that in a future blog since it's a little non-standard, but kinda clever in how they shoe-horned a 62kB network stack into the kernel that's already out of space...
So, if you were to follow those directions for the SMS kernel at patchlevel 195, you'd hit this snag. One nice thing about the config shell script is that it saves a copy of the old Makefile. The SMS kernel comes pre-configured (eg pre-tweaked to be small enough). Diffing the makefiles reveals the fix. Moves vm_swp.o from the BASE set of objects to the OV6 set of objects. These are the swapping routines that swap things out. So while this is less than ideal, this is for an I/O operation, so the slight overhead of MMU segment flipping is acceptable. However, knowing what you can move and why it's OK is a black art that's likely learned by a lot of trial an error (and a good backup copy of Unix for the inevitable ooops).
tl;dr: do follow the directions. Instead "cd /usr/src/sys/SMS; make all; cp /unix /genunix; make install" But don't reboot just yet. Oh, and only do the cp if you've not installed a kernel before. This will be your backup to boot if you install a bad kernel, and it's best to never change that.
This is the issue, I think, that I'm running into with the kernel reconstruction for my as released project.
2.11BSD Network Configuration
Edit /etc/netstart. You'll need to fill in these lines:
as appropriate. I leave the default route alone, since I don't want this machine on the internet. You'll also need to uncomment out the qe0 line and change 22.214.171.124 to the IP address for this machine. Then, when you reboot, you'll be able to get to the machine.
You may want to populate /etc/hosts. And maybe /etc/networks. Following the documentation for 4.2BSD or 4.3BSD network configuration will get the job done.
Create a user
Since you don't want to login as root, create a user using vipw. The sms account can be used as a template for what to do. You'll want to add this user to the 'wheel' group in /etc/group. You'll also want to make a home directory, chown it to this user, populate dot files, etc. And you'll likely want to set a password, but since you are using telnet, the password will be transmitted in the clear, so don't use a valuable one.
If you really do want to login as root, mark the PTYs as secure in /etc/ttys. You'll likely not want to do this. But it's a useful hack if you forgot to start simh in a 'screen' session and you want to hack as root from another room. OK for the short term, but you really don't want to leave it in this state.
Use halt to halt 2.11BSD and get back to the simh> prompt. Type boot rq0 and hit return at the : prompt. hit ^D at the # prompt for single user and then login. ifconfig qe0 should show everything configured correctly. ftp and telnet are configured by default, for better or worse.