summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel-module-split.bbclass
diff options
context:
space:
mode:
authorHaris Okanovic <haris.okanovic@ni.com>2017-11-07 12:40:39 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-02 17:24:37 +0000
commit5b4aab6b40cf21471442e21abc8051b38985de84 (patch)
tree5ef7f35eed15902da0356765f068d57af99f5c23 /meta/classes/kernel-module-split.bbclass
parent2362b78887a63e2e7e5afe1c1cc539c4a6be959d (diff)
downloadpoky-5b4aab6b40cf21471442e21abc8051b38985de84.tar.gz
kernel: Add support for multiple kernel packages
Some distros may want to provide alternate kernel "flavors" via feeds or within bootable images. For example, readily available builds which provide certain diagnostic features can enable developers and testers to more quickly resolve issues by avoiding lengthy kernel builds. This change allows for building multiple flavors of the kernel and module packages by templatizing kernel package names via a new KERNEL_PACKAGE_NAME variable in kernel.bbclass. It defaults to the old name of "kernel", but can be overridden by certain recipes providing alternate kernel flavors. To maintain compatibility, recipes providing alternate kernel flavors cannot be the "preferred provider" for virtual/kernel. This is because OE puts the preferred provider's build and source at "tmp-glibc/work-shared/$MACHINE/kernel-build-artifacts/" and "tmp-glibc/work-shared/$MACHINE/kernel-source/" instead of "tmp-glibc/work/*/$PN/" like other recipes. Therefore, recipes using the default KERNEL_PACKAGE_NAME="kernel" follows the old semantics -- build in the old location and may be preferred provider -- while recipes using all other KERNEL_PACKAGE_NAME's build from the normal WORKDIR and don't provide "virtual/kernel". Testing: 1. Add `KERNEL_PACKAGE_NAME_pn-linux-yocto-tiny = "tiny-linux"` to local.conf so that linux-yocto-tiny may build alongside the main kernel (linux-yocto). 2. `bitbake linux-yocto linux-yocto-tiny` to build both kernel flavors. 3. Verified image and modules IPKs exist for both: tmp-glibc/deploy/ipk/qemux86/kernel-* for linux-yocto tmp-glibc/deploy/ipk/qemux86/tiny-linux* for linux-yocto-tiny 4. Verified linux-yocto is the "preferred provider", and was built in shared directory: tmp-glibc/work-shared/qemux86/kernel-* 5. Add `CORE_IMAGE_BASE_INSTALL_append_pn-core-image-base = "tiny-linux"` to local.conf to install both kernel flavors in core-image-base. 6. `bitbake core-image-base` to build an image. 7. Verified image contains two bzImage's under /boot/, with "yocto-standard" (linux-yocto recipe) selected to boot via symlink. Discussion threads: http://lists.openembedded.org/pipermail/openembedded-core/2015-December/thread.html#114122 http://lists.openembedded.org/pipermail/openembedded-core/2017-July/thread.html#139130 [YOCTO #11363] (From OE-Core rev: 6c8c899849d101fd1b86aad0b8eed05c7c785924) 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> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/kernel-module-split.bbclass')
-rw-r--r--meta/classes/kernel-module-split.bbclass9
1 files changed, 6 insertions, 3 deletions
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index 1035525dac..73c7f18c78 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -30,7 +30,7 @@ do_install_append() {
30 30
31PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages " 31PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
32 32
33KERNEL_MODULES_META_PACKAGE ?= "kernel-modules" 33KERNEL_MODULES_META_PACKAGE ?= "${@ d.getVar("KERNEL_PACKAGE_NAME", True) or "kernel" }-modules"
34 34
35KERNEL_MODULE_PACKAGE_PREFIX ?= "" 35KERNEL_MODULE_PACKAGE_PREFIX ?= ""
36KERNEL_MODULE_PACKAGE_SUFFIX ?= "-${KERNEL_VERSION}" 36KERNEL_MODULE_PACKAGE_SUFFIX ?= "-${KERNEL_VERSION}"
@@ -129,16 +129,19 @@ python split_kernel_module_packages () {
129 postfix = format.split('%s')[1] 129 postfix = format.split('%s')[1]
130 d.setVar('RPROVIDES_' + pkg, pkg.replace(postfix, '')) 130 d.setVar('RPROVIDES_' + pkg, pkg.replace(postfix, ''))
131 131
132 kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME", True) or "kernel"
133 kernel_version = d.getVar("KERNEL_VERSION", True)
134
132 module_regex = '^(.*)\.k?o$' 135 module_regex = '^(.*)\.k?o$'
133 136
134 module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX') 137 module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX')
135 module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX') 138 module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')
136 module_pattern = module_pattern_prefix + 'kernel-module-%s' + module_pattern_suffix 139 module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix
137 140
138 postinst = d.getVar('pkg_postinst_modules') 141 postinst = d.getVar('pkg_postinst_modules')
139 postrm = d.getVar('pkg_postrm_modules') 142 postrm = d.getVar('pkg_postrm_modules')
140 143
141 modules = do_split_packages(d, root='${nonarch_base_libdir}/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"))) 144 modules = do_split_packages(d, root='${nonarch_base_libdir}/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))
142 if modules: 145 if modules:
143 metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE') 146 metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE')
144 d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules)) 147 d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))