Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | inherit module-base kernel-module-split pkgconfig |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 2 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 3 | addtask make_scripts after do_prepare_recipe_sysroot before do_compile |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 4 | do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock" |
| 5 | do_make_scripts[depends] += "virtual/kernel:do_shared_workdir" |
| 6 | |
| 7 | EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}" |
| 8 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 9 | MODULES_INSTALL_TARGET ?= "modules_install" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 10 | MODULES_MODULE_SYMVERS_LOCATION ?= "" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 11 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 12 | python __anonymous () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 13 | depends = d.getVar('DEPENDS') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 14 | extra_symbols = [] |
| 15 | for dep in depends.split(): |
| 16 | if dep.startswith("kernel-module-"): |
| 17 | extra_symbols.append("${STAGING_INCDIR}/" + dep + "/Module.symvers") |
| 18 | d.setVar('KBUILD_EXTRA_SYMBOLS', " ".join(extra_symbols)) |
| 19 | } |
| 20 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 21 | module_do_compile() { |
| 22 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS |
| 23 | oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \ |
| 24 | KERNEL_VERSION=${KERNEL_VERSION} \ |
| 25 | CC="${KERNEL_CC}" LD="${KERNEL_LD}" \ |
| 26 | AR="${KERNEL_AR}" \ |
| 27 | O=${STAGING_KERNEL_BUILDDIR} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 28 | KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | ${MAKE_TARGETS} |
| 30 | } |
| 31 | |
| 32 | module_do_install() { |
| 33 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 34 | oe_runmake DEPMOD=echo MODLIB="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}" \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 35 | CC="${KERNEL_CC}" LD="${KERNEL_LD}" \ |
| 36 | O=${STAGING_KERNEL_BUILDDIR} \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 37 | ${MODULES_INSTALL_TARGET} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 38 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 39 | if [ ! -e "${B}/${MODULES_MODULE_SYMVERS_LOCATION}/Module.symvers" ] ; then |
| 40 | bbwarn "Module.symvers not found in ${B}/${MODULES_MODULE_SYMVERS_LOCATION}" |
| 41 | bbwarn "Please consider setting MODULES_MODULE_SYMVERS_LOCATION to a" |
| 42 | bbwarn "directory below B to get correct inter-module dependencies" |
| 43 | else |
| 44 | install -Dm0644 "${B}/${MODULES_MODULE_SYMVERS_LOCATION}"/Module.symvers ${D}${includedir}/${BPN}/Module.symvers |
| 45 | # Module.symvers contains absolute path to the build directory. |
| 46 | # While it doesn't actually seem to matter which path is specified, |
| 47 | # clear them out to avoid confusion |
| 48 | sed -e 's:${B}/::g' -i ${D}${includedir}/${BPN}/Module.symvers |
| 49 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | EXPORT_FUNCTIONS do_compile do_install |
| 53 | |
| 54 | # add all splitted modules to PN RDEPENDS, PN can be empty now |
| 55 | KERNEL_MODULES_META_PACKAGE = "${PN}" |
| 56 | FILES_${PN} = "" |
| 57 | ALLOW_EMPTY_${PN} = "1" |