Skip to content

Commit

Permalink
Change fastboot_flash_recovery to also flash additional partitions if…
Browse files Browse the repository at this point in the history
… nessecary (only for Mi439)
  • Loading branch information
tsterbak committed Oct 13, 2023
1 parent 3d44666 commit 8c6183e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
8 changes: 1 addition & 7 deletions openandroidinstaller/assets/configs/Mi439.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 additional partitions it will do nothing and is save to continue.
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.
Expand Down
2 changes: 1 addition & 1 deletion openandroidinstaller/assets/configs/vayu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
28 changes: 25 additions & 3 deletions openandroidinstaller/tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand Down Expand Up @@ -505,7 +525,9 @@ def fastboot_flash_additional_partitions(
if vbmeta:
logger.info("vbmeta selected. Flashing vbmeta partition.")
for line in run_command(
"fastboot --disable-verity --disable-verification 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:
Expand Down
4 changes: 4 additions & 0 deletions openandroidinstaller/views/step_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 8c6183e

Please sign in to comment.