Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [wic][PATCH 6/6] wic: use sparse_copy to copy partitions
Date: Thu, 28 Apr 2016 10:14:57 +0300	[thread overview]
Message-ID: <1461827697-16934-6-git-send-email-ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <1461827697-16934-1-git-send-email-ed.bartosh@linux.intel.com>

Copied partition images into final partitioned image using
sparse_copy API. This method preserves sparseness of the
final image. It also makes wic much faster, as unmapped
blocks of the partition images are not copied.

[YOCTO #9099]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 scripts/lib/wic/utils/partitionedfs.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index ad596d2..1b3870f 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -22,6 +22,7 @@ import os
 from wic import msger
 from wic.utils.errors import ImageError
 from wic.utils.oe.misc import exec_cmd, exec_native_cmd
+from wic.filemap import sparse_copy
 
 # Overhead of the MBR partitioning scheme (just one sector)
 MBR_OVERHEAD = 1
@@ -338,10 +339,7 @@ class Image(object):
             source = part['source_file']
             if source:
                 # install source_file contents into a partition
-                cmd = "dd if=%s of=%s bs=%d seek=%d count=%d conv=notrunc" % \
-                      (source, image_file, self.sector_size,
-                       part['start'], part['size'])
-                exec_cmd(cmd)
+                sparse_copy(source, image_file, part['start'] * self.sector_size)
 
                 msger.debug("Installed %s in partition %d, sectors %d-%d, "
                             "size %d sectors" % \
-- 
2.1.4



  parent reply	other threads:[~2016-04-28  9:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28  7:14 [wic][PATCH 1/6] wic: use truncate utility to create sparse file Ed Bartosh
2016-04-28  7:14 ` [wic][PATCH 2/6] wic: get rid of inheritance Disk->DiskImage Ed Bartosh
2016-04-28  7:14 ` [wic][PATCH 3/6] wic: get rid of fs_related.makedirs Ed Bartosh
2016-04-28  7:14 ` [wic][PATCH 4/6] wic: moved DiskImage to direct.py Ed Bartosh
2016-04-28  7:14 ` [wic][PATCH 5/6] wic: add FIEMAP/SEEK_HOLE APIs from bmaptool Ed Bartosh
2016-04-28  7:14 ` Ed Bartosh [this message]
2016-04-28  8:53 ` [wic][PATCH 1/6] wic: use truncate utility to create sparse file Ed Bartosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461827697-16934-6-git-send-email-ed.bartosh@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox