Skip to contentSkip to conversation

modules: move creation of some module related tools

PATCH In review Joe Slater 3 participants 3 messages Jul 21, 2017

lore
Share & tools
lore

Joe Slater

author
#0 lore raw

PATCH 1/1 modules: move creation of some module related tools

Move creation of tools needed by module building recipes into kernel.bbclass but invoke the task only from the module recipes. Without this change, one module recipe can fail trying to use the tools while another is (re-)building them.

---
 meta/classes/kernel.bbclass      | 15 +++++++++++++++
 meta/classes/module-base.bbclass | 10 ++--------
 meta/classes/module.bbclass      |  4 ----
 3 files changed, 17 insertions(+), 12 deletions(-)
meta/classes/kernel.bbclass +15 -0
index 7670c71..131387e 100644
@@ -280,6 +280,11 @@ kernel_do_compile() {
 
 do_compile_kernelmodules() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
+
+	# build modpost, etc
+	make CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \
+	           -C ${STAGING_KERNEL_DIR} O=${STAGING_KERNEL_BUILDDIR} scripts
+
 	if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then
 		oe_runmake -C ${B} ${PARALLEL_MAKE} modules CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
 
@@ -296,6 +301,16 @@ do_compile_kernelmodules() {
 }
 addtask compile_kernelmodules after do_compile before do_strip
 
+# Task to ensure the kernel scripts are created. Expected to be invoked
+# only by module building recipes. 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
+}
+addtask make_scripts after do_compile_kernelmodules
+do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
+
 kernel_do_install() {
 	#
 	# First install the modules
meta/classes/module-base.bbclass +2 -8
index 6fe77c0..c1fe191 100644
@@ -1,7 +1,8 @@
 inherit kernel-arch
 
 # This is instead of DEPENDS = "virtual/kernel"
-do_configure[depends] += "virtual/kernel:do_compile_kernelmodules"
+# do_make_scripts() used to be in here, but is now in kernel.bbclass
+do_configure[depends] += "virtual/kernel:do_make_scripts"
 
 export OS = "${TARGET_OS}"
 export CROSS_COMPILE = "${TARGET_PREFIX}"
@@ -18,10 +19,3 @@ 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.
-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
-}
meta/classes/module.bbclass +0 -4
index 391776d..e344960 100644
@@ -1,9 +1,5 @@
 inherit module-base kernel-module-split pkgconfig
 
-addtask make_scripts after do_prepare_recipe_sysroot before do_compile
-do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
-do_make_scripts[depends] += "virtual/kernel:do_shared_workdir"
-
 EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}"
 
 MODULES_INSTALL_TARGET ?= "modules_install"
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · Joe Slater

Move creation of tools needed by module building recipes into kernel.bbclass but invoke the task only from the module recipes. Without this change, one module recipe can fail trying to use the tools while another is (re-)building them.

You are changing some core code that has been protecting our builds for quite some time .. yet, you have no example of the errors that are being seen, and no proof that this actually fixes the problem (and that it doesn't introduce other issues).

i.e. how are the lock files no protecting this in whatever is breaking for you ?

Looking at the change, I'm not convinced it is the right thing to do.

i.e. putting something in kernel.bbclass that is only used by the modules is less than ideal, without some sort of justification.

Bruce

Quoted 94 lines
---
 meta/classes/kernel.bbclass      | 15 +++++++++++++++
 meta/classes/module-base.bbclass | 10 ++--------
 meta/classes/module.bbclass      |  4 ----
 3 files changed, 17 insertions(+), 12 deletions(-)
meta/classes/kernel.bbclass +4 -0
index 7670c71..131387e 100644
@@ -280,6 +280,11 @@ kernel_do_compile() {
 
 do_compile_kernelmodules() {
        unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
+
+       # build modpost, etc
+       make CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \
+                  -C ${STAGING_KERNEL_DIR} O=${STAGING_KERNEL_BUILDDIR}

scripts
+

        if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then
                oe_runmake -C ${B} ${PARALLEL_MAKE} modules

CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}

meta/classes/kernel.bbclass +6 -0
@@ -296,6 +301,16 @@ do_compile_kernelmodules() {
 }
 addtask compile_kernelmodules after do_compile before do_strip
 
+# Task to ensure the kernel scripts are created. Expected to be invoked
+# only by module building recipes. 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

meta/classes/kernel.bbclass +4 -0
+}
+addtask make_scripts after do_compile_kernelmodules
+do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
+
 kernel_do_install() {
        #
        # First install the modules
meta/classes/module-base. renamed from meta/classes/module-base.bbclass +0 -0

bbclass
index 6fe77c0..c1fe191 100644

meta/classes/module-base.bbclass +2 -7
@@ -1,7 +1,8 @@
 inherit kernel-arch
 
 # This is instead of DEPENDS = "virtual/kernel"
-do_configure[depends] += "virtual/kernel:do_compile_kernelmodules"
+# do_make_scripts() used to be in here, but is now in kernel.bbclass
+do_configure[depends] += "virtual/kernel:do_make_scripts"
 
 export OS = "${TARGET_OS}"
 export CROSS_COMPILE = "${TARGET_PREFIX}"
@@ -18,10 +19,3 @@ 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.
-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

meta/classes/module-base.bbclass +0 -1
-}
meta/classes/module.bbclass +0 -5
index 391776d..e344960 100644
@@ -1,9 +1,5 @@
 inherit module-base kernel-module-split pkgconfig
 
-addtask make_scripts after do_prepare_recipe_sysroot before do_compile
-do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
-do_make_scripts[depends] += "virtual/kernel:do_shared_workdir"
-
 EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}"
 
 MODULES_INSTALL_TARGET ?= "modules_install"
--

2.7.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"
#2 lore raw

Below, is the error and a heavily edited log file. For those in Wind River, the issue is LIN10-858. Btw, there is duplicate script building code in my patch because I forgot to take it out of do_compile_kernelmodules() which is where I first moved it to.

Joe

LD /home/wrlbuild/builds/builds-c23c9015-5785-4a83-8075-2a2fa9401ba3/wrlinux-std-sato_intel-skylake-avx512-64_world_10/tmp/work/intel_skylake_avx512_64-wrs-linux/hello-mod/0.1-r0/built-in.o
CC [M] /home/wrlbuild/builds/builds-c23c9015-5785-4a83-8075-2a2fa9401ba3/wrlinux-std-sato_intel-skylake-avx512-64_world_10/tmp/work/intel_skylake_avx512_64-wrs-linux/hello-mod/0.1-r0/hello.o Building modules, stage 2.
MODPOST 1 modules
/bin/sh: scripts/mod/modpost: Permission denied
make
[3]: *** [/home/wrlbuild/builds/builds-c23c9015-5785-4a83-8075-2a2fa9401ba3/wrlinux-std-sato_intel-skylake-avx512-64_world_10/tmp/work-shared/intel-skylake-avx512-64/kernel-source/scripts/Makefile.modpost:91: __modpost] Error 126 make[2]: *** [/home/wrlbuild/builds/builds-c23c9015-5785-4a83-8075-2a2fa9401ba3/wrlinux-std-sato_intel-skylake-avx512-64_world_10/tmp/work-shared/intel-skylake-avx512-64/kernel-source/Makefile:1475: modules] Error 2

(modpost is under work-shared)

[2017-07-13 21:02:39.512674040-07:00] NOTE: recipe hello-mod-0.1-r0: task do_make_scripts: Started

[2017-07-13 21:02:39.648216523-07:00] NOTE: recipe module-debug-example-0.99-r0: task do_make_scripts: Started

[2017-07-13 21:02:44.190642236-07:00] NOTE: recipe hello-mod-0.1-r0: task do_configure: Started

[2017-07-13 21:02:44.308167085-07:00] NOTE: recipe hello-mod-0.1-r0: task do_configure: Succeeded

[2017-07-13 21:02:45.074545820-07:00] NOTE: recipe module-debug-example-0.99-r0: task do_configure: Started

[2017-07-13 21:02:45.077889943-07:00] NOTE: recipe module-debug-example-0.99-r0: task do_configure: Succeeded

[2017-07-13 21:02:59.371609194-07:00] NOTE: recipe hello-mod-0.1-r0: task do_make_scripts: Succeeded

[2017-07-13 21:03:00.149468691-07:00] NOTE: recipe hello-mod-0.1-r0: task do_compile: Started

[2017-07-13 21:03:02.840652134-07:00] ERROR: hello-mod-0.1-r0 do_compile: oe_runmake failed
[2017-07-13 21:03:04.406712693-07:00] ERROR: hello-mod-0.1-r0 do_compile: Function failed: do_compile (log file is located at /home/wrlbuild/builds/builds-c23c9015-5785-4a83-8075-2a2fa9401ba3/wrlinux-std-sato_intel-skylake-avx512-64_world_10/tmp/work/intel_skylake_avx512_64-wrs-linux/hello-mod/0.1-r0/temp/log.do_compile.110776)

[2017-07-13 21:03:04.407703129-07:00] NOTE: recipe module-debug-example-0.99-r0: task do_make_scripts: Succeeded

From: Bruce Ashfield [mailto:[email protected]]
Sent: Friday, July 21, 2017 10:30 AM
To: Slater, Joseph
Cc: Patches and discussions about the oe-core layer
Subject: Re: [OE-core] [oe-core][PATCH 1/1] modules: move creation of some module related tools

On Fri, Jul 21, 2017 at 1:13 PM, Joe Slater <[email protected]<mailto:[email protected]>> wrote:
Move creation of tools needed by module building recipes into
kernel.bbclass but invoke the task only from the module recipes.
Without this change, one module recipe can fail trying to use the
tools while another is (re-)building them.

You are changing some core code that has been protecting our builds for quite some time .. yet, you have no example of the errors that are being seen, and no proof that this actually fixes the problem (and that it doesn't introduce other issues).

i.e. how are the lock files no protecting this in whatever is breaking for you ?

Looking at the change, I'm not convinced it is the right thing to do.

i.e. putting something in kernel.bbclass that is only used by the modules is less than ideal, without some sort of justification.

Bruce

---
 meta/classes/kernel.bbclass      | 15 +++++++++++++++
 meta/classes/module-base.bbclass | 10 ++--------
 meta/classes/module.bbclass      |  4 ----
 3 files changed, 17 insertions(+), 12 deletions(-)
meta/classes/kernel.bbclass +15 -0
index 7670c71..131387e 100644
@@ -280,6 +280,11 @@ kernel_do_compile() {
 
 do_compile_kernelmodules() {
        unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
+
+       # build modpost, etc
+       make CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \
+                  -C ${STAGING_KERNEL_DIR} O=${STAGING_KERNEL_BUILDDIR} scripts
+
        if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then
                oe_runmake -C ${B} ${PARALLEL_MAKE} modules CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
 
@@ -296,6 +301,16 @@ do_compile_kernelmodules() {
 }
 addtask compile_kernelmodules after do_compile before do_strip
 
+# Task to ensure the kernel scripts are created. Expected to be invoked
+# only by module building recipes. 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
+}
+addtask make_scripts after do_compile_kernelmodules
+do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
+
 kernel_do_install() {
        #
        # First install the modules
meta/classes/module-base.bbclass +2 -8
index 6fe77c0..c1fe191 100644
@@ -1,7 +1,8 @@
 inherit kernel-arch
 
 # This is instead of DEPENDS = "virtual/kernel"
-do_configure[depends] += "virtual/kernel:do_compile_kernelmodules"
+# do_make_scripts() used to be in here, but is now in kernel.bbclass
+do_configure[depends] += "virtual/kernel:do_make_scripts"
 
 export OS = "${TARGET_OS}"
 export CROSS_COMPILE = "${TARGET_PREFIX}"
@@ -18,10 +19,3 @@ 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.
-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
-}
meta/classes/module.bbclass +0 -4
index 391776d..e344960 100644
@@ -1,9 +1,5 @@
 inherit module-base kernel-module-split pkgconfig
 
-addtask make_scripts after do_prepare_recipe_sysroot before do_compile
-do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
-do_make_scripts[depends] += "virtual/kernel:do_shared_workdir"
-
 EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}"
 
 MODULES_INSTALL_TARGET ?= "modules_install"

--
2.7.4

--
_______________________________________________
Openembedded-core mailing list [email protected]<mailto:[email protected]>
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"