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