freebsd-update and custom kernels

Saturday, 03. 16. 2013  –  Category: stash, sw

This post is search fodder, mostly.

If you’re using freebsd-update to upgrade FreeBSD and you run a custom kernel and temporarily using the generic kernel isn’t an option and it’s been ages since you’ve done this, then welcome!

$ sudo freebsd-update upgrade -r 9.1-RELEASE

[ warnings about custom kernel ]

$ sudo freebsd-update install

[ this is when the new generic kernel is installed if we weren't running a custom kernel ]

$ cd /usr 
$ mv src{,-8.2}
$ sudo svn co https://svn.freebsd.org/base/releng/9.1/
$ sudo cp src{-8.2,}/sys/i386/conf/PULP
$ cd src

$ sudo rsync -a /boot/kernel{,-8.2}/
$ sudo make kernel-toolchain
$ sudo make buildkernel KERNCONF=PULP
$ sudo make installkernel KERNCONF=PULP

$ sudo reboot

$ sudo freebsd-update install
$ sudo reboot

The kernel-toolchain bit is the important one. In the Old Days ((not really, but binary updating is way nicer)) of buildworld the new kernel is built with the new world’s compiler, linker etc instead of what’s currently installed. Going directly to buildkernel during the freebsd-update dance means the custom kernel builds with the toolchain that’s about to be replaced.

Trying to build the new kernel with the old toolchain results in

  • warnings-as-errors in random modules
  • old kernel linker unable to parse new kernel link data

and no kernel.

Comments are closed.