mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-12 19:09:56 +03:00
treewide: switch back to bootimg_qcdt{,_type}
In some refactoring work deviceinfo_bootimg_qcdt and deviceinfo_bootimg_qcdt_type were accidentally renamed to just deviceinfo_qcdt{,_type}. Change back to original name everywhere. Among the notable changes is that we modify the bootimg header_v2 test so that bootimg_qcdt="false" is acceptable in the deviceinfo. I am not sure why it was added to the !expected substrings, we have plenty of header_v2 devices with the property set. Part-of: https://gitlab.postmarketos.org/postmarketos/pmbootstrap/-/merge_requests/2628 Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2628
This commit is contained in:
parent
799140da2b
commit
f25a8bf374
6 changed files with 25 additions and 20 deletions
|
@ -124,8 +124,8 @@ def generate_deviceinfo_fastboot_content(bootimg: Bootimg | None = None) -> str:
|
|||
if bootimg is None:
|
||||
bootimg = Bootimg(
|
||||
cmdline="",
|
||||
qcdt="false",
|
||||
qcdt_type=None,
|
||||
bootimg_qcdt="false",
|
||||
bootimg_qcdt_type=None,
|
||||
dtb_offset=None,
|
||||
dtb_second="false",
|
||||
base="",
|
||||
|
@ -145,7 +145,13 @@ def generate_deviceinfo_fastboot_content(bootimg: Bootimg | None = None) -> str:
|
|||
deviceinfo_flash_pagesize="{bootimg["pagesize"]}"
|
||||
"""
|
||||
|
||||
for k in ["qcdt_type", "dtb_second", "mtk_label_kernel", "mtk_label_ramdisk", "header_version"]:
|
||||
for k in [
|
||||
"bootimg_qcdt_type",
|
||||
"dtb_second",
|
||||
"mtk_label_kernel",
|
||||
"mtk_label_ramdisk",
|
||||
"header_version",
|
||||
]:
|
||||
v = bootimg[k] # type: ignore
|
||||
if v:
|
||||
content += f"""\
|
||||
|
|
|
@ -155,7 +155,7 @@ def bootimg(path: Path) -> Bootimg:
|
|||
with open(f"{bootimg_path}-pagesize") as f:
|
||||
output["pagesize"] = trim_input(f)
|
||||
|
||||
output["qcdt"] = (
|
||||
output["bootimg_qcdt"] = (
|
||||
"true"
|
||||
if os.path.isfile(f"{bootimg_path}-dt") and os.path.getsize(f"{bootimg_path}-dt") > 0
|
||||
else "false"
|
||||
|
@ -166,7 +166,7 @@ def bootimg(path: Path) -> Bootimg:
|
|||
for key, value in {
|
||||
"mtk_label_kernel": get_mtk_label(f"{bootimg_path}-kernel"),
|
||||
"mtk_label_ramdisk": get_mtk_label(f"{bootimg_path}-ramdisk"),
|
||||
"qcdt_type": get_qcdt_type(f"{bootimg_path}-dt"),
|
||||
"bootimg_qcdt_type": get_qcdt_type(f"{bootimg_path}-dt"),
|
||||
}.items()
|
||||
if value is not None
|
||||
}
|
||||
|
@ -181,8 +181,8 @@ def bootimg(path: Path) -> Bootimg:
|
|||
|
||||
return Bootimg(
|
||||
cmdline=output["cmdline"],
|
||||
qcdt=output["qcdt"],
|
||||
qcdt_type=output.get("qcdt_type"),
|
||||
bootimg_qcdt=output["bootimg_qcdt"],
|
||||
bootimg_qcdt_type=output.get("bootimg_qcdt_type"),
|
||||
dtb_offset=output.get("dtb_offset"),
|
||||
dtb_second=output["dtb_second"],
|
||||
base=output.get("base", ""),
|
||||
|
|
|
@ -144,6 +144,7 @@ class Deviceinfo:
|
|||
generate_bootimg: str | None = ""
|
||||
header_version: str | None = ""
|
||||
bootimg_qcdt: str | None = ""
|
||||
bootimg_qcdt_type: str | None = ""
|
||||
bootimg_mtk_mkimage: str | None = "" # deprecated
|
||||
bootimg_mtk_label_kernel: str | None = ""
|
||||
bootimg_mtk_label_ramdisk: str | None = ""
|
||||
|
|
|
@ -86,8 +86,8 @@ class AportGenEntry(TypedDict):
|
|||
|
||||
class Bootimg(TypedDict):
|
||||
cmdline: str
|
||||
qcdt: str
|
||||
qcdt_type: str | None
|
||||
bootimg_qcdt: str
|
||||
bootimg_qcdt_type: str | None
|
||||
dtb_offset: str | None
|
||||
dtb_second: str
|
||||
base: str
|
||||
|
|
|
@ -13,11 +13,11 @@ test_data: dict[str, tuple[Bootimg | None, list[str], list[str]]] = {
|
|||
Bootimg(
|
||||
cmdline="beep boop",
|
||||
header_version="0",
|
||||
qcdt="false",
|
||||
bootimg_qcdt="false",
|
||||
base="0x80000000",
|
||||
kernel_offset="0x8000",
|
||||
tags_offset="0x100",
|
||||
qcdt_type=None,
|
||||
bootimg_qcdt_type=None,
|
||||
dtb_offset=None,
|
||||
dtb_second="",
|
||||
pagesize="2048",
|
||||
|
@ -39,11 +39,11 @@ test_data: dict[str, tuple[Bootimg | None, list[str], list[str]]] = {
|
|||
Bootimg(
|
||||
cmdline="console=ttyMSM0,115200n8",
|
||||
header_version="2",
|
||||
qcdt="false",
|
||||
bootimg_qcdt="false",
|
||||
base="0x80000000",
|
||||
kernel_offset="",
|
||||
tags_offset="",
|
||||
qcdt_type=None,
|
||||
bootimg_qcdt_type=None,
|
||||
dtb_offset="0x101f00000",
|
||||
dtb_second="",
|
||||
pagesize="2048",
|
||||
|
@ -58,19 +58,17 @@ test_data: dict[str, tuple[Bootimg | None, list[str], list[str]]] = {
|
|||
'append_dtb="false"',
|
||||
'flash_offset_dtb="0x101f00000"',
|
||||
],
|
||||
[
|
||||
"qcdt",
|
||||
],
|
||||
[],
|
||||
),
|
||||
"header_v3": (
|
||||
Bootimg(
|
||||
cmdline="console=ttyMSM0,115200n8",
|
||||
header_version="3",
|
||||
qcdt="false",
|
||||
bootimg_qcdt="false",
|
||||
base="",
|
||||
kernel_offset="",
|
||||
tags_offset="",
|
||||
qcdt_type=None,
|
||||
bootimg_qcdt_type=None,
|
||||
dtb_offset="",
|
||||
dtb_second="",
|
||||
pagesize="4096",
|
||||
|
|
|
@ -79,7 +79,7 @@ def test_bootimg(bootimg, pmb_args, pmaports):
|
|||
print(f"Header v0: {img}")
|
||||
assert img["header_version"] == "0", "header v0 expected header version 0"
|
||||
assert img["cmdline"] == "", "header v0 expected empty cmdline"
|
||||
assert img["qcdt"] == "false", "header v0 expected qcdt false"
|
||||
assert img["bootimg_qcdt"] == "false", "header v0 expected qcdt false"
|
||||
assert img["base"] == "0x80000000", "header v0 expected base 0x80000000"
|
||||
assert int(img["kernel_offset"], 16) == 0x8000, "header v0 expected kernel offset 0x8000"
|
||||
assert int(img["tags_offset"], 16) == 0x100, "header v0 expected tags offset 0x100"
|
||||
|
@ -91,7 +91,7 @@ def test_bootimg(bootimg, pmb_args, pmaports):
|
|||
print(f"Header v2: {img}")
|
||||
assert img["header_version"] == "2", "header v2 expected header version 2"
|
||||
assert img["cmdline"] == "", "header v2 expected empty cmdline"
|
||||
assert img["qcdt"] == "false", "header v2 expected qcdt false"
|
||||
assert img["bootimg_qcdt"] == "false", "header v2 expected qcdt false"
|
||||
assert img["base"] == "0x80000000", "header v2 expected base 0x80000000"
|
||||
assert int(img["kernel_offset"], 16) == 0x8000, "header v2 expected kernel offset 0x8000"
|
||||
assert int(img["tags_offset"], 16) == 0x100, "header v2 expected tags offset 0x100"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue