Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jun 2002 14:18:50 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Nick Hibma <n_hibma@van-laarhoven.org>
Cc:        FreeBSD CURRENT Mailing List <current@FreeBSD.ORG>
Subject:   Re: making make load work for /sys/modules/*
Message-ID:  <20020617135321.S3207-100000@gamplex.bde.org>
In-Reply-To: <20020616201846.G1928-200000@heather.van-laarhoven.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 16 Jun 2002, Nick Hibma wrote:

> At the moment 'make load' does not work in /sys/modules. The attached
> patch fixes that by using .OBJDIR instead of .CURDIR as the absolute
> path to find the module at:

> ...
> After changing .CURDIR to .OBJDIR it selects the correct module
> depending on whether it was created in the MAKEOBJDIR directory or not:

> ...
> Any objections to the attached patch? Any reason to wait for a system
> makefiles guru?

I patched this locally when the problem was first reported a year or two
ago, but since I don't believe in modules and have only built a couple
in the last year or two, this patch and nearby ones have not been tested
much.

%%%
Index: kmod.mk
===================================================================
RCS file: /home/ncvs/src/sys/conf/kmod.mk,v
retrieving revision 1.124
diff -u -2 -r1.124 kmod.mk
--- kmod.mk	14 May 2002 07:49:12 -0000	1.124
+++ kmod.mk	16 May 2002 19:15:55 -0000
@@ -278,11 +278,11 @@

 .if !target(load)
-load:	${PROG}
-	${KMODLOAD} -v ${.CURDIR}/${KMOD}.ko
+load: ${PROG}
+	${KMODLOAD} -v ${.OBJDIR}/${PROG}
 .endif

 .if !target(unload)
 unload:
-	${KMODUNLOAD} -v ${KMOD}
+	${KMODUNLOAD} -v ${PROG}
 .endif
%%%


This bug is related to the full brokenness of the kernel's search for
modules.  The path was originally simply ${KMOD} (/sbin/modload -o ${KMOD})
imp committed my change to ./${KMOD} in rev.1.79.  I forget what this was
for, but it may have been an attempt to prevent the path search.  Perhaps
it actually did that then.  Next, the path was changed to ./${KMOD}.ko
in rev.1.82.  I'm not sure why that was necessary, since one of the
misfeatures in the module seaching is appending ".ko", but it is good
for the pathname to be complete.  Next, the path was changed to
${.CURDIR}/${KMOD}.ko, to work around the full brokenness of the search
(the search apparently doesn't recognize that a "./" prefix means an
absolute path) and to completely break the usual ${.OBJDIR} != ${.CURDIR}
case.  Fixing this can't make things worse :-).

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020617135321.S3207-100000>