Currently, specifying --with-bsd-kernel-build during configure causes
us to set BSD_KERNEL_BUILD, which sets KBLD in MakefileProto.FBSD.in,
but nothing ever uses KBLD. This means that when we use
--with-bsd-kernel-build, we don't actually build against the
configuration for that kernel, which can result in a libafs.ko that
cannot be loaded or causes other errors. Specifically, if trying to
build for a VIMAGE kernel, the kernel complains when trying to load
libafs:
[...] kernel: link_elf_obj: symbol in_ifaddrhead undefined
[...] kernel: linker_load_file: Unsupported file type
The FreeBSD module build system looks for KERNBUILDDIR for an
alternative build, which it uses to pull in opt_global.h and other
required pieces from the build tree. So just specify KERNBUILDDIR if
we have one.
At the same time, avoid setting our default value for BSD_KERNEL_BUILD
for FBSD when the calculated dir doesn't exist. At least for the
default GENERIC kernel on FreeBSD 11.2-RELEASE, there may not be a
build dir on the running machine, and so setting BSD_KERNEL_BUILD to
the calculated value causes the build to fail when it doesn't exist.
Change-Id: Ib3079354f9f6dba13970de5308bbcecaf9b35059
Reviewed-on: https://gerrit.openafs.org/13746
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
else
case $AFS_SYSNAME in
*_fbsd_*)
- BSD_KERNEL_BUILD="${BSD_KERNEL_PATH}/${HOST_CPU}/compile/GENERIC"
+ AS_IF([test -d "${BSD_KERNEL_PATH}/${HOST_CPU}/compile/GENERIC"],
+ [BSD_KERNEL_BUILD="${BSD_KERNEL_PATH}/${HOST_CPU}/compile/GENERIC"])
;;
*_nbsd*)
BSD_KERNEL_BUILD="${BSD_KERNEL_PATH}/arch/${HOST_CPU}/compile/GENERIC"
KMODDIR=/boot/modules
KMOD= libafs
SYSDIR= ${KSRC}
+.if !empty(KBLD)
+KERNBUILDDIR=${KBLD}
+.endif
# Name of directory to hold object files and libraries.
KOBJ = MODLOAD