Skip to contentSkip to conversation

module-base: use modules_prepare build target in do_make_scripts()

PATCH New Enrico Jorns 1 participant 1 message Jan 31, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module-base: use modules_prepare build target in do_make_scripts()

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.

---
 meta/classes/module-base.bbclass | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
meta/classes/module-base.bbclass +6 -3
index 6fe77c01b7..bee6cac916 100644
@@ -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
 }
Signature · 1 line
2.15.1