@@ -972,3 +972,12 @@ we introduce the variables ``MMAPTOPT_NOEXPKEYSIGN`` and ``DISTRO_MM_OPTS``.
While the former provides an argument to disable the key expiry checking, the
latter allows users to inject custom options into ``mmdebstrap``. For details,
see ``man mmdebstrap``. Use with care!
+
+### Provide additional fragments via KERNEL_CONFIG_FRAGMENTS
+
+Custom kernel builds can now inject config fragments into the build which were
+not provided via individual SRC_URI entries. If a kernel source tree contains a
+fragment, this can be specified via adding `${S}/path/to/fragment.cfg` to
+`KERNEL_CONFIG_FRAGMENTS`. If a fragment was checked out into ${WORKDIR} as
+part of a repository, a tarball, or some other directory structure, just
+specify it relative to ${WORKDIR} in `KERNEL_CONFIG_FRAGMENTS`.
@@ -83,7 +83,7 @@ TEMPLATE_VARS += " \
KERNEL_LIBC_DEV_ARCH \
LINUX_VERSION_EXTENSION \
KERNEL_NAME_PROVIDED \
- KERNEL_CONFIG_FRAGMENTS \
+ KCONFIG_FRAGMENTS \
KCFLAGS \
KAFLAGS \
DISTRIBUTOR \
@@ -214,8 +214,10 @@ KERNEL_ARCH ??= "${@get_kernel_arch(d)}"
# set KERNEL_FILE without depending on package arch used in bitbake.conf
KERNEL_FILE:forcevariable = "${@ 'vmlinux' if d.getVar('KERNEL_ARCH') in ['mipsel', 'riscv', 'arm64'] else 'vmlinuz'}"
+KERNEL_CONFIG_FRAGMENTS ?= ""
+
def config_fragments(d):
- fragments = []
+ fragments = d.getVar('KERNEL_CONFIG_FRAGMENTS').split()
sources = d.getVar("SRC_URI").split()
for s in sources:
_, _, local, _, _, parm = bb.fetch.decodeurl(s)
@@ -284,17 +286,21 @@ def get_kernel_config_target(d):
return config_target
-def get_kernel_config_fragments(d):
- src_frags = " ".join(config_fragments(d))
- out_frags = " ".join(map(lambda frag: 'debian/fragments/' + frag, config_fragments(d)))
-
- linux_version_extension = d.getVar('LINUX_VERSION_EXTENSION')
- if linux_version_extension:
- out_frags += " debian/isar/version.cfg"
+KERNEL_CONFIG_FRAGMENTS:append = " \
+ ${@'${S}/debian/isar/version.cfg' if d.getVar('LINUX_VERSION_EXTENSION') else ''}"
- return out_frags
+def get_kernel_config_fragments(d):
+ out_frags = ""
+ S = d.getVar('S') + '/'
+ for frag in config_fragments(d):
+ if frag.startswith(S):
+ out_frags += ' ' + frag[len(S):]
+ else:
+ out_frags += ' debian/fragments/' + frag
+ return out_frags.strip()
-KERNEL_CONFIG_FRAGMENTS = "${@get_kernel_config_fragments(d)}"
+# internal list of config fragments
+KCONFIG_FRAGMENTS = "${@get_kernel_config_fragments(d)}"
dpkg_configure_kernel() {
grep -q "KERNEL_CONFIG_TARGET=" ${S}/debian/isar/configure ||
@@ -313,9 +319,12 @@ EOF
src_frags="${@ " ".join(config_fragments(d)) }"
rm -rf ${S}/debian/fragments
for frag in ${src_frags}; do
- basedir=$(dirname ${frag})
- mkdir -p ${S}/debian/fragments/${basedir}
- cp ${WORKDIR}/${frag} ${S}/debian/fragments/${basedir}/
+ # skip frag if it starts with ${S}, thus is part of the sources
+ if [ "${frag#${S}}" = "$frag" ]; then
+ basedir=$(dirname ${frag})
+ mkdir -p ${S}/debian/fragments/${basedir}
+ cp ${WORKDIR}/${frag} ${S}/debian/fragments/${basedir}/
+ fi
done
}
@@ -26,7 +26,7 @@ do_configure() {
# Process kernel config target and fragments
${MAKE} O=${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET}
./scripts/kconfig/merge_config.sh -O ${KERNEL_BUILD_DIR}/ \
- ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS}
+ ${KERNEL_BUILD_DIR}/.config ${KCONFIG_FRAGMENTS}
fi
# Stop tracing