[OE-core] [PATCH] module-base: use modules_prepare build target in do_make_scripts()

Enrico Jorns ejo at pengutronix.de
Wed Jan 31 11:48:46 UTC 2018


The kernel Makefile's 'modules_prepare' target must be called for fully
setting up a module build environment. Unlike calling 'scripts' target,
this also calls 'prepare' target which compiles 'objtool' for example.

Otherwise, when having CONFIG_STACK_VALIDATION in kernel config enabled,
module build will fail with

| make[5]: *** No rule to make target 'tools/objtool/objtool', needed by '[...]'

The 'modules_prepare' target also requires bc-native to be present in sysroot.

Signed-off-by: Enrico Jorns <ejo at pengutronix.de>
---
 meta/classes/module-base.bbclass | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/meta/classes/module-base.bbclass b/meta/classes/module-base.bbclass
index 6fe77c01b7..bee6cac916 100644
--- a/meta/classes/module-base.bbclass
+++ b/meta/classes/module-base.bbclass
@@ -18,10 +18,13 @@ KERNEL_OBJECT_SUFFIX = ".ko"
 # kernel modules are generally machine specific
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-# Function to ensure the kernel scripts are created. Expected to
-# be called before do_compile. See module.bbclass for an example.
+DEPENDS += "bc-native"
+
+# Function to ensure the kernel scripts and utilities required for building
+# modules are created.
+# Expected to be called before do_compile. See module.bbclass for an example.
 do_make_scripts() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS 
 	make CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \
-	           -C ${STAGING_KERNEL_DIR} O=${STAGING_KERNEL_BUILDDIR} scripts
+	           -C ${STAGING_KERNEL_DIR} O=${STAGING_KERNEL_BUILDDIR} modules_prepare
 }
-- 
2.15.1




More information about the Openembedded-core mailing list