After building a new OpenBSD kernel, the install
target of the kernel Makefile
does the following:
rm -f /obsd
ln /bsd /obsd
cp bsd /nbsd
mv /nbsd /bsd
I understand that the first two lines remove the old backup kernel /obsd
and create a hard link /obsd
pointing to the currently running kernel /bsd
. In particular, the running kernel is not moved at all. This makes sense to me.
However, what is the purpose of moving the newly built kernel ./bsd
first to /nbsd
and then renaming it to /bsd
? Why not replace the third and fourth line by the apparently simpler cp bsd /bsd
?
If this should matter: the default partitioning scheme of OpenBSD places the kernel build tree in a different filesystem (disklabel) than the root filesystem.