Dissecting NetBSD's main architecture: the base system, modular kernel, userland, rump kernels, and the build.sh build system, as well as understanding the differences between -current, stable, and release that will accompany you throughout the series.

In episode 1 we traced NetBSD's history — from 386BSD in 1993 to the 11.0 release in 2026 — and understood why portability is the soul of this project. Now it's time to get under the hood: in this episode we'll dissect NetBSD's core concepts and main architecture — how the system is organized, what its components are, and how those components relate to one another.
Why is understanding the architecture important? Because almost everything you'll do in the following episodes — installation, kernel builds, package management, networking, even embedded — is manipulation of this architecture. If you understand that the base system and pkgsrc are two separate worlds, you won't be confused about why updating the base system and updating packages are two different things. Let's dig in.
The most fundamental division in NetBSD is between two strictly separated worlds:
/usr/src source tree and controlled directly by the NetBSD project./usr/pkg, it never mixes with the base system.You must always remember this division. When you update NetBSD with build.sh distribution, that updates the base system. When you run pkg_add -u, that updates pkgsrc packages. The two coexist side by side without overwriting each other.
| Directory | Contents |
|---|---|
/usr/src | Base system source tree (kernel + userland) |
/usr/pkgsrc | pkgsrc package source tree |
/usr/pkg | Package installation prefix (bin, sbin, lib, etc) |
/etc | System configuration |
/usr/sbin | Administration tools |
/sys | Kernel source (symlink to /usr/src/sys) |
ls -l /usr/pkg/bin
ls -l /usr/src/sys/archamd64 arm arm64 evbarm evbmips m68k mips powerpc riscv sparc64 ...The list of directories in /usr/src/sys/arch is proof of NetBSD's portability: every folder is an architecture supported by the kernel, and all of them are built from the same source tree.
NetBSD has three development tracks you need to clearly distinguish:
| Track | Description | Who Uses It |
|---|---|---|
-current | The latest development branch, changing constantly | Developers, testing new features |
netbsd-N (stable) | The maintained release branch, only receiving backported fixes | Production, most users |
release | A formally released snapshot (e.g. 11.0) | Users who want maximum stability |
For production, use the stable branch such as netbsd-11. You can see which track you're running with uname -a or sysctl kern.version:
uname -a
sysctl kern.versionNetBSD hostname 11.0 NetBSD 11.0 (GENERIC) #0: Thu Jul 30 12:00:00 UTC 2026
NetBSD 11.0 (GENERIC) #0: Thu Jul 30 12:00:00 UTC 2026
root@build02:/build/src/sys/arch/amd64/compile/GENERICThe NetBSD kernel is designed to be modular. Drivers and subsystems can be loaded and unloaded dynamically via modload, modunload, and modstat. The core kernel can be slimmed down as needed — this is one reason NetBSD is so well suited to embedded.
modstatNAME CLASS SOURCE REFS SIZE
acpi misc - 0 101
pf network - 0 60
npf network - 0 82Notice the npf and pf lines in the example above — even firewalls can be modules. In episode 9 we'll dissect kernel modules in depth.
One of NetBSD's unique features is rump kernels — the ability to run kernel drivers and subsystems in userspace as ordinary processes. This makes it possible to test filesystems, the network stack, and drivers without rebooting or needing a separate machine. In episode 17 we'll use it directly to boot a filesystem in userspace.
The NetBSD base system contains a complete userland: shell, editor, compiler, network tools, and administration utilities. Its hallmark is cleanliness and consistency — all tools follow the same conventions, and man documentation is complete. Whenever in doubt, read the man page:
man sysctlNetBSD is a source-based system. The entire base system is built with build.sh — a script that orchestrates the toolchain, kernel, and userland in one flow. This sets it apart from systems that only ship prebuilt binaries. The flow looks roughly like this:
| build.sh stage | Function |
|---|---|
build.sh tools | Builds the toolchain (compiler, binutils) |
build.sh kernel=GENERIC | Builds the kernel for the target architecture |
build.sh distribution | Builds the entire userland + sets |
build.sh release | Produces a complete release in RELEASEDIR |
In episode 10 we'll run this entire flow. What matters now is understanding that NetBSD gives you the ability to build the entire system from source — with no closed secrets.
sysctl is the doorway to reading and setting kernel parameters at runtime. Almost all NetBSD tuning goes through this tool, and you'll use it across many episodes — from checking the kernel version to configuring security.
sysctl hw.model
sysctl kern.ostype
sysctl net.inet.ip.forwardinghw.model = Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
kern.ostype = NetBSD
net.inet.ip.forwarding = 0Now that you understand the architecture, let's lay out the typical workflow of a NetBSD user:
sysinst (episode 3).pkg_add or build from pkgsrc (episode 4).In this episode 2, you've dissected NetBSD's main architecture: the strict division between the base system and pkgsrc, the -current/stable/release development flow, and the core components such as the modular kernel, rump kernels, the build.sh build system, and sysctl.
Key takeaways:
netbsd-11) for production.modload, modunload, and modstat.In the next episode, episode 3, we'll begin the real hands-on journey: installing NetBSD with sysinst — from partitioning the disk with fdisk and disklabel, choosing the right sets, to a successful first boot. Get your VM ready, because we're really going to type! See you in episode 3!