[OE-core] [PATCH 1/2] wic: plugins: rawcopy: support to add offset when writing the raw image

Kevin Hao kexin.hao at windriver.com
Sat Dec 9 02:45:45 UTC 2017


In some cases we need to skip some reserved sectors when writing a raw
image. So add support to set an offset for writing.

Signed-off-by: Kevin Hao <kexin.hao at windriver.com>
---
 scripts/lib/wic/plugins/source/rawcopy.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py
index 424ed26ed6ba..baf991fe8d5d 100644
--- a/scripts/lib/wic/plugins/source/rawcopy.py
+++ b/scripts/lib/wic/plugins/source/rawcopy.py
@@ -53,10 +53,9 @@ class RawCopyPlugin(SourcePlugin):
         src = os.path.join(kernel_dir, source_params['file'])
         dst = os.path.join(cr_workdir, "%s.%s" % (source_params['file'], part.lineno))
 
-        if 'skip' in source_params:
-            sparse_copy(src, dst, skip=int(source_params['skip']))
-        else:
-            sparse_copy(src, dst)
+        skip = 0 if 'skip' not in source_params else int(source_params['skip'])
+        seek = 0 if 'seek' not in source_params else int(source_params['seek'])
+        sparse_copy(src, dst, skip, seek)
 
         # get the size in the right units for kickstart (kB)
         du_cmd = "du -Lbks %s" % dst
-- 
2.9.3




More information about the Openembedded-core mailing list