aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-07-06 14:32:33 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-21 22:45:19 +0100
commit67b7c67edba305fbd31967baa10d27c2e603ec77 (patch)
treebeef509b77454c1cfb59630ba9ab1bf70b6c0305 /scripts
parent0954452d151613fa758fbde8ee9469b30d80776b (diff)
downloadopenembedded-core-contrib-67b7c67edba305fbd31967baa10d27c2e603ec77.tar.gz
wic: implement wks option --mkfs-extraopts
This option specifies extra options to pass to mkfs.<fstype> utilities. [YOCTO #11709] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/ksparser.py1
-rw-r--r--scripts/lib/wic/partition.py39
2 files changed, 25 insertions, 15 deletions
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 47afda43ce..99b66eebc5 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -139,6 +139,7 @@ class KickStart():
part.add_argument('--fstype', default='vfat',
choices=('ext2', 'ext3', 'ext4', 'btrfs',
'squashfs', 'vfat', 'msdos', 'swap'))
+ part.add_argument('--mkfs-extraopts', default='')
part.add_argument('--label')
part.add_argument('--no-table', action='store_true')
part.add_argument('--ondisk', '--ondrive', dest='disk', default='sda')
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 5aa68c93c1..b623bb9e6d 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -46,6 +46,7 @@ class Partition():
self.fsopts = args.fsopts
self.fstype = args.fstype
self.label = args.label
+ self.mkfs_extraopts = args.mkfs_extraopts
self.mountpoint = args.mountpoint
self.no_table = args.no_table
self.num = None
@@ -256,14 +257,14 @@ class Partition():
with open(rootfs, 'w') as sparse:
os.ftruncate(sparse.fileno(), rootfs_size * 1024)
- extra_imagecmd = "-i 8192"
+ extraopts = self.mkfs_extraopts or "-F -i 8192"
label_str = ""
if self.label:
label_str = "-L %s" % self.label
- mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \
- (self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir)
+ mkfs_cmd = "mkfs.%s %s %s %s -d %s" % \
+ (self.fstype, extraopts, rootfs, label_str, rootfs_dir)
exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs)
@@ -289,8 +290,9 @@ class Partition():
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 -b %d -r %s %s %s %s" % \
+ (self.fstype, rootfs_size * 1024, rootfs_dir, label_str,
+ self.mkfs_extraopts, rootfs)
exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
def prepare_rootfs_msdos(self, rootfs, oe_builddir, rootfs_dir,
@@ -312,8 +314,10 @@ class Partition():
if self.fstype == 'msdos':
size_str = "-F 16" # FAT 16
- dosfs_cmd = "mkdosfs %s -S 512 %s -C %s %d" % (label_str, size_str,
- rootfs, rootfs_size)
+ extraopts = self.mkfs_extraopts or '-S 512'
+
+ dosfs_cmd = "mkdosfs %s %s %s -C %s %d" % \
+ (label_str, size_str, extraopts, rootfs, rootfs_size)
exec_native_cmd(dosfs_cmd, native_sysroot)
mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir)
@@ -329,8 +333,9 @@ class Partition():
"""
Prepare content for a squashfs rootfs partition.
"""
- squashfs_cmd = "mksquashfs %s %s -noappend" % \
- (rootfs_dir, rootfs)
+ extraopts = self.mkfs_extraopts or '-noappend'
+ squashfs_cmd = "mksquashfs %s %s %s" % \
+ (rootfs_dir, rootfs, extraopts)
exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo)
def prepare_empty_partition_ext(self, rootfs, oe_builddir,
@@ -342,14 +347,14 @@ class Partition():
with open(rootfs, 'w') as sparse:
os.ftruncate(sparse.fileno(), size * 1024)
- extra_imagecmd = "-i 8192"
+ extraopts = self.mkfs_extraopts or "-i 8192"
label_str = ""
if self.label:
label_str = "-L %s" % self.label
mkfs_cmd = "mkfs.%s -F %s %s %s" % \
- (self.fstype, extra_imagecmd, label_str, rootfs)
+ (self.fstype, extraopts, label_str, rootfs)
exec_native_cmd(mkfs_cmd, native_sysroot)
def prepare_empty_partition_btrfs(self, rootfs, oe_builddir,
@@ -365,8 +370,9 @@ class Partition():
if self.label:
label_str = "-L %s" % self.label
- mkfs_cmd = "mkfs.%s -b %d %s %s" % \
- (self.fstype, self.size * 1024, label_str, rootfs)
+ mkfs_cmd = "mkfs.%s -b %d %s %s %s" % \
+ (self.fstype, self.size * 1024, label_str,
+ self.mkfs_extraopts, rootfs)
exec_native_cmd(mkfs_cmd, native_sysroot)
def prepare_empty_partition_msdos(self, rootfs, oe_builddir,
@@ -384,8 +390,11 @@ class Partition():
if self.fstype == 'msdos':
size_str = "-F 16" # FAT 16
- dosfs_cmd = "mkdosfs %s -S 512 %s -C %s %d" % (label_str, size_str,
- rootfs, blocks)
+ extraopts = self.mkfs_extraopts or '-S 512'
+
+ dosfs_cmd = "mkdosfs %s %s %s -C %s %d" % \
+ (label_str, extraopts, size_str, rootfs, blocks)
+
exec_native_cmd(dosfs_cmd, native_sysroot)
chmod_cmd = "chmod 644 %s" % rootfs