<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 14, 2015 at 2:17 PM, Bruce Ashfield <span dir="ltr">&lt;<a href="mailto:bruce.ashfield@gmail.com" target="_blank">bruce.ashfield@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Dec 14, 2015 at 2:06 PM, Haris Okanovic <span dir="ltr">&lt;<a href="mailto:haris.okanovic@ni.com" target="_blank">haris.okanovic@ni.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Gratian Crisan &lt;<a href="mailto:gratian.crisan@ni.com" target="_blank">gratian.crisan@ni.com</a>&gt;<br>
<br>
Templetize kernel package name:<br>
<br>
Add a &quot;weak&quot; variable KERNEL_PACKAGE_NAME used as the base name for kernel<br>
packages. It defaults to the old hard-coded name &#39;kernel&#39; but it can be<br>
redefined by recipes that provide additional kernel packages in order<br>
to avoid build conflicts.<br>
<br>
Change hard-coded &#39;kernel&#39; references to KERNEL_PACKAGE_NAME in<br>
kernel bbclass-es.<br>
<br>
Build alternate kernels from WORKDIR instead of STAGING_KERNEL_DIR:<br>
<br>
Prior to this change, kernel recipes would all fetch source to<br>
STAGING_KERNEL_DIR as defined by bitbake/distro confs. This broke<br>
parallel builds when more than one kernel recipes are defined in<br>
the distribution, since they all attempted to fetch() and patch()<br>
in a shared source dir.<br>
<br>
With this change, alternate kernel recipes fetch source into their<br>
${WORKDIR} so that they may build in parallel to each other and the<br>
default kernel recipe, which still fetches to STAGING_KERNEL_DIR.<br></blockquote><div><br><br></div></span><div>But what&#39;s the system level use case for this capability ? Honestly, it just<br></div><div>looks complicated .. and I&#39;m not seeing exactly multiple kernels are being<br></div><div>built in parallel in a single build. We&#39;ve been forcing everything explicitly<br></div><div>to be in a single, shared location .. and I see that this is both complicating<br></div><div>and a possible source of errors.<br><br></div><div>It&#39;s probably that I&#39;m just misunderstanding the point of the change.<br><br></div><div>If I had to guess, you are building recovery, or kexec/kdump kernels along<br></div><div>side the main kernel ?<br></div></div></div></div></blockquote><div><br></div><div>Aha. I see the debug kernel reference in the comments (as one example).<br><br></div><div>As a follow up. If these kernel&#39;s are building via kernel.bbclass, how are you<br></div><div>avoiding the artifacts all ending up in STAGING_KERNEL_BUILDDIR ? I did<br></div><div>a quick scan, and couldn&#39;t see if it was being considered.<br><br></div><div>Bruce<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div><br></div><div>Cheers,<br><br></div><div>Bruce<br></div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Testing:<br>
<br>
Built linux-yocto-4.1.13 for qemux86 and verified it produced kernel<br>
image and modules packages. Added kernel recipe with non-default<br>
KERNEL_PACKAGE_NAME and verified it produces kernel image and modules<br>
packages with alternate name next to default kernel.<br>
<br>
Signed-off-by: Gratian Crisan &lt;<a href="mailto:gratian.crisan@ni.com" target="_blank">gratian.crisan@ni.com</a>&gt;<br>
Signed-off-by: Haris Okanovic &lt;<a href="mailto:haris.okanovic@ni.com" target="_blank">haris.okanovic@ni.com</a>&gt;<br>
Coauthored-by: Haris Okanovic &lt;<a href="mailto:haris.okanovic@ni.com" target="_blank">haris.okanovic@ni.com</a>&gt;<br>
Coauthored-by: Josh Hernstrom &lt;<a href="mailto:josh.hernstrom@ni.com" target="_blank">josh.hernstrom@ni.com</a>&gt;<br>
Natinst-ReviewBoard-ID: 120348<br>
Natinst-ReviewBoard-ID: 120447<br>
---<br>
 meta/classes/kernel-module-split.bbclass |  9 ++--<br>
 meta/classes/kernel.bbclass              | 71 ++++++++++++++++++--------------<br>
 meta/conf/documentation.conf             |  1 +<br>
 meta/recipes-kernel/linux/linux-dtb.inc  |  2 +-<br>
 4 files changed, 49 insertions(+), 34 deletions(-)<br>
<br>
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass<br>
index e1a70e6..7415ec8 100644<br>
--- a/meta/classes/kernel-module-split.bbclass<br>
+++ b/meta/classes/kernel-module-split.bbclass<br>
@@ -28,7 +28,7 @@ do_install_append() {<br>
<br>
 PACKAGESPLITFUNCS_prepend = &quot;split_kernel_module_packages &quot;<br>
<br>
-KERNEL_MODULES_META_PACKAGE ?= &quot;kernel-modules&quot;<br>
+KERNEL_MODULES_META_PACKAGE ?= &quot;${KERNEL_PACKAGE_NAME}-modules&quot;<br>
<br>
 python split_kernel_module_packages () {<br>
     import re<br>
@@ -179,14 +179,17 @@ python split_kernel_module_packages () {<br>
         # Avoid automatic -dev recommendations for modules ending with -dev.<br>
         d.setVarFlag(&#39;RRECOMMENDS_&#39; + pkg, &#39;nodeprrecs&#39;, 1)<br>
<br>
+    kernel_package_name = d.getVar(&quot;KERNEL_PACKAGE_NAME&quot;, True)<br>
+    kernel_version = d.getVar(&quot;KERNEL_VERSION&quot;, True)<br>
+<br>
     module_deps = parse_depmod()<br>
     module_regex = &#39;^(.*)\.k?o$&#39;<br>
-    module_pattern = &#39;kernel-module-%s&#39;<br>
+    module_pattern = &#39;%s-module-%%s&#39; % kernel_package_name<br>
<br>
     postinst = d.getVar(&#39;pkg_postinst_modules&#39;, True)<br>
     postrm = d.getVar(&#39;pkg_postrm_modules&#39;, True)<br>
<br>
-    modules = do_split_packages(d, root=&#39;/lib/modules&#39;, file_regex=module_regex, output_pattern=module_pattern, description=&#39;%s kernel module&#39;, postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends=&#39;kernel-%s&#39; % (d.getVar(&quot;KERNEL_VERSION&quot;, True)))<br>
+    modules = do_split_packages(d, root=&#39;/lib/modules&#39;, file_regex=module_regex, output_pattern=module_pattern, description=&#39;%s kernel module&#39;, postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends=&#39;%s-%s&#39; % (kernel_package_name, kernel_version))<br>
     if modules:<br>
         metapkg = d.getVar(&#39;KERNEL_MODULES_META_PACKAGE&#39;, True)<br>
         d.appendVar(&#39;RDEPENDS_&#39; + metapkg, &#39; &#39;+&#39; &#39;.join(modules))<br>
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass<br>
index b75a462..cc27364 100644<br>
--- a/meta/classes/kernel.bbclass<br>
+++ b/meta/classes/kernel.bbclass<br>
@@ -3,7 +3,6 @@ inherit linux-kernel-base kernel-module-split<br>
 PROVIDES += &quot;virtual/kernel&quot;<br>
 DEPENDS += &quot;virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native&quot;<br>
<br>
-S = &quot;${STAGING_KERNEL_DIR}&quot;<br>
 B = &quot;${WORKDIR}/build&quot;<br>
 KBUILD_OUTPUT = &quot;${B}&quot;<br>
 OE_TERMINAL_EXPORTS += &quot;KBUILD_OUTPUT&quot;<br>
@@ -11,6 +10,7 @@ OE_TERMINAL_EXPORTS += &quot;KBUILD_OUTPUT&quot;<br>
 # we include gcc above, we dont need virtual/libc<br>
 INHIBIT_DEFAULT_DEPS = &quot;1&quot;<br>
<br>
+KERNEL_PACKAGE_NAME ??= &quot;kernel&quot;<br>
 KERNEL_IMAGETYPE ?= &quot;zImage&quot;<br>
 INITRAMFS_IMAGE ?= &quot;&quot;<br>
 INITRAMFS_TASK ?= &quot;&quot;<br>
@@ -34,6 +34,17 @@ python __anonymous () {<br>
     image_task = d.getVar(&#39;INITRAMFS_TASK&#39;, True)<br>
     if image_task:<br>
         d.appendVarFlag(&#39;do_configure&#39;, &#39;depends&#39;, &#39; ${INITRAMFS_TASK}&#39;)<br>
+<br>
+    # The default kernel recipe fetches it&#39;s source to<br>
+    # STAGING_KERNEL_DIR as defined by bitbake/distro confs.<br>
+    # Alternate kernel recipes (E.g. debug kernels) fetch source into<br>
+    # their work dir so that they may build in parallel.<br>
+    if d.getVar(&quot;KERNEL_PACKAGE_NAME&quot;, True) == &quot;kernel&quot;:<br>
+        d.setVar(&quot;S&quot;, d.getVar(&quot;STAGING_KERNEL_DIR&quot;, True))<br>
+    else:<br>
+        workdir = d.getVar(&quot;WORKDIR&quot;, True)<br>
+        kernelSourceDir = os.path.join(workdir, &#39;kernel-source&#39;)<br>
+        d.setVar(&quot;S&quot;, kernelSourceDir)<br>
 }<br>
<br>
 # Here we pull in all various kernel image types which we support.<br>
@@ -79,9 +90,9 @@ base_do_unpack_append () {<br>
<br>
 inherit kernel-arch deploy<br>
<br>
-PACKAGES_DYNAMIC += &quot;^kernel-module-.*&quot;<br>
-PACKAGES_DYNAMIC += &quot;^kernel-image-.*&quot;<br>
-PACKAGES_DYNAMIC += &quot;^kernel-firmware-.*&quot;<br>
+PACKAGES_DYNAMIC += &quot;^${KERNEL_PACKAGE_NAME}-module-.*&quot;<br>
+PACKAGES_DYNAMIC += &quot;^${KERNEL_PACKAGE_NAME}-image-.*&quot;<br>
+PACKAGES_DYNAMIC += &quot;^${KERNEL_PACKAGE_NAME}-firmware-.*&quot;<br>
<br>
 export OS = &quot;${TARGET_OS}&quot;<br>
 export CROSS_COMPILE = &quot;${TARGET_PREFIX}&quot;<br>
@@ -270,9 +281,9 @@ do_shared_workdir_setscene () {<br>
<br>
 emit_depmod_pkgdata() {<br>
        # Stash data for depmod<br>
-       install -d ${PKGDESTWORK}/kernel-depmod/<br>
-       echo &quot;${KERNEL_VERSION}&quot; &gt; ${PKGDESTWORK}/kernel-depmod/kernel-abiversion<br>
-       cp ${B}/System.map ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}<br>
+       install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/<br>
+       echo &quot;${KERNEL_VERSION}&quot; &gt; ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion<br>
+       cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}<br>
 }<br>
<br>
 PACKAGEFUNCS += &quot;emit_depmod_pkgdata&quot;<br>
@@ -287,7 +298,7 @@ do_shared_workdir () {<br>
        # Store the kernel version in sysroots for module-base.bbclass<br>
        #<br>
<br>
-       echo &quot;${KERNEL_VERSION}&quot; &gt; $kerneldir/kernel-abiversion<br>
+       echo &quot;${KERNEL_VERSION}&quot; &gt; $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion<br>
<br>
        # Copy files required for module builds<br>
        cp System.map $kerneldir/System.map-${KERNEL_VERSION}<br>
@@ -361,28 +372,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure<br>
<br>
 # kernel-base becomes kernel-${KERNEL_VERSION}<br>
 # kernel-image becomes kernel-image-${KERNEL_VERISON}<br>
-PACKAGES = &quot;kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules&quot;<br>
+PACKAGES = &quot;${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules&quot;<br>
 FILES_${PN} = &quot;&quot;<br>
-FILES_kernel-base = &quot;/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin&quot;<br>
-FILES_kernel-image = &quot;/boot/${KERNEL_IMAGETYPE}*&quot;<br>
-FILES_kernel-dev = &quot;/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build&quot;<br>
-FILES_kernel-vmlinux = &quot;/boot/vmlinux*&quot;<br>
-FILES_kernel-modules = &quot;&quot;<br>
-RDEPENDS_kernel = &quot;kernel-base&quot;<br>
+FILES_${KERNEL_PACKAGE_NAME}-base = &quot;/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin&quot;<br>
+FILES_${KERNEL_PACKAGE_NAME}-image = &quot;/boot/${KERNEL_IMAGETYPE}*&quot;<br>
+FILES_${KERNEL_PACKAGE_NAME}-dev = &quot;/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build&quot;<br>
+FILES_${KERNEL_PACKAGE_NAME}-vmlinux = &quot;/boot/vmlinux*&quot;<br>
+FILES_${KERNEL_PACKAGE_NAME}-modules = &quot;&quot;<br>
+RDEPENDS_${KERNEL_PACKAGE_NAME} = &quot;${KERNEL_PACKAGE_NAME}-base&quot;<br>
 # Allow machines to override this dependency if kernel image files are<br>
 # not wanted in images as standard<br>
-RDEPENDS_kernel-base ?= &quot;kernel-image&quot;<br>
-PKG_kernel-image = &quot;kernel-image-${@legitimize_package_name(&#39;${KERNEL_VERSION}&#39;)}&quot;<br>
-RDEPENDS_kernel-image += &quot;${@base_conditional(&#39;KERNEL_IMAGETYPE&#39;, &#39;vmlinux&#39;, &#39;kernel-vmlinux&#39;, &#39;&#39;, d)}&quot;<br>
-PKG_kernel-base = &quot;kernel-${@legitimize_package_name(&#39;${KERNEL_VERSION}&#39;)}&quot;<br>
-RPROVIDES_kernel-base += &quot;kernel-${KERNEL_VERSION}&quot;<br>
-ALLOW_EMPTY_kernel = &quot;1&quot;<br>
-ALLOW_EMPTY_kernel-base = &quot;1&quot;<br>
-ALLOW_EMPTY_kernel-image = &quot;1&quot;<br>
-ALLOW_EMPTY_kernel-modules = &quot;1&quot;<br>
-DESCRIPTION_kernel-modules = &quot;Kernel modules meta package&quot;<br>
-<br>
-pkg_postinst_kernel-base () {<br>
+RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= &quot;${KERNEL_PACKAGE_NAME}-image&quot;<br>
+PKG_${KERNEL_PACKAGE_NAME}-image = &quot;${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name(&#39;${KERNEL_VERSION}&#39;)}&quot;<br>
+RDEPENDS_${KERNEL_PACKAGE_NAME}-image += &quot;${@base_conditional(&#39;KERNEL_IMAGETYPE&#39;, &#39;vmlinux&#39;, &#39;${KERNEL_PACKAGE_NAME}-vmlinux&#39;, &#39;&#39;, d)}&quot;<br>
+PKG_${KERNEL_PACKAGE_NAME}-base = &quot;${KERNEL_PACKAGE_NAME}-${@legitimize_package_name(&#39;${KERNEL_VERSION}&#39;)}&quot;<br>
+RPROVIDES_${KERNEL_PACKAGE_NAME}-base += &quot;${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}&quot;<br>
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = &quot;1&quot;<br>
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = &quot;1&quot;<br>
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = &quot;1&quot;<br>
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = &quot;1&quot;<br>
+DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = &quot;Kernel modules meta package&quot;<br>
+<br>
+pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {<br>
        if [ ! -e &quot;$D/lib/modules/${KERNEL_VERSION}&quot; ]; then<br>
                mkdir -p $D/lib/modules/${KERNEL_VERSION}<br>
        fi<br>
@@ -393,18 +404,18 @@ pkg_postinst_kernel-base () {<br>
        fi<br>
 }<br>
<br>
-pkg_postinst_kernel-image () {<br>
+pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {<br>
        update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true<br>
 }<br>
<br>
-pkg_postrm_kernel-image () {<br>
+pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {<br>
        update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true<br>
 }<br>
<br>
 PACKAGESPLITFUNCS_prepend = &quot;split_kernel_packages &quot;<br>
<br>
 python split_kernel_packages () {<br>
-    do_split_packages(d, root=&#39;/lib/firmware&#39;, file_regex=&#39;^(.*)\.(bin|fw|cis|dsp)$&#39;, output_pattern=&#39;kernel-firmware-%s&#39;, description=&#39;Firmware for %s&#39;, recursive=True, extra_depends=&#39;&#39;)<br>
+    do_split_packages(d, root=&#39;/lib/firmware&#39;, file_regex=&#39;^(.*)\.(bin|fw|cis|dsp)$&#39;, output_pattern=&#39;${KERNEL_PACKAGE_NAME}-firmware-%s&#39;, description=&#39;Firmware for %s&#39;, recursive=True, extra_depends=&#39;&#39;)<br>
 }<br>
<br>
 do_strip() {<br>
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf<br>
index 1b5c071..fb5e03f 100644<br>
--- a/meta/conf/documentation.conf<br>
+++ b/meta/conf/documentation.conf<br>
@@ -250,6 +250,7 @@ KERNEL_FEATURES[doc] = &quot;Includes additional metadata from the Yocto Project kern<br>
 KERNEL_IMAGETYPE[doc] = &quot;The type of kernel to build for a device, usually set by the machine configuration files and defaults to &#39;zImage&#39;.&quot;<br>
 KERNEL_MODULE_AUTOLOAD[doc] = &quot;Lists kernel modules that need to be auto-loaded during boot&quot;<br>
 KERNEL_MODULE_PROBECONF[doc] = &quot;Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules&quot;<br>
+KERNEL_PACKAGE_NAME[doc] = &quot;Name prefix for kernel packages. Defaults to &#39;kernel&#39;.&quot;<br>
 KERNEL_PATH[doc] = &quot;The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass).&quot;<br>
 KERNEL_SRC[doc] = &quot;The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass).&quot;<br>
 KFEATURE_DESCRIPTION[doc] = &quot;Provides a short description of a configuration fragment. You use this variable in the .scc file that describes a configuration fragment file.&quot;<br>
diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc<br>
index 772adcb..c27a3cb 100644<br>
--- a/meta/recipes-kernel/linux/linux-dtb.inc<br>
+++ b/meta/recipes-kernel/linux/linux-dtb.inc<br>
@@ -2,7 +2,7 @@<br>
 FILES_kernel-devicetree = &quot;/${KERNEL_IMAGEDEST}/devicetree*&quot;<br>
<br>
 python __anonymous () {<br>
-    d.appendVar(&quot;PACKAGES&quot;, &quot; kernel-devicetree&quot;)<br>
+    d.appendVar(&quot;PACKAGES&quot;, &quot; ${KERNEL_PACKAGE_NAME}-devicetree&quot;)<br>
 }<br>
<br>
 normalize_dtb () {<br>
<span><font color="#888888">--<br>
2.6.2<br>
<br>
--<br>
_______________________________________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</font></span></blockquote></div></div></div><span class=""><font color="#888888"><br><br clear="all"><br>-- <br><div>&quot;Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end&quot;</div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">&quot;Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end&quot;</div>
</div></div>