-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add support for Xiaomi (with OrangeFox) #188
Conversation
Thanks a lot for the contribution! Why would you require OrangeFox for these devices? There are also TWRP version available. Great work! |
Depends of the device : there is no Android 12 & 13 support by TWRP for lavender (Remi Note 7) |
if this PR is merged, will i just need to create a .yaml file to add support for a new xiaomi device? I believe that the whole process is similar except that the bootloader can be unlocked using fastboot oem unlock. |
Yep, therefore I refer to the contribute section in the README: https://github.com/openandroidinstaller-dev/openandroidinstaller/#how-to-contribute-your-own-installation-configurations
Xiaomi devices are a bit more locked down afaik. You need to create a Mi account, which has to be connected to your SIM and phone number and then request an unlock for your device. (can you confirm @anon1892?) Sources: |
Sidenote: I would move this PR on to 0.5, as it is a massive amount of new features and therefore needs a larger amount of testing. Or what do you think? |
I see, so it makes sense to move forward with these changes together. I will see that I get some testing for OrangeFox started and see how these changes work. I might need to streamline or refactor some code to make it work smoothly. :) |
Yes, in theory this is true. But for some devices there are steps necessary that are not supported yet. Also some Xiaomi devices are affected by this. (For example flashing a vb_meta partition). |
I'm not sure yet. We will see :D |
@@ -497,3 +518,24 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]: | |||
except CalledProcessError: | |||
logger.error("Failed to detect a device.") | |||
return None | |||
|
|||
@add_logging("Flash custom recovery with fastboot.") | |||
def fastboot_flash_recovery( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to flash the recovery here, or could we just boot it?
I would prefer that, since if something goes wrong, the recovery of the device is still intact. This reduces the risk for users (I would say).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree - that is the same reason I initially brought this feature forward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't flash the recovery, you will not be able to install OTA.
In addition, the Xiaomi recovery is very poor... And if something goes wrong, as I mentioned in notes
metadata for lavender & ginkgo, you can flash MIUI and all partitions with a script.
For Xiaomi devices, I never saw a documentation recommanding not to flash the recovery (it's even a mandatory step)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OTA is a very good point. Should be fine. 👍
Maybe we should even consider moving more phones to flashing the recovery.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this one - I'd still vote for only flashing if necessary, like on Samsung or Xiaomi devices, as it is easier to revert back and as seen on the OnePlus One - the bootloader can't interact with any non stock recovery. So backwards compatibility would be another issue...
Sadly, not on Xiaomi devices. @MagicLike got the point.
Yes, go ahead! The code can certainly be improved |
Sidequestion: Does the SIM card need a internet connection, or could I just use a prepaid card without internet and use Wifi instead? (Having a Xiaomi myself, but don't want to give them all my data...) |
You have to give them everything... I have a MI 9 Lite and they needed internet connection to unlock it. |
It needs internet connection, but very few (less than 1Mo for sure, but I didn't measure how many) |
mine is the Mi A2 Lite (daisy) it doesn't come with MIUI it comes with pure android so only the fastboot oem unlock command solves it |
README.md
Outdated
Xiaomi | Redmi Note 7 | [lavender](https://wiki.lineageos.org/devices/lavender) | lavender | tested | ||
Xiaomi | Redmi Note 8 / 8T | [ginkgo](https://wiki.lineageos.org/devices/ginkgo) | ginkgo / willow | untested | ||
Xiaomi | Redmi Note 10S / 11SE / Poco M5S | [rosemary](https://wiki.lineageos.org/devices/rosemary) | rosemary / maltose / secret / rosemary_p | untested | ||
Xiaomi | Redmi 9A / 9C / 9AT / 9i / 9A Sport / 10A / 10A Sport | [garden](https://wiki.lineageos.org/devices/garden) | garden / dandelion / blossom / angelican | tested |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This url does not exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ups... Copy - paste ! garden
was never officially supported by Lineage. Which URL should I replace it with?
EDIT : No link at all, like some others phones on the readme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also prefer, to have one config file per device code (if they are not very similar) and treat them as separate devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dandelion
and angelican
are official Xiaomi namecodes.
garden
and blossom
are names of unified groups of codenames, given by ROM developers.
A garden
ROM will fit for dandelion
device, for example. So as far I understand, we cannot divide config files per device code, isn't it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by that? - Do you mean having an extra device code for 2 configs or multiple device codes for one config? (Sorry, I am just a bit confused)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may forgot some (it's a mess), but globally :
Official Xiaomi codenames :
- Redmi 9C : angelica
- Redmi 9C NFC : angelican
- Redmi 9A/10A/10A Sport/9i/9A Sport : dandelion
- Poco C3/C31 : angelicain
Community names :
- Redmi 9A/9C/9i/9 India : garden
- All of the above + Redmi 9 Active/9AT/9I Sport : blossom
So, a garden
ROM will work on dandelion
and angelica
phones for example
And I forgot some codenames...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, thats confusing 😀
Then it might be a good idea, to start displaying multiple device codes (or the actually found one) as well as multiple possible names for devices (or based on the code) to the user. I could see this causing confusion for users (we recently also saw this for Samsung devices :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is !
I agree, we could display device code + group name, it may be more clear?
Also, some questions :
|
Maybe, but then the whole system would need a rewrite afaik, as then the different recoveries would need to be detected and then OAI would need to adapt it's commands to it. But yes it would make more sence instead of spaghetti coding another recovery in addition to twrp.
Yes, documentation is needed indeed - but I would want to use mkdocs(-material) for its higher capabilities -> #192 (comment). I also would set it up for you @tsterbak - if needed.
|
Ok. Will do it then. Yes, see 0fd5f35, I started to allow several recoveries to be used for the same device, and OAI to behave differently depending on the selected recovery. (need more work, I pursue) |
I need up my mind about if and how to integrate different recoveries at this point. As @MagicLike pointed out, there would be a substantial amount of refactoring and generalization necessary to make it work smoothly. And testing these things is horrible 😅 So if have to think about if and how I can maintain this puppy (https://textual.textualize.io/blog/2023/07/29/pull-requests-are-cake-or-puppies/). |
Does this support Xiaomi Redmi Note 9 Pro? |
Ok. I will start by making different pull requests, then that. Thank you !
Just looked, it's simple (sames steps as lavender, in this PR). |
If it is that simple, I will maybe also try to look into creating a config for begonia, but as it is currently my main device I will probably not be able to test it for now. (Would mark it as untested in the README and add a warning in the config itself...) |
Just looked at https://forum.xda-developers.com/t/rom-12-0-begonia-lineageos-19-0-unofficial.4381391/ |
Thanks a lot for splitting it up! |
Yes! |
so no redmi note 9 pro support :C |
If does not work, what will happen with my phone? |
That is pretty difficult to say in my perspective. But there defenetly is a way back afaik. But @anon1892 probably knows it better, as they flashed multiple xiaomi phones already. |
You will have to follow steps, which are easy : https://wiki.lineageos.org/devices/miatoll/install/variant3 |
@anon1892 btw, does mi unlock work for you? It doesn't on my end |
@RaptaG Yes, but sometimes it's annoying. |
Some modifications to the code, so OrangeFox recovery can be supported (especially useful for Xiaomi devices) Work started in #188 It works, but I don't like the fix line 267 of `tooling.py`
Some modifications to the code, so OrangeFox recovery can be supported (especially useful for Xiaomi devices)
To start, I just created two devices files, I have to test for others, but should be roughly the same, a lot of Xiaomi devices follow the same installation process (and will not have need to update code like this time)
Also added two devices metadata :
recovery
for OAI to know which recovery handle (optional, TWRP by default)notes
for showing device specific notes on the OS chooser screen (optional too)That's about it, what do you think?
EDIT : This PR is now split into many little ones : #218 #220 #221 #222 #223 #224 #225 #226