          exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
  
      def prepare_rootfs_btrfs(self, rootfs, oe_builddir, rootfs_dir,
+@@ -241,6 +251,9 @@ class Partition(object):
+         Currently handles ext2/3/4 and btrfs.
+         """
+         du_cmd = "du -ks %s" % rootfs_dir
++        if self.exclude_dirs:
++            for exdir in self.exclude_dirs:
++                du_cmd = du_cmd + " --exclude " + exdir
+         out = exec_cmd(du_cmd)
+         actual_rootfs_size = int(out.split()[0])
+ 
+@@ -262,8 +275,10 @@ class Partition(object):
+         if self.label:
+             label_str = "-L %s" % self.label
+ 
+-        mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \
+-            (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, rootfs)
++        mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \
++                   (self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir)
++        if self.exclude_dirs:
++            mkfs_cmd = mkfs_cmd + " -w %s" % ",".join(self.exclude_dirs)
+         exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
+ 
+     def prepare_rootfs_vfat(self, rootfs, oe_builddir, rootfs_dir,
+@@ -411,4 +426,3 @@ class Partition(object):
+             label_str = "-L %s" % self.label
+         mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), path)
+         exec_native_cmd(mkswap_cmd, native_sysroot)
+-
 -- 
 2.7.4
 

+            if part.submount_dir:
+                prefix = '%s' % (part.submount_dir)
+            msg += '  ROOTFS_DIR%s%s\n' % (suffix.ljust(20), (part.rootfs_dir + prefix))

         msg += '  BOOTIMG_DIR:                  %s\n' % self.bootimg_dir
         msg += '  KERNEL_DIR:                   %s\n' % self.kernel_dir
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py

From 63f1cddaad77f808205a62d0431e72100e4218aa Mon Sep 17 00:00:00 2001
From: Christian Fries <christian.fries123@gmail.com>
Date: Thu, 1 Sep 2016 18:54:30 +0200
Subject: [PATCH] add support to split a rootfs in sub partitions Per default 
 wic does not support this. it is nice to have a full rootfs for testing with 
 qemu, but for deployment on a productive flash/sd it makes more sense to 
 split the rootfs. With this patch it is possible to reach both goals... enjoy

---
 scripts/lib/wic/engine.py        |  1 +
 scripts/lib/wic/imager/direct.py |  5 ++++-
 scripts/lib/wic/ksparser.py      | 16 ++++++++++++++++
 scripts/lib/wic/partition.py     | 20 +++++++++++++++++---
 4 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 76b93e8..12a8a10 100644
