From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f51.google.com (mail-vk0-f51.google.com [209.85.213.51]) by mail.openembedded.org (Postfix) with ESMTP id 0A4DF7316F for ; Mon, 14 Dec 2015 19:16:59 +0000 (UTC) Received: by vkgj66 with SMTP id j66so64030468vkg.1 for ; Mon, 14 Dec 2015 11:17:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=damWMoFbXehkk+NmubzduFLuTB9SiKYoGRagrjvLtN8=; b=J1wL8ckj/gwyzmszCXOm4JMzTEFPqlLtKctdvJ/i5yXA4ebHqrUDETdg7y86OHPl8B olRFNQdIGMtdZMWSnF7PUhkfWAZKIqHsVPIQQ4Nwgq2GB/XVrM8EGhP1hMLMnThQLw8Z ku/zt2ZLDlZFcIatBMhkqmCQO22BRgbLWdgxOHCom6wxmD/brLzQk1oCg86ip6fsU+Re FRJkzr087MhyKZDMGN5yl7A6H15XbGd5UrrFiwmQJWf6aQxqbD4gDiuxs79qZh/OBOX9 +7JfPC1tO87Lrd9rh9b8HZ1QH1y2mcVjyObpHWcDAG8IzM06a4UDQdfbaA29otLBg75v 0p2w== MIME-Version: 1.0 X-Received: by 10.31.48.11 with SMTP id w11mr23293840vkw.114.1450120620144; Mon, 14 Dec 2015 11:17:00 -0800 (PST) Received: by 10.31.202.196 with HTTP; Mon, 14 Dec 2015 11:17:00 -0800 (PST) In-Reply-To: <1450119998-2912-1-git-send-email-haris.okanovic@ni.com> References: <1450119998-2912-1-git-send-email-haris.okanovic@ni.com> Date: Mon, 14 Dec 2015 14:17:00 -0500 Message-ID: From: Bruce Ashfield To: Haris Okanovic Cc: Gratian Crisan , Patches and discussions about the oe-core layer Subject: Re: [PATCH] kernel: Add support for multiple kernel packages X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Dec 2015 19:17:01 -0000 Content-Type: multipart/alternative; boundary=001a1143e72871fc920526e08489 --001a1143e72871fc920526e08489 Content-Type: text/plain; charset=UTF-8 On Mon, Dec 14, 2015 at 2:06 PM, Haris Okanovic wrote: > From: Gratian Crisan > > 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 > Signed-off-by: Haris Okanovic > Coauthored-by: Haris Okanovic > Coauthored-by: Josh Hernstrom > 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" --001a1143e72871fc920526e08489 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Mon, Dec 14, 2015 at 2:06 PM, Haris Okanovic <<= a href=3D"mailto:haris.okanovic@ni.com" target=3D"_blank">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 f= or kernel
packages. It defaults to the old hard-coded name 'kernel' but it ca= n 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
=C2=A0

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
---
=C2=A0meta/classes/kernel-module-split.bbclass |=C2=A0 9 ++--
=C2=A0meta/classes/kernel.bbclass=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 | 71 ++++++++++++++++++--------------
=C2=A0meta/conf/documentation.conf=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0|=C2=A0 1 +
=C2=A0meta/recipes-kernel/linux/linux-dtb.inc=C2=A0 |=C2=A0 2 +-
=C2=A04 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() {

=C2=A0PACKAGESPLITFUNCS_prepend =3D "split_kernel_module_packages &quo= t;

-KERNEL_MODULES_META_PACKAGE ?=3D "kernel-modules"
+KERNEL_MODULES_META_PACKAGE ?=3D "${KERNEL_PACKAGE_NAME}-modules"= ;

=C2=A0python split_kernel_module_packages () {
=C2=A0 =C2=A0 =C2=A0import re
@@ -179,14 +179,17 @@ python split_kernel_module_packages () {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# Avoid automatic -dev recommendations fo= r modules ending with -dev.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0d.setVarFlag('RRECOMMENDS_' + pkg= , 'nodeprrecs', 1)

+=C2=A0 =C2=A0 kernel_package_name =3D d.getVar("KERNEL_PACKAGE_NAME&q= uot;, True)
+=C2=A0 =C2=A0 kernel_version =3D d.getVar("KERNEL_VERSION", True= )
+
=C2=A0 =C2=A0 =C2=A0module_deps =3D parse_depmod()
=C2=A0 =C2=A0 =C2=A0module_regex =3D '^(.*)\.k?o$'
-=C2=A0 =C2=A0 module_pattern =3D 'kernel-module-%s'
+=C2=A0 =C2=A0 module_pattern =3D '%s-module-%%s' % kernel_package_= name

=C2=A0 =C2=A0 =C2=A0postinst =3D d.getVar('pkg_postinst_modules', T= rue)
=C2=A0 =C2=A0 =C2=A0postrm =3D d.getVar('pkg_postrm_modules', True)=

-=C2=A0 =C2=A0 modules =3D do_split_packages(d, root=3D'/lib/modules= 9;, file_regex=3Dmodule_regex, output_pattern=3Dmodule_pattern, description= =3D'%s kernel module', postinst=3Dpostinst, postrm=3Dpostrm, recurs= ive=3DTrue, hook=3Dfrob_metadata, extra_depends=3D'kernel-%s' % (d.= getVar("KERNEL_VERSION", True)))
+=C2=A0 =C2=A0 modules =3D do_split_packages(d, root=3D'/lib/modules= 9;, file_regex=3Dmodule_regex, output_pattern=3Dmodule_pattern, description= =3D'%s kernel module', postinst=3Dpostinst, postrm=3Dpostrm, recurs= ive=3DTrue, hook=3Dfrob_metadata, extra_depends=3D'%s-%s' % (kernel= _package_name, kernel_version))
=C2=A0 =C2=A0 =C2=A0if modules:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0metapkg =3D d.getVar('KERNEL_MODULES_= META_PACKAGE', True)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0d.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
=C2=A0PROVIDES +=3D "virtual/kernel"
=C2=A0DEPENDS +=3D "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_= PREFIX}gcc kmod-native depmodwrapper-cross bc-native"

-S =3D "${STAGING_KERNEL_DIR}"
=C2=A0B =3D "${WORKDIR}/build"
=C2=A0KBUILD_OUTPUT =3D "${B}"
=C2=A0OE_TERMINAL_EXPORTS +=3D "KBUILD_OUTPUT"
@@ -11,6 +10,7 @@ OE_TERMINAL_EXPORTS +=3D "KBUILD_OUTPUT"
=C2=A0# we include gcc above, we dont need virtual/libc
=C2=A0INHIBIT_DEFAULT_DEPS =3D "1"

+KERNEL_PACKAGE_NAME ??=3D "kernel"
=C2=A0KERNEL_IMAGETYPE ?=3D "zImage"
=C2=A0INITRAMFS_IMAGE ?=3D ""
=C2=A0INITRAMFS_TASK ?=3D ""
@@ -34,6 +34,17 @@ python __anonymous () {
=C2=A0 =C2=A0 =C2=A0image_task =3D d.getVar('INITRAMFS_TASK', True)=
=C2=A0 =C2=A0 =C2=A0if image_task:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0d.appendVarFlag('do_configure', &= #39;depends', ' ${INITRAMFS_TASK}')
+
+=C2=A0 =C2=A0 # The default kernel recipe fetches it's source to
+=C2=A0 =C2=A0 # STAGING_KERNEL_DIR as defined by bitbake/distro confs.
+=C2=A0 =C2=A0 # Alternate kernel recipes (E.g. debug kernels) fetch source= into
+=C2=A0 =C2=A0 # their work dir so that they may build in parallel.
+=C2=A0 =C2=A0 if d.getVar("KERNEL_PACKAGE_NAME", True) =3D=3D &q= uot;kernel":
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 d.setVar("S", d.getVar("STAGING= _KERNEL_DIR", True))
+=C2=A0 =C2=A0 else:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 workdir =3D d.getVar("WORKDIR", True= )
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 kernelSourceDir =3D os.path.join(workdir, '= ;kernel-source')
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 d.setVar("S", kernelSourceDir)
=C2=A0}

=C2=A0# Here we pull in all various kernel image types which we support. @@ -79,9 +90,9 @@ base_do_unpack_append () {

=C2=A0inherit kernel-arch deploy

-PACKAGES_DYNAMIC +=3D "^kernel-module-.*"
-PACKAGES_DYNAMIC +=3D "^kernel-image-.*"
-PACKAGES_DYNAMIC +=3D "^kernel-firmware-.*"
+PACKAGES_DYNAMIC +=3D "^${KERNEL_PACKAGE_NAME}-module-.*"
+PACKAGES_DYNAMIC +=3D "^${KERNEL_PACKAGE_NAME}-image-.*"
+PACKAGES_DYNAMIC +=3D "^${KERNEL_PACKAGE_NAME}-firmware-.*"

=C2=A0export OS =3D "${TARGET_OS}"
=C2=A0export CROSS_COMPILE =3D "${TARGET_PREFIX}"
@@ -270,9 +281,9 @@ do_shared_workdir_setscene () {

=C2=A0emit_depmod_pkgdata() {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Stash data for depmod
-=C2=A0 =C2=A0 =C2=A0 =C2=A0install -d ${PKGDESTWORK}/kernel-depmod/
-=C2=A0 =C2=A0 =C2=A0 =C2=A0echo "${KERNEL_VERSION}" > ${PKGDE= STWORK}/kernel-depmod/kernel-abiversion
-=C2=A0 =C2=A0 =C2=A0 =C2=A0cp ${B}/System.map ${PKGDESTWORK}/kernel-depmod= /System.map-${KERNEL_VERSION}
+=C2=A0 =C2=A0 =C2=A0 =C2=A0install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME= }-depmod/
+=C2=A0 =C2=A0 =C2=A0 =C2=A0echo "${KERNEL_VERSION}" > ${PKGDE= STWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
+=C2=A0 =C2=A0 =C2=A0 =C2=A0cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACK= AGE_NAME}-depmod/System.map-${KERNEL_VERSION}
=C2=A0}

=C2=A0PACKAGEFUNCS +=3D "emit_depmod_pkgdata"
@@ -287,7 +298,7 @@ do_shared_workdir () {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Store the kernel version in sysroots for modu= le-base.bbclass
=C2=A0 =C2=A0 =C2=A0 =C2=A0 #

-=C2=A0 =C2=A0 =C2=A0 =C2=A0echo "${KERNEL_VERSION}" > $kernel= dir/kernel-abiversion
+=C2=A0 =C2=A0 =C2=A0 =C2=A0echo "${KERNEL_VERSION}" > $kernel= dir/${KERNEL_PACKAGE_NAME}-abiversion

=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Copy files required for module builds
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cp System.map $kerneldir/System.map-${KERNEL_VE= RSION}
@@ -361,28 +372,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
=C2=A0# kernel-base becomes kernel-${KERNEL_VERSION}
=C2=A0# kernel-image becomes kernel-image-${KERNEL_VERISON}
-PACKAGES =3D "kernel kernel-base kernel-vmlinux kernel-image kernel-d= ev kernel-modules"
+PACKAGES =3D "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KE= RNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NA= ME}-dev ${KERNEL_PACKAGE_NAME}-modules"
=C2=A0FILES_${PN} =3D ""
-FILES_kernel-base =3D "/lib/modules/${KERNEL_VERSION}/modules.order /= lib/modules/${KERNEL_VERSION}/modules.builtin"
-FILES_kernel-image =3D "/boot/${KERNEL_IMAGETYPE}*"
-FILES_kernel-dev =3D "/boot/System.map* /boot/Module.symvers* /boot/c= onfig* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
-FILES_kernel-vmlinux =3D "/boot/vmlinux*"
-FILES_kernel-modules =3D ""
-RDEPENDS_kernel =3D "kernel-base"
+FILES_${KERNEL_PACKAGE_NAME}-base =3D "/lib/modules/${KERNEL_VERSION}= /modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
+FILES_${KERNEL_PACKAGE_NAME}-image =3D "/boot/${KERNEL_IMAGETYPE}*&qu= ot;
+FILES_${KERNEL_PACKAGE_NAME}-dev =3D "/boot/System.map* /boot/Module.= symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/bu= ild"
+FILES_${KERNEL_PACKAGE_NAME}-vmlinux =3D "/boot/vmlinux*"
+FILES_${KERNEL_PACKAGE_NAME}-modules =3D ""
+RDEPENDS_${KERNEL_PACKAGE_NAME} =3D "${KERNEL_PACKAGE_NAME}-base"= ;
=C2=A0# Allow machines to override this dependency if kernel image files ar= e
=C2=A0# not wanted in images as standard
-RDEPENDS_kernel-base ?=3D "kernel-image"
-PKG_kernel-image =3D "kernel-image-${@legitimize_package_name('${= KERNEL_VERSION}')}"
-RDEPENDS_kernel-image +=3D "${@base_conditional('KERNEL_IMAGETYPE= ', 'vmlinux', 'kernel-vmlinux', '', d)}" -PKG_kernel-base =3D "kernel-${@legitimize_package_name('${KERNEL_= VERSION}')}"
-RPROVIDES_kernel-base +=3D "kernel-${KERNEL_VERSION}"
-ALLOW_EMPTY_kernel =3D "1"
-ALLOW_EMPTY_kernel-base =3D "1"
-ALLOW_EMPTY_kernel-image =3D "1"
-ALLOW_EMPTY_kernel-modules =3D "1"
-DESCRIPTION_kernel-modules =3D "Kernel modules meta package"
-
-pkg_postinst_kernel-base () {
+RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?=3D "${KERNEL_PACKAGE_NAME}-ima= ge"
+PKG_${KERNEL_PACKAGE_NAME}-image =3D "${KERNEL_PACKAGE_NAME}-image-${= @legitimize_package_name('${KERNEL_VERSION}')}"
+RDEPENDS_${KERNEL_PACKAGE_NAME}-image +=3D "${@base_conditional('= KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlin= ux', '', d)}"
+PKG_${KERNEL_PACKAGE_NAME}-base =3D "${KERNEL_PACKAGE_NAME}-${@legiti= mize_package_name('${KERNEL_VERSION}')}"
+RPROVIDES_${KERNEL_PACKAGE_NAME}-base +=3D "${KERNEL_PACKAGE_NAME}-${= KERNEL_VERSION}"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} =3D "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base =3D "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image =3D "1"
+ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules =3D "1"
+DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules =3D "Kernel modules meta p= ackage"
+
+pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if [ ! -e "$D/lib/modules/${KERNEL_VERSION= }" ]; then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mkdir -p $D/lib/mod= ules/${KERNEL_VERSION}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 fi
@@ -393,18 +404,18 @@ pkg_postinst_kernel-base () {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 fi
=C2=A0}

-pkg_postinst_kernel-image () {
+pkg_postinst_${KERNEL_PACKAGE_NAME}-image () {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 update-alternatives --install /${KERNEL_IMAGEDE= ST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_I= MAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
=C2=A0}

-pkg_postrm_kernel-image () {
+pkg_postrm_${KERNEL_PACKAGE_NAME}-image () {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 update-alternatives --remove ${KERNEL_IMAGETYPE= } ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
=C2=A0}

=C2=A0PACKAGESPLITFUNCS_prepend =3D "split_kernel_packages "

=C2=A0python split_kernel_packages () {
-=C2=A0 =C2=A0 do_split_packages(d, root=3D'/lib/firmware', file_re= gex=3D'^(.*)\.(bin|fw|cis|dsp)$', output_pattern=3D'kernel-firm= ware-%s', description=3D'Firmware for %s', recursive=3DTrue, ex= tra_depends=3D'')
+=C2=A0 =C2=A0 do_split_packages(d, root=3D'/lib/firmware', file_re= gex=3D'^(.*)\.(bin|fw|cis|dsp)$', output_pattern=3D'${KERNEL_PA= CKAGE_NAME}-firmware-%s', description=3D'Firmware for %s', recu= rsive=3DTrue, extra_depends=3D'')
=C2=A0}

=C2=A0do_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] =3D "Includes additional meta= data from the Yocto Project kern
=C2=A0KERNEL_IMAGETYPE[doc] =3D "The type of kernel to build for a dev= ice, usually set by the machine configuration files and defaults to 'zI= mage'."
=C2=A0KERNEL_MODULE_AUTOLOAD[doc] =3D "Lists kernel modules that need = to be auto-loaded during boot"
=C2=A0KERNEL_MODULE_PROBECONF[doc] =3D "Lists kernel modules for which= the build system expects to find module_conf_* values that specify configu= ration for each of the modules"
+KERNEL_PACKAGE_NAME[doc] =3D "Name prefix for kernel packages. Defaul= ts to 'kernel'."
=C2=A0KERNEL_PATH[doc] =3D "The location of the kernel sources. This v= ariable is set to the value of the STAGING_KERNEL_DIR within the module cla= ss (module.bbclass)."
=C2=A0KERNEL_SRC[doc] =3D "The location of the kernel sources. This va= riable is set to the value of the STAGING_KERNEL_DIR within the module clas= s (module.bbclass)."
=C2=A0KFEATURE_DESCRIPTION[doc] =3D "Provides a short description of a= configuration fragment. You use this variable in the .scc file that descri= bes 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 @@
=C2=A0FILES_kernel-devicetree =3D "/${KERNEL_IMAGEDEST}/devicetree*&qu= ot;

=C2=A0python __anonymous () {
-=C2=A0 =C2=A0 d.appendVar("PACKAGES", " kernel-devicetree&q= uot;)
+=C2=A0 =C2=A0 d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NA= ME}-devicetree")
=C2=A0}

=C2=A0normalize_dtb () {
--
2.6.2

--
_______________________________________________
Openembedded-core mailing list
Openembedded-co= re@lists.openembedded.org
http://lists.openembedded.org/mailma= n/listinfo/openembedded-core



--
"Thou shalt not follow the NULL pointer, for cha= os and madness await thee at its end"
--001a1143e72871fc920526e08489--