Add a no-cover DTB rollback for 2720 Flip hardware sign-off

This commit is contained in:
Luxferre committed 2026-11-10 14:14:47 +02:00
1 parent 90e6771700
commit 31db372779
8 files changed
+153 -11

No files matched your search

+17 -7
View File
@@ -118,7 +118,9 @@ def validate_cmdline(conf, allow_debug=False):
return append
def check(raw_path, dtb_path, boot_img_path, verbose=True, allow_debug=False):
def check(raw_path, dtb_path, boot_img_path, verbose=True, allow_debug=False,
files=None):
files = files if files is not None else BOOT_FS_FILES
raw = open(raw_path, "rb").read(1024 * 1024 + 4096)
offset, size = mbr_first_partition(raw)
if len(raw) < offset + 2048 or raw[offset + EXT2_MAGIC_OFFSET:offset + EXT2_MAGIC_OFFSET + 2] != EXT2_MAGIC:
@@ -140,7 +142,7 @@ def check(raw_path, dtb_path, boot_img_path, verbose=True, allow_debug=False):
if "fdt /qcom-msm8905-nokia-beatles.dtb" not in conf:
raise ValueError("extlinux.conf does not name the beatles DTB")
validate_cmdline(conf, allow_debug)
for name, expected in BOOT_FS_FILES.items():
for name, expected in files.items():
got = sha(cat(fs, "/" + name))
want = sha(open(expected, "rb").read())
if got != want:
@@ -166,10 +168,17 @@ def main():
parser.add_argument("--allow-debug", action="store_true",
help="With --check, accept a diagnostic cmdline")
parser.add_argument("--check", action="store_true")
parser.add_argument("--dtb", default=str(BOOT_FS_FILES["qcom-msm8905-nokia-beatles.dtb"]),
help="Override the DTB written to/checked in pmOS_boot")
parser.add_argument("--boot-image", default=str(BOOT_FS_FILES["boot.img"]),
help="Override the boot.img written to/checked in pmOS_boot")
args = parser.parse_args()
dtb = BOOT_FS_FILES["qcom-msm8905-nokia-beatles.dtb"]
boot_img = BOOT_FS_FILES["boot.img"]
dtb = Path(args.dtb)
boot_img = Path(args.boot_image)
boot_files = dict(BOOT_FS_FILES)
boot_files["qcom-msm8905-nokia-beatles.dtb"] = dtb
boot_files["boot.img"] = boot_img
for path in (args.raw_image, str(dtb), str(boot_img)):
if not os.path.isfile(path):
print("FAIL: missing %s" % path)
@@ -177,7 +186,8 @@ def main():
if args.check:
try:
check(args.raw_image, dtb, boot_img, allow_debug=args.allow_debug)
check(args.raw_image, dtb, boot_img, allow_debug=args.allow_debug,
files=boot_files)
return 0
except ValueError as exc:
print("FAIL: %s" % exc)
@@ -212,7 +222,7 @@ def main():
raise ValueError("source boot fs has no ext2 superblock")
commands = []
for name, host_path in BOOT_FS_FILES.items():
for name, host_path in boot_files.items():
commands += ["rm /%s" % name,
"write %s /%s" % (host_path, name)]
conf = cat(fs, "/extlinux/extlinux.conf").decode("utf-8", "replace")
@@ -251,7 +261,7 @@ def main():
os.unlink(fs)
try:
check(args.raw_image, dtb, boot_img)
check(args.raw_image, dtb, boot_img, files=boot_files)
except ValueError as exc:
print("FAIL: %s" % exc)
return 1