Chicken and egg problem when building (third-party) kernel modules with <bsd.kmod.mk> -- how to solve?

Lev Serebryakov lev at FreeBSD.org
Wed Sep 11 21:18:10 UTC 2013


Hello, John-Mark.
You wrote 11 сентября 2013 г., 20:53:46:

>>  It is good idea to set KERNBUILDDIR when build module. But to set it you
>> need to know ${.OBJDIR} from ${SYSDIR} and ${SYSDIR} is set in bsd.kmod.mk,
>> which should be included last (after defining KERNBUILDDIR).
>> 
>>  How this loop could be broken?

JMG> If you need to build it stand alone, you still need the opt_*.h files
 I'm speaking about making port with kernel module, but this port is using
bsd.*.mk infrastructure by itself.

JMG> from the kernel you are going to run it with, and that directory is
JMG> what you need to set KERNBUILDDIR...
 KERNBUILDDIR could be set automagically with:

KERNBUILDROOT!= make -C ${SYSDIR} -V .OBJDIR
KERNNAME!=              uname -i
.if exists(${KERNBUILDROOT}/${KERNNAME}/opt_global.h) && !defined(KERNBUILDDIR)
KERNBUILDDIR:=${KERNBUILDROOT}/${KERNNAME}
.endif

  But here is problem, which I'm speaking about: it should go BEFORE
 <bsd.kmod.mk> but it needs to use ${SYSDIR}.

-- 
// Black Lion AKA Lev Serebryakov <lev at FreeBSD.org>



More information about the freebsd-current mailing list