diff --git a/README.md b/README.md index b1aabeb0..a7ca149d 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Linux is currently the best supported platform (tested with Ubuntu 20.04/22.04 L ## Officially supported devices -Currently, the **we support 74 devices** by various vendors and working on adding more soon! +Currently, the **we support 80 devices** by various vendors and working on adding more soon! Support for these devices is provided as best effort, but things might still go wrong. Help to improve the tool by reporting any issues you might face. @@ -185,11 +185,14 @@ Xiaomi | Redmi Note 7 | [lavender](https://wiki.lineageos.org/devices/lavender) Xiaomi | Redmi 7A / 8 / 8A / 8A Dual | [Mi439](https://wiki.lineageos.org/devices/Mi439) : pine / olive / olivelite / olivewood | | tested Xiaomi | Redmi Note 8 / 8T | [ginkgo](https://wiki.lineageos.org/devices/ginkgo) / willow | | untested Xiaomi | Redmi Note 8 Pro | begonia | | untested +Xiaomi | Mi 8 | [dipper](https://wiki.lineageos.org/devices/dipper) | | untested Xiaomi | Redmi 9A / 9C / 9AT / 9i / 9A Sport / 10A / 10A Sport | garden / dandelion / blossom / angelican | | tested Xiaomi | Mi 9T / Redmi K20 | [davinci](https://wiki.lineageos.org/devices/davinci) / davinciin | | untested Xiaomi | Redmi K20 Pro / Mi 9T Pro | raphael / raphaelin | | untested Xiaomi | Redmi Note 9S / 9 Pro / 9 Pro Max / 10 Lite / Poco M2 pro | [miatoll](https://wiki.lineageos.org/devices/lavender) : gram / curtana / excalibur / joyeuse | | untested Xiaomi | Redmi Note 10S / 11SE / Poco M5S | [rosemary](https://wiki.lineageos.org/devices/rosemary) / maltose / secret /rosemary_p | | untested +Xiaomi | Redmi K40 / Mi 11X / Poco F3 | [alioth](https://wiki.lineageos.org/devices/alioth) / aliothin | | untested +Xiaomi | Poco X3 / X3 NFC | [surya](https://wiki.lineageos.org/devices/surya) / karna | | untested Xiaomi | Poco X3 Pro | [vayu](https://wiki.lineageos.org/devices/vayu) | | tested Xiaomi | 12 | cupid | | untested diff --git a/openandroidinstaller/app_state.py b/openandroidinstaller/app_state.py index 30f68b08..22d2722f 100644 --- a/openandroidinstaller/app_state.py +++ b/openandroidinstaller/app_state.py @@ -52,6 +52,7 @@ def __init__( self.dtbo_path = None self.vbmeta_path = None self.super_empty_path = None + self.vendor_boot_path = None # store views self.default_views: List = [] diff --git a/openandroidinstaller/assets/configs/Mi439.yaml b/openandroidinstaller/assets/configs/Mi439.yaml index a2cb23b9..7aa6cffd 100644 --- a/openandroidinstaller/assets/configs/Mi439.yaml +++ b/openandroidinstaller/assets/configs/Mi439.yaml @@ -49,18 +49,12 @@ steps: Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. command: adb_reboot_bootloader - - type: call_button - content: > - Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue. - - Note : If you have not selected this partition, it will do nothing. - command: fastboot_flash_additional_partitions - type: call_button content: > Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. command: fastboot_flash_recovery - type: call_button - img: ofox.png + img: twrp-start.jpeg content: > Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. diff --git a/openandroidinstaller/assets/configs/alioth.yaml b/openandroidinstaller/assets/configs/alioth.yaml new file mode 100644 index 00000000..730aeffa --- /dev/null +++ b/openandroidinstaller/assets/configs/alioth.yaml @@ -0,0 +1,55 @@ +metadata: + maintainer: A non (anon) + brand: xiaomi + device_name: Xiaomi Redmi K40 / Mi 11X / POCO F3 + is_ab_device: false + device_code: alioth + untested: true + additional_steps: + - vbmeta + supported_device_codes: + - alioth + - aliothin + notes: + - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: call_button + content: > + Now you need to install a custom recovery system on the phone. A recovery is a small subsystem on your phone, + that manages updating, adapting and repairing of the operating system. + + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: twrp-start.jpeg + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery diff --git a/openandroidinstaller/assets/configs/avicii.yaml b/openandroidinstaller/assets/configs/avicii.yaml index f65d4191..9befd3fb 100644 --- a/openandroidinstaller/assets/configs/avicii.yaml +++ b/openandroidinstaller/assets/configs/avicii.yaml @@ -6,6 +6,9 @@ metadata: supported_device_codes: - avicii - Nord + additional_steps: + - dtbo + - vbmeta requirements: android: 12 steps: @@ -31,6 +34,12 @@ steps: adapting and repairing of the operating system. Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. command: adb_reboot_bootloader + - type: call_button + content: > + Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue. + + Note : If you have not selected additional partitions it will do nothing and is save to continue. + command: fastboot_flash_additional_partitions - type: call_button img: twrp-start.jpeg content: > diff --git a/openandroidinstaller/assets/configs/begonia.yaml b/openandroidinstaller/assets/configs/begonia.yaml index 12b27299..73b194ce 100644 --- a/openandroidinstaller/assets/configs/begonia.yaml +++ b/openandroidinstaller/assets/configs/begonia.yaml @@ -48,7 +48,7 @@ steps: Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. command: fastboot_flash_recovery - type: call_button - img: ofox.png + img: twrp-start.jpeg content: > Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. diff --git a/openandroidinstaller/assets/configs/coral.yaml b/openandroidinstaller/assets/configs/coral.yaml index 980c1a68..99b2f176 100644 --- a/openandroidinstaller/assets/configs/coral.yaml +++ b/openandroidinstaller/assets/configs/coral.yaml @@ -5,6 +5,8 @@ metadata: device_code: coral supported_device_codes: - coral + additional_steps: + - dtbo requirements: android: 13 steps: @@ -48,6 +50,12 @@ steps: - type: confirm_button content: > Select 'Restart bootloader' on your smartphone screen. Then confirm to continue. + - type: call_button + content: > + When you are in the bootloder, install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue. + + Note : If you have not selected additional partitions it will do nothing and is save to continue. + command: fastboot_flash_additional_partitions - type: call_button img: twrp-start.jpeg content: > diff --git a/openandroidinstaller/assets/configs/cupid.yaml b/openandroidinstaller/assets/configs/cupid.yaml index 566a24d0..6639cd99 100644 --- a/openandroidinstaller/assets/configs/cupid.yaml +++ b/openandroidinstaller/assets/configs/cupid.yaml @@ -43,18 +43,12 @@ steps: Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. command: adb_reboot_bootloader - - type: call_button - content: > - Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue. - - Note : If you have not selected this partition, it will do nothing. - command: fastboot_flash_additional_partitions - type: call_button content: > Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. command: fastboot_flash_recovery - type: call_button - img: ofox.png + img: twrp-start.jpeg content: > Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. diff --git a/openandroidinstaller/assets/configs/davinci.yaml b/openandroidinstaller/assets/configs/davinci.yaml index da4e29ed..7c6ca5e0 100644 --- a/openandroidinstaller/assets/configs/davinci.yaml +++ b/openandroidinstaller/assets/configs/davinci.yaml @@ -44,7 +44,7 @@ steps: Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. command: fastboot_flash_recovery - type: call_button - img: ofox.png + img: twrp-start.jpeg content: > Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. diff --git a/openandroidinstaller/assets/configs/dipper.yaml b/openandroidinstaller/assets/configs/dipper.yaml new file mode 100644 index 00000000..95bbea5a --- /dev/null +++ b/openandroidinstaller/assets/configs/dipper.yaml @@ -0,0 +1,55 @@ +metadata: + maintainer: A non (anon) + brand: xiaomi + device_name: Xiaomi Mi 8 + is_ab_device: false + device_code: dipper + supported_device_codes: + - dipper + notes: + - You should install Android 10 or newer ROM. +requirements: + android: 10 (MiUI 12) +untested: true +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: confirm_button + content: > + Now you need to boot a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating, + adapting and repairing of the operating system. + - type: call_button + content: > + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/dre.yaml b/openandroidinstaller/assets/configs/dre.yaml index 7601b1c0..366ea8a0 100644 --- a/openandroidinstaller/assets/configs/dre.yaml +++ b/openandroidinstaller/assets/configs/dre.yaml @@ -6,6 +6,10 @@ metadata: supported_device_codes: - dre - NordN200 + additional_steps: + - dtbo + - vbmeta + - vendor_boot requirements: android: 11 steps: diff --git a/openandroidinstaller/assets/configs/flame.yaml b/openandroidinstaller/assets/configs/flame.yaml index 045753ac..b8151709 100644 --- a/openandroidinstaller/assets/configs/flame.yaml +++ b/openandroidinstaller/assets/configs/flame.yaml @@ -5,6 +5,8 @@ metadata: device_code: flame supported_device_codes: - flame + additional_steps: + - dtbo requirements: android: 13 steps: diff --git a/openandroidinstaller/assets/configs/garden.yaml b/openandroidinstaller/assets/configs/garden.yaml index 1d1003e7..c6ed2d92 100644 --- a/openandroidinstaller/assets/configs/garden.yaml +++ b/openandroidinstaller/assets/configs/garden.yaml @@ -49,7 +49,7 @@ steps: Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. command: fastboot_flash_recovery - type: call_button - img: ofox.png + img: twrp-start.jpeg content: > Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. diff --git a/openandroidinstaller/assets/configs/ginkgo.yaml b/openandroidinstaller/assets/configs/ginkgo.yaml index 5e4d49dc..0f93e73a 100644 --- a/openandroidinstaller/assets/configs/ginkgo.yaml +++ b/openandroidinstaller/assets/configs/ginkgo.yaml @@ -48,7 +48,7 @@ steps: Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. command: fastboot_flash_recovery - type: call_button - img: ofox.png + img: twrp-start.jpeg content: > Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. diff --git a/openandroidinstaller/assets/configs/guacamole.yaml b/openandroidinstaller/assets/configs/guacamole.yaml index 16bb60e0..4d8a092b 100644 --- a/openandroidinstaller/assets/configs/guacamole.yaml +++ b/openandroidinstaller/assets/configs/guacamole.yaml @@ -6,6 +6,9 @@ metadata: supported_device_codes: - guacamole - OnePlus7Pro + additional_steps: + - dtbo + - vbmeta requirements: android: 12 steps: diff --git a/openandroidinstaller/assets/configs/guacamoleb.yaml b/openandroidinstaller/assets/configs/guacamoleb.yaml index eed97a70..2962717d 100644 --- a/openandroidinstaller/assets/configs/guacamoleb.yaml +++ b/openandroidinstaller/assets/configs/guacamoleb.yaml @@ -5,7 +5,10 @@ metadata: device_code: guacamoleb supported_device_codes: - guacamoleb - - OnePlus7 + - OnePlus7 + additional_steps: + - dtbo + - vbmeta requirements: android: 12 steps: diff --git a/openandroidinstaller/assets/configs/hotdog.yaml b/openandroidinstaller/assets/configs/hotdog.yaml index 850965c8..46e886b8 100644 --- a/openandroidinstaller/assets/configs/hotdog.yaml +++ b/openandroidinstaller/assets/configs/hotdog.yaml @@ -6,6 +6,9 @@ metadata: supported_device_codes: - hotdog - OnePlus7TPro + additional_steps: + - dtbo + - vbmeta requirements: android: 12 steps: diff --git a/openandroidinstaller/assets/configs/hotdogb.yaml b/openandroidinstaller/assets/configs/hotdogb.yaml index 6bf44a55..d5be5b19 100644 --- a/openandroidinstaller/assets/configs/hotdogb.yaml +++ b/openandroidinstaller/assets/configs/hotdogb.yaml @@ -6,6 +6,9 @@ metadata: supported_device_codes: - hotdogb - OnePlus7T + additional_steps: + - dtbo + - vbmeta requirements: android: 12 steps: diff --git a/openandroidinstaller/assets/configs/lavender.yaml b/openandroidinstaller/assets/configs/lavender.yaml index cd44bd05..5a983651 100644 --- a/openandroidinstaller/assets/configs/lavender.yaml +++ b/openandroidinstaller/assets/configs/lavender.yaml @@ -46,7 +46,7 @@ steps: Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. command: fastboot_flash_recovery - type: call_button - img: ofox.png + img: twrp-start.jpeg content: > Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. diff --git a/openandroidinstaller/assets/configs/miatoll.yaml b/openandroidinstaller/assets/configs/miatoll.yaml index b4f3fdaa..246d53e4 100644 --- a/openandroidinstaller/assets/configs/miatoll.yaml +++ b/openandroidinstaller/assets/configs/miatoll.yaml @@ -49,7 +49,7 @@ steps: Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. command: fastboot_flash_recovery - type: call_button - img: ofox.png + img: twrp-start.jpeg content: > Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. diff --git a/openandroidinstaller/assets/configs/raphael.yaml b/openandroidinstaller/assets/configs/raphael.yaml index 0bec88e7..e985663b 100644 --- a/openandroidinstaller/assets/configs/raphael.yaml +++ b/openandroidinstaller/assets/configs/raphael.yaml @@ -40,18 +40,12 @@ steps: Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. command: adb_reboot_bootloader - - type: call_button - content: > - Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue. - - Note : If you have not selected this partition, it will do nothing. - command: fastboot_flash_additional_partitions - type: call_button content: > Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. command: fastboot_flash_recovery - type: call_button - img: ofox.png + img: twrp-start.jpeg content: > Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. diff --git a/openandroidinstaller/assets/configs/sunfish.yaml b/openandroidinstaller/assets/configs/sunfish.yaml index 0d92f669..ea08d2d2 100644 --- a/openandroidinstaller/assets/configs/sunfish.yaml +++ b/openandroidinstaller/assets/configs/sunfish.yaml @@ -5,6 +5,8 @@ metadata: device_code: sunfish supported_device_codes: - sunfish + additional_steps: + - dtbo requirements: android: 12.1.0 steps: diff --git a/openandroidinstaller/assets/configs/surya.yaml b/openandroidinstaller/assets/configs/surya.yaml new file mode 100644 index 00000000..8c539ff4 --- /dev/null +++ b/openandroidinstaller/assets/configs/surya.yaml @@ -0,0 +1,52 @@ +metadata: + maintainer: A non (anon) + brand: poco + device_name: Poco X3 - X3 NFC + is_ab_device: false + device_code: surya + supported_device_codes: + - surya + - karna + untested: true +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: confirm_button + content: > + Now you need to boot a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating, + adapting and repairing of the operating system. + - type: call_button + content: > + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/vayu.yaml b/openandroidinstaller/assets/configs/vayu.yaml index b1c88a56..d8524123 100644 --- a/openandroidinstaller/assets/configs/vayu.yaml +++ b/openandroidinstaller/assets/configs/vayu.yaml @@ -45,7 +45,7 @@ steps: Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. command: fastboot_flash_recovery - type: call_button - img: ofox.png + img: twrp-start.jpeg content: > Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index 03dcff5a..69cfd0a7 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -451,9 +451,29 @@ def fastboot_flash_boot(bin_path: Path, recovery: str) -> TerminalResponse: @add_logging("Flash custom recovery with fastboot.") def fastboot_flash_recovery( - bin_path: Path, recovery: str, is_ab: bool = True + bin_path: Path, + recovery: str, + is_ab: bool = True, + vendor_boot: Optional[str] = None, + dtbo: Optional[str] = None, + vbmeta: Optional[str] = None, + super_empty: Optional[str] = None, ) -> TerminalResponse: - """Flash custom recovery with fastboot.""" + """Flash custom recovery with fastboot. + + If necessary, flash additional partitions (dtbo, vbmeta, super_empty) with fastboot before. + """ + if any([dtbo, vbmeta, super_empty, vendor_boot]): + for line in fastboot_flash_additional_partitions( + bin_path=bin_path, + dtbo=dtbo, + vbmeta=vbmeta, + super_empty=super_empty, + vendor_boot=vendor_boot, + is_ab=is_ab, + ): + yield line + for line in run_command( "fastboot flash recovery ", target=f"{recovery}", bin_path=bin_path ): @@ -482,6 +502,7 @@ def fastboot_flash_additional_partitions( dtbo: Optional[str], vbmeta: Optional[str], super_empty: Optional[str], + vendor_boot: Optional[str], is_ab: bool = True, ) -> TerminalResponse: """Flash additional partitions (dtbo, vbmeta, super_empty) with fastboot.""" @@ -504,7 +525,9 @@ def fastboot_flash_additional_partitions( if vbmeta: logger.info("vbmeta selected. Flashing vbmeta partition.") for line in run_command( - "fastboot flash vbmeta ", target=f"{vbmeta}", bin_path=bin_path + "fastboot --disable-verity --disable-verification flash vbmeta ", + target=f"{vbmeta}", + bin_path=bin_path, ): yield line if not is_ab: @@ -527,6 +550,19 @@ def fastboot_flash_additional_partitions( else: yield True + if vendor_boot: + logger.info("vendor_boot selected. Flashing vendor_boot partition.") + for line in run_command( + "fastboot flash vendor_boot ", target=f"{vendor_boot}", bin_path=bin_path + ): + yield line + if not is_ab: + if (type(line) == bool) and not line: + logger.error("Flashing vendor_boot failed.") + yield False + else: + yield True + def heimdall_wait_for_download_available(bin_path: Path) -> bool: """Use heimdall detect to wait for download mode to become available on the device.""" diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index ecbd9de0..d5937870 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -106,6 +106,9 @@ def init_visuals( self.pick_super_empty_dialog = FilePicker( on_result=self.pick_super_empty_result ) + self.pick_vendor_boot_dialog = FilePicker( + on_result=self.pick_vendor_boot_result + ) self.selected_image = Text("Selected image: ") self.selected_recovery = Text("Selected recovery: ") @@ -118,6 +121,9 @@ def init_visuals( self.selected_super_empty = Checkbox( fill_color=colors.RED, value=None, disabled=True, tristate=True ) + self.selected_vendor_boot = Checkbox( + fill_color=colors.RED, value=None, disabled=True, tristate=True + ) # initialize and manage button state. self.confirm_button = confirm_button(self.on_confirm) @@ -131,6 +137,7 @@ def init_visuals( self.pick_dtbo_dialog.on_result = self.enable_button_if_ready self.pick_vbmeta_dialog.on_result = self.enable_button_if_ready self.pick_super_empty_dialog.on_result = self.enable_button_if_ready + self.pick_vendor_boot_dialog.on_result = self.enable_button_if_ready # back button self.back_button = ElevatedButton( "Back", @@ -155,6 +162,7 @@ def build(self): self.pick_dtbo_dialog, self.pick_vbmeta_dialog, self.pick_super_empty_dialog, + self.pick_vendor_boot_dialog, ] ) @@ -462,6 +470,27 @@ def toggle_additional_image_selection(self): self.selected_super_empty, ] ), + ] + ) + if "vendor_boot" in self.state.config.additional_steps: + self.selected_vendor_boot.value = False + additional_image_selection.extend( + [ + Row( + [ + FilledButton( + "Pick `vendor_boot.img` image", + icon=icons.UPLOAD_FILE, + on_click=lambda _: self.pick_vendor_boot_dialog.pick_files( + allow_multiple=False, + file_type="custom", + allowed_extensions=["img"], + ), + expand=True, + ), + self.selected_vendor_boot, + ] + ), Divider(), ] ) @@ -600,6 +629,26 @@ def pick_super_empty_result(self, e: FilePickerResultEvent): # update self.selected_super_empty.update() + def pick_vendor_boot_result(self, e: FilePickerResultEvent): + path = ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!" + # update the textfield with the name of the file + if e.files: + # check if the super_empty works with the device and show the filename in different colors accordingly + if path == "vendor_boot.img": + self.selected_vendor_boot.fill_color = colors.GREEN + self.selected_vendor_boot.value = True + self.state.vendor_boot_path = e.files[0].path + logger.info( + f"Selected vendor_boot.img from {self.state.vendor_boot_path}" + ) + else: + self.selected_vendor_boot.fill_color = colors.RED + self.selected_vendor_boot.value = False + else: + logger.info("No image selected.") + # update + self.selected_vendor_boot.update() + def enable_button_if_ready(self, e): """Enable the confirm button if both files have been selected.""" if (".zip" in self.selected_image.value) and ( @@ -642,6 +691,8 @@ def enable_button_if_ready(self, e): or "vbmeta" not in self.state.config.additional_steps, self.selected_super_empty.value or "super_empty" not in self.state.config.additional_steps, + self.selected_vendor_boot.value + or "vendor_boot" not in self.state.config.additional_steps, ] ): logger.error( @@ -693,4 +744,3 @@ def enable_button_if_ready(self, e): self.right_view.update() else: self.confirm_button.disabled = True - # self.continue_eitherway_button.disabled = True diff --git a/openandroidinstaller/views/step_view.py b/openandroidinstaller/views/step_view.py index 3fbe2af3..b64a78c2 100644 --- a/openandroidinstaller/views/step_view.py +++ b/openandroidinstaller/views/step_view.py @@ -242,6 +242,10 @@ def call_to_phone(self, e, command: str): fastboot_flash_recovery, recovery=self.state.recovery_path, is_ab=self.state.config.is_ab, + dtbo=self.state.dtbo_path, + vbmeta=self.state.vbmeta_path, + super_empty=self.state.super_empty_path, + vendor_boot=self.state.vendor_boot_path, ), "fastboot_reboot_recovery": fastboot_reboot_recovery, "fastboot_flash_additional_partitions": partial( @@ -249,6 +253,7 @@ def call_to_phone(self, e, command: str): dtbo=self.state.dtbo_path, vbmeta=self.state.vbmeta_path, super_empty=self.state.super_empty_path, + vendor_boot=self.state.vendor_boot_path, is_ab=self.state.config.is_ab, ), "fastboot_reboot": fastboot_reboot,