[Xperia Z5 Compact General] NeoBeum:
E5803/E5823

Android Nougat 7.1.2+ Bootable Recovery

(TWRP) Android Bootable Recovery v3.1.1-0

NB:14OCT17 - I will be rebuilding the base Recovery Image, as it was using a mix of 7.1.2 for Omnirom and TWRP, and 7.1.1 r17, while I'm still technically ahead of the Sony AOSP, they are now using 7.1.1 r55

13 OCTOBER 2017

Step 1 - Get correct files

Step 2 - Read & know to use exact same process, without going back to Lollipop to relock the bootloader.

Step 3 - Flash correct recovery to recovery partition 'fastboot flash recovery CRC#######v-###.img'

A OR B, NOT BOTH

Step 4a - Rootkernel the 324A0160Kernel Elf and patch it for DM Verity & Sony RIC Disable, and 'Fastboot flash boot 324A0160KernelElf.img'

Step 4b - Rootkernel the 324A154 Kernel Elf and patch it for DM Verity & Sony RIC Disable, and 'Fastboot flash boot 324A154KernelElf.img'

Step 5 - Install Magisk v14 via TWRP Recovery.

Done.

See you all next Patch

13OCTOBER2017

Recovery Build v2.1.54 is complete for FTF 32.4.A.1.54 - currently untested by me, but should be ok - I'll be testing 2 versions, there'll be another coming up in a few days - it's related to Device Encryption & Location for Blocks. This version is basically the updated recovery build, with all the same settings, but correct partitions. The next release will test the Device Encryption Location, from /dev/block/data (what it is currently), to /dev/block/dm-0

I'll be testing Flashing and Installing of Magisk with both of my devices and using different methods to test flexibility in capturing the boot image and hash.

Got other things to do currently and my laptop is still in bits and pieces - this was just done to get something out of the way and working.

There's new partitions you should be able to see in Recovery, in addition to the extra ones I had originally.

The 'Misc' partition from Lollipop is back, and FOTAKernel has been renamed to 'recovery'. Everything else is labelled overthetop style.

Back everything up. Once you get a good recovery and successful restore, then you can skimp out and just backup the 'userdata' partition which is now called 'data'..

Expect another update if Sony are nice, and decide to patch the Bluetooth security flaws... While I was building, the bluetooth directories compiled with no errors - and I was getting most faults with QCOM stuff because I had quad and tri merges happening (just the way I set up my mirrors)- but it means that Bluetooth wasn't really touched . CVE-2017-0781 ... CVE-2017-0785.

I could be wrong, and patches could have been included.

Initial Tests:

Installing Magisk.zip in Recovery without disabling Sony RIC or DM Verity will cause the device to become unstable.

Currently - it's looking like a similar process to lock boot loader, for clean install, and patch of boot image to disable RIC and Verity.

I have access to all functions in TWRP and have done a successful restore and backup.

CRCD0FF4662-recovery-v2.1.54.img is attached to the post.

====================​

Device Targets

FTF 32.4.A.0.160 ONLY

CRC81D43A45-recovery-v1.1

Magisk: v14.0

Magisk Manager: v5.3.0

====================

====================​

Device Targets

FTF 32.4.A.1.54 ONLY - Magisk Requires RIC & Verity Disabled Prior to Installing in Recovery

CRCD0FF4662-recovery-v2.1.54

Magisk: v14.0

Magisk Manager: v5.3.0

====================​

12OCTOBER2017

Don't go updating to 32.4.A.1.54 and trying to use the recovery here... much breakage... much change... (actually - the changes I saw I actually added a while ago in FSTAB which is probably why things weren't breaking compared to other recovery with Magisk.... busy making the recovery at the moment but the repo has shifted things so I'll do it over the weekend because I'm busy doing Windows PE programming) Recap. Don't upgrade to 32.4.A.1.54 and use this recovery -- read the rainbow colour device targets above... don't mix and match

13OCT2017: Recovery is compiling for 32.4.A.1.54 ... I screwed up my laptop and I accidentally Raided my storage drive, so my build disk is not on a SSD.. it should be done in an hour or so

MINI ANNOUNCEMENT: 04 OCTOBER 2017

NOTE: Decryption may fail during boot to recovery - currently investigating - Reinstallation of Magisk or Google FOTA Updates may trigger a crash and password properties may be lost somewhere

MINI ANNOUNCEMENT: 26 SEPTEMBER 2017

Device and SD Card Encryption is fully functional.

CURRENT ANNOUNCEMENT: 8 SEPTEMBER 2017

Magisk Manager 5.3.0 and Magisk v14.0 is out.

New feature for Magisk Manager Hide and Unhide.

Load for this is different to previous.

Use Magisk 5.1.1 In-App Auto Download and Install zip package v14.0

Take a Backup beforehand.

The intrinsic nature will make future ad-lib/on the go Root/CTS pass more complex, but perhaps easier to Complete Uninstall in Recovery, Reboot Cycle, and Install v14.0 in Recovery - with less errors to previous versions. (I haven't completely zeroed all errors on my other device that I purposely broke beyond broken.. doing some extreme hide/unhide testing).

Leaving APK 5.1.1 attached for users to leapfrog

Here's a sample of the broken device getting back to Root Access + CTS

PREVIOUS ANNOUNCEMENT LOG

ANNOUNCEMENT: 28 JULY 2017

Added temperature example in TWRP.

CTS Pass. All MMC blocks are R/W. may cause bugs - to revert permissions, Magisk Manager must set "Mount namespace mode":

All root sessions use the global mount namespace

Following the procedure with Magisk Manager 4.3.3 and Magisk v12.0 installed:

Install 5.1.1 APK.

Launch Magisk Manager and accept 13.3 download and install.

[YOUTUBE]qVv0lM4cXHM[/YOUTUBE][YOUTUBE]Cs3dNQCZj2w[/YOUTUBE]

Users experiencing problems with adaptive brightness must use Magisk hide for com.qualcomm.cabl, and an example of temperature difference with Global R/W on eMMC blocks

ANNOUNCEMENT: 13 JULY 2017 Regarding Magisk eMMC Global R/W changes to v13.1

Magisk Manager 5.0.4 is able to be installed via APK attachment & Magisk v12.0 Only with 81D43A45-recovery-v1.1

I'm working on getting v13.1+(E5823) on to the device without problems. Further reading may be done further in the thread regarding the issue below.

One of the distinct behaviours; Qualcomm Adaptive Brightness - sensitivity & lag - The gradient isn't smooth as it should be, and is erratic (AND EXCESSIVE HEAT)

This is a preview for the short debrief - and there are video examples to view. Read more here: https://xdaforums.com/z5-compact/general/recovery-nougat-7-0-android-bootable-t3609358/post73005789

[YOUTUBE]SV1VGElE8eg[/YOUTUBE] [YOUTUBE]f6mYk6cLNao[/YOUTUBE]

====================​

PREVIOUS ANNOUNCEMENT LOG

17 JULY 2017

CTS Failure. All versions

There's some changes to NFC stack that I'll be adding later this week

ANNOUNCEMENT: 11 JULY 2017 - 20:00 ACST UTC+09:30

Do not flash or install Magisk 13.1 - Manager 5.0.4

I noticed my device acting strange - so I ran through everything on my phone - and I'm retracting the announcement earlier as a recommendation.

I'll try and iron out what exactly is at fault - but for now - just stay at

MagiskSU 12.0 and MManager 4.4.3

Appologies to anyone who managed to get 5.0.4 working.

I might head over to the Magisk thread and see if there are any others encountering the problems I see.

I'm going to leave the APK and previous annoucement recorded, for users who aren't bothered by things not really being exactly as they should be.

NB: I found exactly what I was looking for written in the Change Log, after I briefly skimmed through 10 pages of problems today @ the Magisk Board.

This will cause conflicts for future changes in TWRP and Sony Firmware - so it's up to you, how you proceed - but the result will be a repeat of Marshmallow to Nougat problems.

One of the distinct behaviours; Qualcomm Adaptive Brightness - sensitivity & lag - The gradient isn't smooth as it should be, and is erratic

Device heat

Security & Play Services background updates - sometimes causes the phone to suddenly reboot

WLAN/BT/NFC - RFCOMM - UID errors

Possible errors during restore and backup function in TWRP - possible that file permissions and attributes are or aren't transferred inheritance R/W

ANNOUNCEMENT - 08 JULY 2017

Sony made some changes to Init and Sec Pol for Audio. Now included in build CRC81D43A45-recovery-v1.1

If you've already followed this guide to flash v1.0, there's no need to repeat everything - just use:

fastboot flash recovery recovery.img

I've also started on the Omnirom port, so my GitHub will be updated soon.

ANNOUNCEMENT - 11 JULY 2017 - See also 08JUL17 Announcement

Magisk 13.1 is out - with Manager 5.0.4.

[IMG="NB"]http://i.imgur.com/roqQRA5m.png[/IMG]

For experienced users, you can manually update. APK attached. Turn off core mode, and hide and modules before install. I don't use modules, but that's probably the best option.

I will update guide soon. If you don't upgrade correctly, you will lose CTS and Root. I did this live, without a PC.

NB: I've now done both of my devices, and can confirm that an improper installation by Initiating the 13.1 Install from within Magisk Manager 4.3.3 will cause overheating. Modules and Core Only must be unloaded and Off, and APK installation must be done first after confirming modules are disabled. 13.1 zip file may then be installed in Recovery, to update SU binary, and Installation from inside Manager 5.0.4 needs to be initiated and will require 2 powercycles to load in to Magisk Hide with Core Only Disabled, for CTS Pass.

Update 4/7/2016 - Happy 4th of July to the Yanks... Here's a present from Down Under.

TWRP 3.1.1 on Android 7.1.1 Firmware 32.4.A.0.160 - I'm using the source for Android 7.1.2 R17

I'll update the build later this week and upload an image - as I'm cleaning up the process and making sure everything is working properly. I started again from scratch on 32.0.A.6.200 going all the way to 32.4.A.0.160. My GitHub doesn't have the source at the moment, because I'm rebuilding my Build Environment, so I can switch between Omnirom and AOSP using the same Repo. I'm just working out the best way to sync without fetch errors.

====================

______________________________

Users on Android Nougat 7.0 (32.3.A.X.XXX)

Upgrading to 7.1.1 will cause you to lose root if you have FOTA-Kernel Recovery and flash 32.4.A.0.160 and exclude FOTA Kernel in Flashtool

This has now been tested on both of my Devices.

______________________________​

REQUIREMENTS:

Flashtool

IOVYroot

Rootkernel

Recovery Image - Find Attachment CRC32 81D43A45 for 32.4.A.0.160 Find Attachment CRC32 D0FF4662 for 32.4.A.1.54

TA Image

Bootloader Unlock Code

USER INSTRUCTIONS

Downgrading to 32.0.A.6.200 to restore keys and lock bootloader

Ensure that you have signed out of any Google Accounts prior to flashing to prevent a Reset Lock

Use Flashtool to downgrade to Android 5.1.1 Lollipop

Use IOVYroot to backup or restore your TA Partition

[IMG="N"]https://i.imgur.com/gmBSI9Z.png[/IMG]

If you previously have lost your original Device Keys, you may be able to use Rootkernel to patch a DRM fix on the 32.0.A.6.200 Kernel.ELF, and then have IOVYroot backup the key

Enable USB Debugging in Developers Options and connect your device to the PC

Use IOVYroot to restore the TA to your device and there will be a message to flash stock firmware

[IMG="N"]https://i.imgur.com/bdAHY01.png[/IMG]

Restart the device as there is no need to flash again and confirm that the device keys are restored

Preparing to flash 32.4.A.0.160

Before starting the Flash process, navigate to the 'prepared' directory in Flashtool's firmware directories and find copy 'kernel.sin' to the Rootkernel directory

[IMG="N"]https://i.imgur.com/xXmHYmX.png[/IMG]

Use Flashtool's 'Sin Editor' found in the 'Tools' to extract a 'kernel.elf' from 'kernel.sin'

Use Rootkernel to create a DRM fix patched Boot image

[IMG="N"]https://i.imgur.com/zLvS3qu.png[/IMG]

Flashing 32.4.A.0.160

​

[IMG="N"]https://i.imgur.com/uWBnMFJ.png[/IMG]

Flash Android Nougat 7.1.1 and boot the device and confirm that DRM keys are present

Enable Developers Option and Enable 'Enable OEM Unlock' then turn off the device

[IMG="N"]https://i.imgur.com/mMzMCEh.png[/IMG] [IMG="N"]https://i.imgur.com/CmfoscX.png[/IMG]

Connect the device to the PC and prepare the Bootloader unlock

Unlocking 7.1.1 Bootloader, Catching the Device Key & Flashing the Recovery

Confirm that device is in USB Debugging Mode

Then send the reboot command via 'adb reboot-bootloader'

fastboot flash boot 'patched-kernel.img'

fastboot flash recovery 'fotakernel-recovery.img'

[IMG="N"]https://i.imgur.com/yfa5b0H.png[/IMG]

Disconnect the device and do not power on

Use Flashtool to flash your Device Key

[IMG="N7"]http://i.imgur.com/hULZB8W.png[/IMG]

Once done, Power On

Andy the Android should briefly display with his guts spilled open upgrading himself (If he doesn't something isn't right)

Complete the Android Welcome Setup

Congratulations

Recovery instructions below.

Flash Magisk v12.0 zip with Sony Fix, in TWRP Recovery

Flash or install using current announcement instructions, or your own preferred Superuser App

[IMG="7.1.1"]https://i.imgur.com/rMRhXZs.png[/IMG] [IMG="7.1.1"]https://i.imgur.com/Y6xR2ds.png[/IMG] [IMG="7.1.1"]https://i.imgur.com/D73VzJv.png[/IMG] [IMG="7.1.1"]https://i.imgur.com/qkaQ778.png[/IMG] [IMG="7.1.1"]https://i.imgur.com/bTSKuo4.png[/IMG] [IMG="7.1.1"]https://i.imgur.com/lMkqgTd.png[/IMG]

====================​

XpeRicoverE5823 History

The Original Project intended to have the Z5 Compact an official device tree for TWRP. This project is still on going as the completed AOSP Recovery is currently not supported by Team Win as there is no room for new devices using AOSP build base on the Gerrit Build Server. As a result, the project has two branches; OmniROM and AOSP. Assuming everything runs smoothly, these projects using Android Bootable Recovery source, should almost be "plug and play" with source of other ROM, so if time permits, I'll get the LineageOS Build environment and build the recovery image.

https://github.com/NeoBeum/android_device_sony_suzuran

====================​

TWRP AOSP Recovery

Recovery Source:

Device Tree: Prototype Completed

Recovery Build:

Recovery Image Upload:

Target Kernel: LA.1.2.3_45, 3.10.84 - Sony Stock 32.4.A.0.160

Flash Instructions for device:

fastboot flash recovery recovery.img

Entry: Power + Volume Down (Until vibration) after 10 seconds, Magenta LED indicates recovery boot process.

Additional notes:

Previous Builds:

CRC665582E7-Recovery-v1.0.zip - [Click for QR Code] (14.18 MB, 104 views) - v1.1 @08JUL2017

Stock AOSP Recovery

Recovery Source:

Recovery Build: Complete

Recovery Image Upload:

Target Kernel: LA.BR.1.3.3_rb2.14

OmniROM Recovery

Recovery Source:

Recovery Build: In Progress

Recovery Image Upload: N/A

Target Kernel: OmniROM 7.1

Time Permits

LineageOS Recovery

Recovery Source: N/A

Recovery Build: Planning Stage/Not Started

Recovery Image Upload: N/A

Target Kernel: LineageOS 7.X.X

====================​

ORIGINAL POST

Android Bootable Recovery (TWRP) 3.1.1-0

The TWRP port and device tree is almost done.

Just got it working after about 16 hours straight of trying to get bionic to spew out overflow.

[IMG="First Pass"]http://i.imgur.com/7Fej4jZm.png[/IMG] [IMG="First Pass Boot"]http://i.imgur.com/EyolLYxm.png[/IMG]

[IMG="Second Pass Recovery & Patch"]http://i.imgur.com/FQfbSwGm.png[/IMG] [IMG="Second Pass in to Recovery and Patch"]http://i.imgur.com/SBK6xLBm.png[/IMG]

[IMG="Nougat"]http://i.imgur.com/p3VTFxGm.png[/IMG] [IMG="Nougat"]http://i.imgur.com/Ohf49IWm.png[/IMG]

The short and sweet guide is:

Get the Recovery Image and Fastboot flash to Recovery

Have your TA-Partition.img or DK.ftf

Flash 32.3.A.2.33 with Flashtool and Select All for Wipe, and Exclude FOTA Partition

Boot to recovery, Zip install Magisk 12.0

Power Cycle for the default Freakout-Google-Recovery-Refresh

Fastboot flash PatchKernel.img to Boot

Boot to recovery, Restore TA partition from image.

If you have your original DRM Key, I have the TA partition backup to restore the DRM Key once the Kernel gets patched.

You'll still need the TA if you want complete key signature - but the patch will still fix DRM loss when you initially flash TWRP to the recovery partition. (Because that action requires an unlocked bootloader)

I'll post a guide up soon, I'm just off for errands.

Once I fix up the device tree, and TeamWin's gerrit recovers from it's heartattack, you will be using all your own resources to do this, and won't need a prebuilt recovery. You can use your own stock kernel extracted with Flashtool. Everything should run smoothly because of less handover with prebuilt images and have the DRM fix patch the kernel that you actually have, and not for some other region..