diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
index c2021002d4..621afb04de 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -50,6 +50,13 @@ PACKAGECONFIG[tarball] = ",,,bzip2"
 # python3, make, ...).
 SKIP_FILEDEPS:${PN} = "${@'1' if bb.utils.contains('PACKAGECONFIG', 'full', True, False, d) and not bb.utils.contains_any('PACKAGECONFIG', 'build tarball', True, False, d) else '0'}"
 
+# Without a level, kernel-devsrc would only be a /usr/src/kernel link to an
+# empty tree.
+python () {
+    if not bb.utils.contains_any('PACKAGECONFIG', 'build source full tarball', True, False, d):
+        raise bb.parse.SkipRecipe("PACKAGECONFIG needs at least one of build, source, full or tarball")
+}
+
 # The curated part of the 'source' level, copied in full along with
 # arch/${ARCH}. The rest (drivers, sound, samples, ...) is not curated: the
 # files the kernel build read are discovered from the manifest the kernel
