mirror of
https://git.yoctoproject.org/poky
synced 2026-05-08 17:19:20 +00:00
wic: implement wks option --mkfs-extraopts
This option specifies extra options to pass to mkfs.<fstype> utilities. [YOCTO #11709] (From OE-Core rev: 67b7c67edba305fbd31967baa10d27c2e603ec77) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
fedac61ad9
commit
9f481f5ac9
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user