FORUMS
Remove All Ads from XDA

[KERNEL][MOD] Sony Stock Patcher for Xperia XZ

2,158 posts
Thanks Meter: 12,544
 
By AdrianDC, Recognized Developer on 21st March 2017, 03:44 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
  • Needs a working TWRP flashed into the FOTA partition (fastboot flash recovery...)
    > Fully working TWRP builds : See below with downloads
  • Boot to TWRP (Power and Volume -)
  • Flash the relevant sony_stock_xz_patcher: n for 7.x
  • (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 XZ : https://mega.nz/#F!K8kUDSaD!LNVmLKHANgwYPuc-aFO-Mg
Downloads mirror : https://basketbuild.com/devs/AdrianDC

Personal TWRP releases
TWRP 3.x.x : https://mega.nz/#F!bg9QhDzC!TTkhy2Fi6cNTZ1ojlmobRQ
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...ce_sony_kagura (branch device_sony_kagura)

Sony Stock Patcher for Xperia XZ 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 XZ, Kernel for the Sony Xperia XZ

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

Kernel Special Features:

Version Information
Status: No Longer Updated

Created 2017-03-21
Last Updated 2019-08-06
The Following 30 Users Say Thank You to AdrianDC For This Useful Post: [ View ]
 
 
21st March 2017, 03:44 AM |#2  
AdrianDC's Avatar
OP Recognized Developer
Flag Île-de-France
Thanks Meter: 12,544
 
More
Reserved
Changelog
Code:
Sony Stock Patcher for XZ - 08/09/2018
=================================================
* Upgrade to Oreo 8.0.0 41.3.A.2.149/157 (o_v6.2.157)

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

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

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

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

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

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

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

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

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

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

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

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

Sony Stock Patcher for XZ - 21/03/2017
=================================================
* Initial release for Stock 7.0 (n_v1, 39.2.A.0.442)
* Based on my initial releases for Xperia X Performance
The Following 12 Users Say Thank You to AdrianDC For This Useful Post: [ View ]
21st March 2017, 11:29 PM |#3  
Senior Member
Flag Nuremberg
Thanks Meter: 608
 
More
I've already tested this patcher and can confirm, it works like a charm

My steps:

- Flashed the current 442 ftf via FlashTool (ejected the ext sd after poweroff, ofc), checked every checkbox in the wipe sector (don't know, if that's really neccessary).
- rebooted into system to check, if it boots fine, then power off again
- installed Adrian's current TWRP 3.1.0 via fastboot command (fastboot flash recovery <name of the recovery>.img)
- boot into recovery (<power> + <vol-> together until one time vibration, then left <power>)
- flashing the provided patcher.zip via TWRP and reboot, then - after booting - choose reboot
- now wait until vibration and the purple led, then push <vol+> => now you have to be in TWRP
- flash the SuperSU.zip, if you want root
- if you want also the drm fix:
Connect your device via usb and type:
# adb -d shell
# su
# dd if=/dev/block/bootdevice/by-name/boot of=/sdcard/kernel.img

Then pull the kernel.img from /sdcard/kernel.img and go on with the unofficial rootkernel 5.23 @serajr I said yes to everything but SuperSU, TWRP and busybox (but test it by your own, it's not related to this thread). Btw, if you've managed to backup your ta before unlocking your bootloader, you can also use the PoC @munjeni for that (I unfortunately can't, because I don't have such a ta backup). But no mor ot here

I can confirm, it works like a charm - and it's like in mm times: you don't have to poweroff your device; just wait for the purple led and push <vol+> = enter TWRP

Thank's @AdrianDC for your brilliant job
The Following 6 Users Say Thank You to Klaus N. For This Useful Post: [ View ] Gift Klaus N. Ad-Free
24th March 2017, 02:31 AM |#4  
serajr's Avatar
Recognized Developer / Recognized Themer
Flag Rafard - SP
Thanks Meter: 18,549
 
Donate to Me
More
You have just made the news!
@AdrianDC Congrats
The Following 2 Users Say Thank You to serajr For This Useful Post: [ View ]
24th March 2017, 02:31 AM |#5  
serajr's Avatar
Recognized Developer / Recognized Themer
Flag Rafard - SP
Thanks Meter: 18,549
 
Donate to Me
More
...
24th March 2017, 08:02 AM |#6  
Ryuu.'s Avatar
Member
Flag Pekanbaru
Thanks Meter: 20
 
More
So it's works for both XZ (F8331 and F8332)?
24th March 2017, 08:13 PM |#7  
Senior Member
Flag Nuremberg
Thanks Meter: 608
 
More
Quote:
Originally Posted by Ryuu.

So it's works for both XZ (F8331 and F8332)?

Just try it and report back! Create a backup of your boot partition via TWRP before, of course
26th March 2017, 01:15 PM |#8  
Soheil_rf's Avatar
Senior Member
Flag Tehran
Thanks Meter: 1,007
 
More
@AdrianDC
Thanks for your work
TWRP 3.10 works perfect on F8332 XZ Dual

I installed Stock Patcher on my patched kernel with PoC for load Kcal Module from here
after load kcal module got reboot and that module cant be loaded , any Help ?
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20170326-164850.png
Views:	1150
Size:	106.9 KB
ID:	4089296  
The Following User Says Thank You to Soheil_rf For This Useful Post: [ View ] Gift Soheil_rf Ad-Free
26th March 2017, 01:42 PM |#9  
paulle's Avatar
Senior Member
Thanks Meter: 274
 
More
@ AdrianDC
Thanks for your work
TWRP 3.10 works perfect on F8331 XZ
The Following 2 Users Say Thank You to paulle For This Useful Post: [ View ] Gift paulle Ad-Free
28th March 2017, 12:28 AM |#10  
RomanSkyline's Avatar
Senior Member
Thanks Meter: 16
 
More
Can you make a Overcloked and Undervolted version? Thanks

Enviado desde mi F8331 mediante Tapatalk
28th March 2017, 06:30 AM |#11  
Senior Member
Flag Nuremberg
Thanks Meter: 608
 
More
Quote:
Originally Posted by RomanSkyline

Can you make a Overcloked and Undervolted version? Thanks

Enviado desde mi F8331 mediante Tapatalk

It's only possible with a custom kernel. On the other hand, it's really not neccessary, because battery drain and performance are really awesome as it is
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