Skip to content

Commit

Permalink
Update configs for additional partitions and flash vendor_boot.img (#317
Browse files Browse the repository at this point in the history
)

The PR adds:
- updates for some OnePlus and Pixel configs with make use of the
flashing of additional partitions if needed for Android 13
- Allow flashing of the vendor_boot partition
- Add --disable-verity --disable-verification  to flash vbmeta command
- support for alioth (Redmi K40 / Mi 11X / Poco F3) (thanks to
@anon1892)

Resolves #303 and #304 .
  • Loading branch information
tsterbak committed Oct 31, 2023
2 parents 3e5f70d + a334957 commit 342369f
Show file tree
Hide file tree
Showing 25 changed files with 201 additions and 34 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -185,12 +185,13 @@ 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 | Redmi 9A / 9C / 9AT / 9i / 9A Sport / 10A / 10A Sport | garden / dandelion / blossom / angelican | | tested
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
Expand Down
1 change: 1 addition & 0 deletions openandroidinstaller/app_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
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 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.
Expand Down
55 changes: 55 additions & 0 deletions openandroidinstaller/assets/configs/alioth.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions openandroidinstaller/assets/configs/avicii.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
supported_device_codes:
- avicii
- Nord
additional_steps:
- dtbo
- vbmeta
requirements:
android: 12
steps:
Expand All @@ -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: >
Expand Down
2 changes: 1 addition & 1 deletion openandroidinstaller/assets/configs/begonia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions openandroidinstaller/assets/configs/coral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
device_code: coral
supported_device_codes:
- coral
additional_steps:
- dtbo
requirements:
android: 13
steps:
Expand Down Expand Up @@ -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: >
Expand Down
8 changes: 1 addition & 7 deletions openandroidinstaller/assets/configs/cupid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion openandroidinstaller/assets/configs/davinci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions openandroidinstaller/assets/configs/dre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ metadata:
supported_device_codes:
- dre
- NordN200
additional_steps:
- dtbo
- vbmeta
- vendor_boot
requirements:
android: 11
steps:
Expand Down
2 changes: 2 additions & 0 deletions openandroidinstaller/assets/configs/flame.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
device_code: flame
supported_device_codes:
- flame
additional_steps:
- dtbo
requirements:
android: 13
steps:
Expand Down
2 changes: 1 addition & 1 deletion openandroidinstaller/assets/configs/garden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion openandroidinstaller/assets/configs/ginkgo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions openandroidinstaller/assets/configs/guacamole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
supported_device_codes:
- guacamole
- OnePlus7Pro
additional_steps:
- dtbo
- vbmeta
requirements:
android: 12
steps:
Expand Down
3 changes: 3 additions & 0 deletions openandroidinstaller/assets/configs/guacamoleb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
supported_device_codes:
- guacamoleb
- OnePlus7
additional_steps:
- dtbo
- vbmeta
requirements:
android: 12
steps:
Expand Down
3 changes: 3 additions & 0 deletions openandroidinstaller/assets/configs/hotdog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
supported_device_codes:
- hotdog
- OnePlus7TPro
additional_steps:
- dtbo
- vbmeta
requirements:
android: 12
steps:
Expand Down
3 changes: 3 additions & 0 deletions openandroidinstaller/assets/configs/hotdogb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
supported_device_codes:
- hotdogb
- OnePlus7T
additional_steps:
- dtbo
- vbmeta
requirements:
android: 12
steps:
Expand Down
2 changes: 1 addition & 1 deletion openandroidinstaller/assets/configs/lavender.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
2 changes: 1 addition & 1 deletion openandroidinstaller/assets/configs/miatoll.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 1 addition & 7 deletions openandroidinstaller/assets/configs/raphael.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions openandroidinstaller/assets/configs/sunfish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
device_code: sunfish
supported_device_codes:
- sunfish
additional_steps:
- dtbo
requirements:
android: 12.1.0
steps:
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
42 changes: 39 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 @@ -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."""
Expand All @@ -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:
Expand All @@ -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."""
Expand Down
Loading

0 comments on commit 342369f

Please sign in to comment.