From 9a03677d7f287e956fd7037d4b5fec00831d70ac Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 3 Jan 2025 13:55:41 -0700 Subject: [PATCH] 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}."