Three Essays on NetBSD
I’ve rereleased three essays on the NetBSD operating system as a book. It’s free to download from Leanpub and it will soon be available as a hardback on Amazon.
Here is the preface.
Preface
In the late 90s, I started to play with the NetBSD operating system. I liked its clean design. The team seemed to go to great lengths to get the code right. It also ran on many different architectures, forcing the developers to make good decisions. It had a small footprint and you could install it from two floppies and an internet connection. I used NetBSD on the desktop. There was no native web browser for it, so I ran Netscape under Linux emulation. I swear to this day that NetBSD ran it better than Linux did. At the time, it was a great operating system. There was no bloat, but there was enough to get things done. As I grew more into the corporate world, I used Windows more every day and eventually Macs that I have stuck with since 2007. But before that, I was using NetBSD every day as my regular operating environment.
This book gathers three essays I wrote. The first essay is about the transition from the a.out binary format to the ELF format on NetBSD. In approximately 1999, NetBSD/i386 and sparc switched to ELF. Christos Zoulas and Paul Kranenburg were instrumental in the work. Christos wrote a how-to guide on upgrading an a.out system to ELF. I followed this guide on my machine (the dmesg output is below). It was a tricky procedure, in the sense that you built a toolchain that outputted ELF binaries but were a.out themselves, then rebuilt the rest of the binaries.
I tried to write the first essay for years. In fact, I had notes from 1999 when I did the upgrades. I never got around to writing up my thoughts. I was sitting in the British Library in early 2022 and for some reason, I got into the flow. I finished the paper on a summer baseball trip to St Louis, where I was away from it all. And subsequently finished the other papers in this book.
In the second paper, we start with a NetBSD 1.0 system and upgrade it to 9.3 using just the sources. It’s still possible to install 1.0 on a VM, but with some care. For example, you can naively give it a massive hard disc. Back then, hard discs were small compared to today. When NetBSD 1.0 writes over the boundary of its maximum disc size, you can stand back and watch the carnage. But with care, you can upgrade the system all the way to 1.5 using the sources. The process is non-trivial and things have to be done in the right order. But it is possible.
NetBSD 1.5 introduced the build.sh system. This allows NetBSD to be built not just on NetBSD, but on other operating systems. From there, upgrading between releases is a lot easier. In fact it’s possible to build any NetBSD architecture from a single machine, not necessarily running NetBSD.
The third paper was a result of a curiosity. The OpenBSD project forked from the NetBSD project. Therefore, it should be possible to convert a NetBSD system to OpenBSD. I managed to do this and build OpenBSD 2.0 on a NetBSD 1.1 system.
All the prepared media for these papers are at my download website:
And finally here is the dmesg of my trusty machine that took me through the a.out to ELF transition.
NetBSD 1.4.1 (GENERIC) #1: Tue Aug 10 00:03:09 MEST 1999
fvdl@struis:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: family 4 model 3 step 5
cpu0: Intel 486DX2 (486-class)
real mem = 16384000
avail mem = 11661312
using 225 buffers containing 921600 bytes of memory
mainbus0 (root)
isa0 at mainbus0
ep0 at isa0 port 0x310-0x31f irq 10: 3Com 3C509 Ethernet
ep0: address 00:20:af:bb:bc:11, 8KB byte-wide FIFO, 5:3 Rx:Tx split
ep0: 10baseT, 10base5 (default 10baseT)
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
wdc0 at isa0 port 0x1f0-0x1f7 irq 14
wd0 at wdc0 channel 0 drive 0: <QUANTUM FIREBALL1280A>
wd0: drive supports 8-sector pio transfers, lba addressing
wd0: 1222MB, 2484 cyl, 16 head, 63 sec, 512 bytes/sect x 2503872 sectors
wd0: drive supports PIO mode 4, DMA mode 2
vga0 at isa0 port 0x3b0-0x3df iomem 0xa0000-0xbffff
wsdisplay0 at vga0: console (80x25, vt100 emulation)
lpt0 at isa0 port 0x378-0x37b irq 7
pckbc0 at isa0 port 0x60-0x64
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
opmsprobe: command error
pcppi0 at isa0 port 0x61
midi0 at pcppi0: <PC speaker>
sysbeep0 at pcppi0
isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
npx0 at isa0 port 0xf0-0xff: using exception 16
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB, 80 cyl, 2 head, 18 sec
isapnp0: no ISA Plug 'n Play devices found
biomask 4040 netmask 4440 ttymask 44c2
wscons: wskbd0 glued to wsdisplay0 (console)
boot device: wd0
root on wd0a dumps on wd0b
root file system type: ffs
