[OE-core] [PATCH] wic: fallback to dd, if sparse_copy does not work

Burton, Ross ross.burton at intel.com
Thu Nov 16 13:28:32 UTC 2017


Would it be neater to change sparse_copy itself so that it does the
fallback, not every caller?

Ross

On 16 November 2017 at 11:49, Dogukan Ergun <dogukan.ergun at gmail.com> wrote:

> 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 at 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
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20171116/f0ca4e7c/attachment-0002.html>


More information about the Openembedded-core mailing list