From: Andrew Deason Date: Sun, 28 Jul 2019 20:03:43 +0000 (-0500) Subject: FBSD: Set KERNBUILDDIR for --with-bsd-kernel-build X-Git-Tag: openafs-devel-1_9_0~242 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=8f9c92a888df7b2fd61a3e84aaf1d2c96a8b10dd FBSD: Set KERNBUILDDIR for --with-bsd-kernel-build 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 Reviewed-by: Tim Creech Reviewed-by: Benjamin Kaduk --- diff --git a/src/cf/bsd.m4 b/src/cf/bsd.m4 index e8027d9..84dc2d7 100644 --- a/src/cf/bsd.m4 +++ b/src/cf/bsd.m4 @@ -10,7 +10,8 @@ if test "x$with_bsd_kernel_build" != "x"; then 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" diff --git a/src/libafs/MakefileProto.FBSD.in b/src/libafs/MakefileProto.FBSD.in index 12f24f5..26e86ea 100644 --- a/src/libafs/MakefileProto.FBSD.in +++ b/src/libafs/MakefileProto.FBSD.in @@ -57,6 +57,9 @@ CWARNFLAGS+= -Wno-redundant-decls KMODDIR=/boot/modules KMOD= libafs SYSDIR= ${KSRC} +.if !empty(KBLD) +KERNBUILDDIR=${KBLD} +.endif # Name of directory to hold object files and libraries. KOBJ = MODLOAD