Add source_size as option for exporting sfdisk layout, compute size better for image
This commit is contained in:
parent
ae75263c4a
commit
86602b2f0d
|
@ -39,7 +39,7 @@ class Partition:
|
||||||
attributes = dict(
|
attributes = dict(
|
||||||
name=self.name,
|
name=self.name,
|
||||||
start=self.start,
|
start=self.start,
|
||||||
size=self.size,
|
size=self.size or self.source_size,
|
||||||
type=self.type,
|
type=self.type,
|
||||||
attrs=self.attrs,
|
attrs=self.attrs,
|
||||||
)
|
)
|
||||||
|
@ -128,17 +128,18 @@ def get_partition(p: Dict[str, Any], out_file: str) -> Partition:
|
||||||
|
|
||||||
def compute_image_size(partitions: List[Partition]) -> int:
|
def compute_image_size(partitions: List[Partition]) -> int:
|
||||||
# leave some space for backup gpt
|
# leave some space for backup gpt
|
||||||
size = 512
|
p = partitions[~0]
|
||||||
for p in partitions:
|
size = 33 + p.start # 33 is magic number for fitting end GPT section
|
||||||
if p.size is None:
|
if p.size is None:
|
||||||
if p.source_size is None:
|
if p.source_size is None:
|
||||||
cmd = ["du", "-B", "512", "--apparent-size", p.source]
|
cmd = ["du", "-B", "512", "--apparent-size", p.source]
|
||||||
proc = subprocess.run(cmd, check=True, stdout=subprocess.PIPE)
|
proc = subprocess.run(cmd, check=True, stdout=subprocess.PIPE)
|
||||||
size += int(proc.stdout)
|
size += int(proc.stdout)
|
||||||
else:
|
|
||||||
size += p.source_size
|
|
||||||
else:
|
else:
|
||||||
size += p.size
|
size += p.source_size
|
||||||
|
else:
|
||||||
|
size += p.size
|
||||||
|
|
||||||
return size
|
return size
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,6 @@ let
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
make mrproper
|
make mrproper
|
||||||
|
|
||||||
sed -i"" 's/cm4io.dtb/blade.dtb/' configs/soquartz-rk3566_defconfig
|
|
||||||
|
|
||||||
cp "${bl31Blobs}/bin/rk35/rk3568_bl31_v1.28.elf" "bl31.elf"
|
cp "${bl31Blobs}/bin/rk35/rk3568_bl31_v1.28.elf" "bl31.elf"
|
||||||
cp "${rkbinBlobs}/bin/rk35/rk3566_ddr_1056MHz_v1.13.bin" ram_init.bin
|
cp "${rkbinBlobs}/bin/rk35/rk3566_ddr_1056MHz_v1.13.bin" ram_init.bin
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue