Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: install multiple kernels if specified #1566

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Makefile.inc1
Original file line number Diff line number Diff line change
Expand Up @@ -1843,13 +1843,13 @@ buildkernel: .MAKE .PHONY
@echo "--------------------------------------------------------------"

.if !make(packages) && !make(update-packages)
NO_INSTALLEXTRAKERNELS?= yes
INSTALLEXTRAKERNELS?= no
.else
# packages/update-packages installs kernels to a staging directory then builds
# packages from the result to be installed, typically to other systems. It is
# less surprising for these targets to honor KERNCONF if multiple kernels are
# specified.
NO_INSTALLEXTRAKERNELS?= no
INSTALLEXTRAKERNELS?= yes
.endif

#
Expand Down Expand Up @@ -1878,7 +1878,7 @@ reinstallkernel reinstallkernel.debug: _installcheck_kernel .PHONY
echo ">>> Install kernel(s) ${INSTALLKERNEL} completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}"
@echo "--------------------------------------------------------------"
.endif
.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
.if ${BUILDKERNELS:[#]} > 1 && ${INSTALLEXTRAKERNELS} != "no"
.for _kernel in ${BUILDKERNELS:[2..-1]}
@echo "--------------------------------------------------------------"
@echo ">>> Installing kernel ${_kernel} $$(LC_ALL=C date)"
Expand Down Expand Up @@ -1917,7 +1917,7 @@ distributekernel distributekernel.debug: .PHONY
${DESTDIR}/${DISTDIR}/kernel.meta
.endif
.endif
.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
.if ${BUILDKERNELS:[#]} > 1 && ${INSTALLEXTRAKERNELS} != "no"
.for _kernel in ${BUILDKERNELS:[2..-1]}
.if defined(NO_ROOT)
@echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
Expand Down Expand Up @@ -1951,7 +1951,7 @@ packagekernel: .PHONY
@${DESTDIR}/${DISTDIR}/kernel.meta | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz
.endif
.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
.if ${BUILDKERNELS:[#]} > 1 && ${INSTALLEXTRAKERNELS} != "no"
.for _kernel in ${BUILDKERNELS:[2..-1]}
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
${TAR_CMD} cvf - --exclude '*.debug' \
Expand All @@ -1976,7 +1976,7 @@ packagekernel: .PHONY
${TAR_CMD} cvf - --include '*/*/*.debug' $$(eval find .) | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz
.endif
.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
.if ${BUILDKERNELS:[#]} > 1 && ${INSTALLEXTRAKERNELS} != "no"
.for _kernel in ${BUILDKERNELS:[2..-1]}
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
${TAR_CMD} cvf - --exclude '*.debug' . | \
Expand Down Expand Up @@ -2059,7 +2059,7 @@ BRANCH_EXT_FROM=
.endif

PKGMAKEARGS+= PKG_VERSION=${PKG_VERSION} \
NO_INSTALLEXTRAKERNELS=${NO_INSTALLEXTRAKERNELS}
INSTALLEXTRAKERNELS=${INSTALLEXTRAKERNELS}

packages: .PHONY
${_+_}${MAKE} -C ${.CURDIR} ${PKGMAKEARGS} real-packages
Expand Down Expand Up @@ -2307,7 +2307,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap
-o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
. endfor
.endif
.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
.if ${BUILDKERNELS:[#]} > 1 && ${INSTALLEXTRAKERNELS} != "no"
. for _kernel in ${BUILDKERNELS:[2..-1]}
. if exists(${KSTAGEDIR}/kernel.${_kernel}.meta)
. if ${MK_DEBUG_FILES} != "no"
Expand Down
18 changes: 14 additions & 4 deletions release/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# WORLDDIR: location of src tree -- must have built world and default kernel
# (by default, the directory above this one)
# PORTSDIR: location of ports tree to distribute (default: /usr/ports)
# INSTALLEXTRAKERNELS: if set, install all kernels in the KERNCONF variable
# XTRADIR: xtra-bits-dir argument for <arch>/mkisoimages.sh
# NOPKG: if set, do not distribute third-party packages
# NOPORTS: if set, do not distribute ports tree
Expand All @@ -36,6 +37,7 @@
# TARGET/TARGET_ARCH: architecture of built release
#

INSTALLEXTRAKERNELS?= no
WORLDDIR?= ${.CURDIR}/..
PORTSDIR?= /usr/ports

Expand Down Expand Up @@ -173,7 +175,9 @@ disc1: packagesystem
# Install system
mkdir -p ${.TARGET}
( cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \
DESTDIR=${.OBJDIR}/${.TARGET} MK_AT=no \
DESTDIR=${.OBJDIR}/${.TARGET} \
INSTALLEXTRAKERNELS=${INSTALLEXTRAKERNELS} \
MK_AT=no \
MK_INSTALLLIB=no MK_MAIL=no \
${_ALL_LIBCOMPATS:@v@MK_LIB$v=no@} \
MK_TOOLCHAIN=no \
Expand Down Expand Up @@ -218,7 +222,9 @@ bootonly: packagesystem
# Install system
mkdir -p ${.TARGET}
( cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \
DESTDIR=${.OBJDIR}/${.TARGET} MK_AT=no \
DESTDIR=${.OBJDIR}/${.TARGET} \
INSTALLEXTRAKERNELS=${INSTALLEXTRAKERNELS} \
MK_AT=no \
MK_GAMES=no \
MK_INSTALLLIB=no MK_MAIL=no \
${_ALL_LIBCOMPATS:@v@MK_LIB$v=no@} \
Expand Down Expand Up @@ -254,8 +260,12 @@ dvd: packagesystem
# Install system
mkdir -p ${.TARGET}
( cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \
DESTDIR=${.OBJDIR}/${.TARGET} MK_RESCUE=no MK_KERNEL_SYMBOLS=no \
MK_TESTS=no MK_DEBUG_FILES=no \
DESTDIR=${.OBJDIR}/${.TARGET} \
INSTALLEXTRAKERNELS=${INSTALLEXTRAKERNELS} \
MK_RESCUE=no \
MK_KERNEL_SYMBOLS=no \
MK_TESTS=no \
MK_DEBUG_FILES=no \
-DDB_FROM_SRC )
# Copy distfiles
mkdir -p ${.TARGET}/usr/freebsd-dist
Expand Down
4 changes: 2 additions & 2 deletions release/Makefile.vm
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ cw-${_CW:tl}-${_FS}-${_FMT}: ${QEMUTGT}
QEMUSTATIC=${QEMUSTATIC} \
${.CURDIR}/scripts/mk-vmimage.sh \
-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} -F ${_FS} \
-i ${.OBJDIR}/${_CW:tl}.${_FS}.${_FMT}.img -s ${VMSIZE} -f ${_FMT} \
-i ${.OBJDIR}/${_CW:tl}.${_FS}.${_FMT}.img -K -s ${VMSIZE} -f ${_FMT} \
-S ${WORLDDIR} -o ${.OBJDIR}/${${_CW:tu}${_FS:tu}${_FMT:tu}IMAGE} -c ${${_CW:tu}CONF}
touch ${.TARGET}
. endfor
Expand Down Expand Up @@ -172,7 +172,7 @@ vm-image: ${QEMUTGT}
${.CURDIR}/scripts/mk-vmimage.sh \
-C ${.CURDIR}/tools/vmimage.subr \
-d ${.OBJDIR}/${.TARGET}-${FORMAT}-${FS} -F ${FS} \
-i ${.OBJDIR}/${FORMAT}.${FS}.img -s ${VMSIZE} -f ${FORMAT} \
-i ${.OBJDIR}/${FORMAT}.${FS}.img -K -s ${VMSIZE} -f ${FORMAT} \
-S ${WORLDDIR} -o ${.OBJDIR}/${VMBASE}.${FS}.${FORMAT}
. endfor
. endfor
Expand Down
4 changes: 3 additions & 1 deletion release/release.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ PORTBRANCH="main"
#TARGET="amd64"
#TARGET_ARCH="amd64"
#KERNEL="GENERIC"
## Multiple kernels may be set.
## Multiple kernels may be set. Kernels after the first will be installed to
## an alternate location. In this example, they'll be installed to /boot/kernel
## and /boot/kernel.XENHVM .
#KERNEL="GENERIC XENHVM"

## Set to specify a custom make.conf and/or src.conf
Expand Down
1 change: 1 addition & 0 deletions release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ env_check() {
RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} \
KERNCONF=\"${KERNEL}\" ${ARCH_FLAGS} ${CONF_FILES}"
RELEASE_RMAKEFLAGS="${ARCH_FLAGS} ${RELEASE_FLAGS} \
INSTALLEXTRAKERNELS=\"yes\" \
KERNCONF=\"${KERNEL}\" ${CONF_FILES} ${SRCPORTS} \
WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES} \
WITH_CLOUDWARE=${WITH_CLOUDWARE} WITH_OCIIMAGES=${WITH_OCIIMAGES} \
Expand Down
6 changes: 5 additions & 1 deletion release/scripts/mk-vmimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ usage() {
main() {
local arg
VMCONFIG="/dev/null"
while getopts "C:c:d:F:f:i:o:s:S:" arg; do
INSTALLEXTRAKERNELS="no"
while getopts "C:c:d:F:f:i:Ko:s:S:" arg; do
case "${arg}" in
C)
VMBUILDCONF="${OPTARG}"
Expand All @@ -59,6 +60,9 @@ main() {
i)
VMBASE="${OPTARG}"
;;
K)
INSTALLEXTRAKERNELS="yes"
;;
o)
VMIMAGE="${OPTARG}"
;;
Expand Down
1 change: 1 addition & 0 deletions release/tools/vmimage.subr
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ vm_install_base() {

cd ${WORLDDIR} && \
make DESTDIR=${DESTDIR} ${INSTALLOPTS} \
INSTALLEXTRAKERNELS=${INSTALLEXTRAKERNELS} \
installworld installkernel distribution || \
err "\n\nCannot install the base system to ${DESTDIR}."

Expand Down