]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: rawcopy: support skipping
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>
Sun, 1 Mar 2015 12:54:16 +0000 (13:54 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 9 Mar 2015 16:00:16 +0000 (16:00 +0000)
Add support for skipping the beginning of a file with the rawcopy
plugin.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/lib/wic/plugins/source/rawcopy.py

index b3b55fa022eb23ad17c58c35703be1211a6fec33..cf6236a04f910c1b7f3862b88bf6f9f122ff3baf 100644 (file)
@@ -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