For me it threw up a notification at 93% but idk if it actually stopped charging, didn't test it. @Freak07 You are a godsend, where there was nothing, there is custom goodness with better battery life. Have you ever seen Alfred Chen's BMQ, now called Project C? I was wondering if it would be possible to run it on Android? It's proven to be great on Archlinux. I would love to hear any customized settings you run on the kernel settings as well, cheers!
yes I found some minutes this morning to investigate the issue. The driver that´s connected to smart charging is not included anywhere in the source that sony releases.
Not with the current release as it is.
You're very welcome.@Freak07
Thabks for this bro. . I'm using the xq-bc72 and everything working smoothly I was or I'm on the Russian build 61.0.A.23.20 release-keys
Update: the kernel from afh(android file host) breaks NFC. Just tried at the local gas station
The forced one from here in the xda link. NFC works. But I will continue testing this one for now
thanks so much for your work on sony kernel!this is hdd_driver_load code from 魔法师蛋小丁's xperia pro i: github.com/DevriesL/PDX217_ImageBreaker/blob/master/kernel/module_injector.c，he said it's a better way to solve the wifi problem……Kirisakura-Kernel for the Sony Xperia 1 III
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!
- 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)
- 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
- 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 is located always in this folder:
Important: Read after Download
Please take a look at the second post after flashing the kernel!
1.0.0 Initial Release
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
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
Thanks for the link. Appreciate the help.
I ended up going with the module kernel, the 1.01 was mostly good but nfc was still broken and the showstopper was a black screen that wouldn't turn on, didn't get a log but sometimes the screen just wouldn't wake or at least turn on the display.Thanks for the link. Appreciate the help.
That's just another way of "(force) loading" the kernel modules from stock firmware on a custom built kernel. Doesn't solve the problem that at the moment the source doesn't contain seemingly all drivers.
I want to build the complete kernel with all the drivers from source. If I'm not able to obtain the source for all the drivers, i won't be able to realize what I plan. But we'll see once A12 is released.
Yes, that's the best option until I'm able to get the driver from Sony to sort the issues
Not sure what causes the screen to fail to wake and stay black but it's random, it happens on the force module version and the regular 1.01 version with the newer clang etc. I don't need nfc so I went back to the 2nd release for now.
Can you get me contents of sys/fs/pstore after you rebooted your phone, zip them up and upload them here?
Idk if it logged what was needed but I have the contents, if I pressed the google assistant button I could hear it's sound loading, black screen but the phone was still running.
thanks for the log. Just to be sure, you got the black screen, the assistant button still worked, you force rebooted the phone and then got the log after the phone was back up?
I might have rebooted after the issue, I'm not sure, if it crops up again I'll zip the log file from there immediately on reboot. I haven't had it in a while so I might have disabled a setting that caused it to happen randomly. Idk, happy new year and thanks for the Kernel dev my best guess is it was a proximity sensor bug.thanks for the log. Just to be sure, you got the black screen, the assistant button still worked, you force rebooted the phone and then got the log after the phone was back up?
Fixed NFC on the source built kernel today. So the only thing left seems to be the driver for smart charging missing from the source.
hey bro，the phone was chargging by wireless charger ，then someone called me，i answered and hung up the phone，and i wanted to continue chargging，but it didn't work，so i restarted the phone，then it worked，is it relate to the kernel？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.