parse: bootimg: make it work again (MR 2477)

Commit 826bb4f2dd (pmb: Properly type Bootimg (MR 2464)) broke the
bootimg_analyze command since some assumptions in whether the bootimg
dictionary had empty keys or non-existent keys were changed without
their usage being updated.

Fix this and apply a trivial cleanup to aportgen.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-11-04 09:49:47 +01:00
parent 4ecd45749d
commit 953f84a79a
No known key found for this signature in database
GPG key ID: 0583312B195F64B6
2 changed files with 17 additions and 31 deletions

View file

@ -171,7 +171,7 @@ def bootimg(path: Path) -> Bootimg:
if value is not None
}
)
output["dtb_second"] = "true" if is_dtb(f"{bootimg_path}-second") else "false"
output["dtb_second"] = "true" if is_dtb(f"{bootimg_path}-second") else ""
with open(f"{bootimg_path}-cmdline") as f:
output["cmdline"] = trim_input(f)
@ -185,11 +185,11 @@ def bootimg(path: Path) -> Bootimg:
qcdt_type=output.get("qcdt_type"),
dtb_offset=output.get("dtb_offset"),
dtb_second=output["dtb_second"],
base=output["base"],
kernel_offset=output["kernel_offset"],
ramdisk_offset=output["ramdisk_offset"],
second_offset=output["second_offset"],
tags_offset=output["tags_offset"],
base=output.get("base", ""),
kernel_offset=output.get("kernel_offset", ""),
ramdisk_offset=output.get("ramdisk_offset", ""),
second_offset=output.get("second_offset", ""),
tags_offset=output.get("tags_offset", ""),
pagesize=output["pagesize"],
header_version=output.get("header_version"),
mtk_label_kernel=output.get("mtk_label_kernel", ""),