Skip to content

Commit 8c6183e

Browse files
committed
Change fastboot_flash_recovery to also flash additional partitions if nessecary (only for Mi439)
1 parent 3d44666 commit 8c6183e

File tree

4 files changed

+31
-11
lines changed

4 files changed

+31
-11
lines changed

openandroidinstaller/assets/configs/Mi439.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,12 @@ steps:
4949
5050
Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
5151
command: adb_reboot_bootloader
52-
- type: call_button
53-
content: >
54-
Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue.
55-
56-
Note : If you have not selected additional partitions it will do nothing and is save to continue.
57-
command: fastboot_flash_additional_partitions
5852
- type: call_button
5953
content: >
6054
Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue.
6155
command: fastboot_flash_recovery
6256
- type: call_button
63-
img: ofox.png
57+
img: twrp-start.jpeg
6458
content: >
6559
Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery.
6660
If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed.

openandroidinstaller/assets/configs/vayu.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ steps:
4646
Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue.
4747
command: fastboot_flash_recovery
4848
- type: call_button
49-
img: ofox.png
49+
img: twrp-start.jpeg
5050
content: >
5151
Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery.
5252
If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed.

openandroidinstaller/tooling.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,29 @@ def fastboot_flash_boot(bin_path: Path, recovery: str) -> TerminalResponse:
451451

452452
@add_logging("Flash custom recovery with fastboot.")
453453
def fastboot_flash_recovery(
454-
bin_path: Path, recovery: str, is_ab: bool = True
454+
bin_path: Path,
455+
recovery: str,
456+
is_ab: bool = True,
457+
vendor_boot: Optional[str] = None,
458+
dtbo: Optional[str] = None,
459+
vbmeta: Optional[str] = None,
460+
super_empty: Optional[str] = None,
455461
) -> TerminalResponse:
456-
"""Flash custom recovery with fastboot."""
462+
"""Flash custom recovery with fastboot.
463+
464+
If necessary, flash additional partitions (dtbo, vbmeta, super_empty) with fastboot before.
465+
"""
466+
if any([dtbo, vbmeta, super_empty, vendor_boot]):
467+
for line in fastboot_flash_additional_partitions(
468+
bin_path=bin_path,
469+
dtbo=dtbo,
470+
vbmeta=vbmeta,
471+
super_empty=super_empty,
472+
vendor_boot=vendor_boot,
473+
is_ab=is_ab,
474+
):
475+
yield line
476+
457477
for line in run_command(
458478
"fastboot flash recovery ", target=f"{recovery}", bin_path=bin_path
459479
):
@@ -505,7 +525,9 @@ def fastboot_flash_additional_partitions(
505525
if vbmeta:
506526
logger.info("vbmeta selected. Flashing vbmeta partition.")
507527
for line in run_command(
508-
"fastboot --disable-verity --disable-verification flash vbmeta ", target=f"{vbmeta}", bin_path=bin_path
528+
"fastboot --disable-verity --disable-verification flash vbmeta ",
529+
target=f"{vbmeta}",
530+
bin_path=bin_path,
509531
):
510532
yield line
511533
if not is_ab:

openandroidinstaller/views/step_view.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ def call_to_phone(self, e, command: str):
242242
fastboot_flash_recovery,
243243
recovery=self.state.recovery_path,
244244
is_ab=self.state.config.is_ab,
245+
dtbo=self.state.dtbo_path,
246+
vbmeta=self.state.vbmeta_path,
247+
super_empty=self.state.super_empty_path,
248+
vendor_boot=self.state.vendor_boot_path,
245249
),
246250
"fastboot_reboot_recovery": fastboot_reboot_recovery,
247251
"fastboot_flash_additional_partitions": partial(

0 commit comments

Comments
 (0)