FORUMS
Remove All Ads from XDA

[KERNEL][MOD] Sony Stock Patcher for Xperia X Performance

2,161 posts
Thanks Meter: 12,646
 
By AdrianDC, Recognized Developer on 29th December 2016, 11:11 AM
Post Reply Email Thread
Code:
#include <std_disclaimer.h>
/*
 * Your warranty is now void.
 *
 * I am not responsible for bricked devices, dead SD cards,
 * thermonuclear war, or you getting fired because the alarm app failed. Please
 * do some research if you have any concerns about features included in this ROM
 * before flashing it! YOU are choosing to make these modifications, and if
 * you point the finger at me for messing up your device, I will laugh at you.
 */


About the project
Sony Stock Patcher is a minimal and easy transition from Sony's Stock ROM
(flashed directly from an FTF for example) to a modifiable ROM that can be modded as you like.

Built out of my evolutions of libbootimg for MultiROM to support Sony ELF bootimages,
a custom modified kernel based on Sony's copyleft with a minimal set of needed custom changes,
and an automated installation process to patch completely a Stock ROM,
this will allow you to use the Stock ROMs as you wish to.

Relevant features of Sony Stock Patcher
  • Using my Sony ELF 64bits port to libbootimg, Stock boot partition is automatically converted
  • Modified copyleft Stock kernel to support alterations and remove limitations
  • Patches the ramdisk to disable automatically Sony RIC security
  • Patches the fstab automatically for verity
  • Injects my init_sony project used on Sony custom ROM projects
  • Supports making the ROM usable as secondary MultiROM

List of changes made to the kernel
  • Disable Selinux trap security (allows to boot with stock ramdisk sepolicies)
  • Disable Device-Mapper verity (needed for example to patch system partitions)
  • Disable kernel modules forced validation (avoids failures on modules signature)
  • Disable coresight (unneeeded and irrelevant, just to avoid unsupported error logs)
  • Disable Sony RIC security (needed to use a recovery and alter /system, /data, ...)
  • Inline kernel modules compilation (to avoid kernel installation fragmentation)
  • Clearpad touchscreen updates for MultiROM UI
  • Minor kernel updates

Installation
  • Needed: Device has to be with an Unlocked Bootloader
  • Use Stock ROM or flash a clean FTF ROM from Nougat or Marshmallow
  • Needs a working TWRP flashed into the FOTA partition (fastboot flash recovery...)
    > Fully working TWRP builds : https://mega.nz/#F!DtsERIzb!OFINTFpTQ6CF85alkcIpgA
  • Boot to TWRP (Power and Volume -)
  • Flash the relevant sony_stock_xperformance_patcher: n for 7.x or m for 6.0
  • (Optional) Flash SuperSU by Chainfire if you want to have root access
  • Reboot to Android

Reasons to use this project ?
  • Unlocked Bootloader customizations allowed on Stock
  • Converts the bootimage to support systemless tools
  • Ability to root with tools like SuperSU
  • Retains the original Sony bootimage files
  • Minimal needed changes, no additional kernel mods

Downloads (Unlocked Bootloader only)
Xperia X Performance : https://mega.nz/#F!ClMRQZaT!vY2aFhVHlGqnqkgJZyDOrQ
Downloads mirror : https://basketbuild.com/devs/AdrianDC

Source code
Kernel sources - https://github.com/AdrianDC/kernel-sony-copyleft (branch 41.2.A.7.xxx)
libbootimg sources - https://github.com/AdrianDC/multirom_libbootimg (branch master)
init_sony sources - https://github.com/AdrianDC/device-sony-common-init (branch master)
MultiROM sources - https://github.com/AdrianDC/multirom_core (branch master)
TWRP sources - https://github.com/AdrianDC/twrp_dev...vice_sony_dora (branch device_sony_dora)

Sony Stock Patcher for Xperia X Performance created also thanks to :
- Sony for their original copyleft kernel sources
- Tasssadar for the original libbootimg / MultiROM sources
- The XperiaMultiROM team for our evolution of MultiROM
- Everyone involved in testing it

XDA:DevDB Information
Sony Stock Patcher for Xperia X Performance, Kernel for the Sony Xperia X Performance

Contributors
Adrian DC
Source Code: https://github.com/AdrianDC/kernel-sony-copyleft

Kernel Special Features:

Version Information
Status: No Longer Updated

Created 2016-12-29
Last Updated 2019-08-06
The Following 13 Users Say Thank You to AdrianDC For This Useful Post: [ View ]
 
 
29th December 2016, 11:11 AM |#2  
AdrianDC's Avatar
OP Recognized Developer
Flag Île-de-France
Thanks Meter: 12,646
 
More
Reserved
Changelog
Code:
Sony Stock Patcher for X Performance - 08/09/2018
=================================================
* Upgrade to Oreo 8.0.0 41.3.A.2.149/157 (o_v6.2.157)

Sony Stock Patcher for X Performance - 19/05/2018
=================================================
* Upgrade to Oreo 8.0.0 41.3.A.2.128 (o_v5.2.128)

Sony Stock Patcher for X Performance - 24/03/2018
=================================================
* Upgrade to Oreo 8.0.0 41.3.A.2.99 (o_v4.2.99)

Sony Stock Patcher for X Performance - 12/03/2018
=================================================
* Upgrade to Oreo 8.0.0 41.3.A.2.75 (o_v3.2.75)

Sony Stock Patcher for X Performance - 25/12/2017
=================================================
* Upgrade to Oreo 8.0.0 41.3.A.2.24 (o_v2.2.24)

Sony Stock Patcher for X Performance - 17/12/2017
=================================================
* Upgrade to Oreo 8.0.0 41.3.A.0.401 (o_v1.0.401)

Sony Stock Patcher for X Performance - 26/11/2017
=================================================
* Upgrade to Nougat 7.1.1 41.2.A.7.76 (n_v12.7.76)

Sony Stock Patcher for X Performance - 25/09/2017
=================================================
* Upgrade to Nougat 7.1.1 41.2.A.7.65 (n_v11.7.65)

Sony Stock Patcher for X Performance - 19/08/2017
=================================================
* Upgrade to Nougat 7.1.1 41.2.A.7.53 (n_v10.7.53)

Sony Stock Patcher for X Performance - 16/07/2017
=================================================
* Upgrade to Nougat 7.1.1 41.2.A.7.35 (n_v9.7.35)

Sony Stock Patcher for X Performance - 08/06/2017
=================================================
* Upgrade to Nougat 7.1.1 41.2.A.7.8 (n_v8.7.8)

Sony Stock Patcher for X Performance - 21/05/2017
=================================================
* Upgrade to Nougat 7.1.1 41.2.A.2.223 (n_v7.223)

Sony Stock Patcher for X Performance - 26/04/2017
=================================================
* Upgrade to Nougat 7.1.1 41.2.A.2.199 (n_v6.199)

Sony Stock Patcher for X Performance - 16/03/2017
=================================================
* Upgrade to Nougat 7.0 39.2.A.0.442 (n_v5.442)

Sony Stock Patcher for X Performance - 04/02/2017
=================================================
* Upgrade to Nougat 7.0 39.2.A.0.417 (n_v4.417)

Sony Stock Patcher for X Performance - 13/01/2017
=================================================
* Minor fix for enforcing SELinux (n_v3.361, m_v3.297)

Sony Stock Patcher for X Performance - 08/01/2017
=================================================
* Remove permissive for Stock 7.0 (n_v2.361, 39.2.A.0.361)
* Remove permissive for Stock 6.0, to fix WiFi (m_v2.297, 35.0.A.1.297)

Sony Stock Patcher for X Performance - 29/12/2016
=================================================
* Initial release for Stock 7.0 (n_v1, 39.2.A.0.361)
* Initial release for Stock 6.0 (m_v1, 35.0.A.1.297)
The Following 6 Users Say Thank You to AdrianDC For This Useful Post: [ View ]
5th January 2017, 01:55 PM |#3  
serajr's Avatar
Recognized Developer / Recognized Themer
Flag Rafard - SP
Thanks Meter: 18,563
 
Donate to Me
More
@Adrian DC Congrats buddy!!
This is absolutely amazing. Confirmed that it is working on my XP with stock MM firmware (35.0.A.1.297).

I need to say that I was afraid of losing all my data due "encryptable" flag, but they were preserved.
Recovery working flawlessly on both ways to enter on it (combo-keys with device turned off, or normal boot with volume + key press).

But I have a question regarding whole process, is Permissive mandatory (# Inject the permissive cmdline)?
Edit.: It looks like it is, but Permissive does break device's wifi connectivity (and maybe other things)!! Is there a way to set Permissive only if we choose to boot up into recovery?

Also, I'm creating a script to do the same! Gonna try it out.
Edit 2: Done, script is working like a charm!
The Following User Says Thank You to serajr For This Useful Post: [ View ]
8th January 2017, 12:17 AM |#4  
AdrianDC's Avatar
OP Recognized Developer
Flag Île-de-France
Thanks Meter: 12,646
 
More
Quote:
Originally Posted by serajr

@Adrian DC Congrats buddy!!
This is absolutely amazing. Confirmed that it is working on my XP with stock MM firmware (35.0.A.1.297).

Thanks, glad it works fine for you too


Quote:
Originally Posted by serajr

But I have a question regarding whole process, is Permissive mandatory (# Inject the permissive cmdline)?
Edit.: It looks like it is, but Permissive does break device's wifi connectivity (and maybe other things)!! Is there a way to set Permissive only if we choose to boot up into recovery?

Nice catch, I had forgotten I had an issue 2 months ago on M with WiFi not working entirely,
and it's not an issue that can be found on Nougat so left it aside for the time.

It is indeed related to permissive, and with the recent changes I made for the Nougat support,
permissive is actually totally useless, therefore I made a new release for both M / N with updated kernel & no permissive changes.

Tested both situations with Stock M and Stock N, all works fine.
The Following 4 Users Say Thank You to AdrianDC For This Useful Post: [ View ]
8th January 2017, 03:07 PM |#5  
serajr's Avatar
Recognized Developer / Recognized Themer
Flag Rafard - SP
Thanks Meter: 18,563
 
Donate to Me
More
Quote:
Originally Posted by Adrian DC

Nice catch, I had forgotten I had an issue 2 months ago on M with WiFi not working entirely,
and it's not an issue that can be found on Nougat so left it aside for the time.

It is indeed related to permissive, and with the recent changes I made for the Nougat support,
permissive is actually totally useless, therefore I made a new release for both M / N with updated kernel & no permissive changes.

Tested both situations with Stock M and Stock N, all works fine.

Thank you so much Adrian... everyting are working now. You're the one!
Just one thing, getenforce returns Permissive (yet)! Not a problem for me at all, but is that right?

I'm still on MM due development of my xposed framework modules.
The Following User Says Thank You to serajr For This Useful Post: [ View ]
8th January 2017, 03:29 PM |#6  
AdrianDC's Avatar
OP Recognized Developer
Flag Île-de-France
Thanks Meter: 12,646
 
More
Quote:
Originally Posted by serajr

Thank you so much Adrian... everyting are working now. You're the one!
Just one thing, getenforce returns Permissive (yet)! Not a problem for me at all, but is that right?

I'm still on MM due development of my xposed framework modules.

Thanks.
You patched the v2 on top of v1 ?

I don't share full boot or ramdisk, I modify them, hence better compatibility & less invasive changes,
and the permissive part is no longer touched, hence if you patched it, the kernel cmdline just stayed as it was.

If you want to, just reflash the boot from ftf (Kernel only listed), then reflash the v2.
You can also edit the bootimage with regular tools now that it's converted away from ELF.
And I could also upload you my N & M bootimages flasher if you need, let me know.
The Following 2 Users Say Thank You to AdrianDC For This Useful Post: [ View ]
8th January 2017, 08:01 PM |#7  
serajr's Avatar
Recognized Developer / Recognized Themer
Flag Rafard - SP
Thanks Meter: 18,563
 
Donate to Me
More
Quote:
Originally Posted by Adrian DC

Thanks.
You patched the v2 on top of v1 ?

I don't share full boot or ramdisk, I modify them, hence better compatibility & less invasive changes,
and the permissive part is no longer touched, hence if you patched it, the kernel cmdline just stayed as it was.

If you want to, just reflash the boot from ftf (Kernel only listed), then reflash the v2.
You can also edit the bootimage with regular tools now that it's converted away from ELF.
And I could also upload you my N & M bootimages flasher if you need, let me know.

No, I didn't! It is somewhere at v2. Weird!!
And now I did it this way:
- Flashed modified stock kernel (tobias.waldvogel's tool: dm-verity, ric, drmfix, and busybox) - Reboot >> Enforcing
- Flashed latest SuperSU - Reboot >> Enforcing
- Flashed modified Sony Stock Patcher v2 (sony_stock_patcher.sh: removed dm-verity and ric related lines) - Reboot >> Permissive
13th January 2017, 06:42 AM |#8  
Senior Member
Thanks Meter: 626
 
More
Quote:
Originally Posted by serajr

No, I didn't! It is somewhere at v2. Weird!!
And now I did it this way:
- Flashed modified stock kernel (tobias.waldvogel's tool: dm-verity, ric, drmfix, and busybox) - Reboot >> Enforcing
- Flashed latest SuperSU - Reboot >> Enforcing
- Flashed modified Sony Stock Patcher v2 (sony_stock_patcher.sh: removed dm-verity and ric related lines) - Reboot >> Permissive

Nice job.
working well with stock
V2 is working with latest kernel
Thank you
Keep updating
The Following User Says Thank You to karrouma For This Useful Post: [ View ] Gift karrouma Ad-Free
13th January 2017, 01:58 PM |#9  
AdrianDC's Avatar
OP Recognized Developer
Flag Île-de-France
Thanks Meter: 12,646
 
More
Quote:
Originally Posted by serajr

No, I didn't! It is somewhere at v2. Weird!!
And now I did it this way:
- Flashed modified stock kernel (tobias.waldvogel's tool: dm-verity, ric, drmfix, and busybox) - Reboot >> Enforcing
- Flashed latest SuperSU - Reboot >> Enforcing
- Flashed modified Sony Stock Patcher v2 (sony_stock_patcher.sh: removed dm-verity and ric related lines) - Reboot >> Permissive

Minor update v3, removed a remaining kernel commit that allowed to override the enforcing/permissive status,
in some situations it can cause the permissive status even if not wished, you might be fine now.
Works fine on mine (Enforcing, running 7.0 from my MicroSD & no issue so far).

v2 removed as it almost identical to v3 with this minor removal.
The Following 5 Users Say Thank You to AdrianDC For This Useful Post: [ View ]
14th January 2017, 10:46 AM |#10  
Senior Member
Thanks Meter: 626
 
More
Thank you working good with xz
14th January 2017, 10:49 AM |#11  
AdrianDC's Avatar
OP Recognized Developer
Flag Île-de-France
Thanks Meter: 12,646
 
More
Quote:
Originally Posted by karrouma

Thank you working good with xz

Do you mean you're using this directly on an Xperia XZ ? Or used my zip installer & a modified kernel ?
I could apply my patcher on XZ 39.0.A.1.xxx if you're interested and release it after validated test like this thread.
The Following 2 Users Say Thank You to AdrianDC For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes