summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--meta/classes/kernel-devicetree.bbclass8
-rw-r--r--meta/classes/kernel-module-split.bbclass9
-rw-r--r--meta/classes/kernel.bbclass114
-rw-r--r--meta/conf/documentation.conf1
-rw-r--r--meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb14
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb2
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_4.12.bb2
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb2
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb2
-rw-r--r--meta/recipes-kernel/linux/linux-yocto.inc2
10 files changed, 94 insertions, 62 deletions
diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass
index 6e08be4b70..4f80cc62eb 100644
--- a/meta/classes/kernel-devicetree.bbclass
+++ b/meta/classes/kernel-devicetree.bbclass
@@ -1,10 +1,10 @@
1# Support for device tree generation 1# Support for device tree generation
2PACKAGES_append = " \ 2PACKAGES_append = " \
3 kernel-devicetree \ 3 ${KERNEL_PACKAGE_NAME}-devicetree \
4 ${@['kernel-image-zimage-bundle', ''][d.getVar('KERNEL_DEVICETREE_BUNDLE') != '1']} \ 4 ${@[d.getVar('KERNEL_PACKAGE_NAME') + '-image-zimage-bundle', ''][d.getVar('KERNEL_DEVICETREE_BUNDLE') != '1']} \
5" 5"
6FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo" 6FILES_${KERNEL_PACKAGE_NAME}-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo"
7FILES_kernel-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin" 7FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin"
8 8
9# Generate kernel+devicetree bundle 9# Generate kernel+devicetree bundle
10KERNEL_DEVICETREE_BUNDLE ?= "0" 10KERNEL_DEVICETREE_BUNDLE ?= "0"
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))
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index e7eda83bd0..f7b612f84f 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -1,6 +1,9 @@
1inherit linux-kernel-base kernel-module-split 1inherit linux-kernel-base kernel-module-split
2 2
3PROVIDES += "virtual/kernel" 3KERNEL_PACKAGE_NAME ??= "kernel"
4KERNEL_DEPLOYSUBDIR ??= "${@ "" if (d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel") else d.getVar("KERNEL_PACKAGE_NAME", True) }"
5
6PROVIDES += "${@ "virtual/kernel" if (d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel") else "" }"
4DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native lzop-native" 7DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native lzop-native"
5PACKAGE_WRITE_DEPS += "depmodwrapper-cross" 8PACKAGE_WRITE_DEPS += "depmodwrapper-cross"
6 9
@@ -34,11 +37,32 @@ KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION')
34KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}" 37KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}"
35 38
36python __anonymous () { 39python __anonymous () {
40 pn = d.getVar("PN", True)
41 kpn = d.getVar("KERNEL_PACKAGE_NAME", True)
42
43 # XXX Remove this after bug 11905 is resolved
44 # FILES_${KERNEL_PACKAGE_NAME}-dev doesn't expand correctly
45 if kpn == pn:
46 bb.warn("Some packages (E.g. *-dev) might be missing due to "
47 "bug 11905 (variable KERNEL_PACKAGE_NAME == PN)")
48
49 # The default kernel recipe builds in a shared location defined by
50 # bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR.
51 # Set these variables to directories under ${WORKDIR} in alternate
52 # kernel recipes (I.e. where KERNEL_PACKAGE_NAME != kernel) so that they
53 # may build in parallel with the default kernel without clobbering.
54 if kpn != "kernel":
55 workdir = d.getVar("WORKDIR", True)
56 sourceDir = os.path.join(workdir, 'kernel-source')
57 artifactsDir = os.path.join(workdir, 'kernel-build-artifacts')
58 d.setVar("STAGING_KERNEL_DIR", sourceDir)
59 d.setVar("STAGING_KERNEL_BUILDDIR", artifactsDir)
37 60
38 # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES 61 # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES
39 type = d.getVar('KERNEL_IMAGETYPE') or "" 62 type = d.getVar('KERNEL_IMAGETYPE') or ""
40 alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or "" 63 alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or ""
41 types = d.getVar('KERNEL_IMAGETYPES') or "" 64 types = d.getVar('KERNEL_IMAGETYPES') or ""
65 kname = d.getVar('KERNEL_PACKAGE_NAME', True) or "kernel"
42 if type not in types.split(): 66 if type not in types.split():
43 types = (type + ' ' + types).strip() 67 types = (type + ' ' + types).strip()
44 if alttype not in types.split(): 68 if alttype not in types.split():
@@ -55,15 +79,15 @@ python __anonymous () {
55 typelower = type.lower() 79 typelower = type.lower()
56 imagedest = d.getVar('KERNEL_IMAGEDEST') 80 imagedest = d.getVar('KERNEL_IMAGEDEST')
57 81
58 d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower) 82 d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
59 83
60 d.setVar('FILES_kernel-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type) 84 d.setVar('FILES_' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type)
61 85
62 d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' + typelower) 86 d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower))
63 87
64 d.setVar('PKG_kernel-image-' + typelower, 'kernel-image-' + typelower + '-${KERNEL_VERSION_PKG_NAME}') 88 d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
65 89
66 d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1') 90 d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1')
67 91
68 image = d.getVar('INITRAMFS_IMAGE') 92 image = d.getVar('INITRAMFS_IMAGE')
69 if image: 93 if image:
@@ -121,9 +145,9 @@ base_do_unpack_append () {
121 145
122inherit kernel-arch deploy 146inherit kernel-arch deploy
123 147
124PACKAGES_DYNAMIC += "^kernel-module-.*" 148PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
125PACKAGES_DYNAMIC += "^kernel-image-.*" 149PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
126PACKAGES_DYNAMIC += "^kernel-firmware-.*" 150PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
127 151
128export OS = "${TARGET_OS}" 152export OS = "${TARGET_OS}"
129export CROSS_COMPILE = "${TARGET_PREFIX}" 153export CROSS_COMPILE = "${TARGET_PREFIX}"
@@ -339,7 +363,9 @@ kernel_do_install() {
339 install -d ${D}/boot 363 install -d ${D}/boot
340 for type in ${KERNEL_IMAGETYPES} ; do 364 for type in ${KERNEL_IMAGETYPES} ; do
341 install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} ${D}/${KERNEL_IMAGEDEST}/${type}-${KERNEL_VERSION} 365 install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} ${D}/${KERNEL_IMAGEDEST}/${type}-${KERNEL_VERSION}
342 ln -sf ${type}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${type} 366 if [ "${KERNEL_PACKAGE_NAME}" == "kernel" ]; then
367 ln -sf ${type}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${type}
368 fi
343 done 369 done
344 install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION} 370 install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}
345 install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} 371 install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}
@@ -393,9 +419,9 @@ do_shared_workdir_setscene () {
393 419
394emit_depmod_pkgdata() { 420emit_depmod_pkgdata() {
395 # Stash data for depmod 421 # Stash data for depmod
396 install -d ${PKGDESTWORK}/kernel-depmod/ 422 install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
397 echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/kernel-depmod/kernel-abiversion 423 echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
398 cp ${B}/System.map ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION} 424 cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
399} 425}
400 426
401PACKAGEFUNCS += "emit_depmod_pkgdata" 427PACKAGEFUNCS += "emit_depmod_pkgdata"
@@ -411,7 +437,7 @@ do_shared_workdir () {
411 # Store the kernel version in sysroots for module-base.bbclass 437 # Store the kernel version in sysroots for module-base.bbclass
412 # 438 #
413 439
414 echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion 440 echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
415 441
416 # Copy files required for module builds 442 # Copy files required for module builds
417 cp System.map $kerneldir/System.map-${KERNEL_VERSION} 443 cp System.map $kerneldir/System.map-${KERNEL_VERSION}
@@ -509,28 +535,28 @@ EXPORT_FUNCTIONS do_compile do_install do_configure
509 535
510# kernel-base becomes kernel-${KERNEL_VERSION} 536# kernel-base becomes kernel-${KERNEL_VERSION}
511# kernel-image becomes kernel-image-${KERNEL_VERSION} 537# kernel-image becomes kernel-image-${KERNEL_VERSION}
512PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules" 538PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules"
513FILES_${PN} = "" 539FILES_${PN} = ""
514FILES_kernel-base = "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.order ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin" 540FILES_${KERNEL_PACKAGE_NAME}-base = "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.order ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin"
515FILES_kernel-image = "" 541FILES_${KERNEL_PACKAGE_NAME}-image = ""
516FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" 542FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
517FILES_kernel-vmlinux = "/boot/vmlinux-${KERNEL_VERSION_NAME}" 543FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux-${KERNEL_VERSION_NAME}"
518FILES_kernel-modules = "" 544FILES_${KERNEL_PACKAGE_NAME}-modules = ""
519RDEPENDS_kernel = "kernel-base" 545RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base"
520# Allow machines to override this dependency if kernel image files are 546# Allow machines to override this dependency if kernel image files are
521# not wanted in images as standard 547# not wanted in images as standard
522RDEPENDS_kernel-base ?= "kernel-image" 548RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image"
523PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}" 549PKG_${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
524RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', 'kernel-vmlinux', '', d)}" 550RDEPENDS_${KERNEL_PACKAGE_NAME}-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}"
525PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}" 551PKG_${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}"
526RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}" 552RPROVIDES_${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
527ALLOW_EMPTY_kernel = "1" 553ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1"
528ALLOW_EMPTY_kernel-base = "1" 554ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1"
529ALLOW_EMPTY_kernel-image = "1" 555ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1"
530ALLOW_EMPTY_kernel-modules = "1" 556ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1"
531DESCRIPTION_kernel-modules = "Kernel modules meta package" 557DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package"
532 558
533pkg_postinst_kernel-base () { 559pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
534 if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then 560 if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
535 mkdir -p $D/lib/modules/${KERNEL_VERSION} 561 mkdir -p $D/lib/modules/${KERNEL_VERSION}
536 fi 562 fi
@@ -544,7 +570,7 @@ pkg_postinst_kernel-base () {
544PACKAGESPLITFUNCS_prepend = "split_kernel_packages " 570PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
545 571
546python split_kernel_packages () { 572python split_kernel_packages () {
547 do_split_packages(d, root='${nonarch_base_libdir}/firmware', file_regex='^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') 573 do_split_packages(d, root='${nonarch_base_libdir}/firmware', file_regex='^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
548} 574}
549 575
550# Many scripts want to look in arch/$arch/boot for the bootable 576# Many scripts want to look in arch/$arch/boot for the bootable
@@ -635,21 +661,27 @@ MODULE_TARBALL_SYMLINK_NAME ?= "modules-${MACHINE}.tgz"
635MODULE_TARBALL_DEPLOY ?= "1" 661MODULE_TARBALL_DEPLOY ?= "1"
636 662
637kernel_do_deploy() { 663kernel_do_deploy() {
664 deployDir="${DEPLOYDIR}"
665 if [ -n "${KERNEL_DEPLOYSUBDIR}" ]; then
666 deployDir="${DEPLOYDIR}/${KERNEL_DEPLOYSUBDIR}"
667 mkdir "$deployDir"
668 fi
669
638 for type in ${KERNEL_IMAGETYPES} ; do 670 for type in ${KERNEL_IMAGETYPES} ; do
639 base_name=${type}-${KERNEL_IMAGE_BASE_NAME} 671 base_name=${type}-${KERNEL_IMAGE_BASE_NAME}
640 install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} ${DEPLOYDIR}/${base_name}.bin 672 install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} $deployDir/${base_name}.bin
641 done 673 done
642 if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then 674 if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
643 mkdir -p ${D}/lib 675 mkdir -p ${D}/lib
644 tar -cvzf ${DEPLOYDIR}/${MODULE_TARBALL_BASE_NAME} -C ${D} lib 676 tar -cvzf $deployDir/${MODULE_TARBALL_BASE_NAME} -C ${D} lib
645 ln -sf ${MODULE_TARBALL_BASE_NAME} ${DEPLOYDIR}/${MODULE_TARBALL_SYMLINK_NAME} 677 ln -sf ${MODULE_TARBALL_BASE_NAME} $deployDir/${MODULE_TARBALL_SYMLINK_NAME}
646 fi 678 fi
647 679
648 for type in ${KERNEL_IMAGETYPES} ; do 680 for type in ${KERNEL_IMAGETYPES} ; do
649 base_name=${type}-${KERNEL_IMAGE_BASE_NAME} 681 base_name=${type}-${KERNEL_IMAGE_BASE_NAME}
650 symlink_name=${type}-${KERNEL_IMAGE_SYMLINK_NAME} 682 symlink_name=${type}-${KERNEL_IMAGE_SYMLINK_NAME}
651 ln -sf ${base_name}.bin ${DEPLOYDIR}/${symlink_name}.bin 683 ln -sf ${base_name}.bin $deployDir/${symlink_name}.bin
652 ln -sf ${base_name}.bin ${DEPLOYDIR}/${type} 684 ln -sf ${base_name}.bin $deployDir/${type}
653 done 685 done
654 686
655 cd ${B} 687 cd ${B}
@@ -659,8 +691,8 @@ kernel_do_deploy() {
659 echo "Copying deploy ${type} kernel-initramfs image and setting up links..." 691 echo "Copying deploy ${type} kernel-initramfs image and setting up links..."
660 initramfs_base_name=${type}-${INITRAMFS_BASE_NAME} 692 initramfs_base_name=${type}-${INITRAMFS_BASE_NAME}
661 initramfs_symlink_name=${type}-initramfs-${MACHINE} 693 initramfs_symlink_name=${type}-initramfs-${MACHINE}
662 install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}.initramfs ${DEPLOYDIR}/${initramfs_base_name}.bin 694 install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}.initramfs $deployDir/${initramfs_base_name}.bin
663 ln -sf ${initramfs_base_name}.bin ${DEPLOYDIR}/${initramfs_symlink_name}.bin 695 ln -sf ${initramfs_base_name}.bin $deployDir/${initramfs_symlink_name}.bin
664 fi 696 fi
665 done 697 done
666} 698}
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 081e726d4b..995b60e158 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -247,6 +247,7 @@ KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set b
247KERNEL_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." 247KERNEL_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."
248KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot" 248KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot"
249KERNEL_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" 249KERNEL_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"
250KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to 'kernel'."
250KERNEL_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)." 251KERNEL_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)."
251KERNEL_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)." 252KERNEL_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)."
252KFEATURE_DESCRIPTION[doc] = "Provides a short description of a configuration fragment. You use this variable in the .scc file that describes a configuration fragment file." 253KFEATURE_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/kmod/depmodwrapper-cross_1.0.bb b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
index 68d3f84c0b..48f012918a 100644
--- a/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
+++ b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
@@ -23,17 +23,13 @@ if [ "\$1" != "-a" -o "\$2" != "-b" ]; then
23 echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION" >&2 23 echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION" >&2
24 exit 1 24 exit 1
25fi 25fi
26if [ ! -r ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion ]; then 26
27 echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion" >&2 27kernelabi=""
28else 28if [ -r "${PKGDATA_DIR}/kernel-depmod/kernel-abiversion" ]; then
29 kernelabi=\$(cat ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion) 29 kernelabi=\$(cat "${PKGDATA_DIR}/kernel-depmod/kernel-abiversion")
30 if [ "\$kernelabi" != "\$4" ]; then
31 echo "Error: Kernel version \$4 does not match kernel-abiversion (\$kernelabi)" >&2
32 exit 1
33 fi
34fi 30fi
35 31
36if [ ! -r ${PKGDATA_DIR}/kernel-depmod/System.map-\$4 ]; then 32if [ ! -r ${PKGDATA_DIR}/kernel-depmod/System.map-\$4 ] || [ "\$kernelabi" != "\$4" ]; then
37 echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/System.map-\$4" >&2 33 echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/System.map-\$4" >&2
38 exec env depmod "\$1" "\$2" "\$3" "\$4" 34 exec env depmod "\$1" "\$2" "\$3" "\$4"
39else 35else
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb
index fd31bf986c..40d6e4ac23 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb
@@ -7,7 +7,7 @@ require recipes-kernel/linux/linux-yocto.inc
7# to build multiple virtual/kernel providers, e.g. as dependency of 7# to build multiple virtual/kernel providers, e.g. as dependency of
8# core-image-rt-sdk, core-image-rt. 8# core-image-rt-sdk, core-image-rt.
9python () { 9python () {
10 if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt": 10 if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") 11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
12} 12}
13 13
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.12.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.12.bb
index 25f3963c74..ed65f77a91 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.12.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.12.bb
@@ -7,7 +7,7 @@ require recipes-kernel/linux/linux-yocto.inc
7# to build multiple virtual/kernel providers, e.g. as dependency of 7# to build multiple virtual/kernel providers, e.g. as dependency of
8# core-image-rt-sdk, core-image-rt. 8# core-image-rt-sdk, core-image-rt.
9python () { 9python () {
10 if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt": 10 if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") 11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
12} 12}
13 13
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb
index c1cbf35a25..e1547e9960 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb
@@ -7,7 +7,7 @@ require recipes-kernel/linux/linux-yocto.inc
7# to build multiple virtual/kernel providers, e.g. as dependency of 7# to build multiple virtual/kernel providers, e.g. as dependency of
8# core-image-rt-sdk, core-image-rt. 8# core-image-rt-sdk, core-image-rt.
9python () { 9python () {
10 if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt": 10 if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") 11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
12} 12}
13 13
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb
index d225339c14..fa25629861 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb
@@ -7,7 +7,7 @@ require recipes-kernel/linux/linux-yocto.inc
7# to build multiple virtual/kernel providers, e.g. as dependency of 7# to build multiple virtual/kernel providers, e.g. as dependency of
8# core-image-rt-sdk, core-image-rt. 8# core-image-rt-sdk, core-image-rt.
9python () { 9python () {
10 if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt": 10 if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") 11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
12} 12}
13 13
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 9c1f61be75..8a70eb5018 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -12,7 +12,7 @@ INC_PR = "r4"
12# PREFERRED_PROVIDER for virtual/kernel. This avoids network access required 12# PREFERRED_PROVIDER for virtual/kernel. This avoids network access required
13# by the use of AUTOREV SRCREVs, which are the default for this recipe. 13# by the use of AUTOREV SRCREVs, which are the default for this recipe.
14python () { 14python () {
15 if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != d.getVar("PN"): 15 if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != d.getVar("PN", True):
16 d.delVar("BB_DONT_CACHE") 16 d.delVar("BB_DONT_CACHE")
17 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to %s to enable it" % (d.getVar("PN"))) 17 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to %s to enable it" % (d.getVar("PN")))
18} 18}