From owner-freebsd-current@FreeBSD.ORG Wed Sep 11 21:18:10 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 79743712 for ; Wed, 11 Sep 2013 21:18:10 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.friendlyhosting.spb.ru (onlyone.friendlyhosting.spb.ru [IPv6:2a01:4f8:131:60a2::2]) by mx1.freebsd.org (Postfix) with ESMTP id 3C83D290B for ; Wed, 11 Sep 2013 21:18:10 +0000 (UTC) Received: from lion.home.serebryakov.spb.ru (unknown [IPv6:2001:470:923f:1:ec11:dc51:d1b4:e536]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.friendlyhosting.spb.ru (Postfix) with ESMTPSA id A9A7D4AC57; Thu, 12 Sep 2013 01:17:59 +0400 (MSK) Date: Thu, 12 Sep 2013 01:17:55 +0400 From: Lev Serebryakov Organization: FreeBSD Project X-Priority: 3 (Normal) Message-ID: <899884661.20130912011755@serebryakov.spb.ru> To: John-Mark Gurney Subject: Re: Chicken and egg problem when building (third-party) kernel modules with -- how to solve? In-Reply-To: <20130911165346.GA68682@funkthat.com> References: <1510067821.20130911173716@serebryakov.spb.ru> <20130911165346.GA68682@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: lev@FreeBSD.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Sep 2013 21:18:10 -0000 Hello, John-Mark. You wrote 11 =D1=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=80=D1=8F 2013 =D0=B3.,= 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). >>=20 >> 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!=3D make -C ${SYSDIR} -V .OBJDIR KERNNAME!=3D uname -i .if exists(${KERNBUILDROOT}/${KERNNAME}/opt_global.h) && !defined(KERNBUILD= DIR) KERNBUILDDIR:=3D${KERNBUILDROOT}/${KERNNAME} .endif But here is problem, which I'm speaking about: it should go BEFORE but it needs to use ${SYSDIR}. --=20 // Black Lion AKA Lev Serebryakov