[oe-commits] Alexandre Belloni : wic: rawcopy: support skipping

git at git.openembedded.org git at git.openembedded.org
Tue Mar 10 10:48:06 UTC 2015


Module: openembedded-core.git
Branch: master
Commit: 89db37c85ac0d0035dbeb9643d7802ca28681e76
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=89db37c85ac0d0035dbeb9643d7802ca28681e76

Author: Alexandre Belloni <alexandre.belloni at free-electrons.com>
Date:   Sun Mar  1 13:54:16 2015 +0100

wic: rawcopy: support skipping

Add support for skipping the beginning of a file with the rawcopy
plugin.

Signed-off-by: Alexandre Belloni <alexandre.belloni at free-electrons.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>

---

 scripts/lib/wic/plugins/source/rawcopy.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py
index b3b55fa..cf6236a 100644
--- a/scripts/lib/wic/plugins/source/rawcopy.py
+++ b/scripts/lib/wic/plugins/source/rawcopy.py
@@ -64,14 +64,21 @@ class RawCopyPlugin(SourcePlugin):
             return
 
         src = os.path.join(bootimg_dir, source_params['file'])
+        dst = src
+
+        if ('skip' in source_params):
+            dst = os.path.join(cr_workdir, source_params['file'])
+            dd_cmd = "dd if=%s of=%s ibs=%s skip=1 conv=notrunc" % \
+                    (src, dst, source_params['skip'])
+            exec_cmd(dd_cmd)
 
         # get the size in the right units for kickstart (kB)
-        du_cmd = "du -Lbks %s" % src
+        du_cmd = "du -Lbks %s" % dst
         out = exec_cmd(du_cmd)
         filesize = out.split()[0]
 
         if filesize > part.size:
             part.size = filesize
 
-        part.source_file = src
+        part.source_file = dst
 



More information about the Openembedded-commits mailing list