rampke.de Archive

NetBSD-6: modules and system upgrades

20 January 2011

NetBSD 6 (which is right now at NetBSD-CURRENT version 5.99.44) will be the next release of the NetBSD operating system. Among other changes, the kernel has been heavily modularized for some architectures (including i386, but not amd64 – if you’re on 64 bit Intel/AMD, this doesn’t concern you (yet), on 32 bit Intel/AMD it does). NetBSD 6 (which is right now at NetBSD-CURRENT version 5.99.44) will be the next release of the NetBSD operating system. Among other changes, the kernel has been heavily modularized for some architectures (including i386, but not amd64 – if you’re on 64 bit Intel/AMD, this doesn’t concern you (yet), on 32 bit Intel/AMD it does).

In practice, this especially means that your beloved GENERIC kernel won’t be bootable in and of itself as it can’t read ffs (or any other file system) unless it’s modules are present and loaded. The modules are being installed with the userland via ./build.sh install=/. The NetBSD Guide demands installing the userland only after you’ve booted into the new kernel. We have a problem here.

There are two possible ways out of this dilemma:

The procedure involving the MONOLITHIC (i.e. classic, non-modularized) kernel is described here. I don’t really like it because it involves building two kernels and rebooting twice. On the other hand, it’s probably a good idea to keep a monolithic kernel around anyway, just in case anything goes wrong.

There is no simple make installmodules or ./build.sh installmodules=/ (yet?) but there is a workaround for that (credit goes here): make install USETOOLS=no DESTDIR=/ in sys/modules.

So here’s the full procedure for upgrading either from NetBSD-5 or from NetBSD-CURRENT with an older kernel version to NetBSD-CURRENT. # assuming your sources are in /usr/src and up to date cd /usr/src # build everything ./build.sh distribution kernel=GENERIC # install the modules cd sys/modules; make install USETOOLS=no DESTDIR=/; cd - #save the old kernel cp /netbsd /netbsd.`date +%Y%m%d` #put the new kernel in place cp obj/sys/arch/i386/compile/GENERIC/netbsd /netbsd The next two steps only need to be done once when upgrading from monolithic to modularied kernels: # update the boot loader cp obj/sys/arch/i386/stand/boot/biosboot/boot /boot # and configure it to load the root filesystem module # modules for other filesystems will be loaded later automatically echo "load=ffs" >> /boot.cfg Back to the regular procedure: #reboot shutdown -r now "Kernel upgrade" and after the reboot cd /usr/src ./build.sh install=/ etcupdate -al postinstall fix as usual.

No guarantees of course, and this is work in progress. (Maybe) I’ll update this post when I know more or things changed. Nudge me.

Update:

asau proposes building the sets and installing them: # build everything and the sets ./build.sh distribution kernel=GENERIC sets # install the modules cd /; pax -rzpe -f /usr/obj/releasedir/i386/binary/sets/modules.tgz and after the reboot cd / # unpack everything except etc (will be handled by etcupdate) and modules (already done) for m in base comp games man misc tests text; do pax -rzpe -f /usr/obj/releasdir/i386/binary/sets/${m}.tgz; done etcupdate -al -s /usr/obj/releasedir/i386/binary/sets/etc.tgz Everything else just as above.

Update 2:

Shouldn’t forget about etcupdate and postinstall.