Development [Kernel][23.12.2021][Android 11] Kirisakura 1.0.1 for Sony Xperia 1 III aka "Sagami"

Search This thread

htcmage

Senior Member
May 3, 2020
103
26
HTC U11+
HTC U12+
Fixed the typos and the link.

No, I only have the Xperia 1 III to work on.
1 III and 5 III know that they use the same boot file if the firmware version is the same. Kernel to the developer, running on 5 III. runs flawlessly
 

Attachments

  • Screenshot_20220110-012521.png
    Screenshot_20220110-012521.png
    96.3 KB · Views: 76

htcmage

Senior Member
May 3, 2020
103
26
HTC U11+
HTC U12+
Freak07,

I guess it should be "Please note this kernel is made to run only on Xperia 1 III" ;)

By the way, is there any plans to make same kernel for 5 III ?


Leads me to nowhere (404).
I am a 5 III user. The kernel makes it possible enough.
However, there are special caveats. Only version 23 of magisk, should be used on 5III. If enabled in the canary version, it will be infinite boot.
 

Attachments

  • Screenshot_20220110-012544_1.jpg
    Screenshot_20220110-012544_1.jpg
    11.9 KB · Views: 47
  • Screenshot_20220110-012521.png
    Screenshot_20220110-012521.png
    96.3 KB · Views: 47
Last edited:

htcmage

Senior Member
May 3, 2020
103
26
HTC U11+
HTC U12+
Amazing work mate, very meticulous tuning. Would love to have this kernel on the 5 III. I understand the device architectures are quite similar?
iam a 5 III user. The kernel makes it possible enough.
However, there are special caveats. Only version 23 of magisk, should be used on 5III. If enabled in the canary version, it will be infinite boot.
 

Attachments

  • Screenshot_20220110-012544_1.jpg
    Screenshot_20220110-012544_1.jpg
    11.9 KB · Views: 40
  • Screenshot_20220110-012521.png
    Screenshot_20220110-012521.png
    96.3 KB · Views: 41
Last edited:

largo2

Member
Jan 15, 2012
27
5
Bratislava
Sony Xperia 1 III
Developer. I have a question. Google Play system update is stuck in June, can I upgrade this?
 

treff89

Senior Member
Oct 31, 2006
82
22
iam a 5 III user. The kernel makes it possible enough.
However, there are special caveats. Only version 23 of magisk, should be used on 5III. If enabled in the canary version, it will be infinite boot.


Wow -- so you simply flash this kernel onto the 5 iii and it works?? Amazing if true!
 

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
5,536
18,346
Yes! The two models share boot.img and have the same firmware version. Works very well, but same as 1 III, NFC doesn't work
did you try the kernel.zip attached to this post?


I believe that should have nfc working on the 5 III as well if it boots.



edit: @htcmage, thanks for testing it on the xperia 5 III and reporting back that it works.

Thank you very much for the generous donation. It´s greatly appreciated. :)
 

htcmage

Senior Member
May 3, 2020
103
26
HTC U11+
HTC U12+
did you try the kernel.zip attached to this post?


I believe that should have nfc working on the 5 III as well if it boots.



edit: @htcmage, thanks for testing it on the xperia 5 III and reporting back that it works.

Thank you very much for the generous donation. It´s greatly appreciated. :)
No, I'm not sure if it's good to load everything, so I'm using the old 1.0.1 :)
 

treff89

Senior Member
Oct 31, 2006
82
22
That's excellent, and good news for 5 iii / 1 iii development that the kernel be shared. Will try it out this weekend.
 
  • Like
Reactions: htcmage

treff89

Senior Member
Oct 31, 2006
82
22
Works brilliantly, seems like the power saving feature is also working nicely after setting it up through FKM.
 
  • Like
Reactions: htcmage

Yndi

Senior Member
Nov 12, 2011
257
65
Thanks for your work @Freak07
Will this work for Android 12 as well or do you have to bring up some updates?
I'm/was a bit sceptical to unlock during waranty but with the cr** Sony threw at us with their update I'm all for changing my ROM and when I reinstall the phone I would likely unlock aswell.
 

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
5,536
18,346
Thanks for your work @Freak07
Will this work for Android 12 as well or do you have to bring up some updates?
I'm/was a bit sceptical to unlock during waranty but with the cr** Sony threw at us with their update I'm all for changing my ROM and when I reinstall the phone I would likely unlock aswell.
Sony needs to upload the source code for the Android 12 kernel, so I can start working on the update for Android 12. So for now I can do nothing besides wait for them to upload the source.
 

ryshd296

Senior Member
Mar 15, 2014
124
14
oita
ASUS ZenFone 8
I compared [Kirisakura_Sagami_1.0.1.zip] and [Kirisakura_Sagami_1.0.1force.zip] with xperia5Ⅲ.

[Kirisakura_Sagami_1.0.1.zip] seems to have a better battery life.
It's a pity that nfc cannot be used with [Kirisakura_Sagami_1.0.1.zip].

But thank you for the wonderful kernel!
 

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
5,536
18,346
if somebody is still on Android 11, I´d appreciate if they could check if smart charging and nfc works with this build on Android 11.
 

Attachments

  • Kirisakura_Sagami_1.0.1_nfc_charging.zip
    24.9 MB · Views: 40

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    Kirisakura-Kernel for the Sony Xperia 1 III

    Hello everyone,

    To keep it short: Here is Kirisakura - Kernel for the Sony Xperia 1 III aka Sagami. Sagami is the internal codename for this years development platform of Sony Mark III devices. Please note this kernel is made to run only on Xperia 1 III.
    I would appreciate if everybody that flashes the kernel, reads at least once through this opening post and the following ones.

    Kirisakura - Kernel is designed to bring a handful of beneficial features to the device, while ensuring excellent performance and smoothness to get you safely through the day!
    If you expect a custom kernel to magically improve your devices battery life manifold and this is your only priority then this might not be the right place for you.
    However the kernel is built to keep battery life close to the same as you would experience the on stock kernel while being tuned to perform better in various UI related benchmarks. The same benches are used by google to verify and ensure UI smoothness on the Pixel devices.
    There´s also a cpu-battery saver mode that cuts back the CPU max- freqs, but without the disadvantages like delayed notifications from built into the system user-space power-saving modes.
    If that got your curious, I welcome you to continue reading if you´re still interested!

    The kernel includes a lot of improvements and contributions from other developers as well. Without this kernel would not exist.
    A big part of improvements originate from @arter97´s, @kdrag0n´s and @Sultanxda´s work. Many others contributed in some way or another to this kernel.
    A big thanks to all of them at this place!

    Now lets continue with a list of features in the next paragraph!


    Main Features:
    - Based on latest kernel sources from Sony for Android 11 and intended to be used on the latest Stock-Firmware (currently 61.0.A.23.20 )
    - compiled with Clang 13.0.1 and built with -O3 speed optimizations
    - CPU-Battery saver to be able to restrict max cpufreqs on the fly, without enabling powersaving modes that might cause missed notifications (more info here)
    - include important fixes/improvements from kernel/common
    - reduce power consumption during deep sleep
    - remove logging while device is suspended
    - disable various debugging mechanisms for drivers which are not needed on a perf build (e.g. binder)
    - disable unnecessary CPU errata for our specific SoC
    - implement LRNG (thanks @arter97, see arter kernel OP for more info )
    - Flashing the kernel will keep root!
    - Flashable via EXKM, FKM or TWRP (if available) on a rooted system!


    CPU related features:
    - Power saving workingqueues enabled by default (toggleable in EXKM)
    - Change various drivers (WLAN, MM, audio, charger, power, thermal, glink etc) to use power efficient workingqueues. This compliments EAS in general
    - improvements to cpufreq
    - vdso32 patches as found on Google Pixel devices (brief documentation here) (CAF 5.4 default, keep for documentation)
    - disable debugging during sleep states as per qcom recommendation
    - remove RTB logging to reduce overhead
    - disable edac (following google on the pixel kernels)
    - disable jtagv8 debugging as recommended by qcom for perf builds to avoid potential power, performance and memory penalty
    - disable s2idle in favor of deep idle state -> improves deep sleep drain (google initially used 2idle for improved suspend/resume latency on pixel 3 and pixel 4, but disabled it on pixel 5. qcom followed suit for sd 888, but apparently didn´t see google reverting it on pixel 5. Other OEMs such as Xiaomi or OnePlus already disabled s2idle on their SD888 devices in favor of deep- read more about s2idle vs deep here)

    GPU related features:
    - gpu/kgsl improvements from pixel 4/pixel 5 kernel
    - add low_prio_worker thread for gpu driver (Improves performance when tearing down processes (eg, via LMK) and not blocking currently running UI from submitting work to the GPU
    - remove POPP functionality from GPU driver to avoid constant fight about downscaling with msm-adreno-tz
    - increase gpu worker thread priority
    - don´t wait for fenced GMU writes

    File System related features:
    - upstream BFQ-MQ to latest state in linux-mainline and default to 128KB readahead
    - improve memory allocations in kernfs
    - ufs improvements from pixel 4/ pixel 5 kernel
    - improve GC as to not interfere while user interaction is happening and prevent possible jitter or latency spikes
    - improvements to deep sleep power consumption (ufs driver, auto hibernate)

    Network related features:
    - Wireguard Support (Details)
    - advanced TCP algorithms enabled
    - use bbr as default TCP congestion algorithm (fasted algo according to this excellent research from @kdrag0n found here )
    - remove unnecessary wakelock from WLAN driver to reduce thousands of very short wakeups during a 7 hour deep sleep period
    - improved bluetooth performance (¹, ²)
    - Enable support for TTL spoofing

    Memory related features:
    - Speculative Page Faults left enabled (1. 2) (CAF 5.4 default, keep for documentation)
    - improve memory allocations in various subsystems, video encode/decode, kernfs, cgroup
    - mm: Micro-optimize PID map reads for arm64 (improves game performance, especially unity engine based games such as genshin impact)

    Security related features:
    - Control-Flow-Integration (CFI) and Link-Time-Optimization (LTO) (CAF 5.4 default, keep for documentation)
    - Use ThinLTO which was first used in the Pixel 4 XL Android R-Kernel instead of full LTO (CAF 5.4 default, keep for documentation)
    - Shadow Call Stack (SCS) Security-Feature ( 5.4 default, keep for documentation)
    - enable init_on_alloc for even more security, more information can be found in the commit message (CAF 5.4 default, keep for documentation)

    Other features:
    - disable logging and debugging to make the kernel more lightweight in various places (includes binder, mm, vma, gpu, ipa etc)
    - fix several coding issues detected by newer Clang-Toolchains
    - enlarge dmesg size to ease debugging


    Flashing Guide, Download and Changelog

    Requirements:
    - unlocked Bootloader
    - USB-Debugging in developer options enabled
    - latest adb and fastboot binaries
    - working adb and fastboot environment
    - magisk root
    - a backup of stock boot.img or your magisk patched boot.img in case you want to go back to stock.

    How to flash the Kernel:
    1. Download the latest kernel.zip and make sure you have properly updated to the latest matching Firmware (check the feature list for the current firmware the source is based on). When there´s an OTA update for the Sony Xperia 1 III it takes Sony a while to release the source code for the new OS and me a while to build a new kernel. If you don´t want to face any issues, wait until I either release an updated kernel or give green light because there were no kernel changes.
    If you want to be sure there are no issues, always make sure to run the firmware the kernel is built for!
    If you feel adventurous and try in advance, make sure you have a backup ready!

    2. Flash the kernel.zip via latest TWRP (if available), EXKM or FKM app and do a full reboot.

    3. Reboot and profit.


    DOWNLOAD:
    Download is located always in this folder:

    Important: Read after Download
    Please take a look at the second post after flashing the kernel!

    Changelog:
    Android 11

    1.0.0 Initial Release
    1.0.1 https://forum.xda-developers.com/t/...xperia-1-iii-aka-sagami.4377449/post-86140929

    Donations:
    Donations are not mandatory but very welcome if you want to support development or just buy me a coffee/tea :)
    If you like my work: http://paypal.me/freak07

    Credits:
    Sony for the development device, giving me the opportunity to create this project!
    @osm0sis for all his work, including the ak3 installer!
    @tbalden for being the best HTC, Pixel, OnePlus and now Asus wingman!
    @LeeDroid and @mwilky for their awesome roms and work I used on multiple devices!
    @Captain_Throwback for all the mentoring and guidance!
    @Eliminater74 for bringing me into the game and the Inspiration
    @nathanchance for his upstream guidance and assistance
    @RenderBroken for helping me out
    @flar2 for all his work
    @joshuous for all the help he provided to me in the past!
    @arter97 for giving me advice
    @kdrag0n for his help and advices!
    @topjohnwu for magisk!


    Source Code: https://github.com/freak07/Kirisakura_Sagami
    4
    Alright here´s a kernel.zip that just force loads all drivers built as kernel modules that come bundled with the firmware. This means instead of building the full kernel from source, we just build the core and load all drivers from the stock firmware compilation from sony. This includes, fingerprint, camera, touchscreen etc and also the sony driver that´s responsible for battery care/smart charging. I think this should fix the smart charging issue for now.

    However I don´t like to do this as force loading modules can cause issues, if the kernel gets to far from the stock base as already happened on the initial release.
    I already needed to revert certain changes done to the full source built kernel, as force loading modules on the previous 1.0.1 release would just crash the device during startup.
    For now it´s fine, but the kernel I plan to do once A12 drops won´t be able to resort to this approach as it will contain a lot more changes.

    I hope I can get this driver somewhere so I can proceed to go forward as planned.

    Source is pushed to a different branch.

    Enjoy the holidays and have a nice Christmas time if you celebrate it. :)
    3
    F.A.Q:

    Question:
    Is root preserved when flashing this kernel?
    Answer: Yes, the AnyKernel.zip will detect root and keep it.

    Question: Safetynet does not pass on my phone since I unlocked the phone, why is this so?
    Answer: Google introduced hardware backed attestation recently. Unfortunately the old kernel tricks to still get safetynet passing won´t work. Instead you will have to rely on some magisk modules. Short guide in post #4 below.

    Question: How do I return back to stock or another kernel.
    Answer: Extract boot.img from the matching firmware you are on (you can do so by using this tool or similar ones found on XDA and when googling around) and flash them via fastboot. If you want to keep root flash back the magisk_patched_boot.img. Or dirty flash your rom and re-root.

    Question: Why is having Magisk installed mandatory for this kernel?
    Answer: The kernel uses a ramdisk overlay to apply some settings after boot. If you are not rooted these settings will not get applied and you miss some of the optimizations.

    Question: How to report bugs properly?
    Answer: Have a look at post #3 in the linked thread. The linked guide is a pretty good starting point.
    Before reporting any bug make sure you´re running on a stock configuration. That´s means you´re not using any mods, tweaks in kernel managers or other root tweaks , magisk modules, scripts or other modifications that alter various functions like sound mods, data traffic, sleeping behaviour, scheduler, magical battery tweaks etc.
    Try to describe the issue as detailed as possible! Give your exact setup, like rom, magisk version, kernel version.
    Is the issue reproducible? Does it happen frequently?
    Provide logs, otherwise debugging is a lot harder. If you can already reproduce the issue and provide logs it greatly limits the amount of time I have to spent until I figure out how to reproduce it.

    If the device force reboots/randomly reboots (that means you see the bootloader unlocked screen!) provide a .zip of /asdf.
    Easiest way is immediately after booting up, with a root explorer navigate to /asdf. Copy the contents to your internal storage, zip it up and send it to me.

    If the issue happens while the device is running provide a dmesg plus a logcat that you take while/shortly after the issue happens. This will log what´s running in the current session. Try to be as detailed as possible what´s happening when the issue appears. It will also help me in reading the log!
    3
    Feature Documentation:
    Here´s a brief documentation about some of the features included in the kernel that can be changed as the user desires.
    They can be accessed via either terminal, scripts or for example EXKM manager ( tools -> user settings).

    CPU-Frequency Limiting:
    Another option is CPU-Freq Limiting. You can now limit the CPU frequency to a few different levels with a sysfs interface. Original implementation is from @tbalden, I only changed it to be accessible via traditional root methods.
    Main Switch:
    sys/module/cpufreq/parameters/batterysaver
    Set this option to "1" to enable the feature

    Max-Frequency Selection (Input boosts, such as scrolling boost or app launching boosts will still apply, if touch boost restriction is not set to 1)
    sys/module/cpufreq/parameters/batterysaver_level
    Set this to "1" to restrict the max CPU-Freqs to 1,7GHZ/2,1GHZ/2,49GHZ (Little Cluster/Big Cluster/Prime Core)
    Set this to "2" to restrict the max CPU-Freqs to 1,6GHZ/1,7GHZ/2,0GHZ (Little Cluster/Big Cluster/Prime Core)
    Set this to "3" to restrict the max CPU-Freqs to 1,49GHZ/1,4GHZ/1,6GHZ (Little Cluster/Big Cluster/Prime Core)

    Touch-Boost Restriction
    sys/module/cpufreq/parameters/batterysaver_touch limiting
    Set this to "1" to restrict the powerhal from boosting over the limit defined in batterysaver_level
    Set this to "0" to allow the powerhal to boost above the values defined in batterysaver_level, but only during interaction with the Phone!

    Screenshots:
    View attachment 5309899View attachment 5309901View attachment 5309903


    This is for example very useful during gaming to prevent additional heat, if not the highest performance from the CPU is required. Check if the game is running fine on level 1 or 2, and you´ll notice much less heat. Powerdraw will be reduced as well.
    Another very useful trick while doing video calls or long extended navigation sessions with google maps to preserve battery or keep the phone from heating. Especially during summer if the ambient temperatures are high.
    This is a very easy way to preserve battery or reduce heat without toggling the battery save mode in settings as that restricts background data usage, which can lead to delayed notifications.
    3
    this one is the last one