niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » BSD » FreeBSD » mail-lists » Architecture
Conditionally building modules based on kernel options
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Robert Watson
*nix forums Guru Wannabe


Joined: 22 Mar 2002
Posts: 218

PostPosted: Mon Aug 05, 2002 4:19 pm    Post subject: Conditionally building modules based on kernel options Reply with quote

Currently, the MAC kernel modules are built regardless of the existence of
'options MAC' in the kernel configuration file. Given that the MAC
modules are effectively useless without that option in the kernel since
the framework they hook into doesn't exist, it seems undesirable to build
the modules for a variety of reasons, not least space consumed and
potential user confusion. Simon Schubert provided me with the following
patch to modify the kernel build code to build the MAC modules only if the
MAC framework is present:

http://corecode.ath.cx/~corecode/stuff/patch-condmac

(also attached below)

Ideally, I suppose the module contents would actually be a property of
conf/somethingfunky rather than a property solely of Makefiles, making it
possible in a more general way to correspond to kernel configuration
choices, but this appears to work in the mean time. Is there a better way
I should be doing this?

Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
robert@fledge.watson.org Network Associates Laboratories

Index: src/sys/conf/kern.pre.mk
===================================================================
RCS file: /home/ncvs/src/sys/conf/kern.pre.mk,v
retrieving revision 1.16
diff -u -r1.16 kern.pre.mk
--- src/sys/conf/kern.pre.mk 22 Jul 2002 00:15:01 -0000 1.16
+++ src/sys/conf/kern.pre.mk 2 Aug 2002 22:20:33 -0000
@@ -89,7 +89,7 @@
# MKMODULESENV is set here so that port makefiles can augment
# them.

-MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
+MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR} AUTOMATIC_BUILD=yes
.if (${KERN_IDENT} == LINT)
MKMODULESENV+= ALL_MODULES=LINT
.endif
Index: src/sys/modules/Makefile
===================================================================
RCS file: /home/ncvs/src/sys/modules/Makefile,v
retrieving revision 1.248
diff -u -r1.248 Makefile
--- src/sys/modules/Makefile 1 Aug 2002 17:41:26 -0000 1.248
+++ src/sys/modules/Makefile 3 Aug 2002 13:17:25 -0000
@@ -48,13 +48,6 @@
libmchain \
lnc \
lpt \
- mac_biba \
- mac_bsdextended \
- mac_ifoff \
- mac_mls \
- mac_none \
- mac_seeotheruids \
- mac_test \
md \
mii \
mlx \
@@ -117,6 +110,22 @@

.if !defined(NO_IPFILTER) && ${MACHINE_ARCH} != "ia64"
SUBDIR+=ipfilter
+.endif
+
+.if exists(${.OBJDIR}/../opt_mac.h)
+BUILD_MAC!=/usr/bin/grep -q "^\#define MAC 1$$" ${.OBJDIR}/../opt_mac.h && echo "yes" || echo "no"
+.else
+BUILD_MAC=no
+.endif
+
+.if !defined(AUTOMATIC_BUILD) || ${BUILD_MAC} == yes
+SUBDIR+=mac_biba \
+ mac_bsdextended \
+ mac_ifoff \
+ mac_mls \
+ mac_none \
+ mac_seeotheruids \
+ mac_test
.endif

#removed while KSE settles in:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
David O'Brien
*nix forums beginner


Joined: 06 Aug 2002
Posts: 1

PostPosted: Tue Aug 06, 2002 2:59 pm    Post subject: Re: Conditionally building modules based on kernel options Reply with quote

On Mon, Aug 05, 2002 at 12:19:48PM -0400, Robert Watson wrote:
Quote:
Index: src/sys/conf/kern.pre.mk
===================================================================
RCS file: /home/ncvs/src/sys/conf/kern.pre.mk,v
retrieving revision 1.16
diff -u -r1.16 kern.pre.mk
--- src/sys/conf/kern.pre.mk 22 Jul 2002 00:15:01 -0000 1.16
+++ src/sys/conf/kern.pre.mk 2 Aug 2002 22:20:33 -0000
@@ -89,7 +89,7 @@
# MKMODULESENV is set here so that port makefiles can augment
# them.

-MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
+MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR} AUTOMATIC_BUILD=yes

Please state (ie, document) what the AUTOMATIC_BUILD knob is supose to
acomplish.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Simon 'corecode' Schubert
*nix forums beginner


Joined: 06 Aug 2002
Posts: 1

PostPosted: Tue Aug 06, 2002 4:52 pm    Post subject: Re: Conditionally building modules based on kernel options Reply with quote

On Tue, 6 Aug 2002 09:59:01 -0700 David O'Brien wrote:

Quote:
On Mon, Aug 05, 2002 at 12:19:48PM -0400, Robert Watson wrote:
Index: src/sys/conf/kern.pre.mk
===================================================================
RCS file: /home/ncvs/src/sys/conf/kern.pre.mk,v
retrieving revision 1.16
diff -u -r1.16 kern.pre.mk
--- src/sys/conf/kern.pre.mk 22 Jul 2002 00:15:01 -0000 1.16
+++ src/sys/conf/kern.pre.mk 2 Aug 2002 22:20:33 -0000
@@ -89,7 +89,7 @@
# MKMODULESENV is set here so that port makefiles can augment
# them.

-MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
+MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR} AUTOMATIC_BUILD=yes
Please state (ie, document) what the AUTOMATIC_BUILD knob is supose to
acomplish.

i thought of this:
o when building modules as dependency of the standard buildkernel stuff,
one can prevent these modules to be built if the user didn't put
options MAC into his KERNCONF.
o if user does cd sys/modules && make himself, there needn't be a
compile/KERNCONF directory, thus we don't know if user didn't choose
MAC.

AUTOMATIC_BUILD is just a knob to tell sys/modules/Makefile wherer it
has been invoked by a buildkernel or has been invoked manually.

cheers
simon

ps: if some sentences don't make any sense, please forgive me, i just
woke up :)


--
/"\ http://corecode.ath.cx/#donate
\ /
\ ASCII Ribbon Campaign
/ \ Against HTML Mail and News
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Fri Jan 09, 2009 3:25 am | All times are GMT
navigation Forum index » *nix » BSD » FreeBSD » mail-lists » Architecture
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Add BCC Based on Email Subject adoner Postfix 0 Tue Mar 18, 2008 6:12 pm
No new posts Minor Annoyance Building mod_jk on Mac OS X Immanuel Tranz-Mischen Apache 1 Mon Aug 13, 2007 2:21 pm
No new posts Home based Internet research Jobs honey PHP 0 Fri Jul 21, 2006 11:29 am
No new posts Bug#379087: ITP: libcomplearn -- data-compression based i... Rudi Cilibrasi devel 0 Fri Jul 21, 2006 7:40 am
No new posts porting linux2.6 on ARM922T based board noor.fatma@gmail.com embedded 0 Fri Jul 21, 2006 6:23 am

Deaf | Discount Magazine Subscriptions | Myspace Layouts | Myspace Layouts | Credit Counseling
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1698s ][ Queries: 16 (0.0915s) ][ GZIP on - Debug on ]