mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-18 02:44:37 +00:00
test: use truncate in mk_fs()
While the dd command actually writes to the block device the truncate command only updates the metadata (at least on ext4). This is faster and reduces wear on the block device. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
f1895bc1e7
commit
f94a05d1c4
1 changed files with 1 additions and 1 deletions
|
@ -54,7 +54,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'dd if=/dev/zero of={fs_img} bs={size_gran} count={count}',
|
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)
|
||||||
if fs_type == 'ext4':
|
if fs_type == 'ext4':
|
||||||
|
|
Loading…
Add table
Reference in a new issue