TWRP for Fairphone 3

This one (obviously) doesn’t work for A.0023 anymore and we require a new magisk patched boot image for that version.

Since I’m eager to learn, given that I have an A.0023 boot.img, Magisk, development tools and a somewhat okay understanding of c/c++, what would one need to do to create such a patched boot image?

The easiest way would be to use the apk created by my PR here:
https://github.com/topjohnwu/Magisk/suites/13452929666/artifacts/738307098

If you want to build it yourself there is a guide https://topjohnwu.github.io/Magisk/build.html

2 Likes

Would it be possible to host the apk somwhere? The github artifacts are no longer available as it seems, and I can’t get the build to work…

Many thanks @k4y0z for getting back here.

No, both LineageOS and /e/ does not use dynamic partitions on FP3. So, no support could be added on device/kernel side.

Let me know if I could be of any help.

Also, I came across this comment. This was done because of VTS I guess. Let me know if you have an alternative option for this.

I did try to create a request for creating a new branch on TWRP project so that we could submit changes via Gerrit but it didn’t work out.

I am happy to see the progress here and would like to contribute for this. :slight_smile:

@fabian.schicker the link still seems to work fine for me.

@TeamB58 Thanks for confirming, I already made some progress regarding LOS, unfortunately I wasn’t able to get decryption working on /e/ yet.
Thanks @AnotherElk and @d2w for testing.

I haven’t had the time yet to commit the changes and and create new releases.

Regarding this, I assume it was done to avoid having to update the bootloader and breaking ROMs that don’t use dynamic partitions. I does however go against googles recomendations:
For Android 10 devices, the bootloader MUST NOT pass skip_initramfs to the kernel command-line. Instead, bootloader should pass androidboot.force_normal_boot=1 to skip recovery and boot normal Android. Devices
(https://source.android.com/docs/core/ota/dynamic_partitions/implement#system-as-root-changes)

1 Like

I think this is applicable for Dynamic Partitions but not for Retrofit since FP3 is Android 9 launch device.

The repistory requires you to be signed in into a GitHub account, then the link works. I uploaded it again here: File-Upload.net - PatchedMagiksAPK.zip

(The original filename was just a bunch of numbers, I just typed somethinig)

Ah, thank you! Didn’t think about signing in on GitHub since it just gave me a 404 error…

I have uploaded two new versions of TWRP, one based on Android 11 and one based on Android 12.

Both versions should detect if the installed ROM uses (retrofitted) dynamic partitions or not.

twrp-3.7.0_11-0_k4y0z-20230818-01-fp3.img should be able to decrypt Android 11 based FPOS.

twrp-3.7.0_12-0_k4y0z-20230818-01-fp3.img should be able to decrypt LOS 20 /e/.

Unfortunately neither version currently supports decrypting Android 13 based FPOS or /e/ LOS.

Feedback welcome.

Thanks again @AnotherElk and @d2w for testing, and sorry for the delay.

EDIT: Seems like I mixed things up a bit, it was /e/ that worked not LOS.

5 Likes

Man you people are saints! Thank you very much!

Any info about Android 13 TWRP? Right now I consider going back to 11/ 12 just to get root.

AFAIK TWRP does not yet support decryption on Android 13 unfortunately.
You don’t need TWRP for root however. A fix for Magisk supporting FPOS with retrofitted dynamic partitions has just been merged yesterday.
Until a new Magisk release is out, you can use this

2 Likes

You are just wonderful!

However, I do need to ask a noob-question: After installing this apk, I only need to use it to patch the boot.img of Android 13 Fairphone-OS, right? Or is there more I have to do?

Yes, patch the boot.img and install it via fastboot: Installation | Magisk

1 Like

Just for feedback: It worked! For slot b, that is, slot a would just not boot. I suspect that it wasn’t (properly) updated to Android 13. Guess I’ll manually flash all images on that slot completely new and try again.

Edit: Nope, slot a remains a diva. Not sure what’s wrong there, even after I ran the Fairphone flash script and then flashed the patched boot.img, only slot b can boot and has root. Slot a just has a bootloop

Edit2: Well this is getting strange. I ran the Fairphone flash script again, and made sure both slots can boot into vanilla FP OS. Then I did the entire “boot into fastboot, determine slot, flash to other slot, check if it works, then try again with other slot” routine. Now Slot A boots perfectly fine and has root, but Slot B is the diva that cannot even boot if I flash the original boot.img to boot_b, no matter how often I try.

Man this is weird.

Fairphone’s official flash script erases several partitions on slot b, making slot b unbootable and setting slot a to active, regardless which slot was active previously.

I guess they did that to prevent booting a different android version from a different slot, which could corrupt userdata, while also saving some time by not flashing the large partitions twice.

    flash_image_ab_or_abort modem "${IMAGES_DIR}/NON-HLOS.bin"
    flash_image_ab_or_abort sbl1 "${IMAGES_DIR}/sbl1.mbn"
    flash_image_ab_or_abort rpm "${IMAGES_DIR}/rpm.mbn"
    flash_image_ab_or_abort tz "${IMAGES_DIR}/tz.mbn"
    flash_image_ab_or_abort devcfg "${IMAGES_DIR}/devcfg.mbn"
    flash_image_ab_or_abort dsp "${IMAGES_DIR}/adspso.bin"
    flash_image_or_abort splash "${IMAGES_DIR}/splash.img"
    flash_image_ab_or_abort mdtp "${IMAGES_DIR}/mdtp.img"
    flash_image_ab_or_abort lksecapp "${IMAGES_DIR}/lksecapp.mbn"
    flash_image_ab_or_abort cmnlib "${IMAGES_DIR}/cmnlib_30.mbn"
    flash_image_ab_or_abort cmnlib64 "${IMAGES_DIR}/cmnlib64_30.mbn"
    flash_image_ab_or_abort keymaster "${IMAGES_DIR}/km4.mbn"
    flash_image_a_erase_b_or_abort dtbo "${IMAGES_DIR}/dtbo.img"
    flash_image_a_erase_b_or_abort vbmeta "${IMAGES_DIR}/vbmeta.img"
    flash_image_a_erase_b_or_abort boot "${IMAGES_DIR}/boot.img"
    flash_image_a_erase_b_or_abort system "${IMAGES_DIR}/super_system.img"
    flash_image_a_erase_b_or_abort vendor "${IMAGES_DIR}/super_vendor.img"
    flash_image_a_erase_b_or_abort product "${IMAGES_DIR}/super_product.img"
    "${FASTBOOT_BIN}" -s "${ANDROID_SERIAL}" --set-active=a

I’ve uploaded a new release:

This one should be able to decrypt FPOS, LOS and /e/.

Thanks again @AnotherElk and @d2w for testing.

11 Likes

Thanks for still spending time on this, much appreciated.
It’s great to see decryption working again at least as long as /e/OS still didn’t make the jump to Android 13.

1 Like

@k4y0z
Works like a charm :slight_smile:
Thank you very much!!!
(I’m using /e/OS: IMG-e-1.12.3-s-20230616300623-dev-FP3.zip)

You’re the official TWRP FP3 maintainer?

So will there be an official TWRP Android-12 FP3 build?
Would be great :slight_smile:
So this issue could be closed.

2 Likes

I wasn’t able to permanently flash this image. When I tried the “Flash Current TWRP” option it complained that ramdisk files have been modified, and when I tried “Install Recovery Ramdisk” it caused a bootloop.

The bootloop was similar to the one caused by Magisk not working with Fairphone’s retrofitted partitions before it was patched (see history of this topic). Apparently TWRP uses magiskboot for both operations, could it be that the version it uses is outdated and as such still has that issue?