All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel: Add support for multiple kernel packages
@ 2015-12-14 19:06 Haris Okanovic
  2015-12-14 19:17 ` Bruce Ashfield
  2016-10-11 18:36 ` [PATCH v3] " Haris Okanovic
  0 siblings, 2 replies; 16+ messages in thread
From: Haris Okanovic @ 2015-12-14 19:06 UTC (permalink / raw)
  To: openembedded-core; +Cc: Haris Okanovic, Gratian Crisan

From: Gratian Crisan <gratian.crisan@ni.com>

Templetize kernel package name:

Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
packages. It defaults to the old hard-coded name 'kernel' but it can be
redefined by recipes that provide additional kernel packages in order
to avoid build conflicts.

Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
kernel bbclass-es.

Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:

Prior to this change, kernel recipes would all fetch source to
STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
parallel builds when more than one kernel recipes are defined in
the distribution, since they all attempted to fetch() and patch()
in a shared source dir.

With this change, alternate kernel recipes fetch source into their
${WORKDIR} so that they may build in parallel to each other and the
default kernel recipe, which still fetches to STAGING_KERNEL_DIR.

Testing:

Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
image and modules packages. Added kernel recipe with non-default
KERNEL_PACKAGE_NAME and verified it produces kernel image and modules
packages with alternate name next to default kernel.

Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
Natinst-ReviewBoard-ID: 120348
Natinst-ReviewBoard-ID: 120447
---
 meta/classes/kernel-module-split.bbclass |  9 ++--
 meta/classes/kernel.bbclass              | 71 ++++++++++++++++++--------------
 meta/conf/documentation.conf             |  1 +
 meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
 4 files changed, 49 insertions(+), 34 deletions(-)

diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index e1a70e6..7415ec8 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -28,7 +28,7 @@ do_install_append() {
 
 PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
 
-KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
+KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
 
 python split_kernel_module_packages () {
     import re
@@ -179,14 +179,17 @@ python split_kernel_module_packages () {
         # Avoid automatic -dev recommendations for modules ending with -dev.
         d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
 
+    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
+    kernel_version = d.getVar("KERNEL_VERSION", True)
+
     module_deps = parse_depmod()
     module_regex = '^(.*)\.k?o$'
-    module_pattern = 'kernel-module-%s'
+    module_pattern = '%s-module-%%s' % kernel_package_name
 
     postinst = d.getVar('pkg_postinst_modules', True)
     postrm = d.getVar('pkg_postrm_modules', True)
 
-    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION", True)))
+    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
     if modules:
         metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
         d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index b75a462..cc27364 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -3,7 +3,6 @@ inherit linux-kernel-base kernel-module-split
 PROVIDES += "virtual/kernel"
 DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native"
 
-S = "${STAGING_KERNEL_DIR}"
 B = "${WORKDIR}/build"
 KBUILD_OUTPUT = "${B}"
 OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
@@ -11,6 +10,7 @@ OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
 # we include gcc above, we dont need virtual/libc
 INHIBIT_DEFAULT_DEPS = "1"
 
+KERNEL_PACKAGE_NAME ??= "kernel"
 KERNEL_IMAGETYPE ?= "zImage"
 INITRAMFS_IMAGE ?= ""
 INITRAMFS_TASK ?= ""
@@ -34,6 +34,17 @@ python __anonymous () {
     image_task = d.getVar('INITRAMFS_TASK', True)
     if image_task:
         d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
+
+    # The default kernel recipe fetches it's source to
+    # STAGING_KERNEL_DIR as defined by bitbake/distro confs.
+    # Alternate kernel recipes (E.g. debug kernels) fetch source into
+    # their work dir so that they may build in parallel.
+    if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel":
+        d.setVar("S", d.getVar("STAGING_KERNEL_DIR", True))
+    else:
+        workdir = d.getVar("WORKDIR", True)
+        kernelSourceDir = os.path.join(workdir, 'kernel-source')
+        d.setVar("S", kernelSourceDir)
 }
 
 # Here we pull in all various kernel image types which we support.
@@ -79,9 +90,9 @@ base_do_unpack_append () {
 
 inherit kernel-arch deploy
 
-PACKAGES_DYNAMIC += "^kernel-module-.*"
-PACKAGES_DYNAMIC += "^kernel-image-.*"
-PACKAGES_DYNAMIC += "^kernel-firmware-.*"
+PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
+PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
+PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
 
 export OS = "${TARGET_OS}"
 export CROSS_COMPILE = "${TARGET_PREFIX}"
@@ -270,9 +281,9 @@ do_shared_workdir_setscene () {
 
 emit_depmod_pkgdata() {
 	# Stash data for depmod
-	install -d ${PKGDESTWORK}/kernel-depmod/
-	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
-	cp ${B}/System.map ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
+	install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
+	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
+	cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
 }
 
 PACKAGEFUNCS += "emit_depmod_pkgdata"
@@ -287,7 +298,7 @@ do_shared_workdir () {
 	# Store the kernel version in sysroots for module-base.bbclass
 	#
 
-	echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
+	echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
 
 	# Copy files required for module builds
 	cp System.map $kerneldir/System.map-${KERNEL_VERSION}
@@ -361,28 +372,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
 
 # kernel-base becomes kernel-${KERNEL_VERSION}
 # kernel-image becomes kernel-image-${KERNEL_VERISON}
-PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules"
+PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
 FILES_${PN} = ""
-FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
-FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
-FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
-FILES_kernel-vmlinux = "/boot/vmlinux*"
-FILES_kernel-modules = ""
-RDEPENDS_kernel = "kernel-base"
+FILES_${KERNEL_PACKAGE_NAME}-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
+FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
+FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
+FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
+FILES_${KERNEL_PACKAGE_NAME}-modules = ""
+RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
 # Allow machines to override this dependency if kernel image files are 
 # not wanted in images as standard
-RDEPENDS_kernel-base ?= "kernel-image"
-PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
-RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', 'kernel-vmlinux', '', d)}"
-PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
-RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
-ALLOW_EMPTY_kernel = "1"
-ALLOW_EMPTY_kernel-base = "1"
-ALLOW_EMPTY_kernel-image = "1"
-ALLOW_EMPTY_kernel-modules = "1"
-DESCRIPTION_kernel-modules = "Kernel modules meta package"
-
-pkg_postinst_kernel-base () {
+RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
+PKG_${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
+RDEPENDS_${KERNEL_PACKAGE_NAME}-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
+PKG_${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
+RPROVIDES_${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
+DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package"
+
+pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
 	if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
 		mkdir -p $D/lib/modules/${KERNEL_VERSION}
 	fi
@@ -393,18 +404,18 @@ pkg_postinst_kernel-base () {
 	fi
 }
 
-pkg_postinst_kernel-image () {
+pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
 	update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
 }
 
-pkg_postrm_kernel-image () {
+pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
 	update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
 }
 
 PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
 
 python split_kernel_packages () {
-    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
+    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
 }
 
 do_strip() {
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 1b5c071..fb5e03f 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto Project kern
 KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set by the machine configuration files and defaults to 'zImage'."
 KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot"
 KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules"
+KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to 'kernel'."
 KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
 KERNEL_SRC[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
 KFEATURE_DESCRIPTION[doc] = "Provides a short description of a configuration fragment. You use this variable in the .scc file that describes a configuration fragment file."
diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index 772adcb..c27a3cb 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -2,7 +2,7 @@
 FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
 
 python __anonymous () {
-    d.appendVar("PACKAGES", " kernel-devicetree")
+    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
 }
 
 normalize_dtb () {
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] kernel: Add support for multiple kernel packages
  2015-12-14 19:06 [PATCH] kernel: Add support for multiple kernel packages Haris Okanovic
@ 2015-12-14 19:17 ` Bruce Ashfield
  2015-12-14 20:02   ` Bruce Ashfield
  2016-10-11 18:36 ` [PATCH v3] " Haris Okanovic
  1 sibling, 1 reply; 16+ messages in thread
From: Bruce Ashfield @ 2015-12-14 19:17 UTC (permalink / raw)
  To: Haris Okanovic
  Cc: Gratian Crisan, Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 14198 bytes --]

On Mon, Dec 14, 2015 at 2:06 PM, Haris Okanovic <haris.okanovic@ni.com>
wrote:

> From: Gratian Crisan <gratian.crisan@ni.com>
>
> Templetize kernel package name:
>
> Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
> packages. It defaults to the old hard-coded name 'kernel' but it can be
> redefined by recipes that provide additional kernel packages in order
> to avoid build conflicts.
>
> Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
> kernel bbclass-es.
>
> Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:
>
> Prior to this change, kernel recipes would all fetch source to
> STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
> parallel builds when more than one kernel recipes are defined in
> the distribution, since they all attempted to fetch() and patch()
> in a shared source dir.
>
> With this change, alternate kernel recipes fetch source into their
> ${WORKDIR} so that they may build in parallel to each other and the
> default kernel recipe, which still fetches to STAGING_KERNEL_DIR.
>


But what's the system level use case for this capability ? Honestly, it just
looks complicated .. and I'm not seeing exactly multiple kernels are being
built in parallel in a single build. We've been forcing everything
explicitly
to be in a single, shared location .. and I see that this is both
complicating
and a possible source of errors.

It's probably that I'm just misunderstanding the point of the change.

If I had to guess, you are building recovery, or kexec/kdump kernels along
side the main kernel ?

Cheers,

Bruce


>
> Testing:
>
> Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
> image and modules packages. Added kernel recipe with non-default
> KERNEL_PACKAGE_NAME and verified it produces kernel image and modules
> packages with alternate name next to default kernel.
>
> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
> Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
> Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
> Natinst-ReviewBoard-ID: 120348
> Natinst-ReviewBoard-ID: 120447
> ---
>  meta/classes/kernel-module-split.bbclass |  9 ++--
>  meta/classes/kernel.bbclass              | 71
> ++++++++++++++++++--------------
>  meta/conf/documentation.conf             |  1 +
>  meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
>  4 files changed, 49 insertions(+), 34 deletions(-)
>
> diff --git a/meta/classes/kernel-module-split.bbclass
> b/meta/classes/kernel-module-split.bbclass
> index e1a70e6..7415ec8 100644
> --- a/meta/classes/kernel-module-split.bbclass
> +++ b/meta/classes/kernel-module-split.bbclass
> @@ -28,7 +28,7 @@ do_install_append() {
>
>  PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
>
> -KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
> +KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
>
>  python split_kernel_module_packages () {
>      import re
> @@ -179,14 +179,17 @@ python split_kernel_module_packages () {
>          # Avoid automatic -dev recommendations for modules ending with
> -dev.
>          d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
>
> +    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
> +    kernel_version = d.getVar("KERNEL_VERSION", True)
> +
>      module_deps = parse_depmod()
>      module_regex = '^(.*)\.k?o$'
> -    module_pattern = 'kernel-module-%s'
> +    module_pattern = '%s-module-%%s' % kernel_package_name
>
>      postinst = d.getVar('pkg_postinst_modules', True)
>      postrm = d.getVar('pkg_postrm_modules', True)
>
> -    modules = do_split_packages(d, root='/lib/modules',
> file_regex=module_regex, output_pattern=module_pattern, description='%s
> kernel module', postinst=postinst, postrm=postrm, recursive=True,
> hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION",
> True)))
> +    modules = do_split_packages(d, root='/lib/modules',
> file_regex=module_regex, output_pattern=module_pattern, description='%s
> kernel module', postinst=postinst, postrm=postrm, recursive=True,
> hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name,
> kernel_version))
>      if modules:
>          metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
>          d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index b75a462..cc27364 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -3,7 +3,6 @@ inherit linux-kernel-base kernel-module-split
>  PROVIDES += "virtual/kernel"
>  DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc
> kmod-native depmodwrapper-cross bc-native"
>
> -S = "${STAGING_KERNEL_DIR}"
>  B = "${WORKDIR}/build"
>  KBUILD_OUTPUT = "${B}"
>  OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
> @@ -11,6 +10,7 @@ OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
>  # we include gcc above, we dont need virtual/libc
>  INHIBIT_DEFAULT_DEPS = "1"
>
> +KERNEL_PACKAGE_NAME ??= "kernel"
>  KERNEL_IMAGETYPE ?= "zImage"
>  INITRAMFS_IMAGE ?= ""
>  INITRAMFS_TASK ?= ""
> @@ -34,6 +34,17 @@ python __anonymous () {
>      image_task = d.getVar('INITRAMFS_TASK', True)
>      if image_task:
>          d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
> +
> +    # The default kernel recipe fetches it's source to
> +    # STAGING_KERNEL_DIR as defined by bitbake/distro confs.
> +    # Alternate kernel recipes (E.g. debug kernels) fetch source into
> +    # their work dir so that they may build in parallel.
> +    if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel":
> +        d.setVar("S", d.getVar("STAGING_KERNEL_DIR", True))
> +    else:
> +        workdir = d.getVar("WORKDIR", True)
> +        kernelSourceDir = os.path.join(workdir, 'kernel-source')
> +        d.setVar("S", kernelSourceDir)
>  }
>
>  # Here we pull in all various kernel image types which we support.
> @@ -79,9 +90,9 @@ base_do_unpack_append () {
>
>  inherit kernel-arch deploy
>
> -PACKAGES_DYNAMIC += "^kernel-module-.*"
> -PACKAGES_DYNAMIC += "^kernel-image-.*"
> -PACKAGES_DYNAMIC += "^kernel-firmware-.*"
> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
>
>  export OS = "${TARGET_OS}"
>  export CROSS_COMPILE = "${TARGET_PREFIX}"
> @@ -270,9 +281,9 @@ do_shared_workdir_setscene () {
>
>  emit_depmod_pkgdata() {
>         # Stash data for depmod
> -       install -d ${PKGDESTWORK}/kernel-depmod/
> -       echo "${KERNEL_VERSION}" >
> ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
> -       cp ${B}/System.map
> ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
> +       install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
> +       echo "${KERNEL_VERSION}" >
> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
> +       cp ${B}/System.map
> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
>  }
>
>  PACKAGEFUNCS += "emit_depmod_pkgdata"
> @@ -287,7 +298,7 @@ do_shared_workdir () {
>         # Store the kernel version in sysroots for module-base.bbclass
>         #
>
> -       echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
> +       echo "${KERNEL_VERSION}" >
> $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
>
>         # Copy files required for module builds
>         cp System.map $kerneldir/System.map-${KERNEL_VERSION}
> @@ -361,28 +372,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
>
>  # kernel-base becomes kernel-${KERNEL_VERSION}
>  # kernel-image becomes kernel-image-${KERNEL_VERISON}
> -PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev
> kernel-modules"
> +PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base
> ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image
> ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
>  FILES_${PN} = ""
> -FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order
> /lib/modules/${KERNEL_VERSION}/modules.builtin"
> -FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
> -FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config*
> ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
> -FILES_kernel-vmlinux = "/boot/vmlinux*"
> -FILES_kernel-modules = ""
> -RDEPENDS_kernel = "kernel-base"
> +FILES_${KERNEL_PACKAGE_NAME}-base =
> "/lib/modules/${KERNEL_VERSION}/modules.order
> /lib/modules/${KERNEL_VERSION}/modules.builtin"
> +FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
> +FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map*
> /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH}
> /lib/modules/${KERNEL_VERSION}/build"
> +FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
> +FILES_${KERNEL_PACKAGE_NAME}-modules = ""
> +RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
>  # Allow machines to override this dependency if kernel image files are
>  # not wanted in images as standard
> -RDEPENDS_kernel-base ?= "kernel-image"
> -PKG_kernel-image =
> "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> -RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE',
> 'vmlinux', 'kernel-vmlinux', '', d)}"
> -PKG_kernel-base =
> "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
> -RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
> -ALLOW_EMPTY_kernel = "1"
> -ALLOW_EMPTY_kernel-base = "1"
> -ALLOW_EMPTY_kernel-image = "1"
> -ALLOW_EMPTY_kernel-modules = "1"
> -DESCRIPTION_kernel-modules = "Kernel modules meta package"
> -
> -pkg_postinst_kernel-base () {
> +RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
> +PKG_${KERNEL_PACKAGE_NAME}-image =
> "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> +RDEPENDS_${KERNEL_PACKAGE_NAME}-image +=
> "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux',
> '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
> +PKG_${KERNEL_PACKAGE_NAME}-base =
> "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
> +RPROVIDES_${KERNEL_PACKAGE_NAME}-base +=
> "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
> +DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package"
> +
> +pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
>         if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
>                 mkdir -p $D/lib/modules/${KERNEL_VERSION}
>         fi
> @@ -393,18 +404,18 @@ pkg_postinst_kernel-base () {
>         fi
>  }
>
> -pkg_postinst_kernel-image () {
> +pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
>         update-alternatives --install
> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}
> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
> ${KERNEL_PRIORITY} || true
>  }
>
> -pkg_postrm_kernel-image () {
> +pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
>         update-alternatives --remove ${KERNEL_IMAGETYPE}
> ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
>  }
>
>  PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
>
>  python split_kernel_packages () {
> -    do_split_packages(d, root='/lib/firmware',
> file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='kernel-firmware-%s',
> description='Firmware for %s', recursive=True, extra_depends='')
> +    do_split_packages(d, root='/lib/firmware',
> file_regex='^(.*)\.(bin|fw|cis|dsp)$',
> output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware
> for %s', recursive=True, extra_depends='')
>  }
>
>  do_strip() {
> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
> index 1b5c071..fb5e03f 100644
> --- a/meta/conf/documentation.conf
> +++ b/meta/conf/documentation.conf
> @@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional metadata
> from the Yocto Project kern
>  KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device,
> usually set by the machine configuration files and defaults to 'zImage'."
>  KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be
> auto-loaded during boot"
>  KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build
> system expects to find module_conf_* values that specify configuration for
> each of the modules"
> +KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to
> 'kernel'."
>  KERNEL_PATH[doc] = "The location of the kernel sources. This variable is
> set to the value of the STAGING_KERNEL_DIR within the module class
> (module.bbclass)."
>  KERNEL_SRC[doc] = "The location of the kernel sources. This variable is
> set to the value of the STAGING_KERNEL_DIR within the module class
> (module.bbclass)."
>  KFEATURE_DESCRIPTION[doc] = "Provides a short description of a
> configuration fragment. You use this variable in the .scc file that
> describes a configuration fragment file."
> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc
> b/meta/recipes-kernel/linux/linux-dtb.inc
> index 772adcb..c27a3cb 100644
> --- a/meta/recipes-kernel/linux/linux-dtb.inc
> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> @@ -2,7 +2,7 @@
>  FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
>
>  python __anonymous () {
> -    d.appendVar("PACKAGES", " kernel-devicetree")
> +    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
>  }
>
>  normalize_dtb () {
> --
> 2.6.2
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>



-- 
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"

[-- Attachment #2: Type: text/html, Size: 17223 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] kernel: Add support for multiple kernel packages
  2015-12-14 19:17 ` Bruce Ashfield
@ 2015-12-14 20:02   ` Bruce Ashfield
  2015-12-14 22:31     ` Haris Okanovic
                       ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Bruce Ashfield @ 2015-12-14 20:02 UTC (permalink / raw)
  To: Haris Okanovic
  Cc: Gratian Crisan, Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 15062 bytes --]

On Mon, Dec 14, 2015 at 2:17 PM, Bruce Ashfield <bruce.ashfield@gmail.com>
wrote:

>
>
> On Mon, Dec 14, 2015 at 2:06 PM, Haris Okanovic <haris.okanovic@ni.com>
> wrote:
>
>> From: Gratian Crisan <gratian.crisan@ni.com>
>>
>> Templetize kernel package name:
>>
>> Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
>> packages. It defaults to the old hard-coded name 'kernel' but it can be
>> redefined by recipes that provide additional kernel packages in order
>> to avoid build conflicts.
>>
>> Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
>> kernel bbclass-es.
>>
>> Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:
>>
>> Prior to this change, kernel recipes would all fetch source to
>> STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
>> parallel builds when more than one kernel recipes are defined in
>> the distribution, since they all attempted to fetch() and patch()
>> in a shared source dir.
>>
>> With this change, alternate kernel recipes fetch source into their
>> ${WORKDIR} so that they may build in parallel to each other and the
>> default kernel recipe, which still fetches to STAGING_KERNEL_DIR.
>>
>
>
> But what's the system level use case for this capability ? Honestly, it
> just
> looks complicated .. and I'm not seeing exactly multiple kernels are being
> built in parallel in a single build. We've been forcing everything
> explicitly
> to be in a single, shared location .. and I see that this is both
> complicating
> and a possible source of errors.
>
> It's probably that I'm just misunderstanding the point of the change.
>
> If I had to guess, you are building recovery, or kexec/kdump kernels along
> side the main kernel ?
>

Aha. I see the debug kernel reference in the comments (as one example).

As a follow up. If these kernel's are building via kernel.bbclass, how are
you
avoiding the artifacts all ending up in STAGING_KERNEL_BUILDDIR ? I did
a quick scan, and couldn't see if it was being considered.

Bruce


>
> Cheers,
>
> Bruce
>
>
>>
>> Testing:
>>
>> Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
>> image and modules packages. Added kernel recipe with non-default
>> KERNEL_PACKAGE_NAME and verified it produces kernel image and modules
>> packages with alternate name next to default kernel.
>>
>> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
>> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
>> Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
>> Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
>> Natinst-ReviewBoard-ID: 120348
>> Natinst-ReviewBoard-ID: 120447
>> ---
>>  meta/classes/kernel-module-split.bbclass |  9 ++--
>>  meta/classes/kernel.bbclass              | 71
>> ++++++++++++++++++--------------
>>  meta/conf/documentation.conf             |  1 +
>>  meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
>>  4 files changed, 49 insertions(+), 34 deletions(-)
>>
>> diff --git a/meta/classes/kernel-module-split.bbclass
>> b/meta/classes/kernel-module-split.bbclass
>> index e1a70e6..7415ec8 100644
>> --- a/meta/classes/kernel-module-split.bbclass
>> +++ b/meta/classes/kernel-module-split.bbclass
>> @@ -28,7 +28,7 @@ do_install_append() {
>>
>>  PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
>>
>> -KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
>> +KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
>>
>>  python split_kernel_module_packages () {
>>      import re
>> @@ -179,14 +179,17 @@ python split_kernel_module_packages () {
>>          # Avoid automatic -dev recommendations for modules ending with
>> -dev.
>>          d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
>>
>> +    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
>> +    kernel_version = d.getVar("KERNEL_VERSION", True)
>> +
>>      module_deps = parse_depmod()
>>      module_regex = '^(.*)\.k?o$'
>> -    module_pattern = 'kernel-module-%s'
>> +    module_pattern = '%s-module-%%s' % kernel_package_name
>>
>>      postinst = d.getVar('pkg_postinst_modules', True)
>>      postrm = d.getVar('pkg_postrm_modules', True)
>>
>> -    modules = do_split_packages(d, root='/lib/modules',
>> file_regex=module_regex, output_pattern=module_pattern, description='%s
>> kernel module', postinst=postinst, postrm=postrm, recursive=True,
>> hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION",
>> True)))
>> +    modules = do_split_packages(d, root='/lib/modules',
>> file_regex=module_regex, output_pattern=module_pattern, description='%s
>> kernel module', postinst=postinst, postrm=postrm, recursive=True,
>> hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name,
>> kernel_version))
>>      if modules:
>>          metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
>>          d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
>> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
>> index b75a462..cc27364 100644
>> --- a/meta/classes/kernel.bbclass
>> +++ b/meta/classes/kernel.bbclass
>> @@ -3,7 +3,6 @@ inherit linux-kernel-base kernel-module-split
>>  PROVIDES += "virtual/kernel"
>>  DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc
>> kmod-native depmodwrapper-cross bc-native"
>>
>> -S = "${STAGING_KERNEL_DIR}"
>>  B = "${WORKDIR}/build"
>>  KBUILD_OUTPUT = "${B}"
>>  OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
>> @@ -11,6 +10,7 @@ OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
>>  # we include gcc above, we dont need virtual/libc
>>  INHIBIT_DEFAULT_DEPS = "1"
>>
>> +KERNEL_PACKAGE_NAME ??= "kernel"
>>  KERNEL_IMAGETYPE ?= "zImage"
>>  INITRAMFS_IMAGE ?= ""
>>  INITRAMFS_TASK ?= ""
>> @@ -34,6 +34,17 @@ python __anonymous () {
>>      image_task = d.getVar('INITRAMFS_TASK', True)
>>      if image_task:
>>          d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
>> +
>> +    # The default kernel recipe fetches it's source to
>> +    # STAGING_KERNEL_DIR as defined by bitbake/distro confs.
>> +    # Alternate kernel recipes (E.g. debug kernels) fetch source into
>> +    # their work dir so that they may build in parallel.
>> +    if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel":
>> +        d.setVar("S", d.getVar("STAGING_KERNEL_DIR", True))
>> +    else:
>> +        workdir = d.getVar("WORKDIR", True)
>> +        kernelSourceDir = os.path.join(workdir, 'kernel-source')
>> +        d.setVar("S", kernelSourceDir)
>>  }
>>
>>  # Here we pull in all various kernel image types which we support.
>> @@ -79,9 +90,9 @@ base_do_unpack_append () {
>>
>>  inherit kernel-arch deploy
>>
>> -PACKAGES_DYNAMIC += "^kernel-module-.*"
>> -PACKAGES_DYNAMIC += "^kernel-image-.*"
>> -PACKAGES_DYNAMIC += "^kernel-firmware-.*"
>> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
>> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
>> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
>>
>>  export OS = "${TARGET_OS}"
>>  export CROSS_COMPILE = "${TARGET_PREFIX}"
>> @@ -270,9 +281,9 @@ do_shared_workdir_setscene () {
>>
>>  emit_depmod_pkgdata() {
>>         # Stash data for depmod
>> -       install -d ${PKGDESTWORK}/kernel-depmod/
>> -       echo "${KERNEL_VERSION}" >
>> ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
>> -       cp ${B}/System.map
>> ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
>> +       install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
>> +       echo "${KERNEL_VERSION}" >
>> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
>> +       cp ${B}/System.map
>> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
>>  }
>>
>>  PACKAGEFUNCS += "emit_depmod_pkgdata"
>> @@ -287,7 +298,7 @@ do_shared_workdir () {
>>         # Store the kernel version in sysroots for module-base.bbclass
>>         #
>>
>> -       echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
>> +       echo "${KERNEL_VERSION}" >
>> $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
>>
>>         # Copy files required for module builds
>>         cp System.map $kerneldir/System.map-${KERNEL_VERSION}
>> @@ -361,28 +372,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
>>
>>  # kernel-base becomes kernel-${KERNEL_VERSION}
>>  # kernel-image becomes kernel-image-${KERNEL_VERISON}
>> -PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev
>> kernel-modules"
>> +PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base
>> ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image
>> ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
>>  FILES_${PN} = ""
>> -FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order
>> /lib/modules/${KERNEL_VERSION}/modules.builtin"
>> -FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
>> -FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers*
>> /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
>> -FILES_kernel-vmlinux = "/boot/vmlinux*"
>> -FILES_kernel-modules = ""
>> -RDEPENDS_kernel = "kernel-base"
>> +FILES_${KERNEL_PACKAGE_NAME}-base =
>> "/lib/modules/${KERNEL_VERSION}/modules.order
>> /lib/modules/${KERNEL_VERSION}/modules.builtin"
>> +FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
>> +FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map*
>> /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH}
>> /lib/modules/${KERNEL_VERSION}/build"
>> +FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
>> +FILES_${KERNEL_PACKAGE_NAME}-modules = ""
>> +RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
>>  # Allow machines to override this dependency if kernel image files are
>>  # not wanted in images as standard
>> -RDEPENDS_kernel-base ?= "kernel-image"
>> -PKG_kernel-image =
>> "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
>> -RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE',
>> 'vmlinux', 'kernel-vmlinux', '', d)}"
>> -PKG_kernel-base =
>> "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
>> -RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
>> -ALLOW_EMPTY_kernel = "1"
>> -ALLOW_EMPTY_kernel-base = "1"
>> -ALLOW_EMPTY_kernel-image = "1"
>> -ALLOW_EMPTY_kernel-modules = "1"
>> -DESCRIPTION_kernel-modules = "Kernel modules meta package"
>> -
>> -pkg_postinst_kernel-base () {
>> +RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
>> +PKG_${KERNEL_PACKAGE_NAME}-image =
>> "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
>> +RDEPENDS_${KERNEL_PACKAGE_NAME}-image +=
>> "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux',
>> '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
>> +PKG_${KERNEL_PACKAGE_NAME}-base =
>> "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
>> +RPROVIDES_${KERNEL_PACKAGE_NAME}-base +=
>> "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
>> +DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta
>> package"
>> +
>> +pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
>>         if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
>>                 mkdir -p $D/lib/modules/${KERNEL_VERSION}
>>         fi
>> @@ -393,18 +404,18 @@ pkg_postinst_kernel-base () {
>>         fi
>>  }
>>
>> -pkg_postinst_kernel-image () {
>> +pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
>>         update-alternatives --install
>> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}
>> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
>> ${KERNEL_PRIORITY} || true
>>  }
>>
>> -pkg_postrm_kernel-image () {
>> +pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
>>         update-alternatives --remove ${KERNEL_IMAGETYPE}
>> ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
>>  }
>>
>>  PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
>>
>>  python split_kernel_packages () {
>> -    do_split_packages(d, root='/lib/firmware',
>> file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='kernel-firmware-%s',
>> description='Firmware for %s', recursive=True, extra_depends='')
>> +    do_split_packages(d, root='/lib/firmware',
>> file_regex='^(.*)\.(bin|fw|cis|dsp)$',
>> output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware
>> for %s', recursive=True, extra_depends='')
>>  }
>>
>>  do_strip() {
>> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
>> index 1b5c071..fb5e03f 100644
>> --- a/meta/conf/documentation.conf
>> +++ b/meta/conf/documentation.conf
>> @@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional metadata
>> from the Yocto Project kern
>>  KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device,
>> usually set by the machine configuration files and defaults to 'zImage'."
>>  KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be
>> auto-loaded during boot"
>>  KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build
>> system expects to find module_conf_* values that specify configuration for
>> each of the modules"
>> +KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to
>> 'kernel'."
>>  KERNEL_PATH[doc] = "The location of the kernel sources. This variable is
>> set to the value of the STAGING_KERNEL_DIR within the module class
>> (module.bbclass)."
>>  KERNEL_SRC[doc] = "The location of the kernel sources. This variable is
>> set to the value of the STAGING_KERNEL_DIR within the module class
>> (module.bbclass)."
>>  KFEATURE_DESCRIPTION[doc] = "Provides a short description of a
>> configuration fragment. You use this variable in the .scc file that
>> describes a configuration fragment file."
>> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc
>> b/meta/recipes-kernel/linux/linux-dtb.inc
>> index 772adcb..c27a3cb 100644
>> --- a/meta/recipes-kernel/linux/linux-dtb.inc
>> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
>> @@ -2,7 +2,7 @@
>>  FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
>>
>>  python __anonymous () {
>> -    d.appendVar("PACKAGES", " kernel-devicetree")
>> +    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
>>  }
>>
>>  normalize_dtb () {
>> --
>> 2.6.2
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>
>
>
>
> --
> "Thou shalt not follow the NULL pointer, for chaos and madness await thee
> at its end"
>



-- 
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"

[-- Attachment #2: Type: text/html, Size: 18620 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] kernel: Add support for multiple kernel packages
  2015-12-14 20:02   ` Bruce Ashfield
@ 2015-12-14 22:31     ` Haris Okanovic
  2015-12-14 22:35     ` [PATCH v2] " Haris Okanovic
  2015-12-15 16:58     ` [PATCH] " Denys Dmytriyenko
  2 siblings, 0 replies; 16+ messages in thread
From: Haris Okanovic @ 2015-12-14 22:31 UTC (permalink / raw)
  To: Bruce Ashfield, Haris Okanovic
  Cc: Gratian Crisan, Patches and discussions about the oe-core layer

Hi Bruce,

Thanks for taking time to look over our patch!

On 12/14/2015 02:02 PM, Bruce Ashfield wrote:
>
>
> On Mon, Dec 14, 2015 at 2:17 PM, Bruce Ashfield
> <bruce.ashfield@gmail.com <mailto:bruce.ashfield@gmail.com>> wrote:
>
>
>
>     On Mon, Dec 14, 2015 at 2:06 PM, Haris Okanovic
>     <haris.okanovic@ni.com <mailto:haris.okanovic@ni.com>> wrote:
>
>         From: Gratian Crisan <gratian.crisan@ni.com
>         <mailto:gratian.crisan@ni.com>>
>
>         Templetize kernel package name:
>
>         Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name
>         for kernel
>         packages. It defaults to the old hard-coded name 'kernel' but it
>         can be
>         redefined by recipes that provide additional kernel packages in
>         order
>         to avoid build conflicts.
>
>         Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
>         kernel bbclass-es.
>
>         Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:
>
>         Prior to this change, kernel recipes would all fetch source to
>         STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
>         parallel builds when more than one kernel recipes are defined in
>         the distribution, since they all attempted to fetch() and patch()
>         in a shared source dir.
>
>         With this change, alternate kernel recipes fetch source into their
>         ${WORKDIR} so that they may build in parallel to each other and the
>         default kernel recipe, which still fetches to STAGING_KERNEL_DIR.
>
>
>
>     But what's the system level use case for this capability ? Honestly,
>     it just
>     looks complicated .. and I'm not seeing exactly multiple kernels are
>     being
>     built in parallel in a single build. We've been forcing everything
>     explicitly
>     to be in a single, shared location .. and I see that this is both
>     complicating
>     and a possible source of errors.
>
>     It's probably that I'm just misunderstanding the point of the change.
>
>     If I had to guess, you are building recovery, or kexec/kdump kernels
>     along
>     side the main kernel ?
>
>
> Aha. I see the debug kernel reference in the comments (as one example).
>

We should have made this a little more clear in the change description. 
I added a short summary at the top to document our use case.

> As a follow up. If these kernel's are building via kernel.bbclass, how
> are you
> avoiding the artifacts all ending up in STAGING_KERNEL_BUILDDIR ? I did
> a quick scan, and couldn't see if it was being considered.
>

Good catch. It looks like I missed that one.

I modified kernel.bbclass to override STAGING_KERNEL_DIR and 
STAGING_KERNEL_BUILDDIR directly when KERNEL_PACKAGE_NAME != kernel, and 
leave S unchanged.

Built 2 kernel recipes side-by-side and verified source and artifacts 
are where they should be: work-shared dir for default kernel, work dir 
for other.

I'll post a V2 patch shortly.

> Bruce
>
>
>     Cheers,
>
>     Bruce
>
>
>         Testing:
>
>         Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
>         image and modules packages. Added kernel recipe with non-default
>         KERNEL_PACKAGE_NAME and verified it produces kernel image and
>         modules
>         packages with alternate name next to default kernel.
>
>         Signed-off-by: Gratian Crisan <gratian.crisan@ni.com
>         <mailto:gratian.crisan@ni.com>>
>         Signed-off-by: Haris Okanovic <haris.okanovic@ni.com
>         <mailto:haris.okanovic@ni.com>>
>         Coauthored-by: Haris Okanovic <haris.okanovic@ni.com
>         <mailto:haris.okanovic@ni.com>>
>         Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com
>         <mailto:josh.hernstrom@ni.com>>
>         Natinst-ReviewBoard-ID: 120348
>         Natinst-ReviewBoard-ID: 120447
>         ---
>           meta/classes/kernel-module-split.bbclass |  9 ++--
>           meta/classes/kernel.bbclass              | 71
>         ++++++++++++++++++--------------
>           meta/conf/documentation.conf             |  1 +
>           meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
>           4 files changed, 49 insertions(+), 34 deletions(-)
>
>         diff --git a/meta/classes/kernel-module-split.bbclass
>         b/meta/classes/kernel-module-split.bbclass
>         index e1a70e6..7415ec8 100644
>         --- a/meta/classes/kernel-module-split.bbclass
>         +++ b/meta/classes/kernel-module-split.bbclass
>         @@ -28,7 +28,7 @@ do_install_append() {
>
>           PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
>
>         -KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
>         +KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
>
>           python split_kernel_module_packages () {
>               import re
>         @@ -179,14 +179,17 @@ python split_kernel_module_packages () {
>                   # Avoid automatic -dev recommendations for modules
>         ending with -dev.
>                   d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
>
>         +    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
>         +    kernel_version = d.getVar("KERNEL_VERSION", True)
>         +
>               module_deps = parse_depmod()
>               module_regex = '^(.*)\.k?o$'
>         -    module_pattern = 'kernel-module-%s'
>         +    module_pattern = '%s-module-%%s' % kernel_package_name
>
>               postinst = d.getVar('pkg_postinst_modules', True)
>               postrm = d.getVar('pkg_postrm_modules', True)
>
>         -    modules = do_split_packages(d, root='/lib/modules',
>         file_regex=module_regex, output_pattern=module_pattern,
>         description='%s kernel module', postinst=postinst,
>         postrm=postrm, recursive=True, hook=frob_metadata,
>         extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION", True)))
>         +    modules = do_split_packages(d, root='/lib/modules',
>         file_regex=module_regex, output_pattern=module_pattern,
>         description='%s kernel module', postinst=postinst,
>         postrm=postrm, recursive=True, hook=frob_metadata,
>         extra_depends='%s-%s' % (kernel_package_name, kernel_version))
>               if modules:
>                   metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
>                   d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
>         diff --git a/meta/classes/kernel.bbclass
>         b/meta/classes/kernel.bbclass
>         index b75a462..cc27364 100644
>         --- a/meta/classes/kernel.bbclass
>         +++ b/meta/classes/kernel.bbclass
>         @@ -3,7 +3,6 @@ inherit linux-kernel-base kernel-module-split
>           PROVIDES += "virtual/kernel"
>           DEPENDS += "virtual/${TARGET_PREFIX}binutils
>         virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross
>         bc-native"
>
>         -S = "${STAGING_KERNEL_DIR}"
>           B = "${WORKDIR}/build"
>           KBUILD_OUTPUT = "${B}"
>           OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
>         @@ -11,6 +10,7 @@ OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
>           # we include gcc above, we dont need virtual/libc
>           INHIBIT_DEFAULT_DEPS = "1"
>
>         +KERNEL_PACKAGE_NAME ??= "kernel"
>           KERNEL_IMAGETYPE ?= "zImage"
>           INITRAMFS_IMAGE ?= ""
>           INITRAMFS_TASK ?= ""
>         @@ -34,6 +34,17 @@ python __anonymous () {
>               image_task = d.getVar('INITRAMFS_TASK', True)
>               if image_task:
>                   d.appendVarFlag('do_configure', 'depends', '
>         ${INITRAMFS_TASK}')
>         +
>         +    # The default kernel recipe fetches it's source to
>         +    # STAGING_KERNEL_DIR as defined by bitbake/distro confs.
>         +    # Alternate kernel recipes (E.g. debug kernels) fetch
>         source into
>         +    # their work dir so that they may build in parallel.
>         +    if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel":
>         +        d.setVar("S", d.getVar("STAGING_KERNEL_DIR", True))
>         +    else:
>         +        workdir = d.getVar("WORKDIR", True)
>         +        kernelSourceDir = os.path.join(workdir, 'kernel-source')
>         +        d.setVar("S", kernelSourceDir)
>           }
>
>           # Here we pull in all various kernel image types which we support.
>         @@ -79,9 +90,9 @@ base_do_unpack_append () {
>
>           inherit kernel-arch deploy
>
>         -PACKAGES_DYNAMIC += "^kernel-module-.*"
>         -PACKAGES_DYNAMIC += "^kernel-image-.*"
>         -PACKAGES_DYNAMIC += "^kernel-firmware-.*"
>         +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
>         +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
>         +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
>
>           export OS = "${TARGET_OS}"
>           export CROSS_COMPILE = "${TARGET_PREFIX}"
>         @@ -270,9 +281,9 @@ do_shared_workdir_setscene () {
>
>           emit_depmod_pkgdata() {
>                  # Stash data for depmod
>         -       install -d ${PKGDESTWORK}/kernel-depmod/
>         -       echo "${KERNEL_VERSION}" >
>         ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
>         -       cp ${B}/System.map
>         ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
>         +       install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
>         +       echo "${KERNEL_VERSION}" >
>         ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
>         +       cp ${B}/System.map
>         ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
>           }
>
>           PACKAGEFUNCS += "emit_depmod_pkgdata"
>         @@ -287,7 +298,7 @@ do_shared_workdir () {
>                  # Store the kernel version in sysroots for
>         module-base.bbclass
>                  #
>
>         -       echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
>         +       echo "${KERNEL_VERSION}" >
>         $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
>
>                  # Copy files required for module builds
>                  cp System.map $kerneldir/System.map-${KERNEL_VERSION}
>         @@ -361,28 +372,28 @@ EXPORT_FUNCTIONS do_compile do_install
>         do_configure
>
>           # kernel-base becomes kernel-${KERNEL_VERSION}
>           # kernel-image becomes kernel-image-${KERNEL_VERISON}
>         -PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image
>         kernel-dev kernel-modules"
>         +PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base
>         ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image
>         ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
>           FILES_${PN} = ""
>         -FILES_kernel-base =
>         "/lib/modules/${KERNEL_VERSION}/modules.order
>         /lib/modules/${KERNEL_VERSION}/modules.builtin"
>         -FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
>         -FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers*
>         /boot/config* ${KERNEL_SRC_PATH}
>         /lib/modules/${KERNEL_VERSION}/build"
>         -FILES_kernel-vmlinux = "/boot/vmlinux*"
>         -FILES_kernel-modules = ""
>         -RDEPENDS_kernel = "kernel-base"
>         +FILES_${KERNEL_PACKAGE_NAME}-base =
>         "/lib/modules/${KERNEL_VERSION}/modules.order
>         /lib/modules/${KERNEL_VERSION}/modules.builtin"
>         +FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
>         +FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map*
>         /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH}
>         /lib/modules/${KERNEL_VERSION}/build"
>         +FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
>         +FILES_${KERNEL_PACKAGE_NAME}-modules = ""
>         +RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
>           # Allow machines to override this dependency if kernel image
>         files are
>           # not wanted in images as standard
>         -RDEPENDS_kernel-base ?= "kernel-image"
>         -PKG_kernel-image =
>         "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
>         -RDEPENDS_kernel-image +=
>         "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux',
>         'kernel-vmlinux', '', d)}"
>         -PKG_kernel-base =
>         "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
>         -RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
>         -ALLOW_EMPTY_kernel = "1"
>         -ALLOW_EMPTY_kernel-base = "1"
>         -ALLOW_EMPTY_kernel-image = "1"
>         -ALLOW_EMPTY_kernel-modules = "1"
>         -DESCRIPTION_kernel-modules = "Kernel modules meta package"
>         -
>         -pkg_postinst_kernel-base () {
>         +RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?=
>         "${KERNEL_PACKAGE_NAME}-image"
>         +PKG_${KERNEL_PACKAGE_NAME}-image =
>         "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
>         +RDEPENDS_${KERNEL_PACKAGE_NAME}-image +=
>         "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux',
>         '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
>         +PKG_${KERNEL_PACKAGE_NAME}-base =
>         "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
>         +RPROVIDES_${KERNEL_PACKAGE_NAME}-base +=
>         "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
>         +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
>         +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
>         +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
>         +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
>         +DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules
>         meta package"
>         +
>         +pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
>                  if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
>                          mkdir -p $D/lib/modules/${KERNEL_VERSION}
>                  fi
>         @@ -393,18 +404,18 @@ pkg_postinst_kernel-base () {
>                  fi
>           }
>
>         -pkg_postinst_kernel-image () {
>         +pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
>                  update-alternatives --install
>         /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}
>         /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
>         ${KERNEL_PRIORITY} || true
>           }
>
>         -pkg_postrm_kernel-image () {
>         +pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
>                  update-alternatives --remove ${KERNEL_IMAGETYPE}
>         ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
>           }
>
>           PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
>
>           python split_kernel_packages () {
>         -    do_split_packages(d, root='/lib/firmware',
>         file_regex='^(.*)\.(bin|fw|cis|dsp)$',
>         output_pattern='kernel-firmware-%s', description='Firmware for
>         %s', recursive=True, extra_depends='')
>         +    do_split_packages(d, root='/lib/firmware',
>         file_regex='^(.*)\.(bin|fw|cis|dsp)$',
>         output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s',
>         description='Firmware for %s', recursive=True, extra_depends='')
>           }
>
>           do_strip() {
>         diff --git a/meta/conf/documentation.conf
>         b/meta/conf/documentation.conf
>         index 1b5c071..fb5e03f 100644
>         --- a/meta/conf/documentation.conf
>         +++ b/meta/conf/documentation.conf
>         @@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional
>         metadata from the Yocto Project kern
>           KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a
>         device, usually set by the machine configuration files and
>         defaults to 'zImage'."
>           KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need
>         to be auto-loaded during boot"
>           KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which
>         the build system expects to find module_conf_* values that
>         specify configuration for each of the modules"
>         +KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages.
>         Defaults to 'kernel'."
>           KERNEL_PATH[doc] = "The location of the kernel sources. This
>         variable is set to the value of the STAGING_KERNEL_DIR within
>         the module class (module.bbclass)."
>           KERNEL_SRC[doc] = "The location of the kernel sources. This
>         variable is set to the value of the STAGING_KERNEL_DIR within
>         the module class (module.bbclass)."
>           KFEATURE_DESCRIPTION[doc] = "Provides a short description of a
>         configuration fragment. You use this variable in the .scc file
>         that describes a configuration fragment file."
>         diff --git a/meta/recipes-kernel/linux/linux-dtb.inc
>         b/meta/recipes-kernel/linux/linux-dtb.inc
>         index 772adcb..c27a3cb 100644
>         --- a/meta/recipes-kernel/linux/linux-dtb.inc
>         +++ b/meta/recipes-kernel/linux/linux-dtb.inc
>         @@ -2,7 +2,7 @@
>           FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
>
>           python __anonymous () {
>         -    d.appendVar("PACKAGES", " kernel-devicetree")
>         +    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
>           }
>
>           normalize_dtb () {
>         --
>         2.6.2
>
>         --
>         _______________________________________________
>         Openembedded-core mailing list
>         Openembedded-core@lists.openembedded.org
>         <mailto:Openembedded-core@lists.openembedded.org>
>         http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>
>
>
>     --
>     "Thou shalt not follow the NULL pointer, for chaos and madness await
>     thee at its end"
>
>
>
>
> --
> "Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end"
>
>

-- Haris


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2] kernel: Add support for multiple kernel packages
  2015-12-14 20:02   ` Bruce Ashfield
  2015-12-14 22:31     ` Haris Okanovic
@ 2015-12-14 22:35     ` Haris Okanovic
  2015-12-15  0:33       ` Khem Raj
  2016-01-19 22:40       ` Haris Okanovic
  2015-12-15 16:58     ` [PATCH] " Denys Dmytriyenko
  2 siblings, 2 replies; 16+ messages in thread
From: Haris Okanovic @ 2015-12-14 22:35 UTC (permalink / raw)
  To: openembedded-core; +Cc: Haris Okanovic, Gratian Crisan

From: Gratian Crisan <gratian.crisan@ni.com>

This change allows distributions to provide multiple builds of kernel
and module packages. For example, a distro may want provide an alternate
debug kernel in a package feed for debug/testing.

Templetize kernel package name:

Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
packages. It defaults to the old hard-coded name 'kernel' but it can be
redefined by recipes that provide additional kernel packages in order
to avoid build conflicts.

Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
kernel bbclass-es.

Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:

Prior to this change, kernel recipes would all fetch source to
STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
parallel builds when more than one kernel recipes are defined in
the distribution, since they all attempted to fetch() and patch()
in a shared source dir.

With this change, alternate kernel recipes fetch source into their
${WORKDIR} so that they may build in parallel to each other and the
default kernel recipe, which still fetches to STAGING_KERNEL_DIR.

Testing:

Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
image and modules packages. Added kernel recipe with non-default
KERNEL_PACKAGE_NAME and verified it produces kernel image and modules
packages with alternate name next to default kernel.

Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
Natinst-ReviewBoard-ID: 120348
Natinst-ReviewBoard-ID: 120447
---
 meta/classes/kernel-module-split.bbclass |  9 ++--
 meta/classes/kernel.bbclass              | 76 ++++++++++++++++++++------------
 meta/conf/documentation.conf             |  1 +
 meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
 4 files changed, 55 insertions(+), 33 deletions(-)

diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index e1a70e6..7415ec8 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -28,7 +28,7 @@ do_install_append() {
 
 PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
 
-KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
+KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
 
 python split_kernel_module_packages () {
     import re
@@ -179,14 +179,17 @@ python split_kernel_module_packages () {
         # Avoid automatic -dev recommendations for modules ending with -dev.
         d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
 
+    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
+    kernel_version = d.getVar("KERNEL_VERSION", True)
+
     module_deps = parse_depmod()
     module_regex = '^(.*)\.k?o$'
-    module_pattern = 'kernel-module-%s'
+    module_pattern = '%s-module-%%s' % kernel_package_name
 
     postinst = d.getVar('pkg_postinst_modules', True)
     postrm = d.getVar('pkg_postrm_modules', True)
 
-    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION", True)))
+    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
     if modules:
         metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
         d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index b75a462..281519e 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -1,5 +1,23 @@
 inherit linux-kernel-base kernel-module-split
 
+KERNEL_PACKAGE_NAME ??= "kernel"
+
+# The default kernel recipe builds in a shared location defined by
+# bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR.
+# Set these variables to directories under ${WORKDIR} in alternate
+# kernel recipes (I.e. where KERNEL_PACKAGE_NAME != kernel) so that they
+# may build in parallel with the default kernel without clobbering.
+python __anonymous () {
+    if d.getVar("KERNEL_PACKAGE_NAME", True) != "kernel":
+        workdir = d.getVar("WORKDIR", True)
+
+        sourceDir = os.path.join(workdir, 'kernel-source')
+        artifactsDir = os.path.join(workdir, 'kernel-build-artifacts')
+
+        d.setVar("STAGING_KERNEL_DIR", sourceDir)
+        d.setVar("STAGING_KERNEL_BUILDDIR", artifactsDir)
+}
+
 PROVIDES += "virtual/kernel"
 DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native"
 
@@ -79,9 +97,9 @@ base_do_unpack_append () {
 
 inherit kernel-arch deploy
 
-PACKAGES_DYNAMIC += "^kernel-module-.*"
-PACKAGES_DYNAMIC += "^kernel-image-.*"
-PACKAGES_DYNAMIC += "^kernel-firmware-.*"
+PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
+PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
+PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
 
 export OS = "${TARGET_OS}"
 export CROSS_COMPILE = "${TARGET_PREFIX}"
@@ -270,9 +288,9 @@ do_shared_workdir_setscene () {
 
 emit_depmod_pkgdata() {
 	# Stash data for depmod
-	install -d ${PKGDESTWORK}/kernel-depmod/
-	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
-	cp ${B}/System.map ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
+	install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
+	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
+	cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
 }
 
 PACKAGEFUNCS += "emit_depmod_pkgdata"
@@ -287,7 +305,7 @@ do_shared_workdir () {
 	# Store the kernel version in sysroots for module-base.bbclass
 	#
 
-	echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
+	echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
 
 	# Copy files required for module builds
 	cp System.map $kerneldir/System.map-${KERNEL_VERSION}
@@ -361,28 +379,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
 
 # kernel-base becomes kernel-${KERNEL_VERSION}
 # kernel-image becomes kernel-image-${KERNEL_VERISON}
-PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules"
+PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
 FILES_${PN} = ""
-FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
-FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
-FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
-FILES_kernel-vmlinux = "/boot/vmlinux*"
-FILES_kernel-modules = ""
-RDEPENDS_kernel = "kernel-base"
+FILES_${KERNEL_PACKAGE_NAME}-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
+FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
+FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
+FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
+FILES_${KERNEL_PACKAGE_NAME}-modules = ""
+RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
 # Allow machines to override this dependency if kernel image files are 
 # not wanted in images as standard
-RDEPENDS_kernel-base ?= "kernel-image"
-PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
-RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', 'kernel-vmlinux', '', d)}"
-PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
-RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
-ALLOW_EMPTY_kernel = "1"
-ALLOW_EMPTY_kernel-base = "1"
-ALLOW_EMPTY_kernel-image = "1"
-ALLOW_EMPTY_kernel-modules = "1"
-DESCRIPTION_kernel-modules = "Kernel modules meta package"
-
-pkg_postinst_kernel-base () {
+RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
+PKG_${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
+RDEPENDS_${KERNEL_PACKAGE_NAME}-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
+PKG_${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
+RPROVIDES_${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
+DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package"
+
+pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
 	if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
 		mkdir -p $D/lib/modules/${KERNEL_VERSION}
 	fi
@@ -393,18 +411,18 @@ pkg_postinst_kernel-base () {
 	fi
 }
 
-pkg_postinst_kernel-image () {
+pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
 	update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
 }
 
-pkg_postrm_kernel-image () {
+pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
 	update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
 }
 
 PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
 
 python split_kernel_packages () {
-    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
+    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
 }
 
 do_strip() {
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 1b5c071..fb5e03f 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto Project kern
 KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set by the machine configuration files and defaults to 'zImage'."
 KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot"
 KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules"
+KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to 'kernel'."
 KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
 KERNEL_SRC[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
 KFEATURE_DESCRIPTION[doc] = "Provides a short description of a configuration fragment. You use this variable in the .scc file that describes a configuration fragment file."
diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index 772adcb..c27a3cb 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -2,7 +2,7 @@
 FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
 
 python __anonymous () {
-    d.appendVar("PACKAGES", " kernel-devicetree")
+    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
 }
 
 normalize_dtb () {
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] kernel: Add support for multiple kernel packages
  2015-12-14 22:35     ` [PATCH v2] " Haris Okanovic
@ 2015-12-15  0:33       ` Khem Raj
  2015-12-15 19:48         ` Haris Okanovic
  2016-01-19 22:40       ` Haris Okanovic
  1 sibling, 1 reply; 16+ messages in thread
From: Khem Raj @ 2015-12-15  0:33 UTC (permalink / raw)
  To: Haris Okanovic; +Cc: Gratian Crisan, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 13170 bytes --]


> On Dec 14, 2015, at 2:35 PM, Haris Okanovic <haris.okanovic@ni.com> wrote:
> 
> From: Gratian Crisan <gratian.crisan@ni.com>
> 
> This change allows distributions to provide multiple builds of kernel
> and module packages. For example, a distro may want provide an alternate
> debug kernel in a package feed for debug/testing.
> 
> Templetize kernel package name:
> 
> Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
> packages. It defaults to the old hard-coded name 'kernel' but it can be
> redefined by recipes that provide additional kernel packages in order
> to avoid build conflicts.
> 
> Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
> kernel bbclass-es.
> 
> Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:
> 
> Prior to this change, kernel recipes would all fetch source to
> STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
> parallel builds when more than one kernel recipes are defined in
> the distribution, since they all attempted to fetch() and patch()
> in a shared source dir.
> 
> With this change, alternate kernel recipes fetch source into their
> ${WORKDIR} so that they may build in parallel to each other and the
> default kernel recipe, which still fetches to STAGING_KERNEL_DIR.
> 
> Testing:
> 
> Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
> image and modules packages. Added kernel recipe with non-default
> KERNEL_PACKAGE_NAME and verified it produces kernel image and modules
> packages with alternate name next to default kernel.

is it all targeted at just kernel package ? can you cite some use cases which benefit from
such a thing and what are current alternatives ?

> 
> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
> Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
> Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
> Natinst-ReviewBoard-ID: 120348
> Natinst-ReviewBoard-ID: 120447
> ---
> meta/classes/kernel-module-split.bbclass |  9 ++--
> meta/classes/kernel.bbclass              | 76 ++++++++++++++++++++------------
> meta/conf/documentation.conf             |  1 +
> meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
> 4 files changed, 55 insertions(+), 33 deletions(-)
> 
> diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
> index e1a70e6..7415ec8 100644
> --- a/meta/classes/kernel-module-split.bbclass
> +++ b/meta/classes/kernel-module-split.bbclass
> @@ -28,7 +28,7 @@ do_install_append() {
> 
> PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
> 
> -KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
> +KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
> 
> python split_kernel_module_packages () {
>     import re
> @@ -179,14 +179,17 @@ python split_kernel_module_packages () {
>         # Avoid automatic -dev recommendations for modules ending with -dev.
>         d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
> 
> +    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
> +    kernel_version = d.getVar("KERNEL_VERSION", True)
> +
>     module_deps = parse_depmod()
>     module_regex = '^(.*)\.k?o$'
> -    module_pattern = 'kernel-module-%s'
> +    module_pattern = '%s-module-%%s' % kernel_package_name
> 
>     postinst = d.getVar('pkg_postinst_modules', True)
>     postrm = d.getVar('pkg_postrm_modules', True)
> 
> -    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION", True)))
> +    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
>     if modules:
>         metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
>         d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index b75a462..281519e 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -1,5 +1,23 @@
> inherit linux-kernel-base kernel-module-split
> 
> +KERNEL_PACKAGE_NAME ??= "kernel"
> +
> +# The default kernel recipe builds in a shared location defined by
> +# bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR.
> +# Set these variables to directories under ${WORKDIR} in alternate
> +# kernel recipes (I.e. where KERNEL_PACKAGE_NAME != kernel) so that they
> +# may build in parallel with the default kernel without clobbering.
> +python __anonymous () {
> +    if d.getVar("KERNEL_PACKAGE_NAME", True) != "kernel":
> +        workdir = d.getVar("WORKDIR", True)
> +
> +        sourceDir = os.path.join(workdir, 'kernel-source')
> +        artifactsDir = os.path.join(workdir, 'kernel-build-artifacts')
> +
> +        d.setVar("STAGING_KERNEL_DIR", sourceDir)
> +        d.setVar("STAGING_KERNEL_BUILDDIR", artifactsDir)
> +}
> +
> PROVIDES += "virtual/kernel"
> DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native"
> 
> @@ -79,9 +97,9 @@ base_do_unpack_append () {
> 
> inherit kernel-arch deploy
> 
> -PACKAGES_DYNAMIC += "^kernel-module-.*"
> -PACKAGES_DYNAMIC += "^kernel-image-.*"
> -PACKAGES_DYNAMIC += "^kernel-firmware-.*"
> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
> 
> export OS = "${TARGET_OS}"
> export CROSS_COMPILE = "${TARGET_PREFIX}"
> @@ -270,9 +288,9 @@ do_shared_workdir_setscene () {
> 
> emit_depmod_pkgdata() {
> 	# Stash data for depmod
> -	install -d ${PKGDESTWORK}/kernel-depmod/
> -	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
> -	cp ${B}/System.map ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
> +	install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
> +	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
> +	cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
> }
> 
> PACKAGEFUNCS += "emit_depmod_pkgdata"
> @@ -287,7 +305,7 @@ do_shared_workdir () {
> 	# Store the kernel version in sysroots for module-base.bbclass
> 	#
> 
> -	echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
> +	echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
> 
> 	# Copy files required for module builds
> 	cp System.map $kerneldir/System.map-${KERNEL_VERSION}
> @@ -361,28 +379,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
> 
> # kernel-base becomes kernel-${KERNEL_VERSION}
> # kernel-image becomes kernel-image-${KERNEL_VERISON}
> -PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules"
> +PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
> FILES_${PN} = ""
> -FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
> -FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
> -FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
> -FILES_kernel-vmlinux = "/boot/vmlinux*"
> -FILES_kernel-modules = ""
> -RDEPENDS_kernel = "kernel-base"
> +FILES_${KERNEL_PACKAGE_NAME}-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
> +FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
> +FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
> +FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
> +FILES_${KERNEL_PACKAGE_NAME}-modules = ""
> +RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
> # Allow machines to override this dependency if kernel image files are
> # not wanted in images as standard
> -RDEPENDS_kernel-base ?= "kernel-image"
> -PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> -RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', 'kernel-vmlinux', '', d)}"
> -PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
> -RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
> -ALLOW_EMPTY_kernel = "1"
> -ALLOW_EMPTY_kernel-base = "1"
> -ALLOW_EMPTY_kernel-image = "1"
> -ALLOW_EMPTY_kernel-modules = "1"
> -DESCRIPTION_kernel-modules = "Kernel modules meta package"
> -
> -pkg_postinst_kernel-base () {
> +RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
> +PKG_${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> +RDEPENDS_${KERNEL_PACKAGE_NAME}-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
> +PKG_${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
> +RPROVIDES_${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
> +DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package"
> +
> +pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
> 	if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
> 		mkdir -p $D/lib/modules/${KERNEL_VERSION}
> 	fi
> @@ -393,18 +411,18 @@ pkg_postinst_kernel-base () {
> 	fi
> }
> 
> -pkg_postinst_kernel-image () {
> +pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
> 	update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
> }
> 
> -pkg_postrm_kernel-image () {
> +pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
> 	update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
> }
> 
> PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
> 
> python split_kernel_packages () {
> -    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
> +    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
> }
> 
> do_strip() {
> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
> index 1b5c071..fb5e03f 100644
> --- a/meta/conf/documentation.conf
> +++ b/meta/conf/documentation.conf
> @@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto Project kern
> KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set by the machine configuration files and defaults to 'zImage'."
> KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot"
> KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules"
> +KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to 'kernel'."
> KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
> KERNEL_SRC[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
> KFEATURE_DESCRIPTION[doc] = "Provides a short description of a configuration fragment. You use this variable in the .scc file that describes a configuration fragment file."
> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
> index 772adcb..c27a3cb 100644
> --- a/meta/recipes-kernel/linux/linux-dtb.inc
> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> @@ -2,7 +2,7 @@
> FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
> 
> python __anonymous () {
> -    d.appendVar("PACKAGES", " kernel-devicetree")
> +    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
> }
> 
> normalize_dtb () {
> --
> 2.6.2
> 
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] kernel: Add support for multiple kernel packages
  2015-12-14 20:02   ` Bruce Ashfield
  2015-12-14 22:31     ` Haris Okanovic
  2015-12-14 22:35     ` [PATCH v2] " Haris Okanovic
@ 2015-12-15 16:58     ` Denys Dmytriyenko
  2015-12-15 19:03       ` Martin Jansa
  2 siblings, 1 reply; 16+ messages in thread
From: Denys Dmytriyenko @ 2015-12-15 16:58 UTC (permalink / raw)
  To: Bruce Ashfield
  Cc: Haris Okanovic, Gratian Crisan,
	Patches and discussions about the oe-core layer

On Mon, Dec 14, 2015 at 03:02:44PM -0500, Bruce Ashfield wrote:
> On Mon, Dec 14, 2015 at 2:17 PM, Bruce Ashfield <bruce.ashfield@gmail.com>
> wrote:
> 
> >
> >
> > On Mon, Dec 14, 2015 at 2:06 PM, Haris Okanovic <haris.okanovic@ni.com>
> > wrote:
> >
> >> From: Gratian Crisan <gratian.crisan@ni.com>
> >>
> >> Templetize kernel package name:
> >>
> >> Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
> >> packages. It defaults to the old hard-coded name 'kernel' but it can be
> >> redefined by recipes that provide additional kernel packages in order
> >> to avoid build conflicts.
> >>
> >> Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
> >> kernel bbclass-es.
> >>
> >> Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:
> >>
> >> Prior to this change, kernel recipes would all fetch source to
> >> STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
> >> parallel builds when more than one kernel recipes are defined in
> >> the distribution, since they all attempted to fetch() and patch()
> >> in a shared source dir.
> >>
> >> With this change, alternate kernel recipes fetch source into their
> >> ${WORKDIR} so that they may build in parallel to each other and the
> >> default kernel recipe, which still fetches to STAGING_KERNEL_DIR.
> >>
> >
> >
> > But what's the system level use case for this capability ? Honestly, it
> > just
> > looks complicated .. and I'm not seeing exactly multiple kernels are being
> > built in parallel in a single build. We've been forcing everything
> > explicitly
> > to be in a single, shared location .. and I see that this is both
> > complicating
> > and a possible source of errors.
> >
> > It's probably that I'm just misunderstanding the point of the change.
> >
> > If I had to guess, you are building recovery, or kexec/kdump kernels along
> > side the main kernel ?
> >
> 
> Aha. I see the debug kernel reference in the comments (as one example).
> 
> As a follow up. If these kernel's are building via kernel.bbclass, how are
> you
> avoiding the artifacts all ending up in STAGING_KERNEL_BUILDDIR ? I did
> a quick scan, and couldn't see if it was being considered.

And the next question would be - how can you build/rebuild and package 
out-of-tree modules against all the alternatives?


I've looked at doing the same for our needs and ran out of time and patience 
to cover all the corner cases... :)

As of the use cases - we have a need to provide multiple variants of the same 
kernel per platform:

1. Production
2. All debugging options enabled
3. RT patch applied
4. Any other major feature, like LPAE

It is common for Linux distros to provide multiple kernel variants:

https://wiki.ubuntu.com/Kernel/Dev/Flavours

So, it's not entirely unheard of...

-- 
Denys


> >> Testing:
> >>
> >> Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
> >> image and modules packages. Added kernel recipe with non-default
> >> KERNEL_PACKAGE_NAME and verified it produces kernel image and modules
> >> packages with alternate name next to default kernel.
> >>
> >> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
> >> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
> >> Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
> >> Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
> >> Natinst-ReviewBoard-ID: 120348
> >> Natinst-ReviewBoard-ID: 120447
> >> ---
> >>  meta/classes/kernel-module-split.bbclass |  9 ++--
> >>  meta/classes/kernel.bbclass              | 71
> >> ++++++++++++++++++--------------
> >>  meta/conf/documentation.conf             |  1 +
> >>  meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
> >>  4 files changed, 49 insertions(+), 34 deletions(-)
> >>
> >> diff --git a/meta/classes/kernel-module-split.bbclass
> >> b/meta/classes/kernel-module-split.bbclass
> >> index e1a70e6..7415ec8 100644
> >> --- a/meta/classes/kernel-module-split.bbclass
> >> +++ b/meta/classes/kernel-module-split.bbclass
> >> @@ -28,7 +28,7 @@ do_install_append() {
> >>
> >>  PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
> >>
> >> -KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
> >> +KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
> >>
> >>  python split_kernel_module_packages () {
> >>      import re
> >> @@ -179,14 +179,17 @@ python split_kernel_module_packages () {
> >>          # Avoid automatic -dev recommendations for modules ending with
> >> -dev.
> >>          d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
> >>
> >> +    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
> >> +    kernel_version = d.getVar("KERNEL_VERSION", True)
> >> +
> >>      module_deps = parse_depmod()
> >>      module_regex = '^(.*)\.k?o$'
> >> -    module_pattern = 'kernel-module-%s'
> >> +    module_pattern = '%s-module-%%s' % kernel_package_name
> >>
> >>      postinst = d.getVar('pkg_postinst_modules', True)
> >>      postrm = d.getVar('pkg_postrm_modules', True)
> >>
> >> -    modules = do_split_packages(d, root='/lib/modules',
> >> file_regex=module_regex, output_pattern=module_pattern, description='%s
> >> kernel module', postinst=postinst, postrm=postrm, recursive=True,
> >> hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION",
> >> True)))
> >> +    modules = do_split_packages(d, root='/lib/modules',
> >> file_regex=module_regex, output_pattern=module_pattern, description='%s
> >> kernel module', postinst=postinst, postrm=postrm, recursive=True,
> >> hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name,
> >> kernel_version))
> >>      if modules:
> >>          metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
> >>          d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
> >> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> >> index b75a462..cc27364 100644
> >> --- a/meta/classes/kernel.bbclass
> >> +++ b/meta/classes/kernel.bbclass
> >> @@ -3,7 +3,6 @@ inherit linux-kernel-base kernel-module-split
> >>  PROVIDES += "virtual/kernel"
> >>  DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc
> >> kmod-native depmodwrapper-cross bc-native"
> >>
> >> -S = "${STAGING_KERNEL_DIR}"
> >>  B = "${WORKDIR}/build"
> >>  KBUILD_OUTPUT = "${B}"
> >>  OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
> >> @@ -11,6 +10,7 @@ OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
> >>  # we include gcc above, we dont need virtual/libc
> >>  INHIBIT_DEFAULT_DEPS = "1"
> >>
> >> +KERNEL_PACKAGE_NAME ??= "kernel"
> >>  KERNEL_IMAGETYPE ?= "zImage"
> >>  INITRAMFS_IMAGE ?= ""
> >>  INITRAMFS_TASK ?= ""
> >> @@ -34,6 +34,17 @@ python __anonymous () {
> >>      image_task = d.getVar('INITRAMFS_TASK', True)
> >>      if image_task:
> >>          d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
> >> +
> >> +    # The default kernel recipe fetches it's source to
> >> +    # STAGING_KERNEL_DIR as defined by bitbake/distro confs.
> >> +    # Alternate kernel recipes (E.g. debug kernels) fetch source into
> >> +    # their work dir so that they may build in parallel.
> >> +    if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel":
> >> +        d.setVar("S", d.getVar("STAGING_KERNEL_DIR", True))
> >> +    else:
> >> +        workdir = d.getVar("WORKDIR", True)
> >> +        kernelSourceDir = os.path.join(workdir, 'kernel-source')
> >> +        d.setVar("S", kernelSourceDir)
> >>  }
> >>
> >>  # Here we pull in all various kernel image types which we support.
> >> @@ -79,9 +90,9 @@ base_do_unpack_append () {
> >>
> >>  inherit kernel-arch deploy
> >>
> >> -PACKAGES_DYNAMIC += "^kernel-module-.*"
> >> -PACKAGES_DYNAMIC += "^kernel-image-.*"
> >> -PACKAGES_DYNAMIC += "^kernel-firmware-.*"
> >> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
> >> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
> >> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
> >>
> >>  export OS = "${TARGET_OS}"
> >>  export CROSS_COMPILE = "${TARGET_PREFIX}"
> >> @@ -270,9 +281,9 @@ do_shared_workdir_setscene () {
> >>
> >>  emit_depmod_pkgdata() {
> >>         # Stash data for depmod
> >> -       install -d ${PKGDESTWORK}/kernel-depmod/
> >> -       echo "${KERNEL_VERSION}" >
> >> ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
> >> -       cp ${B}/System.map
> >> ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
> >> +       install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
> >> +       echo "${KERNEL_VERSION}" >
> >> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
> >> +       cp ${B}/System.map
> >> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
> >>  }
> >>
> >>  PACKAGEFUNCS += "emit_depmod_pkgdata"
> >> @@ -287,7 +298,7 @@ do_shared_workdir () {
> >>         # Store the kernel version in sysroots for module-base.bbclass
> >>         #
> >>
> >> -       echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
> >> +       echo "${KERNEL_VERSION}" >
> >> $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
> >>
> >>         # Copy files required for module builds
> >>         cp System.map $kerneldir/System.map-${KERNEL_VERSION}
> >> @@ -361,28 +372,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
> >>
> >>  # kernel-base becomes kernel-${KERNEL_VERSION}
> >>  # kernel-image becomes kernel-image-${KERNEL_VERISON}
> >> -PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev
> >> kernel-modules"
> >> +PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base
> >> ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image
> >> ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
> >>  FILES_${PN} = ""
> >> -FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order
> >> /lib/modules/${KERNEL_VERSION}/modules.builtin"
> >> -FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
> >> -FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers*
> >> /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
> >> -FILES_kernel-vmlinux = "/boot/vmlinux*"
> >> -FILES_kernel-modules = ""
> >> -RDEPENDS_kernel = "kernel-base"
> >> +FILES_${KERNEL_PACKAGE_NAME}-base =
> >> "/lib/modules/${KERNEL_VERSION}/modules.order
> >> /lib/modules/${KERNEL_VERSION}/modules.builtin"
> >> +FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
> >> +FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map*
> >> /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH}
> >> /lib/modules/${KERNEL_VERSION}/build"
> >> +FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
> >> +FILES_${KERNEL_PACKAGE_NAME}-modules = ""
> >> +RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
> >>  # Allow machines to override this dependency if kernel image files are
> >>  # not wanted in images as standard
> >> -RDEPENDS_kernel-base ?= "kernel-image"
> >> -PKG_kernel-image =
> >> "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> >> -RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE',
> >> 'vmlinux', 'kernel-vmlinux', '', d)}"
> >> -PKG_kernel-base =
> >> "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
> >> -RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
> >> -ALLOW_EMPTY_kernel = "1"
> >> -ALLOW_EMPTY_kernel-base = "1"
> >> -ALLOW_EMPTY_kernel-image = "1"
> >> -ALLOW_EMPTY_kernel-modules = "1"
> >> -DESCRIPTION_kernel-modules = "Kernel modules meta package"
> >> -
> >> -pkg_postinst_kernel-base () {
> >> +RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
> >> +PKG_${KERNEL_PACKAGE_NAME}-image =
> >> "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> >> +RDEPENDS_${KERNEL_PACKAGE_NAME}-image +=
> >> "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux',
> >> '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
> >> +PKG_${KERNEL_PACKAGE_NAME}-base =
> >> "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
> >> +RPROVIDES_${KERNEL_PACKAGE_NAME}-base +=
> >> "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
> >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
> >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
> >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
> >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
> >> +DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta
> >> package"
> >> +
> >> +pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
> >>         if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
> >>                 mkdir -p $D/lib/modules/${KERNEL_VERSION}
> >>         fi
> >> @@ -393,18 +404,18 @@ pkg_postinst_kernel-base () {
> >>         fi
> >>  }
> >>
> >> -pkg_postinst_kernel-image () {
> >> +pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
> >>         update-alternatives --install
> >> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}
> >> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
> >> ${KERNEL_PRIORITY} || true
> >>  }
> >>
> >> -pkg_postrm_kernel-image () {
> >> +pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
> >>         update-alternatives --remove ${KERNEL_IMAGETYPE}
> >> ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
> >>  }
> >>
> >>  PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
> >>
> >>  python split_kernel_packages () {
> >> -    do_split_packages(d, root='/lib/firmware',
> >> file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='kernel-firmware-%s',
> >> description='Firmware for %s', recursive=True, extra_depends='')
> >> +    do_split_packages(d, root='/lib/firmware',
> >> file_regex='^(.*)\.(bin|fw|cis|dsp)$',
> >> output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware
> >> for %s', recursive=True, extra_depends='')
> >>  }
> >>
> >>  do_strip() {
> >> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
> >> index 1b5c071..fb5e03f 100644
> >> --- a/meta/conf/documentation.conf
> >> +++ b/meta/conf/documentation.conf
> >> @@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional metadata
> >> from the Yocto Project kern
> >>  KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device,
> >> usually set by the machine configuration files and defaults to 'zImage'."
> >>  KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be
> >> auto-loaded during boot"
> >>  KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build
> >> system expects to find module_conf_* values that specify configuration for
> >> each of the modules"
> >> +KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to
> >> 'kernel'."
> >>  KERNEL_PATH[doc] = "The location of the kernel sources. This variable is
> >> set to the value of the STAGING_KERNEL_DIR within the module class
> >> (module.bbclass)."
> >>  KERNEL_SRC[doc] = "The location of the kernel sources. This variable is
> >> set to the value of the STAGING_KERNEL_DIR within the module class
> >> (module.bbclass)."
> >>  KFEATURE_DESCRIPTION[doc] = "Provides a short description of a
> >> configuration fragment. You use this variable in the .scc file that
> >> describes a configuration fragment file."
> >> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc
> >> b/meta/recipes-kernel/linux/linux-dtb.inc
> >> index 772adcb..c27a3cb 100644
> >> --- a/meta/recipes-kernel/linux/linux-dtb.inc
> >> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> >> @@ -2,7 +2,7 @@
> >>  FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
> >>
> >>  python __anonymous () {
> >> -    d.appendVar("PACKAGES", " kernel-devicetree")
> >> +    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
> >>  }
> >>
> >>  normalize_dtb () {
> >> --
> >> 2.6.2
> >>
> >> --
> >> _______________________________________________
> >> Openembedded-core mailing list
> >> Openembedded-core@lists.openembedded.org
> >> http://lists.openembedded.org/mailman/listinfo/openembedded-core
> >>
> >
> >
> >
> > --
> > "Thou shalt not follow the NULL pointer, for chaos and madness await thee
> > at its end"
> >
> 
> 
> 
> -- 
> "Thou shalt not follow the NULL pointer, for chaos and madness await thee
> at its end"

> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] kernel: Add support for multiple kernel packages
  2015-12-15 16:58     ` [PATCH] " Denys Dmytriyenko
@ 2015-12-15 19:03       ` Martin Jansa
  2015-12-15 19:10         ` Denys Dmytriyenko
  0 siblings, 1 reply; 16+ messages in thread
From: Martin Jansa @ 2015-12-15 19:03 UTC (permalink / raw)
  To: Denys Dmytriyenko
  Cc: Haris Okanovic, Gratian Crisan,
	Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 18143 bytes --]

On Tue, Dec 15, 2015 at 11:58:26AM -0500, Denys Dmytriyenko wrote:
> On Mon, Dec 14, 2015 at 03:02:44PM -0500, Bruce Ashfield wrote:
> > On Mon, Dec 14, 2015 at 2:17 PM, Bruce Ashfield <bruce.ashfield@gmail.com>
> > wrote:
> > 
> > >
> > >
> > > On Mon, Dec 14, 2015 at 2:06 PM, Haris Okanovic <haris.okanovic@ni.com>
> > > wrote:
> > >
> > >> From: Gratian Crisan <gratian.crisan@ni.com>
> > >>
> > >> Templetize kernel package name:
> > >>
> > >> Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
> > >> packages. It defaults to the old hard-coded name 'kernel' but it can be
> > >> redefined by recipes that provide additional kernel packages in order
> > >> to avoid build conflicts.
> > >>
> > >> Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
> > >> kernel bbclass-es.
> > >>
> > >> Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:
> > >>
> > >> Prior to this change, kernel recipes would all fetch source to
> > >> STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
> > >> parallel builds when more than one kernel recipes are defined in
> > >> the distribution, since they all attempted to fetch() and patch()
> > >> in a shared source dir.
> > >>
> > >> With this change, alternate kernel recipes fetch source into their
> > >> ${WORKDIR} so that they may build in parallel to each other and the
> > >> default kernel recipe, which still fetches to STAGING_KERNEL_DIR.
> > >>
> > >
> > >
> > > But what's the system level use case for this capability ? Honestly, it
> > > just
> > > looks complicated .. and I'm not seeing exactly multiple kernels are being
> > > built in parallel in a single build. We've been forcing everything
> > > explicitly
> > > to be in a single, shared location .. and I see that this is both
> > > complicating
> > > and a possible source of errors.
> > >
> > > It's probably that I'm just misunderstanding the point of the change.
> > >
> > > If I had to guess, you are building recovery, or kexec/kdump kernels along
> > > side the main kernel ?
> > >
> > 
> > Aha. I see the debug kernel reference in the comments (as one example).
> > 
> > As a follow up. If these kernel's are building via kernel.bbclass, how are
> > you
> > avoiding the artifacts all ending up in STAGING_KERNEL_BUILDDIR ? I did
> > a quick scan, and couldn't see if it was being considered.
> 
> And the next question would be - how can you build/rebuild and package 
> out-of-tree modules against all the alternatives?
> 
> 
> I've looked at doing the same for our needs and ran out of time and patience 
> to cover all the corner cases... :)

When I was implementing this for SHR, I ended with the default kernel in
default images and other kernels + out-of-tree modules built in separate
build directories with separate binary feed.

Having just separate kernel image users deploy manually is nice and
still useful, but to cover all corner cases and upgrade-able package
feeds providing different kernel flavors is indeed nightmare.

> As of the use cases - we have a need to provide multiple variants of the same 
> kernel per platform:
> 
> 1. Production
> 2. All debugging options enabled
> 3. RT patch applied
> 4. Any other major feature, like LPAE
> 
> It is common for Linux distros to provide multiple kernel variants:
> 
> https://wiki.ubuntu.com/Kernel/Dev/Flavours
> 
> So, it's not entirely unheard of...
> 
> -- 
> Denys
> 
> 
> > >> Testing:
> > >>
> > >> Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
> > >> image and modules packages. Added kernel recipe with non-default
> > >> KERNEL_PACKAGE_NAME and verified it produces kernel image and modules
> > >> packages with alternate name next to default kernel.
> > >>
> > >> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
> > >> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
> > >> Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
> > >> Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
> > >> Natinst-ReviewBoard-ID: 120348
> > >> Natinst-ReviewBoard-ID: 120447
> > >> ---
> > >>  meta/classes/kernel-module-split.bbclass |  9 ++--
> > >>  meta/classes/kernel.bbclass              | 71
> > >> ++++++++++++++++++--------------
> > >>  meta/conf/documentation.conf             |  1 +
> > >>  meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
> > >>  4 files changed, 49 insertions(+), 34 deletions(-)
> > >>
> > >> diff --git a/meta/classes/kernel-module-split.bbclass
> > >> b/meta/classes/kernel-module-split.bbclass
> > >> index e1a70e6..7415ec8 100644
> > >> --- a/meta/classes/kernel-module-split.bbclass
> > >> +++ b/meta/classes/kernel-module-split.bbclass
> > >> @@ -28,7 +28,7 @@ do_install_append() {
> > >>
> > >>  PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
> > >>
> > >> -KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
> > >> +KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
> > >>
> > >>  python split_kernel_module_packages () {
> > >>      import re
> > >> @@ -179,14 +179,17 @@ python split_kernel_module_packages () {
> > >>          # Avoid automatic -dev recommendations for modules ending with
> > >> -dev.
> > >>          d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
> > >>
> > >> +    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
> > >> +    kernel_version = d.getVar("KERNEL_VERSION", True)
> > >> +
> > >>      module_deps = parse_depmod()
> > >>      module_regex = '^(.*)\.k?o$'
> > >> -    module_pattern = 'kernel-module-%s'
> > >> +    module_pattern = '%s-module-%%s' % kernel_package_name
> > >>
> > >>      postinst = d.getVar('pkg_postinst_modules', True)
> > >>      postrm = d.getVar('pkg_postrm_modules', True)
> > >>
> > >> -    modules = do_split_packages(d, root='/lib/modules',
> > >> file_regex=module_regex, output_pattern=module_pattern, description='%s
> > >> kernel module', postinst=postinst, postrm=postrm, recursive=True,
> > >> hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION",
> > >> True)))
> > >> +    modules = do_split_packages(d, root='/lib/modules',
> > >> file_regex=module_regex, output_pattern=module_pattern, description='%s
> > >> kernel module', postinst=postinst, postrm=postrm, recursive=True,
> > >> hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name,
> > >> kernel_version))
> > >>      if modules:
> > >>          metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
> > >>          d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
> > >> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> > >> index b75a462..cc27364 100644
> > >> --- a/meta/classes/kernel.bbclass
> > >> +++ b/meta/classes/kernel.bbclass
> > >> @@ -3,7 +3,6 @@ inherit linux-kernel-base kernel-module-split
> > >>  PROVIDES += "virtual/kernel"
> > >>  DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc
> > >> kmod-native depmodwrapper-cross bc-native"
> > >>
> > >> -S = "${STAGING_KERNEL_DIR}"
> > >>  B = "${WORKDIR}/build"
> > >>  KBUILD_OUTPUT = "${B}"
> > >>  OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
> > >> @@ -11,6 +10,7 @@ OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
> > >>  # we include gcc above, we dont need virtual/libc
> > >>  INHIBIT_DEFAULT_DEPS = "1"
> > >>
> > >> +KERNEL_PACKAGE_NAME ??= "kernel"
> > >>  KERNEL_IMAGETYPE ?= "zImage"
> > >>  INITRAMFS_IMAGE ?= ""
> > >>  INITRAMFS_TASK ?= ""
> > >> @@ -34,6 +34,17 @@ python __anonymous () {
> > >>      image_task = d.getVar('INITRAMFS_TASK', True)
> > >>      if image_task:
> > >>          d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
> > >> +
> > >> +    # The default kernel recipe fetches it's source to
> > >> +    # STAGING_KERNEL_DIR as defined by bitbake/distro confs.
> > >> +    # Alternate kernel recipes (E.g. debug kernels) fetch source into
> > >> +    # their work dir so that they may build in parallel.
> > >> +    if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel":
> > >> +        d.setVar("S", d.getVar("STAGING_KERNEL_DIR", True))
> > >> +    else:
> > >> +        workdir = d.getVar("WORKDIR", True)
> > >> +        kernelSourceDir = os.path.join(workdir, 'kernel-source')
> > >> +        d.setVar("S", kernelSourceDir)
> > >>  }
> > >>
> > >>  # Here we pull in all various kernel image types which we support.
> > >> @@ -79,9 +90,9 @@ base_do_unpack_append () {
> > >>
> > >>  inherit kernel-arch deploy
> > >>
> > >> -PACKAGES_DYNAMIC += "^kernel-module-.*"
> > >> -PACKAGES_DYNAMIC += "^kernel-image-.*"
> > >> -PACKAGES_DYNAMIC += "^kernel-firmware-.*"
> > >> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
> > >> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
> > >> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
> > >>
> > >>  export OS = "${TARGET_OS}"
> > >>  export CROSS_COMPILE = "${TARGET_PREFIX}"
> > >> @@ -270,9 +281,9 @@ do_shared_workdir_setscene () {
> > >>
> > >>  emit_depmod_pkgdata() {
> > >>         # Stash data for depmod
> > >> -       install -d ${PKGDESTWORK}/kernel-depmod/
> > >> -       echo "${KERNEL_VERSION}" >
> > >> ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
> > >> -       cp ${B}/System.map
> > >> ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
> > >> +       install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
> > >> +       echo "${KERNEL_VERSION}" >
> > >> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
> > >> +       cp ${B}/System.map
> > >> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
> > >>  }
> > >>
> > >>  PACKAGEFUNCS += "emit_depmod_pkgdata"
> > >> @@ -287,7 +298,7 @@ do_shared_workdir () {
> > >>         # Store the kernel version in sysroots for module-base.bbclass
> > >>         #
> > >>
> > >> -       echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
> > >> +       echo "${KERNEL_VERSION}" >
> > >> $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
> > >>
> > >>         # Copy files required for module builds
> > >>         cp System.map $kerneldir/System.map-${KERNEL_VERSION}
> > >> @@ -361,28 +372,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
> > >>
> > >>  # kernel-base becomes kernel-${KERNEL_VERSION}
> > >>  # kernel-image becomes kernel-image-${KERNEL_VERISON}
> > >> -PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev
> > >> kernel-modules"
> > >> +PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base
> > >> ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image
> > >> ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
> > >>  FILES_${PN} = ""
> > >> -FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order
> > >> /lib/modules/${KERNEL_VERSION}/modules.builtin"
> > >> -FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
> > >> -FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers*
> > >> /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
> > >> -FILES_kernel-vmlinux = "/boot/vmlinux*"
> > >> -FILES_kernel-modules = ""
> > >> -RDEPENDS_kernel = "kernel-base"
> > >> +FILES_${KERNEL_PACKAGE_NAME}-base =
> > >> "/lib/modules/${KERNEL_VERSION}/modules.order
> > >> /lib/modules/${KERNEL_VERSION}/modules.builtin"
> > >> +FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
> > >> +FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map*
> > >> /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH}
> > >> /lib/modules/${KERNEL_VERSION}/build"
> > >> +FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
> > >> +FILES_${KERNEL_PACKAGE_NAME}-modules = ""
> > >> +RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
> > >>  # Allow machines to override this dependency if kernel image files are
> > >>  # not wanted in images as standard
> > >> -RDEPENDS_kernel-base ?= "kernel-image"
> > >> -PKG_kernel-image =
> > >> "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> > >> -RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE',
> > >> 'vmlinux', 'kernel-vmlinux', '', d)}"
> > >> -PKG_kernel-base =
> > >> "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
> > >> -RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
> > >> -ALLOW_EMPTY_kernel = "1"
> > >> -ALLOW_EMPTY_kernel-base = "1"
> > >> -ALLOW_EMPTY_kernel-image = "1"
> > >> -ALLOW_EMPTY_kernel-modules = "1"
> > >> -DESCRIPTION_kernel-modules = "Kernel modules meta package"
> > >> -
> > >> -pkg_postinst_kernel-base () {
> > >> +RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
> > >> +PKG_${KERNEL_PACKAGE_NAME}-image =
> > >> "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> > >> +RDEPENDS_${KERNEL_PACKAGE_NAME}-image +=
> > >> "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux',
> > >> '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
> > >> +PKG_${KERNEL_PACKAGE_NAME}-base =
> > >> "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
> > >> +RPROVIDES_${KERNEL_PACKAGE_NAME}-base +=
> > >> "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
> > >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
> > >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
> > >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
> > >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
> > >> +DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta
> > >> package"
> > >> +
> > >> +pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
> > >>         if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
> > >>                 mkdir -p $D/lib/modules/${KERNEL_VERSION}
> > >>         fi
> > >> @@ -393,18 +404,18 @@ pkg_postinst_kernel-base () {
> > >>         fi
> > >>  }
> > >>
> > >> -pkg_postinst_kernel-image () {
> > >> +pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
> > >>         update-alternatives --install
> > >> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}
> > >> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
> > >> ${KERNEL_PRIORITY} || true
> > >>  }
> > >>
> > >> -pkg_postrm_kernel-image () {
> > >> +pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
> > >>         update-alternatives --remove ${KERNEL_IMAGETYPE}
> > >> ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
> > >>  }
> > >>
> > >>  PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
> > >>
> > >>  python split_kernel_packages () {
> > >> -    do_split_packages(d, root='/lib/firmware',
> > >> file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='kernel-firmware-%s',
> > >> description='Firmware for %s', recursive=True, extra_depends='')
> > >> +    do_split_packages(d, root='/lib/firmware',
> > >> file_regex='^(.*)\.(bin|fw|cis|dsp)$',
> > >> output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware
> > >> for %s', recursive=True, extra_depends='')
> > >>  }
> > >>
> > >>  do_strip() {
> > >> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
> > >> index 1b5c071..fb5e03f 100644
> > >> --- a/meta/conf/documentation.conf
> > >> +++ b/meta/conf/documentation.conf
> > >> @@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional metadata
> > >> from the Yocto Project kern
> > >>  KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device,
> > >> usually set by the machine configuration files and defaults to 'zImage'."
> > >>  KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be
> > >> auto-loaded during boot"
> > >>  KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build
> > >> system expects to find module_conf_* values that specify configuration for
> > >> each of the modules"
> > >> +KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to
> > >> 'kernel'."
> > >>  KERNEL_PATH[doc] = "The location of the kernel sources. This variable is
> > >> set to the value of the STAGING_KERNEL_DIR within the module class
> > >> (module.bbclass)."
> > >>  KERNEL_SRC[doc] = "The location of the kernel sources. This variable is
> > >> set to the value of the STAGING_KERNEL_DIR within the module class
> > >> (module.bbclass)."
> > >>  KFEATURE_DESCRIPTION[doc] = "Provides a short description of a
> > >> configuration fragment. You use this variable in the .scc file that
> > >> describes a configuration fragment file."
> > >> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc
> > >> b/meta/recipes-kernel/linux/linux-dtb.inc
> > >> index 772adcb..c27a3cb 100644
> > >> --- a/meta/recipes-kernel/linux/linux-dtb.inc
> > >> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> > >> @@ -2,7 +2,7 @@
> > >>  FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
> > >>
> > >>  python __anonymous () {
> > >> -    d.appendVar("PACKAGES", " kernel-devicetree")
> > >> +    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
> > >>  }
> > >>
> > >>  normalize_dtb () {
> > >> --
> > >> 2.6.2
> > >>
> > >> --
> > >> _______________________________________________
> > >> Openembedded-core mailing list
> > >> Openembedded-core@lists.openembedded.org
> > >> http://lists.openembedded.org/mailman/listinfo/openembedded-core
> > >>
> > >
> > >
> > >
> > > --
> > > "Thou shalt not follow the NULL pointer, for chaos and madness await thee
> > > at its end"
> > >
> > 
> > 
> > 
> > -- 
> > "Thou shalt not follow the NULL pointer, for chaos and madness await thee
> > at its end"
> 
> > -- 
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] kernel: Add support for multiple kernel packages
  2015-12-15 19:03       ` Martin Jansa
@ 2015-12-15 19:10         ` Denys Dmytriyenko
  2015-12-15 19:45           ` Haris Okanovic
  0 siblings, 1 reply; 16+ messages in thread
From: Denys Dmytriyenko @ 2015-12-15 19:10 UTC (permalink / raw)
  To: Martin Jansa
  Cc: Haris Okanovic, Gratian Crisan,
	Patches and discussions about the oe-core layer

On Tue, Dec 15, 2015 at 08:03:10PM +0100, Martin Jansa wrote:
> On Tue, Dec 15, 2015 at 11:58:26AM -0500, Denys Dmytriyenko wrote:
> > On Mon, Dec 14, 2015 at 03:02:44PM -0500, Bruce Ashfield wrote:
> > > On Mon, Dec 14, 2015 at 2:17 PM, Bruce Ashfield <bruce.ashfield@gmail.com>
> > > wrote:
> > > 
> > > >
> > > >
> > > > On Mon, Dec 14, 2015 at 2:06 PM, Haris Okanovic <haris.okanovic@ni.com>
> > > > wrote:
> > > >
> > > >> From: Gratian Crisan <gratian.crisan@ni.com>
> > > >>
> > > >> Templetize kernel package name:
> > > >>
> > > >> Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
> > > >> packages. It defaults to the old hard-coded name 'kernel' but it can be
> > > >> redefined by recipes that provide additional kernel packages in order
> > > >> to avoid build conflicts.
> > > >>
> > > >> Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
> > > >> kernel bbclass-es.
> > > >>
> > > >> Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:
> > > >>
> > > >> Prior to this change, kernel recipes would all fetch source to
> > > >> STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
> > > >> parallel builds when more than one kernel recipes are defined in
> > > >> the distribution, since they all attempted to fetch() and patch()
> > > >> in a shared source dir.
> > > >>
> > > >> With this change, alternate kernel recipes fetch source into their
> > > >> ${WORKDIR} so that they may build in parallel to each other and the
> > > >> default kernel recipe, which still fetches to STAGING_KERNEL_DIR.
> > > >>
> > > >
> > > >
> > > > But what's the system level use case for this capability ? Honestly, it
> > > > just
> > > > looks complicated .. and I'm not seeing exactly multiple kernels are being
> > > > built in parallel in a single build. We've been forcing everything
> > > > explicitly
> > > > to be in a single, shared location .. and I see that this is both
> > > > complicating
> > > > and a possible source of errors.
> > > >
> > > > It's probably that I'm just misunderstanding the point of the change.
> > > >
> > > > If I had to guess, you are building recovery, or kexec/kdump kernels along
> > > > side the main kernel ?
> > > >
> > > 
> > > Aha. I see the debug kernel reference in the comments (as one example).
> > > 
> > > As a follow up. If these kernel's are building via kernel.bbclass, how are
> > > you
> > > avoiding the artifacts all ending up in STAGING_KERNEL_BUILDDIR ? I did
> > > a quick scan, and couldn't see if it was being considered.
> > 
> > And the next question would be - how can you build/rebuild and package 
> > out-of-tree modules against all the alternatives?
> > 
> > 
> > I've looked at doing the same for our needs and ran out of time and patience 
> > to cover all the corner cases... :)
> 
> When I was implementing this for SHR, I ended with the default kernel in
> default images and other kernels + out-of-tree modules built in separate
> build directories with separate binary feed.

Yep, I ended up using separate build directories and setting corresponding 
PREFERRED_PROVIDER_virtual/kernel for now...


> Having just separate kernel image users deploy manually is nice and
> still useful, but to cover all corner cases and upgrade-able package
> feeds providing different kernel flavors is indeed nightmare.

Agree. Should we raise this topic for more detailed discussion on the new 
Architecture list, as it seems it would require some invasive changes and 
careful consideration of all the corner cases?


> > As of the use cases - we have a need to provide multiple variants of the same 
> > kernel per platform:
> > 
> > 1. Production
> > 2. All debugging options enabled
> > 3. RT patch applied
> > 4. Any other major feature, like LPAE
> > 
> > It is common for Linux distros to provide multiple kernel variants:
> > 
> > https://wiki.ubuntu.com/Kernel/Dev/Flavours
> > 
> > So, it's not entirely unheard of...
> > 
> > -- 
> > Denys
> > 
> > 
> > > >> Testing:
> > > >>
> > > >> Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
> > > >> image and modules packages. Added kernel recipe with non-default
> > > >> KERNEL_PACKAGE_NAME and verified it produces kernel image and modules
> > > >> packages with alternate name next to default kernel.
> > > >>
> > > >> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
> > > >> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
> > > >> Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
> > > >> Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
> > > >> Natinst-ReviewBoard-ID: 120348
> > > >> Natinst-ReviewBoard-ID: 120447
> > > >> ---
> > > >>  meta/classes/kernel-module-split.bbclass |  9 ++--
> > > >>  meta/classes/kernel.bbclass              | 71
> > > >> ++++++++++++++++++--------------
> > > >>  meta/conf/documentation.conf             |  1 +
> > > >>  meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
> > > >>  4 files changed, 49 insertions(+), 34 deletions(-)
> > > >>
> > > >> diff --git a/meta/classes/kernel-module-split.bbclass
> > > >> b/meta/classes/kernel-module-split.bbclass
> > > >> index e1a70e6..7415ec8 100644
> > > >> --- a/meta/classes/kernel-module-split.bbclass
> > > >> +++ b/meta/classes/kernel-module-split.bbclass
> > > >> @@ -28,7 +28,7 @@ do_install_append() {
> > > >>
> > > >>  PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
> > > >>
> > > >> -KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
> > > >> +KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
> > > >>
> > > >>  python split_kernel_module_packages () {
> > > >>      import re
> > > >> @@ -179,14 +179,17 @@ python split_kernel_module_packages () {
> > > >>          # Avoid automatic -dev recommendations for modules ending with
> > > >> -dev.
> > > >>          d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
> > > >>
> > > >> +    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
> > > >> +    kernel_version = d.getVar("KERNEL_VERSION", True)
> > > >> +
> > > >>      module_deps = parse_depmod()
> > > >>      module_regex = '^(.*)\.k?o$'
> > > >> -    module_pattern = 'kernel-module-%s'
> > > >> +    module_pattern = '%s-module-%%s' % kernel_package_name
> > > >>
> > > >>      postinst = d.getVar('pkg_postinst_modules', True)
> > > >>      postrm = d.getVar('pkg_postrm_modules', True)
> > > >>
> > > >> -    modules = do_split_packages(d, root='/lib/modules',
> > > >> file_regex=module_regex, output_pattern=module_pattern, description='%s
> > > >> kernel module', postinst=postinst, postrm=postrm, recursive=True,
> > > >> hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION",
> > > >> True)))
> > > >> +    modules = do_split_packages(d, root='/lib/modules',
> > > >> file_regex=module_regex, output_pattern=module_pattern, description='%s
> > > >> kernel module', postinst=postinst, postrm=postrm, recursive=True,
> > > >> hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name,
> > > >> kernel_version))
> > > >>      if modules:
> > > >>          metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
> > > >>          d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
> > > >> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> > > >> index b75a462..cc27364 100644
> > > >> --- a/meta/classes/kernel.bbclass
> > > >> +++ b/meta/classes/kernel.bbclass
> > > >> @@ -3,7 +3,6 @@ inherit linux-kernel-base kernel-module-split
> > > >>  PROVIDES += "virtual/kernel"
> > > >>  DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc
> > > >> kmod-native depmodwrapper-cross bc-native"
> > > >>
> > > >> -S = "${STAGING_KERNEL_DIR}"
> > > >>  B = "${WORKDIR}/build"
> > > >>  KBUILD_OUTPUT = "${B}"
> > > >>  OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
> > > >> @@ -11,6 +10,7 @@ OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
> > > >>  # we include gcc above, we dont need virtual/libc
> > > >>  INHIBIT_DEFAULT_DEPS = "1"
> > > >>
> > > >> +KERNEL_PACKAGE_NAME ??= "kernel"
> > > >>  KERNEL_IMAGETYPE ?= "zImage"
> > > >>  INITRAMFS_IMAGE ?= ""
> > > >>  INITRAMFS_TASK ?= ""
> > > >> @@ -34,6 +34,17 @@ python __anonymous () {
> > > >>      image_task = d.getVar('INITRAMFS_TASK', True)
> > > >>      if image_task:
> > > >>          d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
> > > >> +
> > > >> +    # The default kernel recipe fetches it's source to
> > > >> +    # STAGING_KERNEL_DIR as defined by bitbake/distro confs.
> > > >> +    # Alternate kernel recipes (E.g. debug kernels) fetch source into
> > > >> +    # their work dir so that they may build in parallel.
> > > >> +    if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel":
> > > >> +        d.setVar("S", d.getVar("STAGING_KERNEL_DIR", True))
> > > >> +    else:
> > > >> +        workdir = d.getVar("WORKDIR", True)
> > > >> +        kernelSourceDir = os.path.join(workdir, 'kernel-source')
> > > >> +        d.setVar("S", kernelSourceDir)
> > > >>  }
> > > >>
> > > >>  # Here we pull in all various kernel image types which we support.
> > > >> @@ -79,9 +90,9 @@ base_do_unpack_append () {
> > > >>
> > > >>  inherit kernel-arch deploy
> > > >>
> > > >> -PACKAGES_DYNAMIC += "^kernel-module-.*"
> > > >> -PACKAGES_DYNAMIC += "^kernel-image-.*"
> > > >> -PACKAGES_DYNAMIC += "^kernel-firmware-.*"
> > > >> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
> > > >> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
> > > >> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
> > > >>
> > > >>  export OS = "${TARGET_OS}"
> > > >>  export CROSS_COMPILE = "${TARGET_PREFIX}"
> > > >> @@ -270,9 +281,9 @@ do_shared_workdir_setscene () {
> > > >>
> > > >>  emit_depmod_pkgdata() {
> > > >>         # Stash data for depmod
> > > >> -       install -d ${PKGDESTWORK}/kernel-depmod/
> > > >> -       echo "${KERNEL_VERSION}" >
> > > >> ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
> > > >> -       cp ${B}/System.map
> > > >> ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
> > > >> +       install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
> > > >> +       echo "${KERNEL_VERSION}" >
> > > >> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
> > > >> +       cp ${B}/System.map
> > > >> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
> > > >>  }
> > > >>
> > > >>  PACKAGEFUNCS += "emit_depmod_pkgdata"
> > > >> @@ -287,7 +298,7 @@ do_shared_workdir () {
> > > >>         # Store the kernel version in sysroots for module-base.bbclass
> > > >>         #
> > > >>
> > > >> -       echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
> > > >> +       echo "${KERNEL_VERSION}" >
> > > >> $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
> > > >>
> > > >>         # Copy files required for module builds
> > > >>         cp System.map $kerneldir/System.map-${KERNEL_VERSION}
> > > >> @@ -361,28 +372,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
> > > >>
> > > >>  # kernel-base becomes kernel-${KERNEL_VERSION}
> > > >>  # kernel-image becomes kernel-image-${KERNEL_VERISON}
> > > >> -PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev
> > > >> kernel-modules"
> > > >> +PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base
> > > >> ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image
> > > >> ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
> > > >>  FILES_${PN} = ""
> > > >> -FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order
> > > >> /lib/modules/${KERNEL_VERSION}/modules.builtin"
> > > >> -FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
> > > >> -FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers*
> > > >> /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
> > > >> -FILES_kernel-vmlinux = "/boot/vmlinux*"
> > > >> -FILES_kernel-modules = ""
> > > >> -RDEPENDS_kernel = "kernel-base"
> > > >> +FILES_${KERNEL_PACKAGE_NAME}-base =
> > > >> "/lib/modules/${KERNEL_VERSION}/modules.order
> > > >> /lib/modules/${KERNEL_VERSION}/modules.builtin"
> > > >> +FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
> > > >> +FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map*
> > > >> /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH}
> > > >> /lib/modules/${KERNEL_VERSION}/build"
> > > >> +FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
> > > >> +FILES_${KERNEL_PACKAGE_NAME}-modules = ""
> > > >> +RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
> > > >>  # Allow machines to override this dependency if kernel image files are
> > > >>  # not wanted in images as standard
> > > >> -RDEPENDS_kernel-base ?= "kernel-image"
> > > >> -PKG_kernel-image =
> > > >> "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> > > >> -RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE',
> > > >> 'vmlinux', 'kernel-vmlinux', '', d)}"
> > > >> -PKG_kernel-base =
> > > >> "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
> > > >> -RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
> > > >> -ALLOW_EMPTY_kernel = "1"
> > > >> -ALLOW_EMPTY_kernel-base = "1"
> > > >> -ALLOW_EMPTY_kernel-image = "1"
> > > >> -ALLOW_EMPTY_kernel-modules = "1"
> > > >> -DESCRIPTION_kernel-modules = "Kernel modules meta package"
> > > >> -
> > > >> -pkg_postinst_kernel-base () {
> > > >> +RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
> > > >> +PKG_${KERNEL_PACKAGE_NAME}-image =
> > > >> "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> > > >> +RDEPENDS_${KERNEL_PACKAGE_NAME}-image +=
> > > >> "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux',
> > > >> '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
> > > >> +PKG_${KERNEL_PACKAGE_NAME}-base =
> > > >> "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
> > > >> +RPROVIDES_${KERNEL_PACKAGE_NAME}-base +=
> > > >> "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
> > > >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
> > > >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
> > > >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
> > > >> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
> > > >> +DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta
> > > >> package"
> > > >> +
> > > >> +pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
> > > >>         if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
> > > >>                 mkdir -p $D/lib/modules/${KERNEL_VERSION}
> > > >>         fi
> > > >> @@ -393,18 +404,18 @@ pkg_postinst_kernel-base () {
> > > >>         fi
> > > >>  }
> > > >>
> > > >> -pkg_postinst_kernel-image () {
> > > >> +pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
> > > >>         update-alternatives --install
> > > >> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}
> > > >> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
> > > >> ${KERNEL_PRIORITY} || true
> > > >>  }
> > > >>
> > > >> -pkg_postrm_kernel-image () {
> > > >> +pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
> > > >>         update-alternatives --remove ${KERNEL_IMAGETYPE}
> > > >> ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
> > > >>  }
> > > >>
> > > >>  PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
> > > >>
> > > >>  python split_kernel_packages () {
> > > >> -    do_split_packages(d, root='/lib/firmware',
> > > >> file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='kernel-firmware-%s',
> > > >> description='Firmware for %s', recursive=True, extra_depends='')
> > > >> +    do_split_packages(d, root='/lib/firmware',
> > > >> file_regex='^(.*)\.(bin|fw|cis|dsp)$',
> > > >> output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware
> > > >> for %s', recursive=True, extra_depends='')
> > > >>  }
> > > >>
> > > >>  do_strip() {
> > > >> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
> > > >> index 1b5c071..fb5e03f 100644
> > > >> --- a/meta/conf/documentation.conf
> > > >> +++ b/meta/conf/documentation.conf
> > > >> @@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional metadata
> > > >> from the Yocto Project kern
> > > >>  KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device,
> > > >> usually set by the machine configuration files and defaults to 'zImage'."
> > > >>  KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be
> > > >> auto-loaded during boot"
> > > >>  KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build
> > > >> system expects to find module_conf_* values that specify configuration for
> > > >> each of the modules"
> > > >> +KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to
> > > >> 'kernel'."
> > > >>  KERNEL_PATH[doc] = "The location of the kernel sources. This variable is
> > > >> set to the value of the STAGING_KERNEL_DIR within the module class
> > > >> (module.bbclass)."
> > > >>  KERNEL_SRC[doc] = "The location of the kernel sources. This variable is
> > > >> set to the value of the STAGING_KERNEL_DIR within the module class
> > > >> (module.bbclass)."
> > > >>  KFEATURE_DESCRIPTION[doc] = "Provides a short description of a
> > > >> configuration fragment. You use this variable in the .scc file that
> > > >> describes a configuration fragment file."
> > > >> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc
> > > >> b/meta/recipes-kernel/linux/linux-dtb.inc
> > > >> index 772adcb..c27a3cb 100644
> > > >> --- a/meta/recipes-kernel/linux/linux-dtb.inc
> > > >> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> > > >> @@ -2,7 +2,7 @@
> > > >>  FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
> > > >>
> > > >>  python __anonymous () {
> > > >> -    d.appendVar("PACKAGES", " kernel-devicetree")
> > > >> +    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
> > > >>  }
> > > >>
> > > >>  normalize_dtb () {
> > > >> --
> > > >> 2.6.2
> > > >>
> > > >> --
> > > >> _______________________________________________
> > > >> Openembedded-core mailing list
> > > >> Openembedded-core@lists.openembedded.org
> > > >> http://lists.openembedded.org/mailman/listinfo/openembedded-core
> > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > "Thou shalt not follow the NULL pointer, for chaos and madness await thee
> > > > at its end"
> > > >
> > > 
> > > 
> > > 
> > > -- 
> > > "Thou shalt not follow the NULL pointer, for chaos and madness await thee
> > > at its end"
> > 
> > > -- 
> > > _______________________________________________
> > > Openembedded-core mailing list
> > > Openembedded-core@lists.openembedded.org
> > > http://lists.openembedded.org/mailman/listinfo/openembedded-core
> > 
> > -- 
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
> 
> -- 
> Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] kernel: Add support for multiple kernel packages
  2015-12-15 19:10         ` Denys Dmytriyenko
@ 2015-12-15 19:45           ` Haris Okanovic
  0 siblings, 0 replies; 16+ messages in thread
From: Haris Okanovic @ 2015-12-15 19:45 UTC (permalink / raw)
  To: Denys Dmytriyenko, Martin Jansa
  Cc: Gratian Crisan, Patches and discussions about the oe-core layer

On 12/15/2015 01:10 PM, Denys Dmytriyenko wrote:
> On Tue, Dec 15, 2015 at 08:03:10PM +0100, Martin Jansa wrote:
>> On Tue, Dec 15, 2015 at 11:58:26AM -0500, Denys Dmytriyenko wrote:
>>> On Mon, Dec 14, 2015 at 03:02:44PM -0500, Bruce Ashfield wrote:
>>>> On Mon, Dec 14, 2015 at 2:17 PM, Bruce Ashfield <bruce.ashfield@gmail.com>
>>>> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Mon, Dec 14, 2015 at 2:06 PM, Haris Okanovic <haris.okanovic@ni.com>
>>>>> wrote:
>>>>>
>>>>>> From: Gratian Crisan <gratian.crisan@ni.com>
>>>>>>
>>>>>> Templetize kernel package name:
>>>>>>
>>>>>> Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
>>>>>> packages. It defaults to the old hard-coded name 'kernel' but it can be
>>>>>> redefined by recipes that provide additional kernel packages in order
>>>>>> to avoid build conflicts.
>>>>>>
>>>>>> Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
>>>>>> kernel bbclass-es.
>>>>>>
>>>>>> Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:
>>>>>>
>>>>>> Prior to this change, kernel recipes would all fetch source to
>>>>>> STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
>>>>>> parallel builds when more than one kernel recipes are defined in
>>>>>> the distribution, since they all attempted to fetch() and patch()
>>>>>> in a shared source dir.
>>>>>>
>>>>>> With this change, alternate kernel recipes fetch source into their
>>>>>> ${WORKDIR} so that they may build in parallel to each other and the
>>>>>> default kernel recipe, which still fetches to STAGING_KERNEL_DIR.
>>>>>>
>>>>>
>>>>>
>>>>> But what's the system level use case for this capability ? Honestly, it
>>>>> just
>>>>> looks complicated .. and I'm not seeing exactly multiple kernels are being
>>>>> built in parallel in a single build. We've been forcing everything
>>>>> explicitly
>>>>> to be in a single, shared location .. and I see that this is both
>>>>> complicating
>>>>> and a possible source of errors.
>>>>>
>>>>> It's probably that I'm just misunderstanding the point of the change.
>>>>>
>>>>> If I had to guess, you are building recovery, or kexec/kdump kernels along
>>>>> side the main kernel ?
>>>>>
>>>>
>>>> Aha. I see the debug kernel reference in the comments (as one example).
>>>>
>>>> As a follow up. If these kernel's are building via kernel.bbclass, how are
>>>> you
>>>> avoiding the artifacts all ending up in STAGING_KERNEL_BUILDDIR ? I did
>>>> a quick scan, and couldn't see if it was being considered.
>>>
>>> And the next question would be - how can you build/rebuild and package
>>> out-of-tree modules against all the alternatives?
>>>
>>>
>>> I've looked at doing the same for our needs and ran out of time and patience
>>> to cover all the corner cases... :)
>>
>> When I was implementing this for SHR, I ended with the default kernel in
>> default images and other kernels + out-of-tree modules built in separate
>> build directories with separate binary feed.
>
> Yep, I ended up using separate build directories and setting corresponding
> PREFERRED_PROVIDER_virtual/kernel for now...
>
>
>> Having just separate kernel image users deploy manually is nice and
>> still useful, but to cover all corner cases and upgrade-able package
>> feeds providing different kernel flavors is indeed nightmare.
>
> Agree. Should we raise this topic for more detailed discussion on the new
> Architecture list, as it seems it would require some invasive changes and
> careful consideration of all the corner cases?
>

Denys, Martin,

Do you think the proposed change precludes this kind of future improvement?

We build most of our drivers outside of OE entirely and version 
on-target against the running kernel, which is why we're only looking to 
provide multiple kernel images + in-tree modules at the moment. We're 
willing to make any change if you guys think it'll help bridge the gap 
between the current implementation and wherever we decide to go in the 
future.

Our change shouldn't break existing recipes, unless they happen to 
already define a KERNEL_PACKAGE_NAME variable (unlikely imo). We're 
defaulting everything in kernel.bbclass & friends so that they behave 
the same as they do now.

-- Haris


>
>>> As of the use cases - we have a need to provide multiple variants of the same
>>> kernel per platform:
>>>
>>> 1. Production
>>> 2. All debugging options enabled
>>> 3. RT patch applied
>>> 4. Any other major feature, like LPAE
>>>
>>> It is common for Linux distros to provide multiple kernel variants:
>>>
>>> https://wiki.ubuntu.com/Kernel/Dev/Flavours
>>>
>>> So, it's not entirely unheard of...
>>>
>>> --
>>> Denys
>>>
>>>
>>>>>> Testing:
>>>>>>
>>>>>> Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
>>>>>> image and modules packages. Added kernel recipe with non-default
>>>>>> KERNEL_PACKAGE_NAME and verified it produces kernel image and modules
>>>>>> packages with alternate name next to default kernel.
>>>>>>
>>>>>> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
>>>>>> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
>>>>>> Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
>>>>>> Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
>>>>>> Natinst-ReviewBoard-ID: 120348
>>>>>> Natinst-ReviewBoard-ID: 120447
>>>>>> ---
>>>>>>   meta/classes/kernel-module-split.bbclass |  9 ++--
>>>>>>   meta/classes/kernel.bbclass              | 71
>>>>>> ++++++++++++++++++--------------
>>>>>>   meta/conf/documentation.conf             |  1 +
>>>>>>   meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
>>>>>>   4 files changed, 49 insertions(+), 34 deletions(-)
>>>>>>
>>>>>> diff --git a/meta/classes/kernel-module-split.bbclass
>>>>>> b/meta/classes/kernel-module-split.bbclass
>>>>>> index e1a70e6..7415ec8 100644
>>>>>> --- a/meta/classes/kernel-module-split.bbclass
>>>>>> +++ b/meta/classes/kernel-module-split.bbclass
>>>>>> @@ -28,7 +28,7 @@ do_install_append() {
>>>>>>
>>>>>>   PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
>>>>>>
>>>>>> -KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
>>>>>> +KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
>>>>>>
>>>>>>   python split_kernel_module_packages () {
>>>>>>       import re
>>>>>> @@ -179,14 +179,17 @@ python split_kernel_module_packages () {
>>>>>>           # Avoid automatic -dev recommendations for modules ending with
>>>>>> -dev.
>>>>>>           d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
>>>>>>
>>>>>> +    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
>>>>>> +    kernel_version = d.getVar("KERNEL_VERSION", True)
>>>>>> +
>>>>>>       module_deps = parse_depmod()
>>>>>>       module_regex = '^(.*)\.k?o$'
>>>>>> -    module_pattern = 'kernel-module-%s'
>>>>>> +    module_pattern = '%s-module-%%s' % kernel_package_name
>>>>>>
>>>>>>       postinst = d.getVar('pkg_postinst_modules', True)
>>>>>>       postrm = d.getVar('pkg_postrm_modules', True)
>>>>>>
>>>>>> -    modules = do_split_packages(d, root='/lib/modules',
>>>>>> file_regex=module_regex, output_pattern=module_pattern, description='%s
>>>>>> kernel module', postinst=postinst, postrm=postrm, recursive=True,
>>>>>> hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION",
>>>>>> True)))
>>>>>> +    modules = do_split_packages(d, root='/lib/modules',
>>>>>> file_regex=module_regex, output_pattern=module_pattern, description='%s
>>>>>> kernel module', postinst=postinst, postrm=postrm, recursive=True,
>>>>>> hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name,
>>>>>> kernel_version))
>>>>>>       if modules:
>>>>>>           metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
>>>>>>           d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
>>>>>> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
>>>>>> index b75a462..cc27364 100644
>>>>>> --- a/meta/classes/kernel.bbclass
>>>>>> +++ b/meta/classes/kernel.bbclass
>>>>>> @@ -3,7 +3,6 @@ inherit linux-kernel-base kernel-module-split
>>>>>>   PROVIDES += "virtual/kernel"
>>>>>>   DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc
>>>>>> kmod-native depmodwrapper-cross bc-native"
>>>>>>
>>>>>> -S = "${STAGING_KERNEL_DIR}"
>>>>>>   B = "${WORKDIR}/build"
>>>>>>   KBUILD_OUTPUT = "${B}"
>>>>>>   OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
>>>>>> @@ -11,6 +10,7 @@ OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
>>>>>>   # we include gcc above, we dont need virtual/libc
>>>>>>   INHIBIT_DEFAULT_DEPS = "1"
>>>>>>
>>>>>> +KERNEL_PACKAGE_NAME ??= "kernel"
>>>>>>   KERNEL_IMAGETYPE ?= "zImage"
>>>>>>   INITRAMFS_IMAGE ?= ""
>>>>>>   INITRAMFS_TASK ?= ""
>>>>>> @@ -34,6 +34,17 @@ python __anonymous () {
>>>>>>       image_task = d.getVar('INITRAMFS_TASK', True)
>>>>>>       if image_task:
>>>>>>           d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
>>>>>> +
>>>>>> +    # The default kernel recipe fetches it's source to
>>>>>> +    # STAGING_KERNEL_DIR as defined by bitbake/distro confs.
>>>>>> +    # Alternate kernel recipes (E.g. debug kernels) fetch source into
>>>>>> +    # their work dir so that they may build in parallel.
>>>>>> +    if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel":
>>>>>> +        d.setVar("S", d.getVar("STAGING_KERNEL_DIR", True))
>>>>>> +    else:
>>>>>> +        workdir = d.getVar("WORKDIR", True)
>>>>>> +        kernelSourceDir = os.path.join(workdir, 'kernel-source')
>>>>>> +        d.setVar("S", kernelSourceDir)
>>>>>>   }
>>>>>>
>>>>>>   # Here we pull in all various kernel image types which we support.
>>>>>> @@ -79,9 +90,9 @@ base_do_unpack_append () {
>>>>>>
>>>>>>   inherit kernel-arch deploy
>>>>>>
>>>>>> -PACKAGES_DYNAMIC += "^kernel-module-.*"
>>>>>> -PACKAGES_DYNAMIC += "^kernel-image-.*"
>>>>>> -PACKAGES_DYNAMIC += "^kernel-firmware-.*"
>>>>>> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
>>>>>> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
>>>>>> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
>>>>>>
>>>>>>   export OS = "${TARGET_OS}"
>>>>>>   export CROSS_COMPILE = "${TARGET_PREFIX}"
>>>>>> @@ -270,9 +281,9 @@ do_shared_workdir_setscene () {
>>>>>>
>>>>>>   emit_depmod_pkgdata() {
>>>>>>          # Stash data for depmod
>>>>>> -       install -d ${PKGDESTWORK}/kernel-depmod/
>>>>>> -       echo "${KERNEL_VERSION}" >
>>>>>> ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
>>>>>> -       cp ${B}/System.map
>>>>>> ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
>>>>>> +       install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
>>>>>> +       echo "${KERNEL_VERSION}" >
>>>>>> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
>>>>>> +       cp ${B}/System.map
>>>>>> ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
>>>>>>   }
>>>>>>
>>>>>>   PACKAGEFUNCS += "emit_depmod_pkgdata"
>>>>>> @@ -287,7 +298,7 @@ do_shared_workdir () {
>>>>>>          # Store the kernel version in sysroots for module-base.bbclass
>>>>>>          #
>>>>>>
>>>>>> -       echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
>>>>>> +       echo "${KERNEL_VERSION}" >
>>>>>> $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
>>>>>>
>>>>>>          # Copy files required for module builds
>>>>>>          cp System.map $kerneldir/System.map-${KERNEL_VERSION}
>>>>>> @@ -361,28 +372,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
>>>>>>
>>>>>>   # kernel-base becomes kernel-${KERNEL_VERSION}
>>>>>>   # kernel-image becomes kernel-image-${KERNEL_VERISON}
>>>>>> -PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev
>>>>>> kernel-modules"
>>>>>> +PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base
>>>>>> ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image
>>>>>> ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
>>>>>>   FILES_${PN} = ""
>>>>>> -FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order
>>>>>> /lib/modules/${KERNEL_VERSION}/modules.builtin"
>>>>>> -FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
>>>>>> -FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers*
>>>>>> /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
>>>>>> -FILES_kernel-vmlinux = "/boot/vmlinux*"
>>>>>> -FILES_kernel-modules = ""
>>>>>> -RDEPENDS_kernel = "kernel-base"
>>>>>> +FILES_${KERNEL_PACKAGE_NAME}-base =
>>>>>> "/lib/modules/${KERNEL_VERSION}/modules.order
>>>>>> /lib/modules/${KERNEL_VERSION}/modules.builtin"
>>>>>> +FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
>>>>>> +FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map*
>>>>>> /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH}
>>>>>> /lib/modules/${KERNEL_VERSION}/build"
>>>>>> +FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
>>>>>> +FILES_${KERNEL_PACKAGE_NAME}-modules = ""
>>>>>> +RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
>>>>>>   # Allow machines to override this dependency if kernel image files are
>>>>>>   # not wanted in images as standard
>>>>>> -RDEPENDS_kernel-base ?= "kernel-image"
>>>>>> -PKG_kernel-image =
>>>>>> "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
>>>>>> -RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE',
>>>>>> 'vmlinux', 'kernel-vmlinux', '', d)}"
>>>>>> -PKG_kernel-base =
>>>>>> "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
>>>>>> -RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
>>>>>> -ALLOW_EMPTY_kernel = "1"
>>>>>> -ALLOW_EMPTY_kernel-base = "1"
>>>>>> -ALLOW_EMPTY_kernel-image = "1"
>>>>>> -ALLOW_EMPTY_kernel-modules = "1"
>>>>>> -DESCRIPTION_kernel-modules = "Kernel modules meta package"
>>>>>> -
>>>>>> -pkg_postinst_kernel-base () {
>>>>>> +RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
>>>>>> +PKG_${KERNEL_PACKAGE_NAME}-image =
>>>>>> "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
>>>>>> +RDEPENDS_${KERNEL_PACKAGE_NAME}-image +=
>>>>>> "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux',
>>>>>> '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
>>>>>> +PKG_${KERNEL_PACKAGE_NAME}-base =
>>>>>> "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
>>>>>> +RPROVIDES_${KERNEL_PACKAGE_NAME}-base +=
>>>>>> "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
>>>>>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
>>>>>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
>>>>>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
>>>>>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
>>>>>> +DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta
>>>>>> package"
>>>>>> +
>>>>>> +pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
>>>>>>          if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
>>>>>>                  mkdir -p $D/lib/modules/${KERNEL_VERSION}
>>>>>>          fi
>>>>>> @@ -393,18 +404,18 @@ pkg_postinst_kernel-base () {
>>>>>>          fi
>>>>>>   }
>>>>>>
>>>>>> -pkg_postinst_kernel-image () {
>>>>>> +pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
>>>>>>          update-alternatives --install
>>>>>> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}
>>>>>> /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
>>>>>> ${KERNEL_PRIORITY} || true
>>>>>>   }
>>>>>>
>>>>>> -pkg_postrm_kernel-image () {
>>>>>> +pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
>>>>>>          update-alternatives --remove ${KERNEL_IMAGETYPE}
>>>>>> ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
>>>>>>   }
>>>>>>
>>>>>>   PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
>>>>>>
>>>>>>   python split_kernel_packages () {
>>>>>> -    do_split_packages(d, root='/lib/firmware',
>>>>>> file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='kernel-firmware-%s',
>>>>>> description='Firmware for %s', recursive=True, extra_depends='')
>>>>>> +    do_split_packages(d, root='/lib/firmware',
>>>>>> file_regex='^(.*)\.(bin|fw|cis|dsp)$',
>>>>>> output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware
>>>>>> for %s', recursive=True, extra_depends='')
>>>>>>   }
>>>>>>
>>>>>>   do_strip() {
>>>>>> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
>>>>>> index 1b5c071..fb5e03f 100644
>>>>>> --- a/meta/conf/documentation.conf
>>>>>> +++ b/meta/conf/documentation.conf
>>>>>> @@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional metadata
>>>>>> from the Yocto Project kern
>>>>>>   KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device,
>>>>>> usually set by the machine configuration files and defaults to 'zImage'."
>>>>>>   KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be
>>>>>> auto-loaded during boot"
>>>>>>   KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build
>>>>>> system expects to find module_conf_* values that specify configuration for
>>>>>> each of the modules"
>>>>>> +KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to
>>>>>> 'kernel'."
>>>>>>   KERNEL_PATH[doc] = "The location of the kernel sources. This variable is
>>>>>> set to the value of the STAGING_KERNEL_DIR within the module class
>>>>>> (module.bbclass)."
>>>>>>   KERNEL_SRC[doc] = "The location of the kernel sources. This variable is
>>>>>> set to the value of the STAGING_KERNEL_DIR within the module class
>>>>>> (module.bbclass)."
>>>>>>   KFEATURE_DESCRIPTION[doc] = "Provides a short description of a
>>>>>> configuration fragment. You use this variable in the .scc file that
>>>>>> describes a configuration fragment file."
>>>>>> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc
>>>>>> b/meta/recipes-kernel/linux/linux-dtb.inc
>>>>>> index 772adcb..c27a3cb 100644
>>>>>> --- a/meta/recipes-kernel/linux/linux-dtb.inc
>>>>>> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
>>>>>> @@ -2,7 +2,7 @@
>>>>>>   FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
>>>>>>
>>>>>>   python __anonymous () {
>>>>>> -    d.appendVar("PACKAGES", " kernel-devicetree")
>>>>>> +    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
>>>>>>   }
>>>>>>
>>>>>>   normalize_dtb () {
>>>>>> --
>>>>>> 2.6.2
>>>>>>
>>>>>> --
>>>>>> _______________________________________________
>>>>>> Openembedded-core mailing list
>>>>>> Openembedded-core@lists.openembedded.org
>>>>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> "Thou shalt not follow the NULL pointer, for chaos and madness await thee
>>>>> at its end"
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> "Thou shalt not follow the NULL pointer, for chaos and madness await thee
>>>> at its end"
>>>
>>>> --
>>>> _______________________________________________
>>>> Openembedded-core mailing list
>>>> Openembedded-core@lists.openembedded.org
>>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>>
>>> --
>>> _______________________________________________
>>> Openembedded-core mailing list
>>> Openembedded-core@lists.openembedded.org
>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>
>> --
>> Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com
>
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] kernel: Add support for multiple kernel packages
  2015-12-15  0:33       ` Khem Raj
@ 2015-12-15 19:48         ` Haris Okanovic
  0 siblings, 0 replies; 16+ messages in thread
From: Haris Okanovic @ 2015-12-15 19:48 UTC (permalink / raw)
  To: Khem Raj, Haris Okanovic; +Cc: Gratian Crisan, openembedded-core

Hi Khem,

On 12/14/2015 06:33 PM, Khem Raj wrote:
>
>> On Dec 14, 2015, at 2:35 PM, Haris Okanovic <haris.okanovic@ni.com> wrote:
>>
>> From: Gratian Crisan <gratian.crisan@ni.com>
>>
>> This change allows distributions to provide multiple builds of kernel
>> and module packages. For example, a distro may want provide an alternate
>> debug kernel in a package feed for debug/testing.
>>
>> Templetize kernel package name:
>>
>> Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
>> packages. It defaults to the old hard-coded name 'kernel' but it can be
>> redefined by recipes that provide additional kernel packages in order
>> to avoid build conflicts.
>>
>> Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
>> kernel bbclass-es.
>>
>> Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:
>>
>> Prior to this change, kernel recipes would all fetch source to
>> STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
>> parallel builds when more than one kernel recipes are defined in
>> the distribution, since they all attempted to fetch() and patch()
>> in a shared source dir.
>>
>> With this change, alternate kernel recipes fetch source into their
>> ${WORKDIR} so that they may build in parallel to each other and the
>> default kernel recipe, which still fetches to STAGING_KERNEL_DIR.
>>
>> Testing:
>>
>> Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
>> image and modules packages. Added kernel recipe with non-default
>> KERNEL_PACKAGE_NAME and verified it produces kernel image and modules
>> packages with alternate name next to default kernel.
>
> is it all targeted at just kernel package ? can you cite some use cases which benefit from
> such a thing and what are current alternatives ?
>

The ultimate goal is to improve developer efficiency:

We're looking to provide an alternate debug kernel+modules in our feed, 
which our developers could easily install to diagnose problems or run 
tests without having to build kernels on their desktop. E.g. Our debug 
kernel would have options like CONFIG_DEBUG_INFO, CONFIG_DEBUG_PREEMPT, 
and CONFIG_FRAME_POINTER enabled. We may provide more variants in the 
future tuned to specific use cases.

We need all kernel+module variants to co-exist both in the feed and 
on-target, so that users may quickly install different variants and 
toggle between them as needed. The only solution we have to that end is 
to change the hard-coded package prefix "kernel" throughout 
kernel.bbclass & friends. The proposed change makes that prefix 
configurable by the recipe.

I'm not sure how else we could do this without rewriting a lot of 
kernel.bbclass functionality. We're certainly open to suggestions.


Denys Dmytriyenko also brought up an interesting point in a separate 
email: "how can you build/rebuild and package out-of-tree modules 
against all the alternatives?"

kernel.bbclass builds under work-shared, which is what I presume enables 
building out-of-tree modules against the default distro kernel. Please 
correct me if I'm wrong on that point. This change overrides the build 
location of alternate kernel recipes
(where KERNEL_PACKAGE_NAME != kernel) to WORKDIR, which likely makes it 
impossible to build against the alternatives.

This is not something we've considered in this change since we build our 
out-of-tree modules outside of OE entirely. I'm not sure what it would 
take to make this happen, but I'd prefer to do it in a separate change, 
so long this change doesn't preclude that eventual improvement.


-- Haris


>>
>> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
>> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
>> Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
>> Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
>> Natinst-ReviewBoard-ID: 120348
>> Natinst-ReviewBoard-ID: 120447
>> ---
>> meta/classes/kernel-module-split.bbclass |  9 ++--
>> meta/classes/kernel.bbclass              | 76 ++++++++++++++++++++------------
>> meta/conf/documentation.conf             |  1 +
>> meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
>> 4 files changed, 55 insertions(+), 33 deletions(-)
>>
>> diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
>> index e1a70e6..7415ec8 100644
>> --- a/meta/classes/kernel-module-split.bbclass
>> +++ b/meta/classes/kernel-module-split.bbclass
>> @@ -28,7 +28,7 @@ do_install_append() {
>>
>> PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
>>
>> -KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
>> +KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
>>
>> python split_kernel_module_packages () {
>>      import re
>> @@ -179,14 +179,17 @@ python split_kernel_module_packages () {
>>          # Avoid automatic -dev recommendations for modules ending with -dev.
>>          d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
>>
>> +    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
>> +    kernel_version = d.getVar("KERNEL_VERSION", True)
>> +
>>      module_deps = parse_depmod()
>>      module_regex = '^(.*)\.k?o$'
>> -    module_pattern = 'kernel-module-%s'
>> +    module_pattern = '%s-module-%%s' % kernel_package_name
>>
>>      postinst = d.getVar('pkg_postinst_modules', True)
>>      postrm = d.getVar('pkg_postrm_modules', True)
>>
>> -    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION", True)))
>> +    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
>>      if modules:
>>          metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
>>          d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
>> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
>> index b75a462..281519e 100644
>> --- a/meta/classes/kernel.bbclass
>> +++ b/meta/classes/kernel.bbclass
>> @@ -1,5 +1,23 @@
>> inherit linux-kernel-base kernel-module-split
>>
>> +KERNEL_PACKAGE_NAME ??= "kernel"
>> +
>> +# The default kernel recipe builds in a shared location defined by
>> +# bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR.
>> +# Set these variables to directories under ${WORKDIR} in alternate
>> +# kernel recipes (I.e. where KERNEL_PACKAGE_NAME != kernel) so that they
>> +# may build in parallel with the default kernel without clobbering.
>> +python __anonymous () {
>> +    if d.getVar("KERNEL_PACKAGE_NAME", True) != "kernel":
>> +        workdir = d.getVar("WORKDIR", True)
>> +
>> +        sourceDir = os.path.join(workdir, 'kernel-source')
>> +        artifactsDir = os.path.join(workdir, 'kernel-build-artifacts')
>> +
>> +        d.setVar("STAGING_KERNEL_DIR", sourceDir)
>> +        d.setVar("STAGING_KERNEL_BUILDDIR", artifactsDir)
>> +}
>> +
>> PROVIDES += "virtual/kernel"
>> DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native"
>>
>> @@ -79,9 +97,9 @@ base_do_unpack_append () {
>>
>> inherit kernel-arch deploy
>>
>> -PACKAGES_DYNAMIC += "^kernel-module-.*"
>> -PACKAGES_DYNAMIC += "^kernel-image-.*"
>> -PACKAGES_DYNAMIC += "^kernel-firmware-.*"
>> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
>> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
>> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
>>
>> export OS = "${TARGET_OS}"
>> export CROSS_COMPILE = "${TARGET_PREFIX}"
>> @@ -270,9 +288,9 @@ do_shared_workdir_setscene () {
>>
>> emit_depmod_pkgdata() {
>> 	# Stash data for depmod
>> -	install -d ${PKGDESTWORK}/kernel-depmod/
>> -	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
>> -	cp ${B}/System.map ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
>> +	install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
>> +	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
>> +	cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
>> }
>>
>> PACKAGEFUNCS += "emit_depmod_pkgdata"
>> @@ -287,7 +305,7 @@ do_shared_workdir () {
>> 	# Store the kernel version in sysroots for module-base.bbclass
>> 	#
>>
>> -	echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
>> +	echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
>>
>> 	# Copy files required for module builds
>> 	cp System.map $kerneldir/System.map-${KERNEL_VERSION}
>> @@ -361,28 +379,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
>>
>> # kernel-base becomes kernel-${KERNEL_VERSION}
>> # kernel-image becomes kernel-image-${KERNEL_VERISON}
>> -PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules"
>> +PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
>> FILES_${PN} = ""
>> -FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
>> -FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
>> -FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
>> -FILES_kernel-vmlinux = "/boot/vmlinux*"
>> -FILES_kernel-modules = ""
>> -RDEPENDS_kernel = "kernel-base"
>> +FILES_${KERNEL_PACKAGE_NAME}-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
>> +FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
>> +FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
>> +FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
>> +FILES_${KERNEL_PACKAGE_NAME}-modules = ""
>> +RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
>> # Allow machines to override this dependency if kernel image files are
>> # not wanted in images as standard
>> -RDEPENDS_kernel-base ?= "kernel-image"
>> -PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
>> -RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', 'kernel-vmlinux', '', d)}"
>> -PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
>> -RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
>> -ALLOW_EMPTY_kernel = "1"
>> -ALLOW_EMPTY_kernel-base = "1"
>> -ALLOW_EMPTY_kernel-image = "1"
>> -ALLOW_EMPTY_kernel-modules = "1"
>> -DESCRIPTION_kernel-modules = "Kernel modules meta package"
>> -
>> -pkg_postinst_kernel-base () {
>> +RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
>> +PKG_${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
>> +RDEPENDS_${KERNEL_PACKAGE_NAME}-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
>> +PKG_${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
>> +RPROVIDES_${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
>> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
>> +DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package"
>> +
>> +pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
>> 	if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
>> 		mkdir -p $D/lib/modules/${KERNEL_VERSION}
>> 	fi
>> @@ -393,18 +411,18 @@ pkg_postinst_kernel-base () {
>> 	fi
>> }
>>
>> -pkg_postinst_kernel-image () {
>> +pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
>> 	update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
>> }
>>
>> -pkg_postrm_kernel-image () {
>> +pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
>> 	update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
>> }
>>
>> PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
>>
>> python split_kernel_packages () {
>> -    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
>> +    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
>> }
>>
>> do_strip() {
>> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
>> index 1b5c071..fb5e03f 100644
>> --- a/meta/conf/documentation.conf
>> +++ b/meta/conf/documentation.conf
>> @@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto Project kern
>> KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set by the machine configuration files and defaults to 'zImage'."
>> KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot"
>> KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules"
>> +KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to 'kernel'."
>> KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
>> KERNEL_SRC[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
>> KFEATURE_DESCRIPTION[doc] = "Provides a short description of a configuration fragment. You use this variable in the .scc file that describes a configuration fragment file."
>> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
>> index 772adcb..c27a3cb 100644
>> --- a/meta/recipes-kernel/linux/linux-dtb.inc
>> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
>> @@ -2,7 +2,7 @@
>> FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
>>
>> python __anonymous () {
>> -    d.appendVar("PACKAGES", " kernel-devicetree")
>> +    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
>> }
>>
>> normalize_dtb () {
>> --
>> 2.6.2
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] kernel: Add support for multiple kernel packages
  2015-12-14 22:35     ` [PATCH v2] " Haris Okanovic
  2015-12-15  0:33       ` Khem Raj
@ 2016-01-19 22:40       ` Haris Okanovic
  2016-02-02 16:12         ` Diego Sueiro
  1 sibling, 1 reply; 16+ messages in thread
From: Haris Okanovic @ 2016-01-19 22:40 UTC (permalink / raw)
  To: openembedded-core; +Cc: Haris Okanovic, Gratian Crisan

Any concerns pulling this into master as-is?

We briefly discussed the possibility of building out-of-tree modules
against multiple kernels back in December, right before this thread
died. This change certainly doesn't preclude that improvement if someone
would like to implement it, nor does it change current behavior.
More importantly, it provides a useful function as-is in our opinion --
E.g. to provide a debug kernel in a feed for testing/development activities.

Thread: http://thread.gmane.org/gmane.comp.handhelds.openembedded.core/72908

Thanks,
Haris


On 12/14/2015 04:35 PM, Haris Okanovic wrote:
> From: Gratian Crisan <gratian.crisan@ni.com>
>
> This change allows distributions to provide multiple builds of kernel
> and module packages. For example, a distro may want provide an alternate
> debug kernel in a package feed for debug/testing.
>
> Templetize kernel package name:
>
> Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
> packages. It defaults to the old hard-coded name 'kernel' but it can be
> redefined by recipes that provide additional kernel packages in order
> to avoid build conflicts.
>
> Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
> kernel bbclass-es.
>
> Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:
>
> Prior to this change, kernel recipes would all fetch source to
> STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
> parallel builds when more than one kernel recipes are defined in
> the distribution, since they all attempted to fetch() and patch()
> in a shared source dir.
>
> With this change, alternate kernel recipes fetch source into their
> ${WORKDIR} so that they may build in parallel to each other and the
> default kernel recipe, which still fetches to STAGING_KERNEL_DIR.
>
> Testing:
>
> Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel
> image and modules packages. Added kernel recipe with non-default
> KERNEL_PACKAGE_NAME and verified it produces kernel image and modules
> packages with alternate name next to default kernel.
>
> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
> Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
> Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
> Natinst-ReviewBoard-ID: 120348
> Natinst-ReviewBoard-ID: 120447
> ---
>   meta/classes/kernel-module-split.bbclass |  9 ++--
>   meta/classes/kernel.bbclass              | 76 ++++++++++++++++++++------------
>   meta/conf/documentation.conf             |  1 +
>   meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-
>   4 files changed, 55 insertions(+), 33 deletions(-)
>
> diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
> index e1a70e6..7415ec8 100644
> --- a/meta/classes/kernel-module-split.bbclass
> +++ b/meta/classes/kernel-module-split.bbclass
> @@ -28,7 +28,7 @@ do_install_append() {
>
>   PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
>
> -KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
> +KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
>
>   python split_kernel_module_packages () {
>       import re
> @@ -179,14 +179,17 @@ python split_kernel_module_packages () {
>           # Avoid automatic -dev recommendations for modules ending with -dev.
>           d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
>
> +    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
> +    kernel_version = d.getVar("KERNEL_VERSION", True)
> +
>       module_deps = parse_depmod()
>       module_regex = '^(.*)\.k?o$'
> -    module_pattern = 'kernel-module-%s'
> +    module_pattern = '%s-module-%%s' % kernel_package_name
>
>       postinst = d.getVar('pkg_postinst_modules', True)
>       postrm = d.getVar('pkg_postrm_modules', True)
>
> -    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION", True)))
> +    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
>       if modules:
>           metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
>           d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index b75a462..281519e 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -1,5 +1,23 @@
>   inherit linux-kernel-base kernel-module-split
>
> +KERNEL_PACKAGE_NAME ??= "kernel"
> +
> +# The default kernel recipe builds in a shared location defined by
> +# bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR.
> +# Set these variables to directories under ${WORKDIR} in alternate
> +# kernel recipes (I.e. where KERNEL_PACKAGE_NAME != kernel) so that they
> +# may build in parallel with the default kernel without clobbering.
> +python __anonymous () {
> +    if d.getVar("KERNEL_PACKAGE_NAME", True) != "kernel":
> +        workdir = d.getVar("WORKDIR", True)
> +
> +        sourceDir = os.path.join(workdir, 'kernel-source')
> +        artifactsDir = os.path.join(workdir, 'kernel-build-artifacts')
> +
> +        d.setVar("STAGING_KERNEL_DIR", sourceDir)
> +        d.setVar("STAGING_KERNEL_BUILDDIR", artifactsDir)
> +}
> +
>   PROVIDES += "virtual/kernel"
>   DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native"
>
> @@ -79,9 +97,9 @@ base_do_unpack_append () {
>
>   inherit kernel-arch deploy
>
> -PACKAGES_DYNAMIC += "^kernel-module-.*"
> -PACKAGES_DYNAMIC += "^kernel-image-.*"
> -PACKAGES_DYNAMIC += "^kernel-firmware-.*"
> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
> +PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
>
>   export OS = "${TARGET_OS}"
>   export CROSS_COMPILE = "${TARGET_PREFIX}"
> @@ -270,9 +288,9 @@ do_shared_workdir_setscene () {
>
>   emit_depmod_pkgdata() {
>   	# Stash data for depmod
> -	install -d ${PKGDESTWORK}/kernel-depmod/
> -	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
> -	cp ${B}/System.map ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
> +	install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
> +	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
> +	cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
>   }
>
>   PACKAGEFUNCS += "emit_depmod_pkgdata"
> @@ -287,7 +305,7 @@ do_shared_workdir () {
>   	# Store the kernel version in sysroots for module-base.bbclass
>   	#
>
> -	echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
> +	echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
>
>   	# Copy files required for module builds
>   	cp System.map $kerneldir/System.map-${KERNEL_VERSION}
> @@ -361,28 +379,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
>
>   # kernel-base becomes kernel-${KERNEL_VERSION}
>   # kernel-image becomes kernel-image-${KERNEL_VERISON}
> -PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules"
> +PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
>   FILES_${PN} = ""
> -FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
> -FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
> -FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
> -FILES_kernel-vmlinux = "/boot/vmlinux*"
> -FILES_kernel-modules = ""
> -RDEPENDS_kernel = "kernel-base"
> +FILES_${KERNEL_PACKAGE_NAME}-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
> +FILES_${KERNEL_PACKAGE_NAME}-image = "/boot/${KERNEL_IMAGETYPE}*"
> +FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
> +FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
> +FILES_${KERNEL_PACKAGE_NAME}-modules = ""
> +RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
>   # Allow machines to override this dependency if kernel image files are
>   # not wanted in images as standard
> -RDEPENDS_kernel-base ?= "kernel-image"
> -PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> -RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', 'kernel-vmlinux', '', d)}"
> -PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
> -RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
> -ALLOW_EMPTY_kernel = "1"
> -ALLOW_EMPTY_kernel-base = "1"
> -ALLOW_EMPTY_kernel-image = "1"
> -ALLOW_EMPTY_kernel-modules = "1"
> -DESCRIPTION_kernel-modules = "Kernel modules meta package"
> -
> -pkg_postinst_kernel-base () {
> +RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
> +PKG_${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
> +RDEPENDS_${KERNEL_PACKAGE_NAME}-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
> +PKG_${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
> +RPROVIDES_${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
> +ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
> +DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package"
> +
> +pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
>   	if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
>   		mkdir -p $D/lib/modules/${KERNEL_VERSION}
>   	fi
> @@ -393,18 +411,18 @@ pkg_postinst_kernel-base () {
>   	fi
>   }
>
> -pkg_postinst_kernel-image () {
> +pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
>   	update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
>   }
>
> -pkg_postrm_kernel-image () {
> +pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
>   	update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
>   }
>
>   PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
>
>   python split_kernel_packages () {
> -    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
> +    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
>   }
>
>   do_strip() {
> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
> index 1b5c071..fb5e03f 100644
> --- a/meta/conf/documentation.conf
> +++ b/meta/conf/documentation.conf
> @@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto Project kern
>   KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set by the machine configuration files and defaults to 'zImage'."
>   KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot"
>   KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules"
> +KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to 'kernel'."
>   KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
>   KERNEL_SRC[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
>   KFEATURE_DESCRIPTION[doc] = "Provides a short description of a configuration fragment. You use this variable in the .scc file that describes a configuration fragment file."
> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
> index 772adcb..c27a3cb 100644
> --- a/meta/recipes-kernel/linux/linux-dtb.inc
> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> @@ -2,7 +2,7 @@
>   FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
>
>   python __anonymous () {
> -    d.appendVar("PACKAGES", " kernel-devicetree")
> +    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
>   }
>
>   normalize_dtb () {
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] kernel: Add support for multiple kernel packages
  2016-01-19 22:40       ` Haris Okanovic
@ 2016-02-02 16:12         ` Diego Sueiro
  2016-02-02 20:39           ` Haris Okanovic
  0 siblings, 1 reply; 16+ messages in thread
From: Diego Sueiro @ 2016-02-02 16:12 UTC (permalink / raw)
  To: Haris Okanovic
  Cc: Gratian Crisan, Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

Haris,


On 19 January 2016 at 22:40, Haris Okanovic <harisokn@gmail.com> wrote:

> Any concerns pulling this into master as-is?
>
> We briefly discussed the possibility of building out-of-tree modules
> against multiple kernels back in December, right before this thread
> died. This change certainly doesn't preclude that improvement if someone
> would like to implement it, nor does it change current behavior.
> More importantly, it provides a useful function as-is in our opinion --
> E.g. to provide a debug kernel in a feed for testing/development
> activities.
>
> Thread:
> http://thread.gmane.org/gmane.comp.handhelds.openembedded.core/72908
>


Could you please give examples how kernel recipes look like?

I'm particularly interested in this feature.


Regards,

--
*dS
Diego Sueiro

Administrador do Embarcados
www.embarcados.com.br
<http://www.embarcados.com.br/?utm_source=assinatura_diego&utm_medium=e-mail&utm_campaign=Assinatura%20Email%20Diego>

/*long live rock 'n roll*/

[-- Attachment #2: Type: text/html, Size: 1800 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] kernel: Add support for multiple kernel packages
  2016-02-02 16:12         ` Diego Sueiro
@ 2016-02-02 20:39           ` Haris Okanovic
  2016-02-03  8:30             ` Diego Sueiro
  0 siblings, 1 reply; 16+ messages in thread
From: Haris Okanovic @ 2016-02-02 20:39 UTC (permalink / raw)
  To: Diego Sueiro
  Cc: Gratian Crisan, Patches and discussions about the oe-core layer

Hi Diego,

On 02/02/2016 10:12 AM, Diego Sueiro wrote:
> Haris,
>
>
> On 19 January 2016 at 22:40, Haris Okanovic <harisokn@gmail.com
> <mailto:harisokn@gmail.com>> wrote:
>
>     Any concerns pulling this into master as-is?
>
>     We briefly discussed the possibility of building out-of-tree modules
>     against multiple kernels back in December, right before this thread
>     died. This change certainly doesn't preclude that improvement if someone
>     would like to implement it, nor does it change current behavior.
>     More importantly, it provides a useful function as-is in our opinion --
>     E.g. to provide a debug kernel in a feed for testing/development
>     activities.
>
>     Thread:
>     http://thread.gmane.org/gmane.comp.handhelds.openembedded.core/72908
>
>
>
> Could you please give examples how kernel recipes look like?
>

Here's a simple recipe to make a debug version linux-yocto. It includes 
the real recipe then overrides KERNEL_PACKAGE_NAME and PROVIDES so that 
two sets of kernel* packages can co-exist in the feed. The other file is 
a kernel config snippet which enables some extra debug options.

[linux-yocto-debug_3.19.bb]
include linux-yocto_3.19.bb
KERNEL_PACKAGE_NAME = "kernel-debug"
PROVIDES = ""
SRC_URI += "file://debug.cfg"

[files/debug.cfg]
CONFIG_DEBUG_INFO=y
CONFIG_FRAME_POINTER=y
CONFIG_LOCKUP_DETECTOR=y
CONFIG_DEBUG_PREEMPT=y
CONFIG_KGDB=y
CONFIG_KGDB_KDB=y
CONFIG_EARLY_PRINTK=y

> I'm particularly interested in this feature.
>
>
> Regards,
>
> --
> *dS
> Diego Sueiro
>
> Administrador do Embarcados
> www.embarcados.com.br
> <http://www.embarcados.com.br/?utm_source=assinatura_diego&utm_medium=e-mail&utm_campaign=Assinatura%20Email%20Diego>
>
> /*long live rock 'n roll*/


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2] kernel: Add support for multiple kernel packages
  2016-02-02 20:39           ` Haris Okanovic
@ 2016-02-03  8:30             ` Diego Sueiro
  0 siblings, 0 replies; 16+ messages in thread
From: Diego Sueiro @ 2016-02-03  8:30 UTC (permalink / raw)
  To: Haris Okanovic
  Cc: Gratian Crisan, Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

Haris,

On 2 February 2016 at 20:39, Haris Okanovic <haris.okanovic@ni.com> wrote:

> Here's a simple recipe to make a debug version linux-yocto. It includes
> the real recipe then overrides KERNEL_PACKAGE_NAME and PROVIDES so that two
> sets of kernel* packages can co-exist in the feed. The other file is a
> kernel config snippet which enables some extra debug options.
>
> [linux-yocto-debug_3.19.bb]
> include linux-yocto_3.19.bb
> KERNEL_PACKAGE_NAME = "kernel-debug"
> PROVIDES = ""
> SRC_URI += "file://debug.cfg"
>
> [files/debug.cfg]
> CONFIG_DEBUG_INFO=y
> CONFIG_FRAME_POINTER=y
> CONFIG_LOCKUP_DETECTOR=y
> CONFIG_DEBUG_PREEMPT=y
> CONFIG_KGDB=y
> CONFIG_KGDB_KDB=y
> CONFIG_EARLY_PRINTK=y
>

Thanks for the info.

Nice job, hope that it can be up-streamed since this use case is quite
common in a product development life cycle.

Regards,

--
*dS
Diego Sueiro

Administrador do Embarcados
www.embarcados.com.br
<http://www.embarcados.com.br/?utm_source=assinatura_diego&utm_medium=e-mail&utm_campaign=Assinatura%20Email%20Diego>

/*long live rock 'n roll*/

[-- Attachment #2: Type: text/html, Size: 1917 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3] kernel: Add support for multiple kernel packages
  2015-12-14 19:06 [PATCH] kernel: Add support for multiple kernel packages Haris Okanovic
  2015-12-14 19:17 ` Bruce Ashfield
@ 2016-10-11 18:36 ` Haris Okanovic
  1 sibling, 0 replies; 16+ messages in thread
From: Haris Okanovic @ 2016-10-11 18:36 UTC (permalink / raw)
  To: openembedded-core; +Cc: haris.okanovic, josh.hernstrom

This change allows distributions to provide multiple builds of kernel
and module packages. For example, a distro may want provide an alternate
debug kernel in a package feed for debug/testing.

Templetize kernel package name:

Add a "weak" variable KERNEL_PACKAGE_NAME used as the base name for kernel
packages. It defaults to the old hard-coded name 'kernel' but it can be
redefined by recipes that provide additional kernel packages in order
to avoid build conflicts.

Change hard-coded 'kernel' references to KERNEL_PACKAGE_NAME in
kernel bbclass-es.

Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:

Prior to this change, kernel recipes would all fetch source to
STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke
parallel builds when more than one kernel recipes are defined in
the distribution, since they all attempted to fetch() and patch()
in a shared source dir.

With this change, alternate kernel recipes fetch source into their
${WORKDIR} so that they may build in parallel to each other and the
default kernel recipe, which still fetches to STAGING_KERNEL_DIR.

Testing: Built linux-yocto-4.8 for qemux86 and verified it produces
kernel image and modules IPKs from source under the "work-shared"
directory. Built a kernel recipe with non-default KERNEL_PACKAGE_NAME
and verified it produces kernel image and modules IPKs with the
alternate package name from source under the normal "work" directory.

Discussion thread: http://lists.openembedded.org/pipermail/openembedded-core/2015-December/thread.html#114122

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Coauthored-by: Gratian Crisan <gratian.crisan@ni.com>
Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
Natinst-ReviewBoard-ID: 120348
---
[PATCH v2] Change STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR to the
"work" directory in alternate kernel builds, instead of "work-shared", so
that the two builds don't clobber each other.

[PATCH v3] An updated version of this change rebased onto the current
OE-core master. Changes:
 * Remove PREFERRED_PROVIDER check in linux-yocto.inc in alternate
   kernel builds, since alternate kernels aren't the
   PREFERRED_PROVIDER for virtual/kernel by definition.
 * Remove "virtual/kernel" from PROVIDES in alternate kernel builds.
---
 meta/classes/kernel-module-split.bbclass  |  9 ++--
 meta/classes/kernel.bbclass               | 87 ++++++++++++++++++-------------
 meta/conf/documentation.conf              |  1 +
 meta/recipes-kernel/linux/linux-dtb.inc   |  2 +-
 meta/recipes-kernel/linux/linux-yocto.inc |  2 +-
 5 files changed, 60 insertions(+), 41 deletions(-)

diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index 08d2262..9f463f1 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -28,7 +28,7 @@ do_install_append() {
 
 PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
 
-KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
+KERNEL_MODULES_META_PACKAGE ?= "${KERNEL_PACKAGE_NAME}-modules"
 
 KERNEL_MODULE_PACKAGE_PREFIX ?= ""
 
@@ -119,15 +119,18 @@ python split_kernel_module_packages () {
         # Avoid automatic -dev recommendations for modules ending with -dev.
         d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
 
+    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True)
+    kernel_version = d.getVar("KERNEL_VERSION", True)
+
     module_regex = '^(.*)\.k?o$'
 
     module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX', True)
-    module_pattern = module_pattern_prefix + 'kernel-module-%s'
+    module_pattern = '%s%s-module-%%s' % (module_pattern_prefix, kernel_package_name)
 
     postinst = d.getVar('pkg_postinst_modules', True)
     postrm = d.getVar('pkg_postrm_modules', True)
 
-    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION", True)))
+    modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
     if modules:
         metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True)
         d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 25a153c..7c0cffe 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -1,6 +1,8 @@
 inherit linux-kernel-base kernel-module-split
 
-PROVIDES += "virtual/kernel"
+KERNEL_PACKAGE_NAME ??= "kernel"
+
+PROVIDES += "${@ "virtual/kernel" if (d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel") else "" }"
 DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native lzop-native"
 
 S = "${STAGING_KERNEL_DIR}"
@@ -30,10 +32,23 @@ KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}"
 python __anonymous () {
     import re
 
+    # The default kernel recipe builds in a shared location defined by
+    # bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR.
+    # Set these variables to directories under ${WORKDIR} in alternate
+    # kernel recipes (I.e. where KERNEL_PACKAGE_NAME != kernel) so that they
+    # may build in parallel with the default kernel without clobbering.
+    if d.getVar("KERNEL_PACKAGE_NAME", True) != "kernel":
+        workdir = d.getVar("WORKDIR", True)
+        sourceDir = os.path.join(workdir, 'kernel-source')
+        artifactsDir = os.path.join(workdir, 'kernel-build-artifacts')
+        d.setVar("STAGING_KERNEL_DIR", sourceDir)
+        d.setVar("STAGING_KERNEL_BUILDDIR", artifactsDir)
+
     # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES
     type = d.getVar('KERNEL_IMAGETYPE', True) or ""
     alttype = d.getVar('KERNEL_ALT_IMAGETYPE', True) or ""
     types = d.getVar('KERNEL_IMAGETYPES', True) or ""
+    kname = d.getVar('KERNEL_PACKAGE_NAME', True) or "kernel"
     if type not in types.split():
         types = (type + ' ' + types).strip()
     if alttype not in types.split():
@@ -46,23 +61,23 @@ python __anonymous () {
     for type in typeformake.split():
         typelower = type.lower()
 
-        d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
+        d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
 
-        d.setVar('FILES_kernel-image-' + typelower, '/boot/' + type + '*')
+        d.setVar('FILES_%s-image-%s' % (kname, typelower), '/boot/' + type + '*')
 
-        d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' + typelower)
+        d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower))
 
-        d.setVar('PKG_kernel-image-' + typelower, 'kernel-image-' + typelower + '-${KERNEL_VERSION_PKG_NAME}')
+        d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
 
-        d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
+        d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1')
 
         imagedest = d.getVar('KERNEL_IMAGEDEST', True)
         priority = d.getVar('KERNEL_PRIORITY', True)
         postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
-        d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
+        d.setVar('pkg_postinst_%s-image-%s' % (kname, typelower), postinst)
 
         postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
-        d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)
+        d.setVar('pkg_postrm_%s-image-%s' % (kname, typelower), postrm)
 
     image = d.getVar('INITRAMFS_IMAGE', True)
     if image:
@@ -120,9 +135,9 @@ base_do_unpack_append () {
 
 inherit kernel-arch deploy
 
-PACKAGES_DYNAMIC += "^kernel-module-.*"
-PACKAGES_DYNAMIC += "^kernel-image-.*"
-PACKAGES_DYNAMIC += "^kernel-firmware-.*"
+PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
+PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
+PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
 
 export OS = "${TARGET_OS}"
 export CROSS_COMPILE = "${TARGET_PREFIX}"
@@ -366,9 +381,9 @@ do_shared_workdir_setscene () {
 
 emit_depmod_pkgdata() {
 	# Stash data for depmod
-	install -d ${PKGDESTWORK}/kernel-depmod/
-	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
-	cp ${B}/System.map ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
+	install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
+	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
+	cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
 }
 
 PACKAGEFUNCS += "emit_depmod_pkgdata"
@@ -383,7 +398,7 @@ do_shared_workdir () {
 	# Store the kernel version in sysroots for module-base.bbclass
 	#
 
-	echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
+	echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
 
 	# Copy files required for module builds
 	cp System.map $kerneldir/System.map-${KERNEL_VERSION}
@@ -481,28 +496,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
 
 # kernel-base becomes kernel-${KERNEL_VERSION}
 # kernel-image becomes kernel-image-${KERNEL_VERSION}
-PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules"
+PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
 FILES_${PN} = ""
-FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
-FILES_kernel-image = ""
-FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
-FILES_kernel-vmlinux = "/boot/vmlinux*"
-FILES_kernel-modules = ""
-RDEPENDS_kernel = "kernel-base"
-# Allow machines to override this dependency if kernel image files are
+FILES_${KERNEL_PACKAGE_NAME}-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
+FILES_${KERNEL_PACKAGE_NAME}-image = ""
+FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
+FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux*"
+FILES_${KERNEL_PACKAGE_NAME}-modules = ""
+RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
+# Allow machines to override this dependency if kernel image files are 
 # not wanted in images as standard
-RDEPENDS_kernel-base ?= "kernel-image"
-PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
-RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', 'kernel-vmlinux', '', d)}"
-PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
-RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
-ALLOW_EMPTY_kernel = "1"
-ALLOW_EMPTY_kernel-base = "1"
-ALLOW_EMPTY_kernel-image = "1"
-ALLOW_EMPTY_kernel-modules = "1"
-DESCRIPTION_kernel-modules = "Kernel modules meta package"
-
-pkg_postinst_kernel-base () {
+RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
+PKG_${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
+RDEPENDS_${KERNEL_PACKAGE_NAME}-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
+PKG_${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
+RPROVIDES_${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
+DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package"
+
+pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
 	if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
 		mkdir -p $D/lib/modules/${KERNEL_VERSION}
 	fi
@@ -516,7 +531,7 @@ pkg_postinst_kernel-base () {
 PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
 
 python split_kernel_packages () {
-    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
+    do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
 }
 
 # Many scripts want to look in arch/$arch/boot for the bootable
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 51c4116..8682e72 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -248,6 +248,7 @@ KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set b
 KERNEL_IMAGETYPES[doc] = "The list of types of kernel to build for a device, usually set by the machine configuration files and defaults to KERNEL_IMAGETYPE."
 KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot"
 KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules"
+KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to 'kernel'."
 KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
 KERNEL_SRC[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
 KFEATURE_DESCRIPTION[doc] = "Provides a short description of a configuration fragment. You use this variable in the .scc file that describes a configuration fragment file."
diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index 8528d64..af5bfca 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -2,7 +2,7 @@
 FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
 
 python __anonymous () {
-    d.appendVar("PACKAGES", " kernel-devicetree")
+    d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
 }
 
 normalize_dtb () {
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index d8d4387..3f4dab9 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -12,7 +12,7 @@ INC_PR = "r4"
 # PREFERRED_PROVIDER for virtual/kernel. This avoids network access required
 # by the use of AUTOREV SRCREVs, which are the default for this recipe.
 python () {
-    if d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != d.getVar("PN", True):
+    if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != d.getVar("PN", True):
         d.delVar("BB_DONT_CACHE")
         raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to %s to enable it" % (d.getVar("PN", True)))
 }
-- 
2.8.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-10-11 18:44 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-14 19:06 [PATCH] kernel: Add support for multiple kernel packages Haris Okanovic
2015-12-14 19:17 ` Bruce Ashfield
2015-12-14 20:02   ` Bruce Ashfield
2015-12-14 22:31     ` Haris Okanovic
2015-12-14 22:35     ` [PATCH v2] " Haris Okanovic
2015-12-15  0:33       ` Khem Raj
2015-12-15 19:48         ` Haris Okanovic
2016-01-19 22:40       ` Haris Okanovic
2016-02-02 16:12         ` Diego Sueiro
2016-02-02 20:39           ` Haris Okanovic
2016-02-03  8:30             ` Diego Sueiro
2015-12-15 16:58     ` [PATCH] " Denys Dmytriyenko
2015-12-15 19:03       ` Martin Jansa
2015-12-15 19:10         ` Denys Dmytriyenko
2015-12-15 19:45           ` Haris Okanovic
2016-10-11 18:36 ` [PATCH v3] " Haris Okanovic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.