Skip to content

Add support for Xiaomi (with OrangeFox) #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ Linux is currently the best supported platform (tested with Ubuntu 20.04/22.04 L
- [LineageOS for microg](https://download.lineage.microg.org)
- [BlissRoms](https://blissroms.org)
- [PixelExperience](https://download.pixelexperience.org)
- [crDroid](https://crdroid.net/)
- [ArrowOS](https://arrowos.net/)
- [DivestOS](https://divestos.org/)
- TWRP Recovery:
- [TWRP recovery](https://twrp.me/Devices)
- [OrangeFox](https://wiki.orangefox.tech)
- Optional Addons:
- There are different packages of *Google Apps* available.
- [MindTheGapps](https://wiki.lineageos.org/gapps#downloads)
Expand All @@ -63,7 +67,7 @@ Linux is currently the best supported platform (tested with Ubuntu 20.04/22.04 L

## Officially supported devices

Currently, the **we support 62 devices** by various vendors and working on adding more soon!
Currently, the **we support 68+ 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.
Expand Down Expand Up @@ -169,8 +173,18 @@ OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested
OnePlus | 9 | lemonade | | under development
</details>

And more to come!
<details><summary><b>Xiaomi</b></summary>

Vendor | Device Name | CodeName | Models | Status
---|-----------------------------------------------------|------------------------------------------------------------------------------------------|-------|---
Xiaomi | Redmi Note 7 | [lavender](https://wiki.lineageos.org/devices/lavender) | | tested
Xiaomi | Redmi Note 8 / 8T | [ginkgo / willow](https://wiki.lineageos.org/devices/ginkgo) | | untested
Xiaomi | Redmi Note 10S / 11SE / Poco M5S | [rosemary](https://wiki.lineageos.org/devices/rosemary) / maltose / secret /rosemary_p | | untested
Xiaomi | Redmi 7A / 8 / 8A / 8A Dual | [Mi439](https://wiki.lineageos.org/devices/Mi439) : pine / olive / olivelite / olivewood | | tested
Xiaomi | Redmi 9A / 9C / 9AT / 9i / 9A Sport / 10A / 10A Sport | garden / dandelion / blossom / angelican | | tested
</details>

And more to come!

## Run OpenAndroidInstaller for development

Expand Down Expand Up @@ -215,6 +229,9 @@ Every config file should have `metadata` with the following fields:
- `device_code`: str; The official device code.
- `supported_device_codes`: List[str]; A list of supported device codes for the config. The config will be loaded based on this field.
- `twrp-link`: [OPTIONAL] str; name of the corresponding twrp page.
- `additional_steps` : [OPTIONAL] List[str]; A list of additional steps. Could be `dtbo`, `vbmeta`, `super_empty`.
- `supported_recovery`: [OPTIONAL] List[str]; A list of supported recoveries. For the moment, can be twrp and/or orangefox (twrp by default)
- `notes`: [OPTIONAL] str; specific phone information, showed before choosing ROM / recovery

In addition to these metadata, every config can have optional `requirements`. If these are set, the user is asked to check if they are meet.
- `android`: [OPTIONAL] int|str; Android version to install prior to installing a custom ROM.
Expand All @@ -231,7 +248,7 @@ Every step in the config file corresponds to one view in the application. These
- `img`: [OPTIONAL] Display an image on the left pane of the step view. Images are loaded from `openandroidinstaller/assets/imgs/`.
- `content`: str; The content text displayed alongside the action of the step. Used to inform the user about what's going on. For consistency and better readability the text should be moved into the next line using `>`.
- `link`: [OPTIONAL] Link to use for the link button if type is `link_button_with_confirm`.
- `command`: [ONLY for call_button* steps] str; The command to run. One of `adb_reboot`, `adb_reboot_bootloader`, `adb_reboot_download`, `adb_sideload`, `adb_twrp_wipe_and_install`, `adb_twrp_copy_partitions`, `fastboot_boot_recovery`, `fastboot_unlock_with_code`, `fastboot_unlock`, `fastboot_oem_unlock`, `fastboot_get_unlock_data`, `fastboot_reboot`, `heimdall_flash_recovery`.
- `command`: [ONLY for call_button* steps] str; The command to run. One of `adb_reboot`, `adb_reboot_bootloader`, `adb_reboot_download`, `adb_sideload`, `adb_twrp_wipe_and_install`, `adb_twrp_copy_partitions`, `fastboot_boot_recovery`, `fastboot_reboot_recovery`, `fastboot_flash_recovery` `fastboot_unlock_with_code`, `fastboot_flash_additional_partitions`, `fastboot_unlock`, `fastboot_oem_unlock`, `fastboot_get_unlock_data`, `fastboot_reboot`, `heimdall_flash_recovery`.
- `allow_skip`: [OPTIONAL] boolean; If a skip button should be displayed to allow skipping this step. Can be useful when the bootloader is already unlocked.

**Please try to retain this order of these fields in your config to ensure consistency.**
Expand Down
4 changes: 4 additions & 0 deletions openandroidinstaller/app_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def __init__(
self.config = None
self.image_path = None
self.recovery_path = None
self.dtbo_path = None
self.vbmeta_path = None
self.super_empty_path = None
self.chosen_recovery = None

# store views
self.default_views: List = []
Expand Down
73 changes: 73 additions & 0 deletions openandroidinstaller/assets/configs/Mi439.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
metadata:
maintainer: A non (anon)
device_name: Xiaomi Redmi 7A / 8 / 8A / 8A Dual
is_ab_device: false
device_code: Mi439
supported_recovery:
- orangefox
- twrp
additional_steps:
- dtbo
- vbmeta
- super_empty
supported_device_codes:
- Mi439
- pine
- olive
- olivelite
- olivewood
notes: >
- If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com

- 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)
requirements:
firmware: MiUI 12.5 (Q)
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.
allow_skip: true
- 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
allow_skip: true
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 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
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
59 changes: 59 additions & 0 deletions openandroidinstaller/assets/configs/garden.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
metadata:
maintainer: A non (anon)
device_name: Xiaomi Redmi 9A / 9C / 9AT / 9i / 9A Sport / 10A / 10A Sport
is_ab_device: false
device_code: garden
supported_recovery:
- orangefox
- twrp
supported_device_codes:
- dandelion
- garden
- blossom
- angelican
notes: >
- If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com

- OAI don't support ROM that requires permissiver.

- 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)
requirements:
firmware: MiUI 12.5 (Q)
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.
allow_skip: true
- type: link_button_with_confirm
content: >
Please download official Xiaomi unlock tool, and follow instructions.
https://en.miui.com/unlock/download_en.html
You may have to wait 7 days before being able to unlock the bootloader.
Do not attempt to bypass this limitation / use non officials tools, you may brick your phone.
link: https://en.miui.com/unlock/download_en.html
allow_skip: true
- type: confirm_button
content: >
The bootloader is now unlocked. Since the device resets completely, you will need to re-enable USB debugging to continue.
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
57 changes: 57 additions & 0 deletions openandroidinstaller/assets/configs/ginkgo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
metadata:
maintainer: A non (anon)
device_name: Xiaomi Redmi Note 8 / 8T
is_ab_device: false
device_code: ginkgo
supported_recovery:
- orangefox
- twrp
supported_device_codes:
- ginkgo
- willow
notes: >
- If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com

- You should install Android 10 or newer ROM.

- 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)
requirements:
android: 10 (Q)
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.
allow_skip: true
- type: link_button_with_confirm
content: >
Please download official Xiaomi unlock tool, and follow instructions.
https://en.miui.com/unlock/download_en.html
You may have to wait 7 days before being able to unlock the bootloader.
Do not attempt to bypass this limitation / use non officials tools, you may brick your phone.
link: https://en.miui.com/unlock/download_en.html
allow_skip: true
- type: confirm_button
content: >
The bootloader is now unlocked. Since the device resets completely, you will need to re-enable USB debugging to continue.
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
56 changes: 56 additions & 0 deletions openandroidinstaller/assets/configs/lavender.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
metadata:
maintainer: A non (anon)
device_name: Xiaomi Redmi Note 7
is_ab_device: false
device_code: lavender
supported_recovery:
- orangefox
- twrp
supported_device_codes:
- lavender
notes: >
- If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com/miui/lavender/

- You should install Android 10 or newer ROM.

- 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)
requirements:
android: 10 (Q)
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.
allow_skip: true
- type: link_button_with_confirm
content: >
Please download official Xiaomi unlock tool, and follow instructions.
https://en.miui.com/unlock/download_en.html
You may have to wait 7 days before being able to unlock the bootloader.
Do not attempt to bypass this limitation / use non officials tools, you may brick your phone.
link: https://en.miui.com/unlock/download_en.html
allow_skip: true
- type: confirm_button
content: >
The bootloader is now unlocked. Since the device resets completely, you will need to re-enable USB debugging to continue.
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
51 changes: 51 additions & 0 deletions openandroidinstaller/assets/configs/rosemary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
metadata:
maintainer: A non (anon)
device_name: Xiaomi Redmi Note 10S / 11SE / Poco M5S
is_ab_device: false
device_code: rosemary
supported_recovery:
- orangefox
- twrp
supported_device_codes:
- rosemary
- secret
- maltose
- rosemary_p
notes: >
- If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com

- Please respect the requested by the ROM developers version for MIUI and Android

- 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.
allow_skip: true
- type: link_button_with_confirm
content: >
Please download official Xiaomi unlock tool, and follow instructions.
https://en.miui.com/unlock/download_en.html
You may have to wait 7 days before being able to unlock the bootloader.
Do not attempt to bypass this limitation / use non officials tools, you may brick your phone.
link: https://en.miui.com/unlock/download_en.html
allow_skip: true
- type: confirm_button
content: >
The bootloader is now unlocked. Since the device resets completely, you will need to re-enable USB debugging to continue.
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.
UNTESTED : Need to hold Vol+ or no ?
command: fastboot_flash_boot
Binary file added openandroidinstaller/assets/imgs/ofox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading