mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
test: fs_helper: Drop the size_gran argument
Nothing uses this argument, so make it a constant for now. Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Christian Taedcke <christian.taedcke@weidmueller.com>
This commit is contained in:
@@ -10,8 +10,11 @@ import os
|
|||||||
from subprocess import call, check_call, check_output, CalledProcessError
|
from subprocess import call, check_call, check_output, CalledProcessError
|
||||||
from subprocess import DEVNULL
|
from subprocess import DEVNULL
|
||||||
|
|
||||||
def mk_fs(config, fs_type, size, prefix, src_dir=None, size_gran = 0x100000,
|
# size_gran (int): Size granularity of file system image in bytes
|
||||||
fs_img=None, quiet=False):
|
SIZE_GRAN = 1 << 20
|
||||||
|
|
||||||
|
|
||||||
|
def mk_fs(config, fs_type, size, prefix, src_dir=None, fs_img=None, quiet=False):
|
||||||
"""Create a file system volume
|
"""Create a file system volume
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -20,7 +23,6 @@ def mk_fs(config, fs_type, size, prefix, src_dir=None, size_gran = 0x100000,
|
|||||||
size (int): Size of file system in bytes
|
size (int): Size of file system in bytes
|
||||||
prefix (str): Prefix string of volume's file name
|
prefix (str): Prefix string of volume's file name
|
||||||
src_dir (str): Root directory to use, or None for none
|
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
|
fs_img (str or None): Leaf filename for image, or None to use a
|
||||||
default name. The image is always placed under
|
default name. The image is always placed under
|
||||||
persistent_data_dir.
|
persistent_data_dir.
|
||||||
@@ -55,7 +57,7 @@ def mk_fs(config, fs_type, size, prefix, src_dir=None, size_gran = 0x100000,
|
|||||||
elif fs_lnxtype != 'vfat' and fs_lnxtype != 'exfat':
|
elif fs_lnxtype != 'vfat' and fs_lnxtype != 'exfat':
|
||||||
raise ValueError(f'src_dir not implemented for fs {fs_lnxtype}')
|
raise ValueError(f'src_dir not implemented for fs {fs_lnxtype}')
|
||||||
|
|
||||||
count = (size + size_gran - 1) // size_gran
|
count = (size + SIZE_GRAN - 1) // SIZE_GRAN
|
||||||
|
|
||||||
# Some distributions do not add /sbin to the default PATH, where mkfs lives
|
# Some distributions do not add /sbin to the default PATH, where mkfs lives
|
||||||
if '/sbin' not in os.environ["PATH"].split(os.pathsep):
|
if '/sbin' not in os.environ["PATH"].split(os.pathsep):
|
||||||
@@ -63,7 +65,7 @@ def mk_fs(config, fs_type, size, prefix, src_dir=None, size_gran = 0x100000,
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
check_call(f'rm -f {fs_img}', shell=True)
|
check_call(f'rm -f {fs_img}', shell=True)
|
||||||
check_call(f'truncate -s $(( {size_gran} * {count} )) {fs_img}',
|
check_call(f'truncate -s $(( {SIZE_GRAN} * {count} )) {fs_img}',
|
||||||
shell=True)
|
shell=True)
|
||||||
check_call(f'mkfs.{fs_lnxtype} {mkfs_opt} {fs_img}', shell=True,
|
check_call(f'mkfs.{fs_lnxtype} {mkfs_opt} {fs_img}', shell=True,
|
||||||
stdout=DEVNULL if quiet else None)
|
stdout=DEVNULL if quiet else None)
|
||||||
|
|||||||
Reference in New Issue
Block a user