[issue1140] installkernel POSTFIX directive

Stefan Johannesdal stefan.johannesdal at gmail.com
Sat Sep 20 20:49:10 PDT 2008


YONETANI Tomokazu wrote:
YONETANI Tomokazu <qhwt+dfly at les.ath.cx> added the comment:

I tend to like the variable name to begin with K... or KERN..., if
they are related to kernel, to avoid name clash with some other
applications (note that environment variables can also affect make
variables).  You may(or may not) feel this way when you a description
in bsd.own.mk.
DESTDIR is `An existing directory to be the root of the hierarchy'
according to build(7), and the location of kernel/modules in the hierarchy
has been moved from / to /boot.  For instance, when you build an ISO image
from the source, DESTDIR is set to ISOROOT, but kernel and modules should be
installed under ISOROOT/boot, not right under ISOROOT.  So if you do want
to be able to install the kernel/modules to some other directory not
containing .../boot, I think you can introduce a variable, say KERNDIR,
which defaults to /boot.
  make installkernel KERNCONF=MYSMPCONF POSTFIX=.smp KERNDIR=/

or, with traditional method:
  cd /sys/config
  config -d /path/to/builddir /path/to/MYSMPCONF
  make depend && make
  make POSTFIX=.smp KERNDIR=/ install
Cheers.

----------
status: unread -> chatting
_____________________________________________________
DragonFly issue tracker <bugs at lists.dragonflybsd.org>
<https://bugs.dragonflybsd.org/issue1140>
_____________________________________________________
  
New try. How about DESTKERNDIR (to go with DESTKERNNAME) and KERNPOSTFIX?

DESTKERNNAME only affects the name of the kernel and if you have 
different module options between different kernel configs you want to 
have something in common between the kernel name and the modules 
directory name -> KERNPOSTFIX.

DESTKERNDIR is a added directive and does not interfer with DESTDIR.

--

Mvh  - Stefan -

--- kern.post.mk.org	2008-09-15 23:13:07 +0200
+++ kern.post.mk	2008-09-20 13:35:38 +0200
@@ -111,31 +111,31 @@
 		echo "You must build a kernel first." ; \
 		exit 1 ; \
 	fi
-.  if exists(${DESTDIR}/boot/${DESTKERNNAME})
+.  if exists(${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}${KERNPOSTFIX})
 .ifndef NOFSCHG
-	-chflags noschg ${DESTDIR}/boot/${DESTKERNNAME}
+	-chflags noschg ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}${KERNPOSTFIX}
 .endif
 .    ifdef NO_KERNEL_OLD_STRIP
-	cp -p ${DESTDIR}/boot/${DESTKERNNAME} ${DESTDIR}/boot/${DESTKERNNAME}.old
+	cp -p ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}${KERNPOSTFIX} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}${KERNPOSTFIX}.old
 .    else
-	${OBJCOPY} --strip-debug ${DESTDIR}/boot/${DESTKERNNAME} ${DESTDIR}/boot/${DESTKERNNAME}.old
+	${OBJCOPY} --strip-debug ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}${KERNPOSTFIX} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}${KERNPOSTFIX}.old
 .    endif
 .  endif
 .ifdef NOFSCHG
 	${INSTALL} -m 555 -o root -g wheel \
-		${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+		${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}${KERNPOSTFIX}
 .else
 	${INSTALL} -m 555 -o root -g wheel -fschg \
-		${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+		${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}${KERNPOSTFIX}
 .endif
 
 kernel-reinstall: kernel-installable
 .ifdef NOFSCHG
 	${INSTALL} -m 555 -o root -g wheel \
-		${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+		${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}${KERNPOSTFIX}
 .else
 	${INSTALL} -m 555 -o root -g wheel -fschg \
-		${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+		${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}${KERNPOSTFIX}
 .endif
 
 # Require DESTDIR to be manually specified when installing a
@@ -143,7 +143,7 @@
 #
 kernel-installable:
 .if ${P} == vkernel
-.if !defined(DESTDIR)
+.if ( !defined(DESTDIR) && ( !defined(DESTKERNDIR) || ${DESTKERNDIR} == /boot ) )
 	@echo "When installing a virtual kernel, DESTDIR must be manually specified"
 	@exit 1
 .endif
@@ -199,24 +199,24 @@
 modules-install:
 .if !defined(NO_MODULES_OLD)
 .  ifdef NO_KERNEL_OLD_STRIP
-	set -- ${DESTDIR}/boot/modules/*; \
+	set -- ${DESTDIR}${DESTKERNDIR}/modules${KERNPOSTFIX}/*; \
 	if [ -f "$$1" ]; then \
-		mkdir -p ${DESTDIR}/boot/modules.old; \
+		mkdir -p ${DESTDIR}${DESTKERNDIR}/modules${KERNPOSTFIX}.old; \
 		for file; do \
-		cp -p $$file ${DESTDIR}/boot/modules.old; \
+		cp -p $$file ${DESTDIR}${DESTKERNDIR}/modules${KERNPOSTFIX}.old; \
 		done; \
 	fi
 .  else
-	set -- ${DESTDIR}/boot/modules/*; \
+	set -- ${DESTDIR}${DESTKERNDIR}/modules${KERNPOSTFIX}/*; \
 	if [ -f "$$1" ]; then \
-		mkdir -p ${DESTDIR}/boot/modules.old; \
+		mkdir -p ${DESTDIR}${DESTKERNDIR}/modules${KERNPOSTFIX}.old; \
 		for file; do \
-		${OBJCOPY} --strip-debug $$file ${DESTDIR}/boot/modules.old/$${file##*/}; \
+		${OBJCOPY} --strip-debug $$file ${DESTDIR}${DESTKERNDIR}/modules${KERNPOSTFIX}.old/$${file##*/}; \
 		done; \
 	fi
 .  endif
 .endif
-	mkdir -p ${DESTDIR}/boot/modules # Ensure that the modules directory exists!
+	mkdir -p ${DESTDIR}${DESTKERNDIR}/modules${KERNPOSTFIX} # Ensure that the modules directory exists!
 	cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
 
 modules-reinstall:
--- bsd.own.mk.org	2008-09-02 13:50:45 +0200
+++ bsd.own.mk		2008-09-15 22:21:42 +0200
@@ -151,7 +151,7 @@
 BINMODE?=	555
 NOBINMODE?=	444
 
-KMODDIR?=	/boot/modules
+KMODDIR?=	/modules${KERNPOSTFIX}
 KMODOWN?=	${BINOWN}
 KMODGRP?=	${BINGRP}
 KMODMODE?=	${BINMODE}
--- kern.pre.mk.org	2008-09-15 22:09:03 +0200
+++ kern.pre.mk		2008-09-15 23:25:54 +0200
@@ -104,9 +104,12 @@
 SELECTEDKERNEL= ${KERNEL}.stripped
 .endif
 DESTKERNNAME?=	${KERNEL}
+.if !defined(DESTKERNDIR)
+  DESTKERNDIR=/boot
+.endif
 
 
-MKMODULESENV=	MAKEOBJDIRPREFIX=${.OBJDIR} BUILDING_WITH_KERNEL=${.OBJDIR}
+MKMODULESENV=	DESTDIR=${DESTDIR}${DESTKERNDIR} KERNPOSTFIX=${KERNPOSTFIX} MAKEOBJDIRPREFIX=${.OBJDIR} BUILDING_WITH_KERNEL=${.OBJDIR}
 .if defined(MODULES_OVERRIDE)
 MKMODULESENV+=	MODULES_OVERRIDE="${MODULES_OVERRIDE}"
 .endif




More information about the Bugs mailing list