diff options
-rw-r--r-- | share/mk/bsd.own.mk | 4 | ||||
-rw-r--r-- | sys/boot/common/boot.c | 2 | ||||
-rw-r--r-- | sys/boot/common/module.c | 2 | ||||
-rw-r--r-- | sys/boot/forth/loader.conf | 4 | ||||
-rw-r--r-- | sys/conf/Makefile.alpha | 62 | ||||
-rw-r--r-- | sys/conf/Makefile.i386 | 61 | ||||
-rw-r--r-- | sys/conf/Makefile.pc98 | 59 | ||||
-rw-r--r-- | sys/conf/Makefile.powerpc | 61 | ||||
-rw-r--r-- | sys/conf/kmod.mk | 2 |
9 files changed, 144 insertions, 113 deletions
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 28d269778db6..45fcab024b6c 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -65,7 +65,7 @@ # # # KMODDIR Base path for loadable kernel modules -# (see kld(4)). [/modules] +# (see kld(4)). [/boot/kernel] # # KMODOWN KLD owner. [${BINOWN}] # @@ -153,7 +153,7 @@ INCGRP?= wheel INCMODE?= 444 INCDIR?= /usr/include -KMODDIR?= /modules +KMODDIR?= /boot/kernel KMODOWN?= ${BINOWN} KMODGRP?= ${BINGRP} KMODMODE?= ${BINMODE} diff --git a/sys/boot/common/boot.c b/sys/boot/common/boot.c index ae3cb7796c99..067012cf53c8 100644 --- a/sys/boot/common/boot.c +++ b/sys/boot/common/boot.c @@ -38,7 +38,7 @@ static char *getbootfile(int try); /* List of kernel names to try (may be overwritten by boot.config) XXX should move from here? */ -static const char *default_bootfiles = "kernel;kernel.old"; +static const char *default_bootfiles = "/boot/modules/kernel.ko"; static int autoboot_tried; diff --git a/sys/boot/common/module.c b/sys/boot/common/module.c index effb848fa0e7..192e58db2c45 100644 --- a/sys/boot/common/module.c +++ b/sys/boot/common/module.c @@ -49,7 +49,7 @@ struct file_metadata* metadata_next(struct file_metadata *base_mp, int type); /* load address should be tweaked by first module loaded (kernel) */ static vm_offset_t loadaddr = 0; -static const char *default_searchpath ="/;/boot;/modules"; +static const char *default_searchpath ="/boot/modules;/modules;/boot/kernel"; struct preloaded_file *preloaded_files = NULL; diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf index 272f37e564fe..897eb40f7991 100644 --- a/sys/boot/forth/loader.conf +++ b/sys/boot/forth/loader.conf @@ -14,7 +14,7 @@ exec=".( Loading /boot/defaults/loader.conf ) cr" -kernel="/kernel" +kernel="/boot/kernel/kernel.ko" kernel_options="" userconfig_script_load="NO" @@ -46,7 +46,7 @@ bitmap_type="splash_image_data" #bootfile="kernel,kernel.old" # Set the default boot file set #console="vidconsole" # Set the current console #currdev="disk1s1a" # Set the current device -#module_path="/;/boot;/modules" # Set the module search path +#module_path="/boot/modules;/modules;/boot/kernel" # Set the module search path #prompt="\\${interpret}" # Set the command prompt #root_disk_unit="0" # Force the root disk unit number #rootdev="disk1s1a" # Set the root filesystem diff --git a/sys/conf/Makefile.alpha b/sys/conf/Makefile.alpha index 1798e889cc2e..ba2ed6abe64e 100644 --- a/sys/conf/Makefile.alpha +++ b/sys/conf/Makefile.alpha @@ -20,7 +20,9 @@ %VERSREQ= 500003 # Can be overridden by makeoptions or /etc/make.conf +KERNEL_KO?= kernel.ko KERNEL?= kernel +KODIR?= /boot/${KERNEL} STD8X16FONT?= iso .if !defined(S) @@ -107,7 +109,7 @@ SYSTEM_DEP+= $S/conf/ldscript.$M %CLEAN .PHONY: all modules -all: ${KERNEL} +all: ${KERNEL_KO} depend: kernel-depend clean: kernel-clean @@ -117,11 +119,11 @@ install install.debug: kernel-install reinstall reinstall.debug: kernel-reinstall .if !defined(DEBUG) -FULLKERNEL= ${KERNEL} +FULLKERNEL= ${KERNEL_KO} .else -FULLKERNEL= ${KERNEL}.debug -${KERNEL}: ${FULLKERNEL} - ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL} +FULLKERNEL= ${KERNEL_KO}.debug +${KERNEL_KO}: ${FULLKERNEL} + ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO} .endif ${FULLKERNEL}: ${SYSTEM_DEP} vers.o @@ -141,7 +143,7 @@ ${mfile:T:S/.m$/.h/}: ${mfile} kernel-clean: rm -f *.o *.so *.So *.ko *.s eddep errs \ - ${FULLKERNEL} ${KERNEL} linterrs makelinks param.c \ + ${FULLKERNEL} ${KERNEL_KO} linterrs makelinks param.c \ setdef[01].c setdefs.h tags \ vers.c vnode_if.c vnode_if.h \ ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \ @@ -267,20 +269,30 @@ kernel-install kernel-install.debug: echo "You must activate /boot/device.hints in loader.conf." ; \ exit 1 ; \ fi - @if [ ! -f ${KERNEL}${.TARGET:S/kernel-install//} ] ; then \ + @if [ ! -f ${KERNEL_KO}${.TARGET:S/kernel-install//} ] ; then \ echo "You must build a kernel first." ; \ exit 1 ; \ fi -.if exists(${DESTDIR}/${KERNEL}) - -chflags noschg ${DESTDIR}/${KERNEL} - mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old +.if exists(${DESTDIR}/${KODIR}) +.if exists(${DESTDIR}/${KODIR}.old) + @-chflags -R noschg ${DESTDIR}/${KODIR}.old + -rm -rf ${DESTDIR}/${KODIR}.old .endif + mv ${DESTDIR}/${KODIR} ${DESTDIR}/${KODIR}.old +.endif + mkdir -p ${KODIR} + @if [ -f ${DESTDIR}/${KODIR}/${KERNEL_KO} ] ; then \ + chflags noschg ${DESTDIR}/${KODIR}/${KERNEL_KO} ; \ + fi install -c -m 555 -o root -g wheel -fschg \ - ${KERNEL}${.TARGET:S/kernel-install//} ${DESTDIR}/${KERNEL} + ${KERNEL_KO}${.TARGET:S/kernel-install//} ${DESTDIR}/${KODIR} kernel-reinstall kernel-reinstall.debug: + @if [ -f ${DESTDIR}/${KODIR}/${KERNEL_KO} ] ; then \ + chflags noschg ${DESTDIR}/${KODIR}/${KERNEL_KO} ; \ + fi install -c -m 555 -o root -g wheel -fschg \ - ${KERNEL}${.TARGET:S/kernel-reinstall//} ${DESTDIR}/${KERNEL} + ${KERNEL_KO}${.TARGET:S/kernel-reinstall//} ${DESTDIR}/${KODIR} .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules) all: modules @@ -292,35 +304,33 @@ install install.debug: modules-install reinstall reinstall.debug: modules-reinstall .endif +MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${DESTDIR}/${KODIR} + modules: @mkdir -p ${.OBJDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} obj all + cd $S/modules && env ${MKMODULESENV} ${MAKE} obj all modules-depend: @mkdir -p ${.OBJDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} obj depend + cd $S/modules && env ${MKMODULESENV} ${MAKE} obj depend modules-clean: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} clean + cd $S/modules && env ${MKMODULESENV} ${MAKE} clean modules-cleandepend: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} cleandepend + cd $S/modules && env ${MKMODULESENV} ${MAKE} cleandepend + +modules-cleandir: + cd $S/modules && env ${MKMODULESENV} ${MAKE} cleandir modules-tags: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} tags + cd $S/modules && env ${MKMODULESENV} ${MAKE} tags modules-install modules-install.debug: -.if !defined(NO_MODULES_OLD) - if [ -d ${DESTDIR}/modules -a -n "`ls ${DESTDIR}/modules`" ]; then \ - mkdir -p ${DESTDIR}/modules.old ; \ - cp -p ${DESTDIR}/modules/* ${DESTDIR}/modules.old ; \ - fi; -.endif - mkdir -p ${DESTDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} install + cd $S/modules && env ${MKMODULESENV} ${MAKE} install modules-reinstall modules-reinstall.debug: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} install + cd $S/modules && env ${MKMODULESENV} ${MAKE} install config.o: ${NORMAL_C} diff --git a/sys/conf/Makefile.i386 b/sys/conf/Makefile.i386 index acf5001199e8..6f940fe45e83 100644 --- a/sys/conf/Makefile.i386 +++ b/sys/conf/Makefile.i386 @@ -20,7 +20,9 @@ %VERSREQ= 500003 # Can be overridden by makeoptions or /etc/make.conf +KERNEL_KO?= kernel.ko KERNEL?= kernel +KODIR?= /boot/${KERNEL} STD8X16FONT?= iso .if !defined(S) @@ -107,7 +109,7 @@ SYSTEM_DEP+= $S/conf/ldscript.$M .PHONY: all modules -all: ${KERNEL} +all: ${KERNEL_KO} depend: kernel-depend clean: kernel-clean @@ -117,11 +119,11 @@ install install.debug: kernel-install reinstall reinstall.debug: kernel-reinstall .if !defined(DEBUG) -FULLKERNEL= ${KERNEL} +FULLKERNEL= ${KERNEL_KO} .else -FULLKERNEL= ${KERNEL}.debug -${KERNEL}: ${FULLKERNEL} - ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL} +FULLKERNEL= ${KERNEL_KO}.debug +${KERNEL_KO}: ${FULLKERNEL} + ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO} .endif ${FULLKERNEL}: ${SYSTEM_DEP} vers.o @@ -141,7 +143,7 @@ ${mfile:T:S/.m$/.h/}: ${mfile} kernel-clean: rm -f *.o *.so *.So *.ko *.s eddep errs \ - ${FULLKERNEL} ${KERNEL} linterrs makelinks param.c \ + ${FULLKERNEL} ${KERNEL_KO} linterrs makelinks param.c \ setdef[01].c setdefs.h tags \ vers.c vnode_if.c vnode_if.h \ ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \ @@ -222,20 +224,30 @@ kernel-install kernel-install.debug: echo "You must activate /boot/device.hints in loader.conf." ; \ exit 1 ; \ fi - @if [ ! -f ${KERNEL}${.TARGET:S/kernel-install//} ] ; then \ + @if [ ! -f ${KERNEL_KO}${.TARGET:S/kernel-install//} ] ; then \ echo "You must build a kernel first." ; \ exit 1 ; \ fi -.if exists(${DESTDIR}/${KERNEL}) - -chflags noschg ${DESTDIR}/${KERNEL} - mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old +.if exists(${DESTDIR}/${KODIR}) +.if exists(${DESTDIR}/${KODIR}.old) + @-chflags -R noschg ${DESTDIR}/${KODIR}.old + -rm -rf ${DESTDIR}/${KODIR}.old .endif + mv ${DESTDIR}/${KODIR} ${DESTDIR}/${KODIR}.old +.endif + mkdir -p ${KODIR} + @if [ -f ${DESTDIR}/${KODIR}/${KERNEL_KO} ] ; then \ + chflags noschg ${DESTDIR}/${KODIR}/${KERNEL_KO} ; \ + fi install -c -m 555 -o root -g wheel -fschg \ - ${KERNEL}${.TARGET:S/kernel-install//} ${DESTDIR}/${KERNEL} + ${KERNEL_KO}${.TARGET:S/kernel-install//} ${DESTDIR}/${KODIR} kernel-reinstall kernel-reinstall.debug: + @if [ -f ${DESTDIR}/${KODIR}/${KERNEL_KO} ] ; then \ + chflags noschg ${DESTDIR}/${KODIR}/${KERNEL_KO} ; \ + fi install -c -m 555 -o root -g wheel -fschg \ - ${KERNEL}${.TARGET:S/kernel-reinstall//} ${DESTDIR}/${KERNEL} + ${KERNEL_KO}${.TARGET:S/kernel-reinstall//} ${DESTDIR}/${KODIR} .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules) all: modules @@ -248,38 +260,33 @@ install install.debug: modules-install reinstall reinstall.debug: modules-reinstall .endif +MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${DESTDIR}/${KODIR} + modules: @mkdir -p ${.OBJDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} obj all + cd $S/modules && env ${MKMODULESENV} ${MAKE} obj all modules-depend: @mkdir -p ${.OBJDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} obj depend + cd $S/modules && env ${MKMODULESENV} ${MAKE} obj depend modules-clean: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} clean + cd $S/modules && env ${MKMODULESENV} ${MAKE} clean modules-cleandepend: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} cleandepend + cd $S/modules && env ${MKMODULESENV} ${MAKE} cleandepend modules-cleandir: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} cleandir + cd $S/modules && env ${MKMODULESENV} ${MAKE} cleandir modules-tags: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} tags + cd $S/modules && env ${MKMODULESENV} ${MAKE} tags modules-install modules-install.debug: -.if !defined(NO_MODULES_OLD) - if [ -d ${DESTDIR}/modules -a -n "`ls ${DESTDIR}/modules`" ]; then \ - mkdir -p ${DESTDIR}/modules.old; \ - cp -p ${DESTDIR}/modules/* ${DESTDIR}/modules.old; \ - fi; -.endif - mkdir -p ${DESTDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} install + cd $S/modules && env ${MKMODULESENV} ${MAKE} install modules-reinstall modules-reinstall.debug: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} install + cd $S/modules && env ${MKMODULESENV} ${MAKE} install config.o: ${NORMAL_C} diff --git a/sys/conf/Makefile.pc98 b/sys/conf/Makefile.pc98 index 7eab4e69def2..dcaf6067456f 100644 --- a/sys/conf/Makefile.pc98 +++ b/sys/conf/Makefile.pc98 @@ -22,7 +22,9 @@ %VERSREQ= 500003 # Can be overridden by makeoptions or /etc/make.conf +KERNEL_KO?= kernel.ko KERNEL?= kernel +KODIR?= /boot/${KERNEL} #STD8X16FONT?= iso .if !defined(S) @@ -109,7 +111,7 @@ SYSTEM_DEP+= $S/conf/ldscript.$M .PHONY: all modules -all: ${KERNEL} +all: ${KERNEL_KO} depend: kernel-depend clean: kernel-clean @@ -119,11 +121,11 @@ install install.debug: kernel-install reinstall reinstall.debug: kernel-reinstall .if !defined(DEBUG) -FULLKERNEL= ${KERNEL} +FULLKERNEL= ${KERNEL_KO} .else -FULLKERNEL= ${KERNEL}.debug -${KERNEL}: ${FULLKERNEL} - ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL} +FULLKERNEL= ${KERNEL_KO}.debug +${KERNEL_KO}: ${FULLKERNEL} + ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO} .endif ${FULLKERNEL}: ${SYSTEM_DEP} vers.o @@ -143,7 +145,7 @@ ${mfile:T:S/.m$/.h/}: ${mfile} kernel-clean: rm -f *.o *.so *.So *.ko *.s eddep errs \ - ${FULLKERNEL} ${KERNEL} linterrs makelinks param.c \ + ${FULLKERNEL} ${KERNEL_KO} linterrs makelinks param.c \ setdef[01].c setdefs.h tags \ vers.c vnode_if.c vnode_if.h \ ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \ @@ -225,18 +227,28 @@ kernel-install kernel-install.debug: echo "You must activate /boot/device.hints in loader.conf." ; \ exit 1 ; \ fi - @if [ ! -f ${KERNEL}${.TARGET:S/kernel-install//} ] ; then \ + @if [ ! -f ${KERNEL_KO}${.TARGET:S/kernel-install//} ] ; then \ echo "You must build a kernel first." ; \ exit 1 ; \ fi -.if exists(${DESTDIR}/${KERNEL}) - -chflags noschg ${DESTDIR}/${KERNEL} - mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old +.if exists(${DESTDIR}/${KODIR}) +.if exists(${DESTDIR}/${KODIR}.old) + @-chflags -R noschg ${DESTDIR}/${KODIR}.old + -rm -rf ${DESTDIR}/${KODIR}.old .endif + mv ${DESTDIR}/${KODIR} ${DESTDIR}/${KODIR}.old +.endif + mkdir -p ${KODIR} + @if [ -f ${DESTDIR}/${KODIR}/${KERNEL_KO} ] ; then \ + chflags noschg ${DESTDIR}/${KODIR}/${KERNEL_KO} ; \ + fi install -c -m 555 -o root -g wheel -fschg \ - ${KERNEL}${.TARGET:S/kernel-install//} ${DESTDIR}/${KERNEL} + ${KERNEL_KO}${.TARGET:S/kernel-install//} ${DESTDIR}/${KODIR} kernel-reinstall kernel-reinstall.debug: + @if [ -f ${DESTDIR}/${KODIR}/${KERNEL_KO} ] ; then \ + chflags noschg ${DESTDIR}/${KODIR}/${KERNEL_KO} ; \ + fi install -c -m 555 -o root -g wheel -fschg \ ${KERNEL}${.TARGET:S/kernel-reinstall//} ${DESTDIR}/${KERNEL} @@ -251,38 +263,33 @@ install install.debug: modules-install reinstall reinstall.debug: modules-reinstall .endif +MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${DESTDIR}/${KODIR} + modules: @mkdir -p ${.OBJDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} obj all + cd $S/modules && env ${MKMODULESENV} ${MAKE} obj all modules-depend: @mkdir -p ${.OBJDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} obj depend + cd $S/modules && env ${MKMODULESENV} ${MAKE} obj depend modules-clean: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} clean + cd $S/modules && env ${MKMODULESENV} ${MAKE} clean modules-cleandepend: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} cleandepend + cd $S/modules && env ${MKMODULESENV} ${MAKE} cleandepend modules-cleandir: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} cleandir + cd $S/modules && env ${MKMODULESENV} ${MAKE} cleandir modules-tags: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} tags + cd $S/modules && env ${MKMODULESENV} ${MAKE} tags modules-install modules-install.debug: -.if !defined(NO_MODULES_OLD) - if [ -d ${DESTDIR}/modules -a -n "`ls ${DESTDIR}/modules`" ]; then \ - mkdir -p ${DESTDIR}/modules.old; \ - cp -p ${DESTDIR}/modules/* ${DESTDIR}/modules.old; \ - fi; -.endif - mkdir -p ${DESTDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} install + cd $S/modules && env ${MKMODULESENV} ${MAKE} install modules-reinstall modules-reinstall.debug: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} install + cd $S/modules && env ${MKMODULESENV} ${MAKE} install config.o: ${NORMAL_C} diff --git a/sys/conf/Makefile.powerpc b/sys/conf/Makefile.powerpc index acf5001199e8..6f940fe45e83 100644 --- a/sys/conf/Makefile.powerpc +++ b/sys/conf/Makefile.powerpc @@ -20,7 +20,9 @@ %VERSREQ= 500003 # Can be overridden by makeoptions or /etc/make.conf +KERNEL_KO?= kernel.ko KERNEL?= kernel +KODIR?= /boot/${KERNEL} STD8X16FONT?= iso .if !defined(S) @@ -107,7 +109,7 @@ SYSTEM_DEP+= $S/conf/ldscript.$M .PHONY: all modules -all: ${KERNEL} +all: ${KERNEL_KO} depend: kernel-depend clean: kernel-clean @@ -117,11 +119,11 @@ install install.debug: kernel-install reinstall reinstall.debug: kernel-reinstall .if !defined(DEBUG) -FULLKERNEL= ${KERNEL} +FULLKERNEL= ${KERNEL_KO} .else -FULLKERNEL= ${KERNEL}.debug -${KERNEL}: ${FULLKERNEL} - ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL} +FULLKERNEL= ${KERNEL_KO}.debug +${KERNEL_KO}: ${FULLKERNEL} + ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO} .endif ${FULLKERNEL}: ${SYSTEM_DEP} vers.o @@ -141,7 +143,7 @@ ${mfile:T:S/.m$/.h/}: ${mfile} kernel-clean: rm -f *.o *.so *.So *.ko *.s eddep errs \ - ${FULLKERNEL} ${KERNEL} linterrs makelinks param.c \ + ${FULLKERNEL} ${KERNEL_KO} linterrs makelinks param.c \ setdef[01].c setdefs.h tags \ vers.c vnode_if.c vnode_if.h \ ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \ @@ -222,20 +224,30 @@ kernel-install kernel-install.debug: echo "You must activate /boot/device.hints in loader.conf." ; \ exit 1 ; \ fi - @if [ ! -f ${KERNEL}${.TARGET:S/kernel-install//} ] ; then \ + @if [ ! -f ${KERNEL_KO}${.TARGET:S/kernel-install//} ] ; then \ echo "You must build a kernel first." ; \ exit 1 ; \ fi -.if exists(${DESTDIR}/${KERNEL}) - -chflags noschg ${DESTDIR}/${KERNEL} - mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old +.if exists(${DESTDIR}/${KODIR}) +.if exists(${DESTDIR}/${KODIR}.old) + @-chflags -R noschg ${DESTDIR}/${KODIR}.old + -rm -rf ${DESTDIR}/${KODIR}.old .endif + mv ${DESTDIR}/${KODIR} ${DESTDIR}/${KODIR}.old +.endif + mkdir -p ${KODIR} + @if [ -f ${DESTDIR}/${KODIR}/${KERNEL_KO} ] ; then \ + chflags noschg ${DESTDIR}/${KODIR}/${KERNEL_KO} ; \ + fi install -c -m 555 -o root -g wheel -fschg \ - ${KERNEL}${.TARGET:S/kernel-install//} ${DESTDIR}/${KERNEL} + ${KERNEL_KO}${.TARGET:S/kernel-install//} ${DESTDIR}/${KODIR} kernel-reinstall kernel-reinstall.debug: + @if [ -f ${DESTDIR}/${KODIR}/${KERNEL_KO} ] ; then \ + chflags noschg ${DESTDIR}/${KODIR}/${KERNEL_KO} ; \ + fi install -c -m 555 -o root -g wheel -fschg \ - ${KERNEL}${.TARGET:S/kernel-reinstall//} ${DESTDIR}/${KERNEL} + ${KERNEL_KO}${.TARGET:S/kernel-reinstall//} ${DESTDIR}/${KODIR} .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules) all: modules @@ -248,38 +260,33 @@ install install.debug: modules-install reinstall reinstall.debug: modules-reinstall .endif +MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${DESTDIR}/${KODIR} + modules: @mkdir -p ${.OBJDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} obj all + cd $S/modules && env ${MKMODULESENV} ${MAKE} obj all modules-depend: @mkdir -p ${.OBJDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} obj depend + cd $S/modules && env ${MKMODULESENV} ${MAKE} obj depend modules-clean: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} clean + cd $S/modules && env ${MKMODULESENV} ${MAKE} clean modules-cleandepend: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} cleandepend + cd $S/modules && env ${MKMODULESENV} ${MAKE} cleandepend modules-cleandir: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} cleandir + cd $S/modules && env ${MKMODULESENV} ${MAKE} cleandir modules-tags: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} tags + cd $S/modules && env ${MKMODULESENV} ${MAKE} tags modules-install modules-install.debug: -.if !defined(NO_MODULES_OLD) - if [ -d ${DESTDIR}/modules -a -n "`ls ${DESTDIR}/modules`" ]; then \ - mkdir -p ${DESTDIR}/modules.old; \ - cp -p ${DESTDIR}/modules/* ${DESTDIR}/modules.old; \ - fi; -.endif - mkdir -p ${DESTDIR}/modules - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} install + cd $S/modules && env ${MKMODULESENV} ${MAKE} install modules-reinstall modules-reinstall.debug: - cd $S/modules && env MAKEOBJDIRPREFIX=${.OBJDIR}/modules ${MAKE} install + cd $S/modules && env ${MKMODULESENV} ${MAKE} install config.o: ${NORMAL_C} diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 803593b24f9a..f1d598a9b49f 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -13,7 +13,7 @@ # # KMOD The name of the kernel module to build. # -# KMODDIR Base path for kernel modules (see kld(4)). [/modules] +# KMODDIR Base path for kernel modules (see kld(4)). [/boot/kernel] # # KMODOWN KLD owner. [${BINOWN}] # |