Development [Kernel][12.04.2023][Android 13] Kirisakura 3.0.1 for Sony Xperia 1 III aka "Sagami"

Search This thread

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
6,441
23,040
I'll take a look at it once I find time, but we probably need to wait for Sony to push the source.
 

jaungster

Member
Aug 10, 2013
26
1
I'll take a look at it once I find time, but we probably need to wait for Sony to push the source.
If we update our rooted devices to the latest firmware update using a newly made patched img, would this also revert the kernel back to stock or is it recommended to flash the stock kernel using ex kernel or something?
 

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
6,441
23,040
Any one use 2.0 kernel on latest fw 219 and is it working fine ?
nope it doesnt. zit will bootloop and have to flash using newflasher. Data will be fine but will have to re-root
Damn that's to bad bro :(

@Freak07
here you go the latest boot.img of fw .219

No problems flashing 2.0.0 on 61.1.A.9.219 on my end using latest magisk.
 

Attachments

  • Screenshot_20220822-073453.png
    Screenshot_20220822-073453.png
    566.8 KB · Views: 76

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
6,441
23,040
If we update our rooted devices to the latest firmware update using a newly made patched img, would this also revert the kernel back to stock or is it recommended to flash the stock kernel using ex kernel or something?
You don't update your phone by using a magisk patched boot.img.
You need to flash the entire firmware package using newsflasher, which overwrites everything including the custom kernel.
After flashing the new firmware you need to re-root by patching the boot.img from the firmware you just installed and afterwards reflash the kernel.
 

jaungster

Member
Aug 10, 2013
26
1
You don't update your phone by using a magisk patched boot.img.
You need to flash the entire firmware package using newsflasher, which overwrites everything including the custom kernel.
After flashing the new firmware you need to re-root by patching the boot.img from the firmware you just installed and afterwards reflash the kernel.
I see. Thanks again for the help and sorry for the noob questions.
 

paul999

Senior Member
Jul 28, 2007
131
27
This kernel is great! so far so good no big problems using 61.1.A.9.219 android 12. only about 2% power drain after 8hr sleep in deep doze mode.

one thing i notice is when you touch the screen/doing normal operations, all eight cores will jump up to 13xx together... this does not happen if you use the stock kernel. it will be better if only the little cluster and big cluster get boosted during input detection... is this something to do with the power saving option? it seem they are all synchronize.
 
Last edited:

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
6,441
23,040
This kernel is great! so far so good no big problems using 61.1.A.9.219 android 12. only about 2% power drain after 8hr sleep in deep doze mode.

one thing i notice is when you touch the screen/doing normal operations, all eight cores will jump up to 13xx together... this does not happen if you use the stock kernel. it will be better if only the little cluster and big cluster get boosted during input detection... is this something to do with the power saving option? it seem they are all synchronize.
Hey :) glad it's working fine for you and you're happy.

Boosting to 1.3ghz happens on stock kernel too and is unrelated to the kernel, as this boost is controlled by the power-hal.
 

paul999

Senior Member
Jul 28, 2007
131
27
Hey :) glad it's working fine for you and you're happy.

Boosting to 1.3ghz happens on stock kernel too and is unrelated to the kernel, as this boost is controlled by the power-hal.
oh you are right, i just flashed back stock kernel and tested again. is there anyway to tune it down? all cpu cores boosting to 13xx everytime i touch the screen seem to be waste of energy
 

JDC2389

Senior Member
Apr 3, 2011
212
46
oh you are right, i just flashed back stock kernel and tested again. is there anyway to tune it down? all cpu cores boosting to 13xx everytime i touch the screen seem to be waste of energy
Idk if that's a good idea, but I'll add that any more updates are welcome when you find the time, maybe some more optimization or like a newer clang? Oh, I also discovered bbr2 tcp congestion algo exists. Idk, thanks for the kernel again my dood.
 
Last edited:

bentree

Senior Member
Apr 30, 2011
272
101
cooktown
Sony Xperia 1 III
Just wanted to say that I have been running this Kernel for a week now on build 61.1.A.11.88 and I have noticed an massive improvement to battery life. Before using this kernel I was struggling to get the phone to last through a 13 hour work day. The biggest issue with the factory kernel was that it very rarely went into deep sleep. Now with @Freak07 kernel the deep sleep time nearly matches the screen off time.
Not sure why it couldn't get deep sleep with the factory Kernel but now it is much better. I haven't noticed any delays with notifications or syncing issues either.
 

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
6,441
23,040
@Freak07 can we except a new kernel for A13 and does v2.0.0 works on A13 also ? Just curious bro 🫶
Anyone tried v2.0.0 on A13 and does it work ?
Any news ? 🫤😶‍🌫️ i am the only one that is still alive here..
Asking for ETAs no matter if direct or indirectly in disguise, politely or impolitely is not considered the proper way on XDA.

I haven´t tried it personally, but you´re free to backup your partitions and give it a try.

As a bonus there´s no source code yet from Sony for A13 for Xperia 1 III. Just like last time as A12 dropped, where you asked the exact same question. It probably will take Sony a few months to release it.
Last time it took them 6 months, so I fear it might take them even longer the older a device gets.


Feel free to check here for archives starting with 61.2.x.x.x.

As a second bonus all my work is open source, so everyone can update or work on it. :)


Just wanted to say that I have been running this Kernel for a week now on build 61.1.A.11.88 and I have noticed an massive improvement to battery life. Before using this kernel I was struggling to get the phone to last through a 13 hour work day. The biggest issue with the factory kernel was that it very rarely went into deep sleep. Now with @Freak07 kernel the deep sleep time nearly matches the screen off time.
Not sure why it couldn't get deep sleep with the factory Kernel but now it is much better. I haven't noticed any delays with notifications or syncing issues either.
Thanks for the kind words, but the kernel is not a magical improvement.

I guess this is just coincidence and whatever kept your phone awake or hogged resources in the background got cleared by the reboot.
If the kernel really fixed an inherent problem though, I´m happy it helped on your end.
 
  • Like
Reactions: Pandemic
Asking for ETAs no matter if direct or indirectly in disguise, politely or impolitely is not considered the proper way on XDA.

I haven´t tried it personally, but you´re free to backup your partitions and give it a try.

As a bonus there´s no source code yet from Sony for A13 for Xperia 1 III. Just like last time as A12 dropped, where you asked the exact same question. It probably will take Sony a few months to release it.
Last time it took them 6 months, so I fear it might take them even longer the older a device gets.


Feel free to check here for archives starting with 61.2.x.x.x.

As a second bonus all my work is open source, so everyone can update or work on it. :)



Thanks for the kind words, but the kernel is not a magical improvement.

I guess this is just coincidence and whatever kept your phone awake or hogged resources in the background got cleared by the reboot.
If the kernel really fixed an inherent problem though, I´m happy it helped on your end.
Yes i agree about the ETA so my apologize bro, i was just curious ans i dunno why Sony nor google is so slow with bringing out the source but once again sorry bro, appriciate your work 💯🫶
 

Top Liked Posts

  • There are no posts matching your filters.
  • 12
    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 12 and intended to be used on the latest Stock-Firmware
    - compiled with Clang 14.0.7 and built with -O3 speed optimizations
    - Linux-Stable-Upstream included to 5.4.202
    - upstreamed CAF base for the Snapdragon 888 (qcoms internal codename "lahaina")
    - 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
    - add SSG-IO scheduler from samsung (less overhead, better tuned towards android)
    - disable various debugging mechanisms for drivers which are not needed on a perf build (e.g. binder)
    - disable selinux auditing (we don´t have to adress selinux denials running a stock rom)
    - 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!


    EAS related features:
    - Implement dynamic WALT-Window size depending on current FPS, collecting information about CPU-Load to provide more precise information for the scheduler
    - EAS implementation patched up to latest CAF state
    - updates from kernel/common
    - scheduler updates from sd888/ 5.4 kernel

    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/times/stats
    - vdso32 patches as found on Google Pixel devices (brief documentation here) (CAF 5.4 default, keep for documentation)
    - remove event debug logging
    - disable broken irq detection, disable debugmon
    - improve suspend/resume from audio driver (caf-upstream for audio-kernel)
    - cpuidle: wake only cpus for which qos has changed (this allows cores to keep idle states better)
    - disable debugging during sleep states as per qcom recommendation
    - remove RTB logging to reduce overhead
    - disable trace_printk as it shouldn´t be used on production/perf kernel builds
    - enable suspend_skip_sync to save power during suspend/resume
    - disable edac and coresight (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 driver updated to latest CAF-State
    - 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

    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

    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 )
    - improved networking drivers from caf-upstream (especially wifi)
    - 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)
    - Fix various memory leaks in different subsystems
    - improved mm with patches from mainline
    - patches from kernel/common
    - improve memory allocations in various subsystems, video encode/decode, kernfs, cgroup
    - Backport to enable CONFIG_HAVE_MOVE_PMD (see here) , thanks @arter97
    - Backport to enable CONFIG_HAVE_MOVE_PUD (commit here) , thanks @arter97
    - free more RAM by removing unused reserved memory regions
    - mm: Micro-optimize PID map reads for arm64 (improves game performance, especially unity based games such as genshin impact)
    - MGLRU added (info here and here

    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)


    Misc Features:

    Wakelock Blocker:
    - advanced wakelock blocker with the ability to block any wakelocks (dangerous, use with caution)
    - please read [URL="https://arstechnica.com/gadgets/2018/08/p-is-for-power-how-google-tests-tracks-and-improves-android-battery-life/"]this for further info
    - blocking a kernel wakelock should only be done in case of firmware incompatabilities (WiFi network at work (can´t be changed) causes deep sleep to not work on the phone.) That´s the only use case I see for this feature. The kernel does not features this to improve battery life!

    Other features:
    - clean up asus drivers and fix a few warnings in kernel log
    - 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:

    Or attached to the release post starting with Android 13 as AFH is currently not working correctly

    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://xdaforums.com/t/kernel-20-1...xperia-1-iii-aka-sagami.4377449/post-86140929

    Android 12
    2.0.0
    Android 13
    3.0.0 https://xdaforums.com/t/kernel-02-0...xperia-1-iii-aka-sagami.4377449/post-88048199
    3.0.1 https://xdaforums.com/t/kernel-25-0...xperia-1-iii-aka-sagami.4377449/post-88404445

    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
    5
    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.
    5
    How to pass Safetynet after unlocking the bootloader

    With the introduction of hardware backed safetynet attestation, passing safetynet has become a lot more complicated.
    Some probably remember a while ago, flashing a kernel that forced some flags was enough to pass it. However these days are gone.
    Below is a short guide how to pass safetynet on phones that are flagged to use HW attestation (such as the ROG 5).

    1. Make sure you´re running latest magisk canary.
    2. In Magisk Manager enable both zygisk and deny list.
    4. Download the latest Universal Safety Net Fix from @kdrag0n ´s github for zygisk cand flash it in Magisk Manager. Reboot.
    5. Profit
    5
    Update to 2.0.0

    Hey guys and girls,


    Alright. The source code for Xperia 1 III for Android 12 firmware was finally released after 6 months of waiting time. 🥳
    USB connection issues are fixed now. Charger detection is fixed. Smart charging features work fine as well.

    The kernel is fully compiled from source with a lot of optimizations as well as latest CAF-Upstream and linux-stable.
    I´ll update the OP to reflect all the changes.

    More changes in the Changelog below:


    Changelog:
    - Import kernel source from 61.1.A.1.149 (works fine on latest a12 firmware)
    - Linux-Stable upstream bumped to 5.4.201
    - use prebuilt clang 14.0.7 for compilation
    - latest caf-upstream
    - for more details please check the first post
    - other improvements and tweaks please check github if you´re interested in details


    Download:



    Instructions can be found in the OP!
    But look at this post too :)

    Have fun, enjoy the kernel and your phone.

    Donations are not mandatory but very welcome.
    If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
    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. :)