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 <arzamas-16@mail.ee>
Co-Authored-By: Alexey Min <alexeymin@postmarketos.org>
Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
This commit is contained in:
Boris Lysov 2021-09-04 05:58:56 +03:00 committed by Alexey Min
parent 881a3a03bc
commit d559db062f
No known key found for this signature in database
GPG Key ID: EBF5ECFFFEE34DED
1 changed files with 9 additions and 1 deletions

View File

@ -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}")