kernel-devsrc.bb 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. SUMMARY = "Linux kernel Development Source"
  2. DESCRIPTION = "Development source linux kernel. When built, this recipe packages the \
  3. source of the preferred virtual/kernel provider and makes it available for full kernel \
  4. development or external module builds"
  5. SECTION = "kernel"
  6. LICENSE = "GPLv2"
  7. inherit linux-kernel-base
  8. # Whilst not a module, this ensures we don't get multilib extended (which would make no sense)
  9. inherit module-base
  10. # We need the kernel to be staged (unpacked, patched and configured) before
  11. # we can grab the source and make the source package. We also need the bits from
  12. # ${B} not to change while we install, so virtual/kernel must finish do_compile.
  13. do_install[depends] += "virtual/kernel:do_shared_workdir"
  14. # Need the source, not just the output of populate_sysroot
  15. do_install[depends] += "virtual/kernel:do_install"
  16. # There's nothing to do here, except install the source where we can package it
  17. do_fetch[noexec] = "1"
  18. do_unpack[noexec] = "1"
  19. do_patch[noexec] = "1"
  20. do_configure[noexec] = "1"
  21. do_compile[noexec] = "1"
  22. do_populate_sysroot[noexec] = "1"
  23. S = "${STAGING_KERNEL_DIR}"
  24. B = "${STAGING_KERNEL_BUILDDIR}"
  25. KERNEL_VERSION = "${@get_kernelversion_headers('${S}')}"
  26. PACKAGE_ARCH = "${MACHINE_ARCH}"
  27. do_install() {
  28. kerneldir=${D}${KERNEL_SRC_PATH}
  29. install -d $kerneldir
  30. #
  31. # Copy the staging dir source (and module build support) into the devsrc structure.
  32. # We can keep this copy simple and take everything, since a we'll clean up any build
  33. # artifacts afterwards, and the extra i/o is not significant
  34. #
  35. cd ${B}
  36. find . -type d -name '.git*' -prune -o -path '.debug' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir
  37. cd ${S}
  38. find . -type d -name '.git*' -prune -o -type d -name '.kernel-meta' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir
  39. # Explicitly set KBUILD_OUTPUT to ensure that the image directory is cleaned and not
  40. # The main build artifacts. We clean the directory to avoid QA errors on mismatched
  41. # architecture (since scripts and helpers are native format).
  42. KBUILD_OUTPUT="$kerneldir"
  43. oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean _mrproper_scripts
  44. # make clean generates an absolute path symlink called "source"
  45. # in $kerneldir points to $kerneldir, which doesn't make any
  46. # sense, so remove it.
  47. if [ -L $kerneldir/source ]; then
  48. bbnote "Removing $kerneldir/source symlink"
  49. rm -f $kerneldir/source
  50. fi
  51. # As of Linux kernel version 3.0.1, the clean target removes
  52. # arch/powerpc/lib/crtsavres.o which is present in
  53. # KBUILD_LDFLAGS_MODULE, making it required to build external modules.
  54. if [ ${ARCH} = "powerpc" ]; then
  55. mkdir -p $kerneldir/arch/powerpc/lib/
  56. cp ${B}/arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o
  57. fi
  58. # Remove fixdep/objtool as they won't be target binaries
  59. for i in fixdep objtool; do
  60. if [ -e $kerneldir/tools/objtool/$i ]; then
  61. rm -rf $kerneldir/tools/objtool/$i
  62. fi
  63. done
  64. chown -R root:root ${D}
  65. }
  66. # Ensure we don't race against "make scripts" during cpio
  67. do_install[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
  68. PACKAGES = "kernel-devsrc"
  69. FILES_${PN} = "${KERNEL_SRC_PATH}"
  70. RDEPENDS_${PN} = "bc"