build/kernel: make kernel default/debug options external files

Easier to maintain.  While here add KASASN to debug for a test drive.
This commit is contained in:
Franco Fichtner 2025-03-06 08:29:27 +01:00
parent f77fd1b8af
commit 54d92acbc8
3 changed files with 13 additions and 4 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2014-2024 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2014-2025 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -44,16 +44,17 @@ git_version ${SRCDIR}
KERNEL_DEBUG_SET=${SETSDIR}/kernel-dbg-${PRODUCT_VERSION}-${PRODUCT_ARCH}${PRODUCT_DEVICE+"-${PRODUCT_DEVICE}"}.txz
KERNEL_RELEASE_SET=${SETSDIR}/kernel-${PRODUCT_VERSION}-${PRODUCT_ARCH}${PRODUCT_DEVICE+"-${PRODUCT_DEVICE}"}.txz
KERNDEBUG="nomakeoptions DEBUG"
KERNDEBUG=default
SRCDEBUG="WITHOUT_DEBUG_FILES=yes"
if [ -n "${PRODUCT_DEBUG}" ]; then
KERNDEBUG="makeoptions DEBUG=-g\noptions INVARIANTS\noptions INVARIANT_SUPPORT\noptions KASSERT_PANIC_OPTIONAL"
KERNDEBUG=debug
SRCDEBUG=
fi
if [ -f "${CONFIGDIR}/${PRODUCT_KERNEL}" ]; then
sed -e "s/%%DEBUG%%/${KERNDEBUG}/" "${CONFIGDIR}/${PRODUCT_KERNEL}" > \
sed -e "/%%DEBUG%%/r ${CONFIGDIR}/kernel.${KERNDEBUG}" \
"${CONFIGDIR}/${PRODUCT_KERNEL}" | grep -v %%DEBUG%% > \
"${SRCDIR}/sys/${PRODUCT_TARGET}/conf/${PRODUCT_KERNEL}"
else
echo ">>> Attempting to use external kernel: ${PRODUCT_KERNEL}"

6
config/25.1/kernel.debug Normal file
View file

@ -0,0 +1,6 @@
# included from kernel.debug
makeoptions DEBUG=-g
options INVARIANTS
options INVARIANT_SUPPORT
options KASSERT_PANIC_OPTIONAL
options KASAN

View file

@ -0,0 +1,2 @@
# included from kernel.default
nomakeoptions DEBUG