From 53b3c2d0761ffd4ad9fd53abde8b11be50a53788 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sat, 16 Aug 2003 02:52:00 +0000 Subject: [PATCH] Make modules work again part 2 (final): Link the module build back into the kernel build. It should now be possible to build and install the modules using the 'mobj', 'modules' and 'minstall' targets in /usr/src/sys/Makefile, though the preferred way is to simply build a kernel using the config or the buildkernel and installkernel mechanisms. This commit also fixes a few minor #include path problems that came up during testing. Tested with: config/make/install, direct make/install, and with buildkernel/installkernel. The following modules are not yet being built by the new system (and were built with the old system): vesa.ko, fpu.ko, gnufpu.ko, ibcs2_coff.ko, usb.ko, ng_mppc.ko, libiconv.ko. --- sys/Makefile | 34 ++++++++++++++++++++------- sys/boot/i386/boot2/Makefile | 4 ++-- sys/boot/pc32/boot2/Makefile | 4 ++-- sys/conf/Makefile.i386 | 35 ++++++++++++++-------------- sys/dev/disk/aic7xxx/Makefile | 5 ++-- sys/dev/disk/aic7xxx/aicasm/Makefile | 6 ++++- sys/dev/netif/ar/if_ar.c | 4 ++-- sys/dev/netif/sr/if_sr.c | 4 ++-- sys/kern/Makefile | 34 ++++++++++++++------------- sys/netinet/ip_gre.c | 6 ++--- 10 files changed, 81 insertions(+), 55 deletions(-) diff --git a/sys/Makefile b/sys/Makefile index 75a63897b3..4928bd8185 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/sys/Makefile,v 1.20.2.1 2000/07/10 08:22:34 obrien Exp $ -# $DragonFly: src/sys/Makefile,v 1.5 2003/08/07 21:16:41 dillon Exp $ +# $DragonFly: src/sys/Makefile,v 1.6 2003/08/16 02:51:54 dillon Exp $ # This is the old aout only boot loader. .if exists(${.CURDIR}/${MACHINE_ARCH}/boot) && ${OBJFORMAT} == "aout" @@ -13,8 +13,9 @@ SUBDIR= boot .endif # KLD modules build for both a.out and ELF +# note: emulation must come before dev (for arch_svr4 softlink) .if defined(MODULES_WITH_WORLD) -SUBDIR+=modules +SUBDIR+=bus crypto emulation dev kern net netgraph netproto vfs .endif HTAGSFLAGS+= -at `awk -F= '/^RELEASE *=/{release=$2}; END {print "FreeBSD", release, "kernel"}' < conf/newvers.sh` @@ -22,9 +23,26 @@ HTAGSFLAGS+= -at `awk -F= '/^RELEASE *=/{release=$2}; END {print "FreeBSD", rele .include all_sysent: - (cd ${.CURDIR}/kern; ${MAKE} init_sysent.c) - (cd ${.CURDIR}/emulation/svr4; ${MAKE} svr4_sysent.c) - (cd ${.CURDIR}/emulation/linux/i386; ${MAKE} linux_sysent.c) - (cd ${.CURDIR}/emulation/ibcs2/i386; ${MAKE} ibcs2_sysent.c) - (cd ${.CURDIR}/emulation/ibcs2/i386; ${MAKE} ibcs2_isc_sysent.c) - (cd ${.CURDIR}/emulation/ibcs2/i386; ${MAKE} ibcs2_xenix_sysent.c) + (cd ${.CURDIR}/kern; ${MAKE} sysent) + (cd ${.CURDIR}/emulation/svr4; ${MAKE} sysent) + (cd ${.CURDIR}/emulation/linux/i386; ${MAKE} sysent) + (cd ${.CURDIR}/emulation/ibcs2/i386; ${MAKE} sysent) + +# XXX this may be temporary, should the module build be incorporated +# into the default build (make the SUBDIR additions above non-conditional)? +# +modules: + cd ${.CURDIR} && ${MAKE} -f Makefile.modules + +mobj: + cd ${.CURDIR} && ${MAKE} -f Makefile.modules obj + +mclean: + cd ${.CURDIR} && ${MAKE} -f Makefile.modules clean + +mcleanobj: + cd ${.CURDIR} && ${MAKE} -f Makefile.modules cleanobj + +minstall: + cd ${.CURDIR} && ${MAKE} -f Makefile.modules install + diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile index 6b9183d27f..9676dd145b 100644 --- a/sys/boot/i386/boot2/Makefile +++ b/sys/boot/i386/boot2/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.16.2.5 2002/08/07 16:31:53 ru Exp $ -# $DragonFly: src/sys/boot/i386/boot2/Attic/Makefile,v 1.2 2003/06/17 04:28:18 dillon Exp $ +# $DragonFly: src/sys/boot/i386/boot2/Attic/Makefile,v 1.3 2003/08/16 02:51:57 dillon Exp $ PROG= boot2 NOMAN= @@ -28,7 +28,7 @@ BTX= ${.CURDIR}/../btx ORG1= 0x7c00 ORG2= 0x1000 -CFLAGS= -elf -I${.CURDIR}/../btx/lib -I. \ +CFLAGS= -elf -I${.CURDIR}/../btx/lib -I. -I${.CURDIR}/../../.. \ -Os -fno-builtin -fforce-addr -fdata-sections \ -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mrtd \ -mpreferred-stack-boundary=2 \ diff --git a/sys/boot/pc32/boot2/Makefile b/sys/boot/pc32/boot2/Makefile index c9ec25b2d3..135d0450f0 100644 --- a/sys/boot/pc32/boot2/Makefile +++ b/sys/boot/pc32/boot2/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.16.2.5 2002/08/07 16:31:53 ru Exp $ -# $DragonFly: src/sys/boot/pc32/boot2/Makefile,v 1.2 2003/06/17 04:28:18 dillon Exp $ +# $DragonFly: src/sys/boot/pc32/boot2/Makefile,v 1.3 2003/08/16 02:51:57 dillon Exp $ PROG= boot2 NOMAN= @@ -28,7 +28,7 @@ BTX= ${.CURDIR}/../btx ORG1= 0x7c00 ORG2= 0x1000 -CFLAGS= -elf -I${.CURDIR}/../btx/lib -I. \ +CFLAGS= -elf -I${.CURDIR}/../btx/lib -I. -I${.CURDIR}/../../.. \ -Os -fno-builtin -fforce-addr -fdata-sections \ -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mrtd \ -mpreferred-stack-boundary=2 \ diff --git a/sys/conf/Makefile.i386 b/sys/conf/Makefile.i386 index ba09b437a3..fb419bb116 100644 --- a/sys/conf/Makefile.i386 +++ b/sys/conf/Makefile.i386 @@ -2,7 +2,7 @@ # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 # $FreeBSD: src/sys/conf/Makefile.i386,v 1.179.2.16 2002/11/18 11:26:49 ru Exp $ -# $DragonFly: src/sys/conf/Attic/Makefile.i386,v 1.4 2003/08/15 06:32:57 dillon Exp $ +# $DragonFly: src/sys/conf/Attic/Makefile.i386,v 1.5 2003/08/16 02:51:57 dillon Exp $ # # Makefile for FreeBSD # @@ -226,7 +226,7 @@ kernel-reinstall kernel-reinstall.debug: ${INSTALL} -m 555 -o root -g wheel -fschg \ ${KERNEL}${.TARGET:S/kernel-reinstall//} ${DESTDIR}/${KERNEL} -.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules) +.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) all: modules depend: modules-depend clean: modules-clean @@ -237,7 +237,7 @@ install install.debug: modules-install reinstall reinstall.debug: modules-reinstall .endif -MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules +MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR} .if defined(MODULES_OVERRIDE) MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}" .endif @@ -247,29 +247,30 @@ MKMODULESENV+= DEBUG="${DEBUG}" DEBUG_FLAGS="${DEBUG}" MKMODULESENV+= MACHINE=i386 modules: - @mkdir -p ${.OBJDIR}/modules - cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \ - env ${MKMODULESENV} ${MAKE} all + @mkdir -p ${.OBJDIR} + cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules obj ; \ + env ${MKMODULESENV} ${MAKE} -f Makefile.modules all modules-depend: - @mkdir -p ${.OBJDIR}/modules - cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \ - env ${MKMODULESENV} ${MAKE} depend + @mkdir -p ${.OBJDIR} + cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules obj ; \ + env ${MKMODULESENV} ${MAKE} -f Makefile.modules depend modules-clean: - cd $S/modules ; env ${MKMODULESENV} ${MAKE} clean + cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules clean modules-cleandepend: - cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandepend + cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules cleandepend -modules-clobber: modules-clean - rm -rf ${MKMODULESENV} +# XXX huh? +#modules-clobber: modules-clean +# rm -rf ${MKMODULESENV} modules-cleandir: - cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandir + cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules cleandir modules-tags: - cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags + cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules tags modules-install modules-install.debug: .if !defined(NO_MODULES_OLD) @@ -278,10 +279,10 @@ modules-install modules-install.debug: cp -p ${DESTDIR}/modules/* ${DESTDIR}/modules.old; \ fi; .endif - cd $S/modules ; env ${MKMODULESENV} ${MAKE} install + cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install modules-reinstall modules-reinstall.debug: - cd $S/modules ; env ${MKMODULESENV} ${MAKE} install + cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install config.o: ${NORMAL_C} diff --git a/sys/dev/disk/aic7xxx/Makefile b/sys/dev/disk/aic7xxx/Makefile index ef59973b0e..86a0be6246 100644 --- a/sys/dev/disk/aic7xxx/Makefile +++ b/sys/dev/disk/aic7xxx/Makefile @@ -1,6 +1,7 @@ - +# This is a module building Makefile. Note that 'aicasm' is not a module. +# # $FreeBSD: src/sys/modules/aic7xxx/Makefile,v 1.1.2.1 2002/09/02 05:47:36 scottl Exp $ -# $DragonFly: src/sys/dev/disk/aic7xxx/Makefile,v 1.2 2003/06/17 04:28:43 dillon Exp $ +# $DragonFly: src/sys/dev/disk/aic7xxx/Makefile,v 1.3 2003/08/16 02:51:58 dillon Exp $ SUBDIR= aicasm ahc ahd diff --git a/sys/dev/disk/aic7xxx/aicasm/Makefile b/sys/dev/disk/aic7xxx/aicasm/Makefile index 8d531d52ed..b3b5d690e7 100644 --- a/sys/dev/disk/aic7xxx/aicasm/Makefile +++ b/sys/dev/disk/aic7xxx/aicasm/Makefile @@ -1,7 +1,7 @@ # $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aicasm/Makefile#2 $ # # $FreeBSD: src/sys/dev/aic7xxx/aicasm/Makefile,v 1.8.2.5 2002/09/27 15:46:28 gibbs Exp $ -# $DragonFly: src/sys/dev/disk/aic7xxx/aicasm/Makefile,v 1.2 2003/06/17 04:28:22 dillon Exp $ +# $DragonFly: src/sys/dev/disk/aic7xxx/aicasm/Makefile,v 1.3 2003/08/16 02:51:58 dillon Exp $ PROG= aicasm @@ -37,4 +37,8 @@ YFLAGS+= -t -v LFLAGS+= -d .endif +# aicasm is used in place, it is not installed anywhere +# +install: + .include diff --git a/sys/dev/netif/ar/if_ar.c b/sys/dev/netif/ar/if_ar.c index 7141c96d61..8a2f7a2bb1 100644 --- a/sys/dev/netif/ar/if_ar.c +++ b/sys/dev/netif/ar/if_ar.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ar/if_ar.c,v 1.52.2.1 2002/06/17 15:10:57 jhay Exp $ - * $DragonFly: src/sys/dev/netif/ar/if_ar.c,v 1.3 2003/08/07 21:16:59 dillon Exp $ + * $DragonFly: src/sys/dev/netif/ar/if_ar.c,v 1.4 2003/08/16 02:51:58 dillon Exp $ */ /* @@ -70,7 +70,7 @@ #include #include "if_ar.h" #else /* NETGRAPH */ -#include +#include #include #endif /* NETGRAPH */ diff --git a/sys/dev/netif/sr/if_sr.c b/sys/dev/netif/sr/if_sr.c index d0a44a9525..a421697372 100644 --- a/sys/dev/netif/sr/if_sr.c +++ b/sys/dev/netif/sr/if_sr.c @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sr/if_sr.c,v 1.48.2.1 2002/06/17 15:10:58 jhay Exp $ - * $DragonFly: src/sys/dev/netif/sr/if_sr.c,v 1.3 2003/08/07 21:17:05 dillon Exp $ + * $DragonFly: src/sys/dev/netif/sr/if_sr.c,v 1.4 2003/08/16 02:51:59 dillon Exp $ */ /* @@ -71,7 +71,7 @@ #ifdef NETGRAPH #include #else /* NETGRAPH */ -#include +#include #include #endif /* NETGRAPH */ diff --git a/sys/kern/Makefile b/sys/kern/Makefile index 20b921c659..dc548ea169 100644 --- a/sys/kern/Makefile +++ b/sys/kern/Makefile @@ -1,13 +1,11 @@ # @(#)Makefile 8.2 (Berkeley) 3/21/94 # $FreeBSD: src/sys/kern/Makefile,v 1.6.2.1 2003/02/10 12:21:08 des Exp $ -# $DragonFly: src/sys/kern/Makefile,v 1.6 2003/08/15 07:34:25 dillon Exp $ +# $DragonFly: src/sys/kern/Makefile,v 1.7 2003/08/16 02:52:00 dillon Exp $ # Makefile for kernel tags files, init_sysent, etc. -ARCH= i386 # luna68k news3400 pmax sparc tahoe vax - -all: - @echo "make tags, make links or sysent only" +TAGARCH= i386 # luna68k news3400 pmax sparc tahoe vax +SUBDIR= libmchain sysent: init_sysent.c @@ -46,14 +44,18 @@ DGEN= conf \ net netinet netns sys \ vm -tags:: - -for i in ${ARCH}; do \ - (cd ../$$i && make ${MFLAGS} tags); done - -links:: - rm -f ${SYSTAGS} - -ln -s ${SYSDIR}/${MACHINE_ARCH}/tags ${SYSTAGS} - -for i in ${DGEN}; do \ - (cd ../$$i && { rm -f tags; ln -s ${SYSTAGS} tags; }) done - -for i in ${ARCH}; do \ - (cd ../$$i && make ${MFLAGS} SYSTAGS=${SYSTAGS} links); done +# XXX interferes with bsd.subdir.mk +#tags:: +# -for i in ${TAGARCH}; do \ +# (cd ../$$i && make ${MFLAGS} tags); done +# +#links:: +# rm -f ${SYSTAGS} +# -ln -s ${SYSDIR}/${MACHINE_ARCH}/tags ${SYSTAGS} +# -for i in ${DGEN}; do \ +# (cd ../$$i && { rm -f tags; ln -s ${SYSTAGS} tags; }) done +# -for i in ${TAGARCH}; do \ +# (cd ../$$i && make ${MFLAGS} SYSTAGS=${SYSTAGS} links); done + +.include + diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c index 96e0ee6231..feaee8300b 100644 --- a/sys/netinet/ip_gre.c +++ b/sys/netinet/ip_gre.c @@ -1,6 +1,6 @@ /* * $NetBSD: ip_gre.c,v 1.21 2002/08/14 00:23:30 itojun Exp $ - * $DragonFly: src/sys/netinet/ip_gre.c,v 1.3 2003/08/07 21:54:32 dillon Exp $ + * $DragonFly: src/sys/netinet/ip_gre.c,v 1.4 2003/08/16 02:52:00 dillon Exp $ * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -77,8 +77,8 @@ #endif #ifdef NS -#include -#include +#include +#include #endif #ifdef NETATALK -- 2.41.0