blob: 78d1b21dbd83902e86734d7f1511912556852f16 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001inherit module-base kernel-module-split pkgconfig
Patrick Williamsc124f4f2015-09-15 14:41:29 -05002
Brad Bishopd7bf8c12018-02-25 22:55:05 -05003addtask make_scripts after do_prepare_recipe_sysroot before do_configure
Patrick Williamsc124f4f2015-09-15 14:41:29 -05004do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
5do_make_scripts[depends] += "virtual/kernel:do_shared_workdir"
6
7EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}"
8
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05009MODULES_INSTALL_TARGET ?= "modules_install"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010MODULES_MODULE_SYMVERS_LOCATION ?= ""
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050011
Patrick Williamsc0f7c042017-02-23 20:41:17 -060012python __anonymous () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013 depends = d.getVar('DEPENDS')
Patrick Williamsc0f7c042017-02-23 20:41:17 -060014 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 Bishopd7bf8c12018-02-25 22:55:05 -050021python 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 Williamsc124f4f2015-09-15 14:41:29 -050041module_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 Williamsc0f7c042017-02-23 20:41:17 -060048 KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049 ${MAKE_TARGETS}
50}
51
52module_do_install() {
53 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
Brad Bishop6e60e8b2018-02-01 10:27:11 -050054 oe_runmake DEPMOD=echo MODLIB="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}" \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055 CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
56 O=${STAGING_KERNEL_BUILDDIR} \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050057 ${MODULES_INSTALL_TARGET}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060058
Brad Bishop6e60e8b2018-02-01 10:27:11 -050059 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 Williamsc124f4f2015-09-15 14:41:29 -050070}
71
72EXPORT_FUNCTIONS do_compile do_install
73
74# add all splitted modules to PN RDEPENDS, PN can be empty now
75KERNEL_MODULES_META_PACKAGE = "${PN}"
76FILES_${PN} = ""
77ALLOW_EMPTY_${PN} = "1"