Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] boot-directdisk: Fix race condition with bootimg
@ 2013-05-01 14:22 Jonathan Liu
  2013-05-01 15:22 ` Jonathan Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Liu @ 2013-05-01 14:22 UTC (permalink / raw)
  To: openembedded-core

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@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




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] boot-directdisk: Fix race condition with bootimg
  2013-05-01 14:22 [PATCH] boot-directdisk: Fix race condition with bootimg Jonathan Liu
@ 2013-05-01 15:22 ` Jonathan Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Liu @ 2013-05-01 15:22 UTC (permalink / raw)
  To: openembedded-core

On 2/05/2013 12:22 AM, Jonathan Liu wrote:
> 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"
The strange thing is, it seems the generated .hdddirect has two copies 
of the root filesystem - one in rootfs.img in the fat partition, and one 
as an ext3 partition.
So maybe there is another conflict with bootimg that needs to be considered.

Regards,
Jonathan



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-01 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-01 14:22 [PATCH] boot-directdisk: Fix race condition with bootimg Jonathan Liu
2013-05-01 15:22 ` Jonathan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox