[v3,1/4] linux-custom: prefix profile names according to BuildProfileSpec

Message ID 20251106141122.2887558-2-felix.moessbauer@siemens.com
State Under Review
Headers show
Series propagate distro-specific dependencies of arch all packages | expand

Commit Message

MOESSBAUER, Felix Nov. 6, 2025, 2:11 p.m. UTC
We introduce custom profiles to control which packages are build from a
custom kernel source package. To avoid collisions with upstream profile
names, we have to use BuildProfileSpec compatible profile names [1].

[1] https://wiki.debian.org/BuildProfileSpec#Registered_profile_names

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 .../linux/files/debian/control.tmpl             | 16 ++++++++--------
 .../linux/files/debian/isar/install.tmpl        |  2 +-
 meta/recipes-kernel/linux/linux-custom.inc      | 17 +++++++++--------
 3 files changed, 18 insertions(+), 17 deletions(-)

Comments

Jan Kiszka Nov. 6, 2025, 4:55 p.m. UTC | #1
On 06.11.25 15:11, Felix Moessbauer wrote:
> We introduce custom profiles to control which packages are build from a
> custom kernel source package. To avoid collisions with upstream profile
> names, we have to use BuildProfileSpec compatible profile names [1].
> 
> [1] https://wiki.debian.org/BuildProfileSpec#Registered_profile_names
> 
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  .../linux/files/debian/control.tmpl             | 16 ++++++++--------
>  .../linux/files/debian/isar/install.tmpl        |  2 +-
>  meta/recipes-kernel/linux/linux-custom.inc      | 17 +++++++++--------
>  3 files changed, 18 insertions(+), 17 deletions(-)
> 
> diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/recipes-kernel/linux/files/debian/control.tmpl
> index 78e95105..01b1a63f 100644
> --- a/meta/recipes-kernel/linux/files/debian/control.tmpl
> +++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
> @@ -1,4 +1,4 @@
> -Source: linux-${KERNEL_NAME_PROVIDED}
> +Source: ${BPN}

Is this change related? Does it actually change anything in practice? If
so, the commit message should elaborate more.

>  Section: kernel
>  Priority: optional
>  Maintainer: ${MAINTAINER}
> @@ -7,7 +7,7 @@ Homepage: http://www.kernel.org/
>  Rules-Requires-Root: no
>  
>  Package: linux-image-${KERNEL_NAME_PROVIDED}
> -Build-Profiles: <kernel>
> +Build-Profiles: <pkg.${BPN}.kernel>
>  Architecture: any
>  Depends: ${KERNEL_DEBIAN_DEPENDS}
>  Description: ${KERNEL_NAME_PROVIDED} Linux kernel, version @KR@
> @@ -15,7 +15,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel, version @KR@
>   files, version: @KR@.
>  
>  Package: linux-headers-${KERNEL_NAME_PROVIDED}
> -Build-Profiles: <kernel>
> +Build-Profiles: <pkg.${BPN}.kernel>
>  Architecture: any
>  Depends: ${KERNEL_HEADERS_DEBIAN_DEPENDS}, ${perl:Depends}, ${shlibs:Depends}
>  Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
> @@ -24,7 +24,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
>   This is useful for people who need to build external modules
>  
>  Package: linux-libc-dev
> -Build-Profiles: <!nolibcdev kernel>
> +Build-Profiles: <!pkg.${BPN}.nolibcdev pkg.${BPN}.kernel>
>  Section: devel
>  Provides: linux-kernel-headers
>  Architecture: ${KERNEL_LIBC_DEV_ARCH}
> @@ -33,7 +33,7 @@ Description: Linux support headers for userspace development
>   are used by the installed headers for GNU glibc and other system libraries.
>  
>  Package: linux-libc-dev-${DISTRO_ARCH}-cross
> -Build-Profiles: <!nolibcdev cross !kbuild>
> +Build-Profiles: <!pkg.${BPN}.nolibcdev cross !pkg.${BPN}.kbuild>
>  Section: devel
>  Provides: linux-kernel-headers-${DISTRO_ARCH}-cross
>  Architecture: all
> @@ -45,7 +45,7 @@ Description: Linux Kernel Headers for development (for cross-compiling)
>   your kernel. Use linux-headers-* packages for that.
>  
>  Package: linux-image-${KERNEL_NAME_PROVIDED}-dbg
> -Build-Profiles: <kernel>
> +Build-Profiles: <pkg.${BPN}.kernel>
>  Section: debug
>  Architecture: any
>  Description: Linux kernel debugging symbols for @KR@
> @@ -53,7 +53,7 @@ Description: Linux kernel debugging symbols for @KR@
>   all the necessary debug symbols for the kernel and its modules.
>  
>  Package: linux-kbuild-${KERNEL_NAME_PROVIDED}
> -Build-Profiles: <kbuild !cross>
> +Build-Profiles: <pkg.${BPN}.kbuild !cross>
>  Architecture: any
>  Depends: ${perl:Depends}, ${shlibs:Depends}
>  Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
> @@ -61,7 +61,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
>   This is useful for people who need to build external modules
>  
>  Package: linux-kbuild-${KERNEL_NAME_PROVIDED}-${DISTRO_ARCH}-cross
> -Build-Profiles: <kbuild cross>
> +Build-Profiles: <pkg.${BPN}.kbuild cross>
>  Architecture: any
>  Multi-Arch: foreign
>  Depends: ${perl:Depends}, ${shlibs:Depends}
> diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> index fe0bd810..a1b00d39 100644
> --- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> +++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> @@ -168,7 +168,7 @@ headers_check() {
>  libc_headers() {
>      mkdir -p ${deb_libc_hdr_dir}
>      arches="${DISTRO_ARCH}"
> -    if echo "${DEB_BUILD_PROFILES}" | grep -q "libcdev-arch-all"; then
> +    if echo "${DEB_BUILD_PROFILES}" | grep -q "pkg.${BPN}.libcdev-arch-all"; then
>          arches="amd64 armhf arm64 i386 mipsel riscv64"
>      fi
>      for distro_arch in ${arches}; do
> diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
> index f2892921..1f46bb31 100644
> --- a/meta/recipes-kernel/linux/linux-custom.inc
> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> @@ -28,7 +28,7 @@ KBUILD_DEPENDS ?= "build-essential:native, \
>                     flex, \
>                     git, \
>                     kmod, \
> -                   linux-image-${KERNEL_NAME_PROVIDED}:${DISTRO_ARCH} <kbuild !kernel>, \
> +                   linux-image-${KERNEL_NAME_PROVIDED}:${DISTRO_ARCH} <pkg.${BPN}.kbuild !pkg.${BPN}.kernel>, \
>                     rsync,"
>  
>  KERNEL_DEBIAN_DEPENDS ?= "initramfs-tools | linux-initramfs-tool, \
> @@ -73,6 +73,7 @@ TEMPLATE_FILES += "                  \
>  "
>  
>  TEMPLATE_VARS += "                \
> +    BPN                           \
>      KBUILD_DEPENDS                \
>      KERNEL_ARCH                   \
>      KERNEL_DEBIAN_DEPENDS         \
> @@ -114,17 +115,17 @@ python() {
>  }
>  
>  # Default profiles and provides
> -BUILD_PROFILES = "kernel kbuild"
> +BUILD_PROFILES = "pkg.${BPN}.kernel pkg.${BPN}.kbuild"
>  
>  # We only offer the -kbuildtarget variant when actually cross compiling
>  BBCLASSEXTEND:append:cross-profile = " kbuildtarget"
>  
>  # When cross-profile is active:
>  # build only kernel (including config) with the default variant of the recipe
> -BUILD_PROFILES:cross-profile = "kernel"
> +BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel"
>  
>  # -native: kbuild package for host
> -BUILD_PROFILES:class-native = "kbuild"
> +BUILD_PROFILES:class-native = "pkg.${BPN}.kbuild"
>  RECIPE_PROVIDES:class-native = " \
>      linux-headers-${KERNEL_NAME_PROVIDED} \
>      linux-kbuild-${KERNEL_NAME_PROVIDED}"
> @@ -135,7 +136,7 @@ RECIPE_PROVIDES:class-native = " \
>  DEPENDS:class-native += "${BPN}-pseudo"
>  
>  # -kbuildtarget: kbuild package for target, enforcing non-cross-build
> -BUILD_PROFILES:class-kbuildtarget = "kbuild"
> +BUILD_PROFILES:class-kbuildtarget = "pkg.${BPN}.kbuild"
>  RECIPE_PROVIDES:class-kbuildtarget = " \
>      linux-headers-${KERNEL_NAME_PROVIDED} \
>      linux-kbuild-${KERNEL_NAME_PROVIDED}"
> @@ -214,12 +215,12 @@ def config_fragments(d):
>  def get_additional_build_profiles(d):
>      profiles = d.getVar('BASE_DISTRO')
>      if not bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_DEPLOY')):
> -        profiles += ' nolibcdev'
> +        profiles += ' pkg.{}.nolibcdev'.format(d.getVar('BPN'))
>      elif bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_ARCH_ALL')):
> -        profiles += ' libcdev-arch-all'
> +        profiles += ' pkg.{}.libcdev-arch-all'.format(d.getVar('BPN'))
>      return profiles
>  
> -KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'libcdev-arch-all', 'all\nMulti-Arch: foreign', 'any', d) }"
> +KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'pkg.{}.libcdev-arch-all'.format(d.getVar('BPN')), 'all\nMulti-Arch: foreign', 'any', d) }"
>  DEB_BUILD_PROFILES += "${@get_additional_build_profiles(d)}"
>  
>  do_prepare_build:prepend() {

Jan
MOESSBAUER, Felix Nov. 7, 2025, 8:19 a.m. UTC | #2
On Thu, 2025-11-06 at 17:55 +0100, Jan Kiszka wrote:
> On 06.11.25 15:11, Felix Moessbauer wrote:
> > We introduce custom profiles to control which packages are build from a
> > custom kernel source package. To avoid collisions with upstream profile
> > names, we have to use BuildProfileSpec compatible profile names [1].
> > 
> > [1] https://wiki.debian.org/BuildProfileSpec#Registered_profile_names
> > 
> > Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> > ---
> >  .../linux/files/debian/control.tmpl             | 16 ++++++++--------
> >  .../linux/files/debian/isar/install.tmpl        |  2 +-
> >  meta/recipes-kernel/linux/linux-custom.inc      | 17 +++++++++--------
> >  3 files changed, 18 insertions(+), 17 deletions(-)
> > 
> > diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/recipes-kernel/linux/files/debian/control.tmpl
> > index 78e95105..01b1a63f 100644
> > --- a/meta/recipes-kernel/linux/files/debian/control.tmpl
> > +++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
> > @@ -1,4 +1,4 @@
> > -Source: linux-${KERNEL_NAME_PROVIDED}
> > +Source: ${BPN}
> 
> Is this change related? Does it actually change anything in practice? If
> so, the commit message should elaborate more.

In practice there is no change, as the BPN carries exactly the same
value as linux-${KERNEL_NAME_PROVIDED} (which is constructed from the
BPN). However, to keep things simple I want to use pkg.${BPN}.foo as
profile names instead of the longer (but identical) pkg.linux-
${KERNEL_NAME_PROVIDED}.foo.

To keep things consistent to the reader, I made this little change as
well. If a v4 will be needed, I'll add a clarification statement.

Felix

> 
> >  Section: kernel
> >  Priority: optional
> >  Maintainer: ${MAINTAINER}
> > @@ -7,7 +7,7 @@ Homepage: http://www.kernel.org/
> >  Rules-Requires-Root: no
> >  
> >  Package: linux-image-${KERNEL_NAME_PROVIDED}
> > -Build-Profiles: <kernel>
> > +Build-Profiles: <pkg.${BPN}.kernel>
> >  Architecture: any
> >  Depends: ${KERNEL_DEBIAN_DEPENDS}
> >  Description: ${KERNEL_NAME_PROVIDED} Linux kernel, version @KR@
> > @@ -15,7 +15,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel, version @KR@
> >   files, version: @KR@.
> >  
> >  Package: linux-headers-${KERNEL_NAME_PROVIDED}
> > -Build-Profiles: <kernel>
> > +Build-Profiles: <pkg.${BPN}.kernel>
> >  Architecture: any
> >  Depends: ${KERNEL_HEADERS_DEBIAN_DEPENDS}, ${perl:Depends}, ${shlibs:Depends}
> >  Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
> > @@ -24,7 +24,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
> >   This is useful for people who need to build external modules
> >  
> >  Package: linux-libc-dev
> > -Build-Profiles: <!nolibcdev kernel>
> > +Build-Profiles: <!pkg.${BPN}.nolibcdev pkg.${BPN}.kernel>
> >  Section: devel
> >  Provides: linux-kernel-headers
> >  Architecture: ${KERNEL_LIBC_DEV_ARCH}
> > @@ -33,7 +33,7 @@ Description: Linux support headers for userspace development
> >   are used by the installed headers for GNU glibc and other system libraries.
> >  
> >  Package: linux-libc-dev-${DISTRO_ARCH}-cross
> > -Build-Profiles: <!nolibcdev cross !kbuild>
> > +Build-Profiles: <!pkg.${BPN}.nolibcdev cross !pkg.${BPN}.kbuild>
> >  Section: devel
> >  Provides: linux-kernel-headers-${DISTRO_ARCH}-cross
> >  Architecture: all
> > @@ -45,7 +45,7 @@ Description: Linux Kernel Headers for development (for cross-compiling)
> >   your kernel. Use linux-headers-* packages for that.
> >  
> >  Package: linux-image-${KERNEL_NAME_PROVIDED}-dbg
> > -Build-Profiles: <kernel>
> > +Build-Profiles: <pkg.${BPN}.kernel>
> >  Section: debug
> >  Architecture: any
> >  Description: Linux kernel debugging symbols for @KR@
> > @@ -53,7 +53,7 @@ Description: Linux kernel debugging symbols for @KR@
> >   all the necessary debug symbols for the kernel and its modules.
> >  
> >  Package: linux-kbuild-${KERNEL_NAME_PROVIDED}
> > -Build-Profiles: <kbuild !cross>
> > +Build-Profiles: <pkg.${BPN}.kbuild !cross>
> >  Architecture: any
> >  Depends: ${perl:Depends}, ${shlibs:Depends}
> >  Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
> > @@ -61,7 +61,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
> >   This is useful for people who need to build external modules
> >  
> >  Package: linux-kbuild-${KERNEL_NAME_PROVIDED}-${DISTRO_ARCH}-cross
> > -Build-Profiles: <kbuild cross>
> > +Build-Profiles: <pkg.${BPN}.kbuild cross>
> >  Architecture: any
> >  Multi-Arch: foreign
> >  Depends: ${perl:Depends}, ${shlibs:Depends}
> > diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> > index fe0bd810..a1b00d39 100644
> > --- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> > +++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> > @@ -168,7 +168,7 @@ headers_check() {
> >  libc_headers() {
> >      mkdir -p ${deb_libc_hdr_dir}
> >      arches="${DISTRO_ARCH}"
> > -    if echo "${DEB_BUILD_PROFILES}" | grep -q "libcdev-arch-all"; then
> > +    if echo "${DEB_BUILD_PROFILES}" | grep -q "pkg.${BPN}.libcdev-arch-all"; then
> >          arches="amd64 armhf arm64 i386 mipsel riscv64"
> >      fi
> >      for distro_arch in ${arches}; do
> > diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
> > index f2892921..1f46bb31 100644
> > --- a/meta/recipes-kernel/linux/linux-custom.inc
> > +++ b/meta/recipes-kernel/linux/linux-custom.inc
> > @@ -28,7 +28,7 @@ KBUILD_DEPENDS ?= "build-essential:native, \
> >                     flex, \
> >                     git, \
> >                     kmod, \
> > -                   linux-image-${KERNEL_NAME_PROVIDED}:${DISTRO_ARCH} <kbuild !kernel>, \
> > +                   linux-image-${KERNEL_NAME_PROVIDED}:${DISTRO_ARCH} <pkg.${BPN}.kbuild !pkg.${BPN}.kernel>, \
> >                     rsync,"
> >  
> >  KERNEL_DEBIAN_DEPENDS ?= "initramfs-tools | linux-initramfs-tool, \
> > @@ -73,6 +73,7 @@ TEMPLATE_FILES += "                  \
> >  "
> >  
> >  TEMPLATE_VARS += "                \
> > +    BPN                           \
> >      KBUILD_DEPENDS                \
> >      KERNEL_ARCH                   \
> >      KERNEL_DEBIAN_DEPENDS         \
> > @@ -114,17 +115,17 @@ python() {
> >  }
> >  
> >  # Default profiles and provides
> > -BUILD_PROFILES = "kernel kbuild"
> > +BUILD_PROFILES = "pkg.${BPN}.kernel pkg.${BPN}.kbuild"
> >  
> >  # We only offer the -kbuildtarget variant when actually cross compiling
> >  BBCLASSEXTEND:append:cross-profile = " kbuildtarget"
> >  
> >  # When cross-profile is active:
> >  # build only kernel (including config) with the default variant of the recipe
> > -BUILD_PROFILES:cross-profile = "kernel"
> > +BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel"
> >  
> >  # -native: kbuild package for host
> > -BUILD_PROFILES:class-native = "kbuild"
> > +BUILD_PROFILES:class-native = "pkg.${BPN}.kbuild"
> >  RECIPE_PROVIDES:class-native = " \
> >      linux-headers-${KERNEL_NAME_PROVIDED} \
> >      linux-kbuild-${KERNEL_NAME_PROVIDED}"
> > @@ -135,7 +136,7 @@ RECIPE_PROVIDES:class-native = " \
> >  DEPENDS:class-native += "${BPN}-pseudo"
> >  
> >  # -kbuildtarget: kbuild package for target, enforcing non-cross-build
> > -BUILD_PROFILES:class-kbuildtarget = "kbuild"
> > +BUILD_PROFILES:class-kbuildtarget = "pkg.${BPN}.kbuild"
> >  RECIPE_PROVIDES:class-kbuildtarget = " \
> >      linux-headers-${KERNEL_NAME_PROVIDED} \
> >      linux-kbuild-${KERNEL_NAME_PROVIDED}"
> > @@ -214,12 +215,12 @@ def config_fragments(d):
> >  def get_additional_build_profiles(d):
> >      profiles = d.getVar('BASE_DISTRO')
> >      if not bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_DEPLOY')):
> > -        profiles += ' nolibcdev'
> > +        profiles += ' pkg.{}.nolibcdev'.format(d.getVar('BPN'))
> >      elif bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_ARCH_ALL')):
> > -        profiles += ' libcdev-arch-all'
> > +        profiles += ' pkg.{}.libcdev-arch-all'.format(d.getVar('BPN'))
> >      return profiles
> >  
> > -KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'libcdev-arch-all', 'all\nMulti-Arch: foreign', 'any', d) }"
> > +KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'pkg.{}.libcdev-arch-all'.format(d.getVar('BPN')), 'all\nMulti-Arch: foreign', 'any', d) }"
> >  DEB_BUILD_PROFILES += "${@get_additional_build_profiles(d)}"
> >  
> >  do_prepare_build:prepend() {
> 
> Jan
> 
> -- 
> Siemens AG, Foundational Technologies
> Linux Expert Center

Patch

diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/recipes-kernel/linux/files/debian/control.tmpl
index 78e95105..01b1a63f 100644
--- a/meta/recipes-kernel/linux/files/debian/control.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
@@ -1,4 +1,4 @@ 
-Source: linux-${KERNEL_NAME_PROVIDED}
+Source: ${BPN}
 Section: kernel
 Priority: optional
 Maintainer: ${MAINTAINER}
@@ -7,7 +7,7 @@  Homepage: http://www.kernel.org/
 Rules-Requires-Root: no
 
 Package: linux-image-${KERNEL_NAME_PROVIDED}
-Build-Profiles: <kernel>
+Build-Profiles: <pkg.${BPN}.kernel>
 Architecture: any
 Depends: ${KERNEL_DEBIAN_DEPENDS}
 Description: ${KERNEL_NAME_PROVIDED} Linux kernel, version @KR@
@@ -15,7 +15,7 @@  Description: ${KERNEL_NAME_PROVIDED} Linux kernel, version @KR@
  files, version: @KR@.
 
 Package: linux-headers-${KERNEL_NAME_PROVIDED}
-Build-Profiles: <kernel>
+Build-Profiles: <pkg.${BPN}.kernel>
 Architecture: any
 Depends: ${KERNEL_HEADERS_DEBIAN_DEPENDS}, ${perl:Depends}, ${shlibs:Depends}
 Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
@@ -24,7 +24,7 @@  Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
  This is useful for people who need to build external modules
 
 Package: linux-libc-dev
-Build-Profiles: <!nolibcdev kernel>
+Build-Profiles: <!pkg.${BPN}.nolibcdev pkg.${BPN}.kernel>
 Section: devel
 Provides: linux-kernel-headers
 Architecture: ${KERNEL_LIBC_DEV_ARCH}
@@ -33,7 +33,7 @@  Description: Linux support headers for userspace development
  are used by the installed headers for GNU glibc and other system libraries.
 
 Package: linux-libc-dev-${DISTRO_ARCH}-cross
-Build-Profiles: <!nolibcdev cross !kbuild>
+Build-Profiles: <!pkg.${BPN}.nolibcdev cross !pkg.${BPN}.kbuild>
 Section: devel
 Provides: linux-kernel-headers-${DISTRO_ARCH}-cross
 Architecture: all
@@ -45,7 +45,7 @@  Description: Linux Kernel Headers for development (for cross-compiling)
  your kernel. Use linux-headers-* packages for that.
 
 Package: linux-image-${KERNEL_NAME_PROVIDED}-dbg
-Build-Profiles: <kernel>
+Build-Profiles: <pkg.${BPN}.kernel>
 Section: debug
 Architecture: any
 Description: Linux kernel debugging symbols for @KR@
@@ -53,7 +53,7 @@  Description: Linux kernel debugging symbols for @KR@
  all the necessary debug symbols for the kernel and its modules.
 
 Package: linux-kbuild-${KERNEL_NAME_PROVIDED}
-Build-Profiles: <kbuild !cross>
+Build-Profiles: <pkg.${BPN}.kbuild !cross>
 Architecture: any
 Depends: ${perl:Depends}, ${shlibs:Depends}
 Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
@@ -61,7 +61,7 @@  Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
  This is useful for people who need to build external modules
 
 Package: linux-kbuild-${KERNEL_NAME_PROVIDED}-${DISTRO_ARCH}-cross
-Build-Profiles: <kbuild cross>
+Build-Profiles: <pkg.${BPN}.kbuild cross>
 Architecture: any
 Multi-Arch: foreign
 Depends: ${perl:Depends}, ${shlibs:Depends}
diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
index fe0bd810..a1b00d39 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
@@ -168,7 +168,7 @@  headers_check() {
 libc_headers() {
     mkdir -p ${deb_libc_hdr_dir}
     arches="${DISTRO_ARCH}"
-    if echo "${DEB_BUILD_PROFILES}" | grep -q "libcdev-arch-all"; then
+    if echo "${DEB_BUILD_PROFILES}" | grep -q "pkg.${BPN}.libcdev-arch-all"; then
         arches="amd64 armhf arm64 i386 mipsel riscv64"
     fi
     for distro_arch in ${arches}; do
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index f2892921..1f46bb31 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -28,7 +28,7 @@  KBUILD_DEPENDS ?= "build-essential:native, \
                    flex, \
                    git, \
                    kmod, \
-                   linux-image-${KERNEL_NAME_PROVIDED}:${DISTRO_ARCH} <kbuild !kernel>, \
+                   linux-image-${KERNEL_NAME_PROVIDED}:${DISTRO_ARCH} <pkg.${BPN}.kbuild !pkg.${BPN}.kernel>, \
                    rsync,"
 
 KERNEL_DEBIAN_DEPENDS ?= "initramfs-tools | linux-initramfs-tool, \
@@ -73,6 +73,7 @@  TEMPLATE_FILES += "                  \
 "
 
 TEMPLATE_VARS += "                \
+    BPN                           \
     KBUILD_DEPENDS                \
     KERNEL_ARCH                   \
     KERNEL_DEBIAN_DEPENDS         \
@@ -114,17 +115,17 @@  python() {
 }
 
 # Default profiles and provides
-BUILD_PROFILES = "kernel kbuild"
+BUILD_PROFILES = "pkg.${BPN}.kernel pkg.${BPN}.kbuild"
 
 # We only offer the -kbuildtarget variant when actually cross compiling
 BBCLASSEXTEND:append:cross-profile = " kbuildtarget"
 
 # When cross-profile is active:
 # build only kernel (including config) with the default variant of the recipe
-BUILD_PROFILES:cross-profile = "kernel"
+BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel"
 
 # -native: kbuild package for host
-BUILD_PROFILES:class-native = "kbuild"
+BUILD_PROFILES:class-native = "pkg.${BPN}.kbuild"
 RECIPE_PROVIDES:class-native = " \
     linux-headers-${KERNEL_NAME_PROVIDED} \
     linux-kbuild-${KERNEL_NAME_PROVIDED}"
@@ -135,7 +136,7 @@  RECIPE_PROVIDES:class-native = " \
 DEPENDS:class-native += "${BPN}-pseudo"
 
 # -kbuildtarget: kbuild package for target, enforcing non-cross-build
-BUILD_PROFILES:class-kbuildtarget = "kbuild"
+BUILD_PROFILES:class-kbuildtarget = "pkg.${BPN}.kbuild"
 RECIPE_PROVIDES:class-kbuildtarget = " \
     linux-headers-${KERNEL_NAME_PROVIDED} \
     linux-kbuild-${KERNEL_NAME_PROVIDED}"
@@ -214,12 +215,12 @@  def config_fragments(d):
 def get_additional_build_profiles(d):
     profiles = d.getVar('BASE_DISTRO')
     if not bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_DEPLOY')):
-        profiles += ' nolibcdev'
+        profiles += ' pkg.{}.nolibcdev'.format(d.getVar('BPN'))
     elif bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_ARCH_ALL')):
-        profiles += ' libcdev-arch-all'
+        profiles += ' pkg.{}.libcdev-arch-all'.format(d.getVar('BPN'))
     return profiles
 
-KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'libcdev-arch-all', 'all\nMulti-Arch: foreign', 'any', d) }"
+KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'pkg.{}.libcdev-arch-all'.format(d.getVar('BPN')), 'all\nMulti-Arch: foreign', 'any', d) }"
 DEB_BUILD_PROFILES += "${@get_additional_build_profiles(d)}"
 
 do_prepare_build:prepend() {