From fc7aca3eae464526512dfdf4acc7a83b37d7b985 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 18 Aug 2004 16:37:15 +0000 Subject: [PATCH] Make the buildkernel and nativekernel targets completely wipe and regenerate the kernel object hierarchy. Add a quickkernel target which does not wipe the object hieracrhy and which skips the make depend step. quickkernel can be run on kernels previously built with buildkernel or nativekernel. This brings the operation of our kernel building targets in-line with the operation of our world building targets. --- Makefile | 24 ++++++++----- Makefile.inc1 | 98 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 77 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index d493d1b618..864b2b5c16 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # # $FreeBSD: src/Makefile,v 1.234.2.19 2003/04/16 09:59:40 ru Exp $ -# $DragonFly: src/Makefile,v 1.7 2004/04/24 04:38:49 drhodus Exp $ +# $DragonFly: src/Makefile,v 1.8 2004/08/18 16:37:15 dillon Exp $ # # The user-driven targets are: # @@ -11,8 +11,14 @@ # crossworld - Just do the bootstrap, build, and cross-build steps # installworld - Install everything built by "buildworld". # world - buildworld + installworld. -# buildkernel - Rebuild the kernel and the kernel-modules. -# nativekernel - Rebuild the kernel using native tools via config. +# buildkernel - Rebuild the kernel and the kernel-modules from scratch +# using build/bootstrap/cross tools from the last +# buildworld. +# nativekernel - Rebuild the kernel and the kernel-modules from scratch +# using native tools. +# quickkernel - rebuild the kernel quickly (build or native), skip +# the make depend step and do not clean out the obj +# modules. # installkernel - Install the kernel and the kernel-modules. # reinstallkernel - Reinstall the kernel and the kernel-modules. # kernel - buildkernel + installkernel. @@ -63,21 +69,21 @@ # Define the user-driven targets. These are listed here in alphabetical # order, but that's not important. # -TGTS= all all-man buildkernel buildworld crossworld quickworld \ - realquickworld checkdpadd clean \ +TGTS= all all-man buildkernel quickkernel nativekernel \ + buildworld crossworld quickworld realquickworld checkdpadd clean \ cleandepend cleandir depend distribute distributeworld everything \ hierarchy install installcheck installkernel \ reinstallkernel installmost installworld libraries lint maninstall \ - mk most nativekernel obj objlink regress rerelease tags update + mk most obj objlink regress rerelease tags update BITGTS= files includes BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} .ORDER: buildworld installworld .ORDER: buildworld distributeworld -.ORDER: buildworld buildkernel -.ORDER: buildkernel installkernel -.ORDER: buildkernel reinstallkernel +.ORDER: buildworld buildkernel nativekernel quickkernel +.ORDER: buildkernel nativekernel quickkernel installkernel +.ORDER: buildkernel nativekernel quickkernel reinstallkernel PATH= /sbin:/bin:/usr/sbin:/usr/bin MAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1 diff --git a/Makefile.inc1 b/Makefile.inc1 index e83512a2b8..d2067b6e0e 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1,6 +1,6 @@ # # $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $ -# $DragonFly: src/Makefile.inc1,v 1.37 2004/08/08 03:21:59 dillon Exp $ +# $DragonFly: src/Makefile.inc1,v 1.38 2004/08/18 16:37:15 dillon Exp $ # # Make command line options: # -DMAKE_KERBEROS5 to build Kerberos5 @@ -457,7 +457,7 @@ redistribute: cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute # -# buildkernel and installkernel +# buildkernel, nativekernel, quickkernel, and installkernel # # Which kernels to build and/or install is specified by setting # KERNCONF. If not defined a GENERIC kernel is built/installed. @@ -499,7 +499,7 @@ INSTALLKERNEL= ${_kernel} # # Builds all kernels defined by BUILDKERNELS. # -check_buildworld_tools: +bk_tools: @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \ echo "You must buildworld before buildkernel. If you wish"; \ echo "to build a kernel using native tools, config it manually"; \ @@ -507,11 +507,13 @@ check_buildworld_tools: exit 1; \ fi -buildkernel: check_buildworld_tools +bk_build_list: .if empty(BUILDKERNELS) @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})." @false .endif + +bk_kernwarn: .if defined(KERNWARN) @echo "--------------------------------------------------------------" @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" @@ -519,14 +521,24 @@ buildkernel: check_buildworld_tools @sleep 3 .endif @echo + +# The buildkernel target rebuilds the specified kernels from scratch +# using the crossbuild tools generated by the last buildworld. It is +# the safest (but also the most time consuming) way to build a new kernel. +# +buildkernel: bk_tools bk_build_list bk_kernwarn .for _kernel in ${BUILDKERNELS} @echo "--------------------------------------------------------------" @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" @echo "--------------------------------------------------------------" @echo "===> ${_kernel}" +.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) + rm -rf ${KRNLOBJDIR}/${_kernel} +.else @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \ - echo "REMOVING OLD NATIVEKERNEL BUILD"; \ + echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \ rm -rf ${KRNLOBJDIR}/${_kernel}; fi +.endif mkdir -p ${KRNLOBJDIR} .if !defined(NO_KERNELCONFIG) cd ${KRNLCONFDIR}; \ @@ -535,14 +547,6 @@ buildkernel: check_buildworld_tools ${KERNCONFDIR}/${_kernel} .endif touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run -.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) - cd ${KRNLOBJDIR}/${_kernel}; \ - ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} -DNO_MODULES clean -.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules) - cd ${KRNLOBJDIR}/${_kernel}; \ - ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} cleandir -.endif -.endif cd ${KRNLOBJDIR}/${_kernel}; \ MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \ ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile @@ -557,29 +561,24 @@ buildkernel: check_buildworld_tools @echo "--------------------------------------------------------------" .endfor -# The nativekernel target is for when you are impatient and want to -# build a kernel without building the world first. +# The nativekernel target rebuilds the specified kernels from scratch +# using the systems standard compiler rather then using the crossbuild +# tools generated by the last buildworld. This is fairly safe if your +# system is reasonable up-to-date. # -nativekernel: -.if empty(BUILDKERNELS) - @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})." - @false -.endif -.if defined(KERNWARN) - @echo "--------------------------------------------------------------" - @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" - @echo "--------------------------------------------------------------" - @sleep 3 -.endif - @echo +nativekernel: bk_build_list bk_kernwarn .for _kernel in ${BUILDKERNELS} @echo "--------------------------------------------------------------" @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" @echo "--------------------------------------------------------------" @echo "===> ${_kernel}" +.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) + rm -rf ${KRNLOBJDIR}/${_kernel} +.else @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \ - echo "REMOVING OLD BUILDKERNEL BUILD"; \ + echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \ rm -rf ${KRNLOBJDIR}/${_kernel}; fi +.endif mkdir -p ${KRNLOBJDIR} .if !defined(NO_KERNELCONFIG) cd ${KRNLCONFDIR}; \ @@ -587,14 +586,6 @@ nativekernel: ${KERNCONFDIR}/${_kernel} .endif touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run -.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) - cd ${KRNLOBJDIR}/${_kernel}; \ - ${MAKE} KERNEL=${INSTKERNNAME} -DNO_MODULES clean -.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules) - cd ${KRNLOBJDIR}/${_kernel}; \ - ${MAKE} KERNEL=${INSTKERNNAME} cleandir -.endif -.endif cd ${KRNLOBJDIR}/${_kernel}; \ MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \ ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile @@ -609,7 +600,42 @@ nativekernel: @echo "--------------------------------------------------------------" .endfor +# The quickkernel target rebuilds the specified kernels as quickly +# as possible. It will use the native tools or the buildworld cross tools +# based on whether the kernel was originally generated via buildkernel or +# nativekernel. Config is rerun but the object hierarchy is not rebuilt, +# nor is the make depend step run. # +quickkernel: bk_tools bk_build_list bk_kernwarn +.for _kernel in ${BUILDKERNELS} + @echo "--------------------------------------------------------------" + @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" + @echo "--------------------------------------------------------------" + @echo "===> ${_kernel}" +.if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run) +.if !defined(NO_KERNELCONFIG) + cd ${KRNLCONFDIR}; \ + PATH=${STRICTTMPPATH} \ + config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ + ${KERNCONFDIR}/${_kernel} +.endif + cd ${KRNLOBJDIR}/${_kernel}; \ + ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all +.else +.if !defined(NO_KERNELCONFIG) + cd ${KRNLCONFDIR}; \ + config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ + ${KERNCONFDIR}/${_kernel} +.endif + cd ${KRNLOBJDIR}/${_kernel}; \ + ${MAKE} KERNEL=${INSTKERNNAME} all +.endif + @echo "--------------------------------------------------------------" + @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" + @echo "--------------------------------------------------------------" +.endfor + + # installkernel # # Install the kernel defined by INSTALLKERNEL -- 2.41.0