diff options
Diffstat (limited to 'meta/classes/kernel.bbclass')
-rw-r--r-- | meta/classes/kernel.bbclass | 114 |
1 files changed, 73 insertions, 41 deletions
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 @@ | |||
1 | inherit linux-kernel-base kernel-module-split | 1 | inherit linux-kernel-base kernel-module-split |
2 | 2 | ||
3 | PROVIDES += "virtual/kernel" | 3 | KERNEL_PACKAGE_NAME ??= "kernel" |
4 | KERNEL_DEPLOYSUBDIR ??= "${@ "" if (d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel") else d.getVar("KERNEL_PACKAGE_NAME", True) }" | ||
5 | |||
6 | PROVIDES += "${@ "virtual/kernel" if (d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel") else "" }" | ||
4 | DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native lzop-native" | 7 | DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native lzop-native" |
5 | PACKAGE_WRITE_DEPS += "depmodwrapper-cross" | 8 | PACKAGE_WRITE_DEPS += "depmodwrapper-cross" |
6 | 9 | ||
@@ -34,11 +37,32 @@ KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION') | |||
34 | KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}" | 37 | KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}" |
35 | 38 | ||
36 | python __anonymous () { | 39 | python __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 | ||
122 | inherit kernel-arch deploy | 146 | inherit kernel-arch deploy |
123 | 147 | ||
124 | PACKAGES_DYNAMIC += "^kernel-module-.*" | 148 | PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*" |
125 | PACKAGES_DYNAMIC += "^kernel-image-.*" | 149 | PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*" |
126 | PACKAGES_DYNAMIC += "^kernel-firmware-.*" | 150 | PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*" |
127 | 151 | ||
128 | export OS = "${TARGET_OS}" | 152 | export OS = "${TARGET_OS}" |
129 | export CROSS_COMPILE = "${TARGET_PREFIX}" | 153 | export 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 | ||
394 | emit_depmod_pkgdata() { | 420 | emit_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 | ||
401 | PACKAGEFUNCS += "emit_depmod_pkgdata" | 427 | PACKAGEFUNCS += "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} |
512 | PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules" | 538 | PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules" |
513 | FILES_${PN} = "" | 539 | FILES_${PN} = "" |
514 | FILES_kernel-base = "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.order ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin" | 540 | FILES_${KERNEL_PACKAGE_NAME}-base = "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.order ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin" |
515 | FILES_kernel-image = "" | 541 | FILES_${KERNEL_PACKAGE_NAME}-image = "" |
516 | FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" | 542 | FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" |
517 | FILES_kernel-vmlinux = "/boot/vmlinux-${KERNEL_VERSION_NAME}" | 543 | FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux-${KERNEL_VERSION_NAME}" |
518 | FILES_kernel-modules = "" | 544 | FILES_${KERNEL_PACKAGE_NAME}-modules = "" |
519 | RDEPENDS_kernel = "kernel-base" | 545 | RDEPENDS_${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 |
522 | RDEPENDS_kernel-base ?= "kernel-image" | 548 | RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image" |
523 | PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}" | 549 | PKG_${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name('${KERNEL_VERSION}')}" |
524 | RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', 'kernel-vmlinux', '', d)}" | 550 | RDEPENDS_${KERNEL_PACKAGE_NAME}-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}" |
525 | PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}" | 551 | PKG_${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name('${KERNEL_VERSION}')}" |
526 | RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}" | 552 | RPROVIDES_${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}" |
527 | ALLOW_EMPTY_kernel = "1" | 553 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1" |
528 | ALLOW_EMPTY_kernel-base = "1" | 554 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1" |
529 | ALLOW_EMPTY_kernel-image = "1" | 555 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1" |
530 | ALLOW_EMPTY_kernel-modules = "1" | 556 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1" |
531 | DESCRIPTION_kernel-modules = "Kernel modules meta package" | 557 | DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package" |
532 | 558 | ||
533 | pkg_postinst_kernel-base () { | 559 | pkg_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 () { | |||
544 | PACKAGESPLITFUNCS_prepend = "split_kernel_packages " | 570 | PACKAGESPLITFUNCS_prepend = "split_kernel_packages " |
545 | 571 | ||
546 | python split_kernel_packages () { | 572 | python 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" | |||
635 | MODULE_TARBALL_DEPLOY ?= "1" | 661 | MODULE_TARBALL_DEPLOY ?= "1" |
636 | 662 | ||
637 | kernel_do_deploy() { | 663 | kernel_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 | } |