13

On UNIX, the boot code is traditionally found in the directory /usr/mdec. Some modern UNIX variants keep this tradition up (e.g. OpenBSD) while others have changed the directory layout (e.g. FreeBSD). I was able to find a /usr/mdec directory in 5th edition UNIX, but not in any of the incomplete earlier versions. No explanation for the name is given.

Where does the name /usr/mdec come from and what does it mean?

3
  • 2
    I suspect the dec part was chosen because the code is DEC-specific... Jul 31, 2018 at 13:22
  • 2
    There are also references to mdec in V4. Jul 31, 2018 at 13:31
  • 3
    I suspect it to mean DEC as well - the directory contains DEC machine specific boot code
    – tofro
    Jul 31, 2018 at 14:01

2 Answers 2

9

These directories have such terse names, don't they? And the etymology is not always documented, nor obvious. In many cases, the etymology of a name in UNIX is simply lost to obscurity.

But the directory you're asking about appears to contain images for magtapes and DECtapes, at least to begin with, or in the earliest versions of UNIX. From the manpage linked to by Stephen Kitt,

The tp command places a bootstrap program on the otherwise unused block zero of the tape. The DECtape version of this program is called tboot, the magtape version mboot.

There also is mention of a /usr/mdec/uboot, which is a bootstrap of the filesystem. I don't know whether that was a magtape or a DECtape.

4

/usr/mdec contains machine-dependent code. In V5 it contains source code as well as programs; in V6 the source code was moved to /usr/source/mdec.

That this is not just about magtapes and DECtapes is clear if you look at the contents, which include programs to format RK03/05 disk packs (rkf.s), print to a terminal attached to a KL-11 serial interface (list.s), an RK05 disk driver (rk.s), low-level terminal-interface-specific getc()/putc()/etc. (tty.s, presumably for use in kernel debugging code or something like that), and so on.

It's not clear to me whether at the time this was considered an abbreviation of "Machine-dependent DEC code" or "Machine DEpendent Code"; either way it was eventually used in the latter sense in early '90s BSD ports, with files such as /usr/mdec/boot.$MACHINE. You can see various examples of this from the 2000s in this search of NetBSD/src on GitHub.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .