Skip to content
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

Dev: flash additional partitions #246

Merged
merged 31 commits into from
Sep 26, 2023
Merged

Dev: flash additional partitions #246

merged 31 commits into from
Sep 26, 2023

Conversation

tsterbak
Copy link
Member

@tsterbak tsterbak commented Aug 8, 2023

This PR is based on #220 (by @anon1892) and aims to integrate the code in the Installer.

  • Include the commands fastboot_flash_recovery and fastboot_reboot_recovery (thanks to @anon1892)
  • Add support for Mi439 (Redmi 7A & co.) (thanks to @anon1892)
  • Display device specific notes at the image selection step (thanks to @anon1892)

Other fixes & additions:

  • Display the scroll bar by default if scrolling is necessary
  • An info text box for additional images

Todo:

  • When the "custom recovery already flashed" button is selected, user should not have to select recovery file, as in this PR for now.
  • User should be able not to select additional partitions, even on Android 13 (maybe add a button like "custom recovery already flashed".
  • When recovery flashing is disabled, adb reboot recovery is not performed. Fix that.

@tsterbak tsterbak changed the base branch from main to dev August 8, 2023 15:36
@tsterbak tsterbak added this to the Release Beta-Version 0.4.5 milestone Aug 8, 2023
@tsterbak tsterbak added the enhancement New feature or request label Aug 8, 2023
@tsterbak
Copy link
Member Author

tsterbak commented Aug 8, 2023

@anon1892 I changed a few things and improved the layout in the app a bit.

Most notably, the process now checks for the android version of the ROM you want to flash and only then decides if the selection for additional images should be displayed.

What is missing now:

  • A bit more explanation of why the partitions are needed and where to get the images.
  • Potentially an option in the config to select from which Android version on the additional images should be flashed. This might be necessary for each partition independently (What would you say?).
  • Some in depth testing. I sadly don't have too many devices available right now that need this feature.

Please have a look and give it a test if you can/want 😊 Also, feel free to add a PR to this PR to improve it!

@anon1892
Copy link
Member

anon1892 commented Aug 8, 2023

Ok, will test it when I have time.

A bit more explanation of why the partitions are needed and where to get the images.

Maybe a button opening an info box?

Potentially an option in the config to select from which Android version on the additional images should be flashed.

As far I know, it's only needed for A13. So, no need for an additional config option?
But may we add a checkbox to allow flashing it if the user knows what he is doing ? Just in case...

@tsterbak tsterbak changed the title Dev flash additional Dev: flash additional partitions Aug 8, 2023
@tsterbak
Copy link
Member Author

tsterbak commented Aug 8, 2023

Ok, will test it when I have time.

Great! Thanks a lot!
Maybe we could already put some Xiaomi device without OFox requirement in for testing? I will add a Mi 9 Lite, which I have available for testing. But it only requires to wipe with super_emtpy. But its a start :)

Maybe a button opening an info box?

Yeah, I guess so. I will try to write a good text for it.

As far I know, it's only needed for A13. So, no need for an additional config option?
But may we add a checkbox to allow flashing it if the user knows what he is doing ? Just in case...

That's a good idea! I will think about a UI layout for that :)

@anon1892
Copy link
Member

anon1892 commented Aug 9, 2023

Maybe we could already put some Xiaomi device without OFox requirement in for testing?

Without OFox for now? It will require more testing, because when OFox support will be added, we will need to test OFox AND TWRP just in case it breaks something, isn't it?

For dtbo, vbmeta and super_empty flashing, there is Mi439 #226.
And for testing if everything is good without additional partitions, maybe garden #224?

@anon1892
Copy link
Member

Why "recovery already flashed" and "bootloader already unlocked" toggles don't behave the same way?
The first can be clicked before choosing device (so, in reading order), but the second can't be clicked before. Why?

And I can't test properly, I have to make changes in device config, add #218, and maybe others things too...
Why don't you commit all these PRs into dev branch? As it is development branch, it can be broken and thr average user should not use it, isn't it?

@tsterbak
Copy link
Member Author

Why "recovery already flashed" and "bootloader already unlocked" toggles don't behave the same way?

good point, actually, I guess they both should be only available after the device is detected. What do you think?

And I can't test properly, I have to make changes in device config, add #218, and maybe others things too...
Why don't you commit all these PRs into dev branch? As it is development branch, it can be broken and thr average user should not use it, isn't it?

I understand and I'm sorry for the inconvenience.

I would prefer not to push out releases with too many changes at the same time and also the OFox integration needs some more thought to make it future proof. Being able to flash additional partitions would be valuable immediately and would enable supporting more devices.
I know this increases the efforts for testing but it also reduces the things that can go wrong with each release quite a bit. And in the Android ecosystem, unexpected side effects of changes are common and overlooking things is easy. So I'd rather take this higher effort, lower stress route.

So, I guess, we would add devices with TWRP support first to test flashing of additional partitions and then move on to add Ofox support.

@anon1892
Copy link
Member

good point, actually, I guess they both should be only available after the device is detected. What do you think?

I would say the opposite, or move these buttons to the bottom (I read from top to bottom, so I click on buttons from top to bottom too, and I think a lot of users do the same)

So I'd rather take this higher effort, lower stress route.

Understandable! But we will need to add fastboot_flash_recovery even without adding OFox, since it's a TWRP command and needed for Xiaomi (and maybe others brands) phones to be supported. And I should be able to test this PR with #226

@tsterbak
Copy link
Member Author

Hey @anon1892, I guess merged and integrated all the required parts for a first test. Let me know if it works for you and/or if something is missing! :)
It will be great to have this merged!

@tsterbak
Copy link
Member Author

tsterbak commented Sep 5, 2023

As of 4/9 , this branch cannot be used to flash any device , even if "recovery is already flashed" is ticked the recovery file is not validated and you cannot go to next step , I will have a look to see what is wrong

Hey, thanks a lot for testing and reporting this issue! It should be fixed and improved now! :)

@freechelmi
Copy link
Contributor

As of 4/9 , this branch cannot be used to flash any device , even if "recovery is already flashed" is ticked the recovery file is not validated and you cannot go to next step , I will have a look to see what is wrong

Hey, thanks a lot for testing and reporting this issue! It should be fixed and improved now! :)

That was fast !!! Yes it works now

@anon1892
Copy link
Member

anon1892 commented Sep 5, 2023

I updated the accompanying text to the progressbar now. But it should go to 100% in the end ;) So this part is not there.

Ok! I was writing this because adb behaves strangly, and on my phone, stop at 47% when sideload is finished...

I want to keep the options as low as reasonably possible on the user side.

Maybe show this button only in a “developer mode”?

@tsterbak
Copy link
Member Author

tsterbak commented Sep 6, 2023

Ok! I was writing this because adb behaves strangly, and on my phone, stop at 47% when sideload is finished...

Ah yes, that's true. The installer on the PC reaches 100% at the end but on the phone it only gets to 47%...

Maybe show this button only in a “developer mode”?

Yeah, I need to prepare to move all "advanced features" to a developer or advanced mode. I'll try to simplify stuff again soon :)

@MagicLike MagicLike mentioned this pull request Sep 8, 2023
@MagicLike
Copy link
Member

When the bugs @anon1892 found are fixed, I'll test it with my OnePlus One to see if there are any issues with older devices 👍

Ok, this is weird: My OnePlus One won't boot the twrp I got here (which worked all the time) and also won't flash it... I will try to investigate in the next few weeks, but I am also pretty busy atm...

@tsterbak
Copy link
Member Author

tsterbak commented Sep 9, 2023

Thanks for testing. Then I will also do some more testing with older devices, maybe I find something :)

@tsterbak
Copy link
Member Author

tsterbak commented Sep 15, 2023

Ok, this is weird: My OnePlus One won't boot the twrp I got here (which worked all the time) and also won't flash it... I will try to investigate in the next few weeks, but I am also pretty busy atm...

So, I got to test with some old Samsung and Sony devices (so far I don't own a OnePlus device). And as far as I can tell everything seems to work as expected.
Could you reproduce your issue? What did the terminal/log output say?

@MagicLike
Copy link
Member

Ok, this is weird: My OnePlus One won't boot the twrp I got here (which worked all the time) and also won't flash it... I will try to investigate in the next few weeks, but I am also pretty busy atm...

So, I got to test with some old Samsung and Sony devices (so far I don't own a OnePlus device). And as far as I can tell everything seems to work as expected. Could you reproduce your issue? What did the terminal/log output say?

Yes, I just reproduced the issue. The OAI log does not show any interesting or relevant information regarding the error - just the normal log...

2023-09-15 18:51:08.329 | INFO     | tooling:logging:88 - Boot custom recovery with fastboot. - Parameters: {'recovery': '/*/twrp-3.6.2_9-0-bacon.img', 'is_ab': False, 'bin_path': PosixPath('/*/openandroidinstaller/openandroidinstaller/bin')}
2023-09-15 18:51:08.329 | INFO     | tooling:fastboot_boot_recovery:414 - Boot custom recovery with fastboot.
2023-09-15 18:51:08.329 | INFO     | tooling:run_command:60 - Run command: ['/*/openandroidinstaller/openandroidinstaller/bin/fastboot', 'boot', '/*/twrp-3.6.2_9-0-bacon.img']
2023-09-15 18:51:09.099 | INFO     | tooling:run_command:73 - Sending 'boot.img' (15256 KB)                      OKAY [  0.480s]
2023-09-15 18:51:09.126 | INFO     | tooling:run_command:73 - Booting                                            OKAY [  0.026s]
2023-09-15 18:51:09.127 | INFO     | tooling:run_command:73 - Finished. Total time: 0.535s
2023-09-15 18:51:09.128 | INFO     | tooling:logging:88 - Wait for recovery - Parameters: {'bin_path': PosixPath('/*/openandroidinstaller/openandroidinstaller/bin')}
2023-09-15 18:51:09.128 | INFO     | tooling:run_command:60 - Run command: ['/*/openandroidinstaller/openandroidinstaller/bin/adb', 'wait-for-recovery']

But even after waiting minutes, nothing is happening on the OnePlus One side. - It seems like it freezes every time, as fastboot does not respond to fastboot commands anymore.

@freechelmi
Copy link
Contributor

I have a one plus one and faced the same behaviour on current stable 0.4.5

The step where we try to boot the recovery via fastboot just let it stuck like you described

@MagicLike
Copy link
Member

I have a one plus one and faced the same behaviour on current stable 0.4.5

The step where we try to boot the recovery via fastboot just let it stuck like you described

I also tried to boot twrp manually over cli, but nothing changes...

@tsterbak
Copy link
Member Author

I have a one plus one and faced the same behaviour on current stable 0.4.5

And I assume there was no issue with version 0.4.4, right? So there must be a regression somewhere on the dev branch. 🤔

@MagicLike
Copy link
Member

I have a one plus one and faced the same behaviour on current stable 0.4.5

And I assume there was no issue with version 0.4.4, right? So there must be a regression somewhere on the dev branch. 🤔

Nope same issue on 0.4.4 - I don't think that this is an issue with OAI, but rather with the devices itself...

@tsterbak
Copy link
Member Author

Nope same issue on 0.4.4 - I don't think that this is an issue with OAI, but rather with the devices itself...

Hm, might be. Maybe it does not implement "wait for recovery" yet? 🤔 What happens if you boot to recovery manually and then run adb wait-for-recovery manually?

@MagicLike
Copy link
Member

Nope same issue on 0.4.4 - I don't think that this is an issue with OAI, but rather with the devices itself...

Hm, might be. Maybe it does not implement "wait for recovery" yet? 🤔 What happens if you boot to recovery manually and then run adb wait-for-recovery manually?

I can't even boot the recovery - that is the point: It worked perfectly fine weeks ago and suddenly I am only able to flash stock stuff and not even boot custom recoveries. The bootloader just freezes and becomes unavailable.

@MagicLike
Copy link
Member

MagicLike commented Sep 17, 2023

I have the feeling, that there is some kind of limit reached / the recovery storage sector might be broken or something else...
Maybe it is also soft-bricked...

@tsterbak
Copy link
Member Author

I can't even boot the recovery - that is the point: It worked perfectly fine weeks ago and suddenly I am only able to flash stock stuff and not even boot custom recoveries. The bootloader just freezes and becomes unavailable.

Hm, that's weird. I had a bit of a similar thing (for a samsung device) and just using a different usb-cable somehow seemed to fix it 🤷‍♂️ 🤔 but could also have been random...

I have the feeling, that there is some kind of limit reached / the recovery storage sector might be broken or something else...
Maybe it is also soft-bricked...

Never heard of something like that (which does not necessarily means something). Booting the recovery leaves no real trace on the device. And if you can flash the stock recovery and image, then something seems to work still. Really interesting. 🤔

@MagicLike
Copy link
Member

Hm, that's weird. I had a bit of a similar thing (for a samsung device) and just using a different usb-cable somehow seemed to fix it 🤷‍♂️ 🤔 but could also have been random...

Tried another cable - no difference 😞

@tsterbak
Copy link
Member Author

Can we move forward with this? I'm slowly wrapping up stuff for the new release.

What can/should we do about the OnePlus issues? Somehow weird, that it comes up now. Can someone try with an older version of the installer?

@MagicLike
Copy link
Member

Can we move forward with this? I'm slowly wrapping up stuff for the new release.

From my side you can merge...

What can/should we do about the OnePlus issues? Somehow weird, that it comes up now. Can someone try with an older version of the installer?

I already tried it in an older version, in which it was working before. I will open an issue to continue with the problem...

@tsterbak tsterbak merged commit 7e34275 into dev Sep 26, 2023
@tsterbak tsterbak deleted the dev-flash-additional branch September 26, 2023 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants