Patchwork [1/1] module.bbclass: add lock to prevent error bulding ext modules

login
register
mail settings
Submitter Anders Darander
Date Oct. 19, 2011, 11:15 a.m.
Message ID <40dcebe98e97bb4fabfec74e9e7acb59548da091.1319022793.git.anders@chargestorm.se>
Download mbox | patch
Permalink /patch/13533/
State Accepted
Commit 8681b82e8b466929205edde7ba479f3ac1a6143e
Headers show

Comments

Anders Darander - Oct. 19, 2011, 11:15 a.m.
When external modules are built, files in $STAGING_KERNEL_DIR/scripts/basic will/can get
rebuilt.
This raises a potential race condition. Prevent this by adding a lock around the
do_make_scripts() function. Further, make sure that the kernel has been installed
to the sysroot, prior to executing this new task.

Signed-off-by: Anders Darander <anders@chargestorm.se>
---
 meta/classes/module.bbclass |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
Koen Kooi - Oct. 19, 2011, 11:38 a.m.
Op 19 okt. 2011, om 13:15 heeft Anders Darander het volgende geschreven:

> When external modules are built, files in $STAGING_KERNEL_DIR/scripts/basic will/can get
> rebuilt.
> This raises a potential race condition. Prevent this by adding a lock around the
> do_make_scripts() function. Further, make sure that the kernel has been installed
> to the sysroot, prior to executing this new task.

So what do external module recipe that aren't using do_compile from module.bbclass need to change to keep working?
Anders Darander - Oct. 19, 2011, 11:55 a.m.
* Koen Kooi <koen@dominion.thruhere.net> [111019 13:38]:

> Op 19 okt. 2011, om 13:15 heeft Anders Darander het volgende geschreven:

> > When external modules are built, files in $STAGING_KERNEL_DIR/scripts/basic will/can get
> > rebuilt.
> > This raises a potential race condition. Prevent this by adding a lock around the
> > do_make_scripts() function. Further, make sure that the kernel has been installed
> > to the sysroot, prior to executing this new task.

> So what do external module recipe that aren't using do_compile from
> module.bbclass need to change to keep working?

I haven't tried any, do you know any widely available ones that I could
check?

If they aren't using the do_compile from module.bbclass, are they
inheriting module.bbclass anyway? If they aren't inheriting
module.bbclass, then they shouldn't be affected.

If they inherit module.bbclass, than I guess that we should remove the
call to do_make_scripts from their do_compile. _But_ this is untested,
as I've got no such recipe (that I'm aware of). If my assumptions hold,
we should probably rephrase the comment regarding do_make_scripts.

Cheers,
Anders

Patch

diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
index 572df0d..53c16b7 100644
--- a/meta/classes/module.bbclass
+++ b/meta/classes/module.bbclass
@@ -14,8 +14,11 @@  do_make_scripts() {
 	           -C ${STAGING_KERNEL_DIR} scripts
 }
 
+addtask make_scripts before do_compile
+do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
+do_make_scripts[deptask] = "do_populate_sysroot"
+
 module_do_compile() {
-	do_make_scripts
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
 	oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR}   \
 		   KERNEL_SRC=${STAGING_KERNEL_DIR}    \