NetBSD for the FreeBSD User: Building a NetBSD kernel
Pages: 1, 2
Several hours later and feeling several years older, I copied the
provided Multia configuration (the file
CANE) to another file. The
NetBSD team provided these examples for very good reason, and if I was
smart I would have used them in the first place.
In my case, trimming the kernel configuration file turned out to be very straightforward. I don't run MFS or NFS on this system, so they went. Since it's a new system, I didn't need compatibility with older versions of NetBSD. On a one-gig disk, I can't really play with OSF/1 compatibility, Linux compatibility, or any of NetBSD's other nifty emulation features. Whack, whack, whack.
The next part was quite familiar:
Don't forget to run "make depend"
Config doesn't give you any notice of where the kernel compilation
directory is, but after a bit of poking I found it in
Man config (8) would have told me that, but I didn't think of that until after I found it.
From there, it was fairly simple:
cd ../compile/SCRAPYARD make depend && make && make install
The system churned. I went home. The next morning, I was looking at a nice long stream of successful compiles, followed by:
make: don't know how to make install. Stop
The NetBSD FAQ came in handy here. The kernel install procedure turns out to be frightfully complicated:
cp /netbsd /netbsd.old cp netbsd /netbsd
Just like FreeBSD, you don't need to update any loaders or write new boot blocks for your average kernel change.
I rebooted, crossing my fingers. To my surprise, the new kernel booted flawlessly. The generic kernel is 3,401,386 bytes. My custom kernel is 1,757,159 bytes. On a 32 meg machine, that's a big difference.
When the time comes to tweak this kernel further,
man (4) options lists all available kernel options. Stripping the kernel is the easy part; tweaking it for maximum performance is where the real BSD
administrators stand out.
(The author would like to thank NetBSD devotees David Brownlee, Andy Doran, Hubert Feyrer, and Richard Rauch for their pre-publication review of this article.)
Read more Big Scary Daemons columns.
Discuss this article in the Operating Systems Forum.
Return to the BSD DevCenter.