[issue1140] installkernel POSTFIX directive
Stefan Johannesdal
stefan.johannesdal at gmail.com
Tue Sep 23 05:12:49 PDT 2008
Matthew Dillon wrote:
Lets clean up the names a bit. DESTKERNDIR is ok, but KERNPOSTFIX
is a problem. Lets rename KERNPOSTFIX to DESTVARIATION or DESTLABEL.
I think DESTLABEL fits better. KERNPOSTFIX is too confusing.
I've thought about it a bit more and I am going to back away from
wanting the postfix automatically based on the kernconf. But we
do want to get rid of the '.' in the postfix (as well as rename it).
So how about this:
make installkernel KERNCONF=GENERIC
Installs as /boot/kernel, /boot/modules
make installkernel KERNCONF=FUBAR DESTLABEL=smp
Installs as /boot/kernel.smp, /boot/modules.smp
make installkernel KERNCONF=FUBAR DESTLABEL=smp DESTDIR=/mnt
Installs as /mnt/boot/kernel.smp, /mnt/boot/modules.smp
make installkenrel KERNCONF=FUBAR DESTKERNDIR=/mnt/fubar
Installs as /mnt/fubar/kernel and /mnt/fubar/kernel.smp
I think its important for DESTLABEL to not need the '.', though it
does mean some additional complication in the Makefile's. I recommend
building an internal DESTKERNNAME and DESTMODULESNAME based on
DESTLABEL. If DESTLABEL does not exist DESTKERNNAME would be 'kernel'
and DESTMODULESNAME would be 'modules'. If DESTLABEL does exist then
DESTKERNNAME would be 'kernel.${DESTLABEL}' and DESTMODULESNAME would
be 'modules.${DESTLABEL}'.
One could also override the whole name by specifying DESTKERNNAME and
DESTMODULESNAME.
How does that sound?
-Matt
Matthew Dillon
<dillon at backplane.com>
Sounds fine to me. Attaching the latest diffs.
--
Mvh - Stefan -
--- bsd.own.mk.org 2008-09-02 13:50:45 +0200
+++ bsd.own.mk 2008-09-23 13:05:35 +0200
@@ -151,7 +151,7 @@
BINMODE?= 555
NOBINMODE?= 444
-KMODDIR?= /boot/modules
+KMODDIR?= ${DESTKERNDIR}/${DESTMODULESNAME}
KMODOWN?= ${BINOWN}
KMODGRP?= ${BINGRP}
KMODMODE?= ${BINMODE}
--- kern.post.mk.org 2008-09-15 23:13:07 +0200
+++ kern.post.mk 2008-09-23 13:37:47 +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})
.ifndef NOFSCHG
- -chflags noschg ${DESTDIR}/boot/${DESTKERNNAME}
+ -chflags noschg ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
.endif
. ifdef NO_KERNEL_OLD_STRIP
- cp -p ${DESTDIR}/boot/${DESTKERNNAME} ${DESTDIR}/boot/${DESTKERNNAME}.old
+ cp -p ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}.old
. else
- ${OBJCOPY} --strip-debug ${DESTDIR}/boot/${DESTKERNNAME} ${DESTDIR}/boot/${DESTKERNNAME}.old
+ ${OBJCOPY} --strip-debug ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}.old
. endif
. endif
.ifdef NOFSCHG
${INSTALL} -m 555 -o root -g wheel \
- ${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+ ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
.else
${INSTALL} -m 555 -o root -g wheel -fschg \
- ${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+ ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
.endif
kernel-reinstall: kernel-installable
.ifdef NOFSCHG
${INSTALL} -m 555 -o root -g wheel \
- ${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+ ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
.else
${INSTALL} -m 555 -o root -g wheel -fschg \
- ${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+ ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
.endif
# Require DESTDIR to be manually specified when installing a
@@ -143,8 +143,9 @@
#
kernel-installable:
.if ${P} == vkernel
-.if !defined(DESTDIR)
- @echo "When installing a virtual kernel, DESTDIR must be manually specified"
+.if ( !defined(DESTDIR) && ( !defined(DESTKERNDIR) || ${DESTKERNDIR} == /boot ) )
+ @echo "When installing a virtual kernel,"
+ @echo "DESTKERNDIR or DESTDIR must be manually specified"
@exit 1
.endif
.endif
@@ -199,24 +200,24 @@
modules-install:
.if !defined(NO_MODULES_OLD)
. ifdef NO_KERNEL_OLD_STRIP
- set -- ${DESTDIR}/boot/modules/*; \
+ set -- ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}/*; \
if [ -f "$$1" ]; then \
- mkdir -p ${DESTDIR}/boot/modules.old; \
+ mkdir -p ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old; \
for file; do \
- cp -p $$file ${DESTDIR}/boot/modules.old; \
+ cp -p $$file ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old; \
done; \
fi
. else
- set -- ${DESTDIR}/boot/modules/*; \
+ set -- ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}/*; \
if [ -f "$$1" ]; then \
- mkdir -p ${DESTDIR}/boot/modules.old; \
+ mkdir -p ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old; \
for file; do \
- ${OBJCOPY} --strip-debug $$file ${DESTDIR}/boot/modules.old/$${file##*/}; \
+ ${OBJCOPY} --strip-debug $$file ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old/$${file##*/}; \
done; \
fi
. endif
.endif
- mkdir -p ${DESTDIR}/boot/modules # Ensure that the modules directory exists!
+ mkdir -p ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME} # Ensure that the modules directory exists!
cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
modules-reinstall:
--- kern.pre.mk.org 2008-09-15 22:09:03 +0200
+++ kern.pre.mk 2008-09-23 13:35:42 +0200
@@ -103,10 +103,17 @@
FULLKERNEL= ${KERNEL}.nodebug
SELECTEDKERNEL= ${KERNEL}.stripped
.endif
-DESTKERNNAME?= ${KERNEL}
+.if defined(DESTLABEL)
+ DESTKERNNAME?=${KERNEL}.${DESTLABEL}
+ DESTMODULESNAME?=modules.${DESTLABEL}
+.else
+ DESTKERNNAME?=${KERNEL}
+ DESTMODULESNAME?=modules
+.endif
+DESTKERNDIR?=/boot
-MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR} BUILDING_WITH_KERNEL=${.OBJDIR}
+MKMODULESENV= DESTKERNDIR=${DESTKERNDIR} DESTMODULESNAME=${DESTMODULESNAME} MAKEOBJDIRPREFIX=${.OBJDIR} BUILDING_WITH_KERNEL=${.OBJDIR}
.if defined(MODULES_OVERRIDE)
MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
.endif
More information about the Bugs
mailing list