import os
from subprocess import call, check_call, check_output, CalledProcessError
-def mk_fs(config, fs_type, size, prefix, src_dir=None, size_gran = 0x100000):
+def mk_fs(config, fs_type, size, prefix, src_dir=None, size_gran = 0x100000,
+ fs_img=None):
"""Create a file system volume
Args:
prefix (str): Prefix string of volume's file name
src_dir (str): Root directory to use, or None for none
size_gran (int): Size granularity of file system image in bytes
+ fs_img (str or None): Leaf filename for image, or None to use a
+ default name. The image is always placed under
+ persistent_data_dir.
Raises:
CalledProcessError: if any error occurs when creating the filesystem
"""
- fs_img = f'{prefix}.{fs_type}.img'
+ if not fs_img:
+ fs_img = f'{prefix}.{fs_type}.img'
fs_img = os.path.join(config.persistent_data_dir, fs_img)
if fs_type == 'fat12':