From ebc8be8e1436eb1f879197e5d65a3be05c893033 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Thu, 2 Jan 2025 11:53:19 -0700 Subject: [PATCH 1/2] Rename NO_INSTALLEXTRAKERNELS to INSTALLEXTRAKERNELS To eliminate the double negative. MFC after: Never Sponsored by: ConnectWise --- Makefile.inc1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 5c3d190e4c3ede..a9fac9087683a9 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -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 # @@ -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)" @@ -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 @@ -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' \ @@ -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' . | \ @@ -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 @@ -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" From 9a03677d7f287e956fd7037d4b5fec00831d70ac Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 3 Jan 2025 13:55:41 -0700 Subject: [PATCH 2/2] release: install multiple kernels if specified If release.conf sets KERNEL to a space-separate list, release.sh will now install all of them into the release media, building separate .txz archives for each. Sponsored by: ConnectWise --- release/Makefile | 18 ++++++++++++++---- release/Makefile.vm | 4 ++-- release/release.conf.sample | 4 +++- release/release.sh | 1 + release/scripts/mk-vmimage.sh | 6 +++++- release/tools/vmimage.subr | 1 + 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/release/Makefile b/release/Makefile index a874aece8cdf33..09f30c7b4af698 100644 --- a/release/Makefile +++ b/release/Makefile @@ -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 /mkisoimages.sh # NOPKG: if set, do not distribute third-party packages # NOPORTS: if set, do not distribute ports tree @@ -36,6 +37,7 @@ # TARGET/TARGET_ARCH: architecture of built release # +INSTALLEXTRAKERNELS?= no WORLDDIR?= ${.CURDIR}/.. PORTSDIR?= /usr/ports @@ -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 \ @@ -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@} \ @@ -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 diff --git a/release/Makefile.vm b/release/Makefile.vm index 5aa506ff678763..211d4a3216acd5 100644 --- a/release/Makefile.vm +++ b/release/Makefile.vm @@ -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 @@ -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 diff --git a/release/release.conf.sample b/release/release.conf.sample index e583e49828d440..c7b64f92109a84 100644 --- a/release/release.conf.sample +++ b/release/release.conf.sample @@ -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 diff --git a/release/release.sh b/release/release.sh index d6752e0169941f..d3a422ca32c757 100755 --- a/release/release.sh +++ b/release/release.sh @@ -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} \ diff --git a/release/scripts/mk-vmimage.sh b/release/scripts/mk-vmimage.sh index dfd91f43140d95..3f15f711aa4a16 100755 --- a/release/scripts/mk-vmimage.sh +++ b/release/scripts/mk-vmimage.sh @@ -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}" @@ -59,6 +60,9 @@ main() { i) VMBASE="${OPTARG}" ;; + K) + INSTALLEXTRAKERNELS="yes" + ;; o) VMIMAGE="${OPTARG}" ;; diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr index 223ef928e83c92..91f9a873ef4953 100644 --- a/release/tools/vmimage.subr +++ b/release/tools/vmimage.subr @@ -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}."