From d559db062f06c2ca91e6a6aa14ef2c63d16d2adb Mon Sep 17 00:00:00 2001 From: Boris Lysov Date: Sat, 4 Sep 2021 05:58:56 +0300 Subject: [PATCH] pmb.parse.bootimg: accept Mediatek recovery images too (MR 2105) Some Mediatek recovery images have headers named "RECOVERY". Accept those too. Signed-off-by: Boris Lysov Co-Authored-By: Alexey Min Co-Authored-By: Oliver Smith --- pmb/parse/bootimg.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pmb/parse/bootimg.py b/pmb/parse/bootimg.py index 24b9b747..ff9257e5 100644 --- a/pmb/parse/bootimg.py +++ b/pmb/parse/bootimg.py @@ -59,7 +59,15 @@ def check_mtk_bootimg(bootimg_path): raise RuntimeError(f"{err_start} Expected the kernel inside the" " boot.img to have a 'KERNEL' label instead of" f" '{label_kernel}'. {err_end}") - if label_ramdisk != "ROOTFS": + if label_ramdisk == "RECOVERY": + logging.warning( + f"WARNING: {err_start} But since you apparently passed a recovery" + " image instead of a regular boot.img, we can't tell if it has the" + " expected label 'ROOTFS' inside the ramdisk (found 'RECOVERY')." + " So there is a slight chance that it may not boot, in that case" + " run bootimg_analyze again with a regular boot.img. It will fail" + " if the label is different from 'ROOTFS'.") + elif label_ramdisk != "ROOTFS": raise RuntimeError(f"{err_start} Expected the ramdisk inside the" " boot.img to have a 'ROOTFS' label instead of" f" '{label_ramdisk}'. {err_end}")