git: c170a96dbeeb - main - universe: emit warning instead of error for bad/missing KERNCONF

From: Siva Mahadevan <siva_at_FreeBSD.org>
Date: Thu, 21 May 2026 14:22:57 UTC
The branch main has been updated by siva:

URL: https://cgit.FreeBSD.org/src/commit/?id=c170a96dbeeb3b0d36456d21beee6c551957a456

commit c170a96dbeeb3b0d36456d21beee6c551957a456
Author:     Siva Mahadevan <siva@FreeBSD.org>
AuthorDate: 2026-05-21 14:08:32 +0000
Commit:     Siva Mahadevan <siva@FreeBSD.org>
CommitDate: 2026-05-21 14:17:03 +0000

    universe: emit warning instead of error for bad/missing KERNCONF
    
    When doing a large `make universe` build with multiple KERNCONFS,
    it should not be an error when a particular target has a missing
    KERNCONF.
    
    In this example,
    
    ```
    $ make universe TARGETS='arm64 riscv' KERNCONFS='QEMU VIRT'
    ```
    
    Currently, arm64 does not have a QEMU conf, and riscv
    does not have a VIRT conf. However, this command should still
    succeed instead of failing with the following message:
    
    ```
    make[2]: /usr/src/Makefile:767: Target architecture for riscv/conf/VIRT unknown.  config(8) likely too old.
            in .for loop from /usr/src/Makefile:761 with kernel = VIRT
            in make[2] in directory "/usr/src"
    
    make[2]: stopped making "universe_kernels" in /usr/src
    ```
    
    Since the opposite is true, we should build whatever confs are available
    from the requested list of KERNCONFS, while making sure to still
    emit warnings along the way.
    
    Reviewed by:    imp
    Approved by:    lwhsu (mentor), emaste (mentor)
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D55571
---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index e7a565cff05e..00c454b38147 100644
--- a/Makefile
+++ b/Makefile
@@ -758,12 +758,16 @@ KERNCONFS!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
 		${_THINNER}
 universe_kernconfs: universe_kernels_prologue .PHONY
 .for kernel in ${KERNCONFS}
+.if !exists(${KERNSRCDIR}/${TARGET}/conf/${kernel})
+.warning ${TARGET}/conf/${kernel} missing; skipping.
+.else
 TARGET_ARCH_${kernel}!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
 	env PATH=${HOST_OBJTOP}/tmp/legacy/bin:${PATH:Q} \
 	config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
 	grep -v WARNING: | cut -f 2
 .if empty(TARGET_ARCH_${kernel})
-.error Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old.
+.error Target architecture for ${TARGET}/conf/${kernel} cannot be determined, kernconf file may be invalid!
+.endif
 .endif
 universe_kernconfs_${TARGET_ARCH_${kernel}}: universe_kernconf_${TARGET}_${kernel}
 universe_kernconf_${TARGET}_${kernel}: .MAKE