installkernel POSTFIX directive
Stefan Johannesdal
stefan.johannesdal at gmail.com
Fri Sep 19 19:13:09 PDT 2008
These patches add a POSTFIX directive to installkernel. Like this:
make installkernel KERNCONF=MYSMPCONF POSTFIX=.smp
The kernel would end up as "/boot/kernel.smp" and the modules as
"/boot/modules.smp".
I also had a go at the hard coded adding of "/boot" that I felt was a
bit illogical since it got added even if one defined DESTDIR. Things
would end up in DESTDIR/boot while I felt that if you define DESTDIR
then you want kernel/modules to end up in DESTDIR.
Affected files:
share/mk/bsd.own.mk
sys/conf/kern.post.mk
sys/conf/kern.pre.mk
--
Mvh - Stefan -
--- 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${POSTFIX}
KMODOWN?= ${BINOWN}
KMODGRP?= ${BINGRP}
KMODMODE?= ${BINMODE}
--- kern.post.mk.org 2008-09-15 23:13:07 +0200
+++ kern.post.mk 2008-09-15 23:21:29 +0200
@@ -111,31 +111,31 @@
echo "You must build a kernel first." ; \
exit 1 ; \
fi
-. if exists(${DESTDIR}/boot/${DESTKERNNAME})
+. if exists(${DESTDIR}/${DESTKERNNAME}${POSTFIX})
.ifndef NOFSCHG
- -chflags noschg ${DESTDIR}/boot/${DESTKERNNAME}
+ -chflags noschg ${DESTDIR}/${DESTKERNNAME}${POSTFIX}
.endif
. ifdef NO_KERNEL_OLD_STRIP
- cp -p ${DESTDIR}/boot/${DESTKERNNAME} ${DESTDIR}/boot/${DESTKERNNAME}.old
+ cp -p ${DESTDIR}/${DESTKERNNAME}${POSTFIX} ${DESTDIR}/${DESTKERNNAME}${POSTFIX}.old
. else
- ${OBJCOPY} --strip-debug ${DESTDIR}/boot/${DESTKERNNAME} ${DESTDIR}/boot/${DESTKERNNAME}.old
+ ${OBJCOPY} --strip-debug ${DESTDIR}/${DESTKERNNAME}${POSTFIX} ${DESTDIR}/${DESTKERNNAME}${POSTFIX}.old
. endif
. endif
.ifdef NOFSCHG
${INSTALL} -m 555 -o root -g wheel \
- ${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+ ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}${POSTFIX}
.else
${INSTALL} -m 555 -o root -g wheel -fschg \
- ${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+ ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}${POSTFIX}
.endif
kernel-reinstall: kernel-installable
.ifdef NOFSCHG
${INSTALL} -m 555 -o root -g wheel \
- ${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+ ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}${POSTFIX}
.else
${INSTALL} -m 555 -o root -g wheel -fschg \
- ${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
+ ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}${POSTFIX}
.endif
# Require DESTDIR to be manually specified when installing a
@@ -143,12 +143,12 @@
#
kernel-installable:
.if ${P} == vkernel
-.if !defined(DESTDIR)
+.if ( !defined(DESTDIR) || ${DESTDIR} == /boot )
@echo "When installing a virtual kernel, DESTDIR must be manually specified"
@exit 1
.endif
.endif
- @if [ -f ${DESTDIR}/${DESTKERNNAME} ]; then \
+ @if [ -f /${DESTKERNNAME} ]; then \
echo "You need to make buildworld, installworld, and upgrade"; \
echo "before you can install a new kernel, because the"; \
echo "kernel and modules have moved to /boot"; \
@@ -199,24 +199,24 @@
modules-install:
.if !defined(NO_MODULES_OLD)
. ifdef NO_KERNEL_OLD_STRIP
- set -- ${DESTDIR}/boot/modules/*; \
+ set -- ${DESTDIR}/modules${POSTFIX}/*; \
if [ -f "$$1" ]; then \
- mkdir -p ${DESTDIR}/boot/modules.old; \
+ mkdir -p ${DESTDIR}/modules${POSTFIX}.old; \
for file; do \
- cp -p $$file ${DESTDIR}/boot/modules.old; \
+ cp -p $$file ${DESTDIR}/modules${POSTFIX}.old; \
done; \
fi
. else
- set -- ${DESTDIR}/boot/modules/*; \
+ set -- ${DESTDIR}/modules${POSTFIX}/*; \
if [ -f "$$1" ]; then \
- mkdir -p ${DESTDIR}/boot/modules.old; \
+ mkdir -p ${DESTDIR}/modules${POSTFIX}.old; \
for file; do \
- ${OBJCOPY} --strip-debug $$file ${DESTDIR}/boot/modules.old/$${file##*/}; \
+ ${OBJCOPY} --strip-debug $$file ${DESTDIR}/modules${POSTFIX}.old/$${file##*/}; \
done; \
fi
. endif
.endif
- mkdir -p ${DESTDIR}/boot/modules # Ensure that the modules directory exists!
+ mkdir -p ${DESTDIR}/modules${POSTFIX} # 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-15 23:25:54 +0200
@@ -104,9 +104,12 @@
SELECTEDKERNEL= ${KERNEL}.stripped
.endif
DESTKERNNAME?= ${KERNEL}
+.if !defined(DESTDIR)
+ DESTDIR=/boot
+.endif
-MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR} BUILDING_WITH_KERNEL=${.OBJDIR}
+MKMODULESENV= DESTDIR=${DESTDIR} POSTFIX=${POSTFIX} MAKEOBJDIRPREFIX=${.OBJDIR} BUILDING_WITH_KERNEL=${.OBJDIR}
.if defined(MODULES_OVERRIDE)
MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
.endif
More information about the Submit
mailing list