From 209d72cab9e844091ec28125910a8b8acb4235a5 Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Sun, 9 Oct 2011 21:17:23 -0500 Subject: [PATCH] script/makeworld: support NO_KERNEL mode for jail image builds --- script/makeworld | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/script/makeworld b/script/makeworld index 7d89188..9ce91d1 100755 --- a/script/makeworld +++ b/script/makeworld @@ -146,14 +146,22 @@ then fi SRCS="$(realpath "${SRCS}")" -# If kernel config matching CONF does not exist, assume GENERIC -if [ -e "${world}/config/${CONF}" ] +# If NO_KERNEL exists, don't bother building one (jails) +if [ -e "${world}/config/NO_KERNEL" ] then - KERNCONFDIR=/usr/obj/conf - KERNCONF="${CONF}" -else + NO_KERNEL=yes KERNCONFDIR= - KERNCONF=GENERIC + KERNCONF= +else + # If kernel config matching CONF does not exist, assume GENERIC + if [ -e "${world}/config/${CONF}" ] + then + KERNCONFDIR=/usr/obj/conf + KERNCONF="${CONF}" + else + KERNCONFDIR= + KERNCONF=GENERIC + fi fi # Environment for chroot build @@ -162,6 +170,7 @@ USER=root HOME=/root PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin SHELL=/bin/sh +DESTDIR=/mnt " date="$(date +%Y%m%d)" @@ -193,19 +202,24 @@ prepare meh "Seed: ${seed}" meh "Srctree: ${SRCS}" meh "Config: ${ARCH}/${CONF}" -[ "${KERNCONF}" != "${CONF}" ] && meh "Kernel config: ${KERNCONF}" +[ "${NO_KERNEL}" ] && meh "Kernel config: NO_KERNEL (will not build kernel)" +[ "${KERNCONF}" -a "${KERNCONF}" != "${CONF}" ] && meh "Kernel config: ${KERNCONF}" meh "Builddir: ${build}" meh "make ${MAKEOPTS}" meh "DESTDIR=${world}/root" for step in ${sequence} do + [ "${NO_KERNEL}" -a "${step%%kernel}" != "${step}" ] && { + meh "Step: ${step} -> Skipped: NO_KERNEL" + continue + } build_log="${world}/log/${date}-${step}.log" meh "==> Step: ${step} -> ${build_log}" [ "${BUILD_VERBOSE}" ] || exec 3>&1 > /dev/null script "${build_log}" env -i ${env} chroot "${build}" sh -c \ - "cd /usr/src; time make ${MAKEOPTS} ${step} TARGET=${ARCH} " \ - "${KERNCONFDIR:+KERNCONFDIR=${KERNCONFDIR}} KERNCONF=${KERNCONF} DESTDIR=/mnt" + "cd /usr/src; time make ${MAKEOPTS} ${step} TARGET=${ARCH} DESTDIR=/mnt " \ + "${KERNCONFDIR:+KERNCONFDIR=${KERNCONFDIR}} ${KERNCONF:+KERNCONF=${KERNCONF}}" res=$? [ "${BUILD_VERBOSE}" ] || exec 1>&3 [ "${res}" -gt 0 ] && wtf "chroot-cmd ${step} failed; check log" -- 2.42.0