NetBSD upgrade system from source

Disclaimer: I wrote these notes some time ago, and I haven't add the occasion to perform a system upgrade from sources since then. Thus, these information may be outdated and/or incomplete.

Backup data (/etc)

      $> tar zcvf etc-3.0.tar.gz /etc

Prepare the directories (as root)

      %> mkdir /usr/src
      %> mkdir /usr/obj
      %> mkdir -p /usr/builds/i386
      %> mkdir -p /usr/releases/i386

Change the ownership of those directories to you user.

Get the sources

      $> wget ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-3.0.2/source/sets/*.tgz

Unpack the sources

      $> for file in *.tgz; do tar zxvf $file -C /; done

Build or update the crosscompiler

      $> cd /usr/src
      $> ./build.sh -D /usr/builds/i386 -R /usr/releases/i386 -u \
                    -m i386 tools

Crosscompile the kernel

      $> ./build.sh -D /usr/builds/i386 -R /usr/releases/i386 -u \
                    -m i386 kernel=GENERIC

Install the new kernel (as root)

       %> cd /
       %> mv netbsd netbsd-3.0
       %> cp /usr/src/sys/arch/i386/compile/obj/GENERIC/netbsd .

Reboot the system.

Crosscompile the userland

       $> build.sh -D /usr/builds/i386/ -R /usr/releases/i386/ -U -u \
                   -m i386 build

Install (as root)

       %> build.sh -D /usr/builds/i386/ -R /usr/releases/i386/ -U -u \
                   -m i386 install=/

Review postinstall failed checks and fix things accordingly.

Update /etc (as root)

       %> /usr/sbin/etcupdate