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 | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 3 | addtask make_scripts after do_prepare_recipe_sysroot before do_configure |
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 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 21 | python do_devshell_prepend () { |
| 22 | os.environ['CFLAGS'] = '' |
| 23 | os.environ['CPPFLAGS'] = '' |
| 24 | os.environ['CXXFLAGS'] = '' |
| 25 | os.environ['LDFLAGS'] = '' |
| 26 | |
| 27 | os.environ['KERNEL_PATH'] = d.getVar('STAGING_KERNEL_DIR') |
| 28 | os.environ['KERNEL_SRC'] = d.getVar('STAGING_KERNEL_DIR') |
| 29 | os.environ['KERNEL_VERSION'] = d.getVar('KERNEL_VERSION') |
| 30 | os.environ['CC'] = d.getVar('KERNEL_CC') |
| 31 | os.environ['LD'] = d.getVar('KERNEL_LD') |
| 32 | os.environ['AR'] = d.getVar('KERNEL_AR') |
| 33 | os.environ['O'] = d.getVar('STAGING_KERNEL_BUILDDIR') |
| 34 | kbuild_extra_symbols = d.getVar('KBUILD_EXTRA_SYMBOLS') |
| 35 | if kbuild_extra_symbols: |
| 36 | os.environ['KBUILD_EXTRA_SYMBOLS'] = kbuild_extra_symbols |
| 37 | else: |
| 38 | os.environ['KBUILD_EXTRA_SYMBOLS'] = '' |
| 39 | } |
| 40 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 41 | module_do_compile() { |
| 42 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS |
| 43 | oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \ |
| 44 | KERNEL_VERSION=${KERNEL_VERSION} \ |
| 45 | CC="${KERNEL_CC}" LD="${KERNEL_LD}" \ |
| 46 | AR="${KERNEL_AR}" \ |
| 47 | O=${STAGING_KERNEL_BUILDDIR} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 48 | KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 49 | ${MAKE_TARGETS} |
| 50 | } |
| 51 | |
| 52 | module_do_install() { |
| 53 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 54 | oe_runmake DEPMOD=echo MODLIB="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}" \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 55 | CC="${KERNEL_CC}" LD="${KERNEL_LD}" \ |
| 56 | O=${STAGING_KERNEL_BUILDDIR} \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 57 | ${MODULES_INSTALL_TARGET} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 58 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 59 | if [ ! -e "${B}/${MODULES_MODULE_SYMVERS_LOCATION}/Module.symvers" ] ; then |
| 60 | bbwarn "Module.symvers not found in ${B}/${MODULES_MODULE_SYMVERS_LOCATION}" |
| 61 | bbwarn "Please consider setting MODULES_MODULE_SYMVERS_LOCATION to a" |
| 62 | bbwarn "directory below B to get correct inter-module dependencies" |
| 63 | else |
| 64 | install -Dm0644 "${B}/${MODULES_MODULE_SYMVERS_LOCATION}"/Module.symvers ${D}${includedir}/${BPN}/Module.symvers |
| 65 | # Module.symvers contains absolute path to the build directory. |
| 66 | # While it doesn't actually seem to matter which path is specified, |
| 67 | # clear them out to avoid confusion |
| 68 | sed -e 's:${B}/::g' -i ${D}${includedir}/${BPN}/Module.symvers |
| 69 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | EXPORT_FUNCTIONS do_compile do_install |
| 73 | |
| 74 | # add all splitted modules to PN RDEPENDS, PN can be empty now |
| 75 | KERNEL_MODULES_META_PACKAGE = "${PN}" |
| 76 | FILES_${PN} = "" |
| 77 | ALLOW_EMPTY_${PN} = "1" |