[OE-core] [PATCH] boot-directdisk: Fix race condition with bootimg

Jonathan Liu net147 at gmail.com
Wed May 1 14:22:38 UTC 2013


If "vmdk" is added to IMAGE_FSTYPES when building core-image-minimal,
there is a race condition where the bootdirectdisk and bootimg tasks
may execute concurrently. The bootdirectdisk task is copying the
contents of ${HDDDIR} into ${HDDIMG} but at the same time, the bootimg
task is writing to ${HDDDIR}/rootfs.img.

This race condition can result in one of the following errors:
- An hdddirect image is created with an incomplete rootfs.img
  (the bootimg task may not have finished writing to rootfs.img yet).
  This would result in an invalid operation error when /init in initrd
  tries to loopback mount rootfs.img to /rootfs.
- A "Disk full" error is generated in the bootdirectdisk task
  because it calculates the number of blocks for the image before
  rootfs.img is written but by the time is gets to copying the contents
  of ${HDDDIR} into ${HDDIMG}, the writing of ${HDDDIR}/rootfs.img by
  the bootimg task results in the size of ${HDDDIR} exceeding the
  initially calculated number of blocks for the image.

Signed-off-by: Jonathan Liu <net147 at gmail.com>
---
 meta/classes/boot-directdisk.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index d265485..fcbee8a 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -96,5 +96,5 @@ python do_bootdirectdisk() {
     bb.build.exec_func('build_boot_dd', d)
 }
 
-addtask bootdirectdisk before do_build
+addtask bootdirectdisk after do_bootimg before do_build
 do_bootdirectdisk[nostamp] = "1"
-- 
1.8.2.1





More information about the Openembedded-core mailing list