losetup: make sure image sizes are multiples of 512K sectors
Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
b540eb5ee7
commit
d9488e5f8b
2 changed files with 4 additions and 2 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import contextlib
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
|
|
@ -54,7 +55,7 @@ def main(tree, input_dir, output_dir, options):
|
|||
mountpoint = f"{workdir}/mnt"
|
||||
|
||||
# Create an empty image file of the right size
|
||||
size = int(tree_size(tree) * 1.2)
|
||||
size = int(math.ceil(tree_size(tree) * 1.2 / 512) * 512)
|
||||
subprocess.run(["truncate", "--size", str(size), image], check=True)
|
||||
|
||||
# Set up the partition table of the image
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue