All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wic: fallback to dd, if sparse_copy does not work
@ 2017-11-16 11:49 Dogukan Ergun
  2017-11-16 13:26 ` Martin Hundebøll
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dogukan Ergun @ 2017-11-16 11:49 UTC (permalink / raw)
  To: openembedded-core

Docker's aufs filesystem doesn't support file ioctl operations like FIGETBSZ
or FIEMAP.
Sparse_copy operation will fail if those ioctls are not supported.
If sparse_copy fails while generating wic images, fallback to dd for copying
filesystems on final image.

Signed-off-by: Dogukan Ergun <dogukan.ergun@gmail.com>
---
 scripts/lib/wic/plugins/imager/direct.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index da1c061..70f93ee 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -577,8 +577,14 @@ class PartitionedImage():
         for part in self.partitions:
             source = part.source_file
             if source:
-                # install source_file contents into a partition
-                sparse_copy(source, self.path, seek=part.start * self.sector_size)
+                try:
+                    # install source_file contents into a partition
+                    sparse_copy(source, self.path, seek=part.start * self.sector_size)
+                except:
+                    # Sparse_copy failed, fallback to dd method
+                    dd_cmd = "dd if=%s of=%s bs=%d seek=%d count=%d conv=notrunc" % \
+                        (source, self.path, self.sector_size, part.start, part.size_sec)
+                    exec_cmd(dd_cmd)
 
                 logger.debug("Installed %s in partition %d, sectors %d-%d, "
                              "size %d sectors", source, part.num, part.start,
-- 
2.7.4



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

end of thread, other threads:[~2017-11-22  9:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-16 11:49 [PATCH] wic: fallback to dd, if sparse_copy does not work Dogukan Ergun
2017-11-16 13:26 ` Martin Hundebøll
2017-11-16 13:28 ` Burton, Ross
2017-11-22  8:26 ` Ed Bartosh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.