blob: 68e3d341a3cd664202d6e30f8ba0f040a17c3805 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001inherit module-base kernel-module-split
2
3addtask make_scripts after do_patch before do_compile
4do_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"
10
Patrick Williamsc0f7c042017-02-23 20:41:17 -060011python __anonymous () {
12 depends = d.getVar('DEPENDS', True)
13 extra_symbols = []
14 for dep in depends.split():
15 if dep.startswith("kernel-module-"):
16 extra_symbols.append("${STAGING_INCDIR}/" + dep + "/Module.symvers")
17 d.setVar('KBUILD_EXTRA_SYMBOLS', " ".join(extra_symbols))
18}
19
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020module_do_compile() {
21 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
22 oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \
23 KERNEL_VERSION=${KERNEL_VERSION} \
24 CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
25 AR="${KERNEL_AR}" \
26 O=${STAGING_KERNEL_BUILDDIR} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060027 KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 ${MAKE_TARGETS}
29}
30
31module_do_install() {
32 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
33 oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" \
34 CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
35 O=${STAGING_KERNEL_BUILDDIR} \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050036 ${MODULES_INSTALL_TARGET}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060037
38 install -d -m0755 ${D}${includedir}/${BPN}
39 cp -a --no-preserve=ownership ${B}/Module.symvers ${D}${includedir}/${BPN}
40 # it doesn't actually seem to matter which path is specified here
41 sed -e 's:${B}/::g' -i ${D}${includedir}/${BPN}/Module.symvers
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042}
43
44EXPORT_FUNCTIONS do_compile do_install
45
46# add all splitted modules to PN RDEPENDS, PN can be empty now
47KERNEL_MODULES_META_PACKAGE = "${PN}"
48FILES_${PN} = ""
49ALLOW_EMPTY_${PN} = "1"