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

Add the zip to repartition Samsung Exynos 7870 devices #76

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ Other phone vendors stops allowing to unlock the bootloader all together. There
- [Heimdall](https://gitlab.com/BenjaminDobell/Heimdall/) is an [MIT](https://gitlab.com/BenjaminDobell/Heimdall/-/blob/master/LICENSE)-licensed replacement for the leaked ODIN tool to flash Samsung devices.
- [libusb-1.0](https://github.com/libusb/libusb) is a [LGPL-2.1](https://github.com/libusb/libusb/blob/master/COPYING)-licensed library for USB device access from Linux, macOS, Windows and others.
- [copy-partitions-20220613-signed.zip](https://mirrorbits.lineageos.org/tools/copy-partitions-20220613-signed.zip) The copy-partitions script was created by LineageOS developer erfanoabdi and filipepferraz and released under LGPL. It is used when the partitions need to be copied before flashing.
- [universal_repartition_script7870](https://github.com/Astrako/universal_repartition_script7870) The universal repartition script for phones with the Samsung Exynos 7870 by [Astrako](https://github.com/Astrako) under Apache License, Version 2.0.


## Acknowledgements
Expand Down
5 changes: 5 additions & 0 deletions openandroidinstaller/assets/configs/a3y17lte.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ steps:
Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for
8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off,
hold *Volume Up* + *Home* + *Power*. Confirm when the recovery screen appears.
- type: call_button
command: adb_twrp_resize_7870_partitions
content: >
With more recent Android ROMs based on Version 10 or higher, the system memory is too small. So the partitions of this device need to be resized.
Confirm to run the repartition process. Once it is finished you can continue.
install_os:
- type: call_button
content: >
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion openandroidinstaller/installer_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def validate_config(config: str) -> bool:
),
"content": str,
schema.Optional("command"): Regex(
r"adb_reboot|adb_reboot_bootloader|adb_reboot_download|adb_sideload|adb_twrp_wipe_and_install|adb_twrp_copy_partitions|fastboot_flash_recovery|fastboot_unlock_with_code|fastboot_get_unlock_data|fastboot_unlock|fastboot_oem_unlock|fastboot_reboot|heimdall_flash_recovery"
r"adb_reboot|adb_reboot_bootloader|adb_reboot_download|adb_sideload|adb_twrp_wipe_and_install|adb_twrp_copy_partitions|adb_twrp_resize_7870_partitions|fastboot_flash_recovery|fastboot_unlock_with_code|fastboot_get_unlock_data|fastboot_unlock|fastboot_oem_unlock|fastboot_reboot|heimdall_flash_recovery"
),
schema.Optional("allow_skip"): bool,
schema.Optional("img"): str,
Expand Down
30 changes: 30 additions & 0 deletions openandroidinstaller/tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,36 @@ def adb_twrp_copy_partitions(bin_path: Path, config_path: Path):
return True


def adb_twrp_resize_7870_partitions(bin_path: Path, config_path: Path):
"""Resize partitions on Samsung Exynos 7870 devices to make Android 10+ ROMs work."""
logger.info("Sideload the resize partition script with adb.")
# activate sideload
for line in run_command("adb", ["shell", "twrp", "sideload"], bin_path):
yield line
if (type(line) == bool) and not line:
logger.error("Activating sideload failed.")
yield False
return
# now sideload the script
sleep(5)
for line in run_command(
"adb",
[
"sideload",
f"{config_path.parent.joinpath(Path('universal_repartition_script7870.zip'))}",
],
bin_path,
):
if line:
yield line
if (type(line) == bool) and not line:
logger.error("Sideloading universal_repartition_script7870.zip failed.")
yield True
sleep(7)
# Resizing partitions end #
yield True


def adb_twrp_wipe_and_install(bin_path: Path, target: str, config_path: Path) -> bool:
"""Wipe and format data with twrp, then flash os image with adb.

Expand Down
4 changes: 4 additions & 0 deletions openandroidinstaller/views/step_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
adb_sideload,
adb_twrp_wipe_and_install,
adb_twrp_copy_partitions,
adb_twrp_resize_7870_partitions,
fastboot_flash_recovery,
fastboot_oem_unlock,
fastboot_reboot,
Expand Down Expand Up @@ -220,6 +221,9 @@ def call_to_phone(self, e, command: str):
"adb_twrp_copy_partitions": partial(
adb_twrp_copy_partitions, config_path=self.state.config_path
),
"adb_twrp_resize_7870_partitions": partial(
adb_twrp_resize_7870_partitions, config_path=self.state.config_path
),
"fastboot_unlock": fastboot_unlock,
"fastboot_unlock_with_code": partial(
fastboot_unlock_with_code, unlock_code=self.inputtext.value
Expand Down