[mido] UndergroundKernel by @Zile995

My, personal kernel builds. This kernel should be performance oriented (smooth scrolling, fast app opening while maintaining good battery life). I am not interested in gaming and benchmarking performance (Antutu). Kernel supports FKM/Spectrum profiles and works with latest oreo 8.1 (preferably official LOS 15.1 sources) , Pie 9.0 and Q 10.0 ROMs (preferably LOS 16.0/17.1 Zeelog sources)

All credits goes to:

  • The Linux Foundation, CAF
  • abhishek987
  • Sultanxda/kerneltoast
  • krasCGQ
  • franciscofranco
  • nathanchance
  • Raphielscape
  • osm0sis
  • zeelog
  • Adesh15
  • All Redmi Note 4(X) (mido) developers/All others who have their commits or contributions picked.

Notice:

  1. Magisk is required to configure thermal zones and kernel parameters! Kernel can work without Magisk, of course.
  2. Use only one kernel manager for profiles!
  3. Kernel supports Spectrum and FKM profiles.
  4. Kernel will apply the last used spectrum profile on boot. If you changed the spectrum profile on the same ROM with other custom kernels before, the Underground will apply the last used profile. If you have installed FKM (Franco Kernel Manager), FKM will apply the last used profile (it will overwrite spectrum profile setup). So, if you have used other custom kernels and changed spectrum profile on the same ROM, check your profile with FKM or Spectrum!
  5. If you don’t like battery life, switch to the battery spectrum profile.
  6. Gaming is safe with gaming profile
  7. Spectrum Gaming profile = FKM Performance profile
  8. Before installing other kernels on android 10:
  • You can restore the stock kernel image, but you will have to flash Magisk. Magisk is required to delete all init scripts and modifications.
  • You can flash Underground-uninstaller.zip and stock boot.img (from your ROM.zip) or simply reflash your ROM.
  • After that you can flash Magisk and other custom kernel
  1. For FKM OTA updates (NOT SUPPORTED ANYMORE):
  1. If you want to use kernel profiles (FKM/Spectrum), you should not use LOS battery profiles, .
  2. Do not flash thermal mods, Underground has configured thermals (use the gaming profile)

Flashing:

  • Before flashing this kernel, flash boot.img (stock kernel) of your current ROM, then Magisk and after that kernel zip. It's better because sometimes I modify ramdisk, delete and add new stuff.

Alternative links:

1.  (github link: EOL, will not be updated): https://github.com/Zile995/android_kernel_xiaomi_msm8953/releases

2. AFH : https://www.androidfilehost.com/?w=files&flid=283890

Changelog:

Anykernel-Fix-New/OldProfiles:

  • Added NewProfiles build which has max GPU freq set to 725MHz for balance and performance spectrum profiles. OldProfiles build has old balance and performance profiles.
  • Updated to the latest Anykernel3
  • Simplified Anykernel scripts
  • Fixed the kernel profiles and configuration on problematic Android 10 ROMs
  • Updated uninstaller zip
  • zRAM size is set to 1.5GB for 3GB RAM devices.
  • Fixed profiles on latest Magisk version.

1.1.2021-Fix build:

  • Fixed the kernel profiles and configuration on the latest LOS 17.1 Zeelog tree.
  • Kernel is compiled with AOSP Clang v12
  • Linux kernel updates from android-3.18 common tree (synced with sources up to January 1, 2021)
  • Updated AnyKernel3

16.11.2020-Final:

  • Kernel is compiled with the latest AOSP Clang v11.0.5
  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to November 11, 2020)
  • That’s it folks, this is the final build. I tried to maintain the kernel as much as I could, thank you all.

06.11.2020:

  • Kernel is compiled with the latest AOSP Clang v11.0.5
  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to November 5, 2020)
  • Allowed installation on Android 11 ROMs with 3.18 kernel

18.10.2020:

  • Kernel is compiled with the latest AOSP Clang v11.0.5
  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to October 15, 2020)

08.10.2020:

  • Kernel is compiled with the latest AOSP Clang v11.0.5
  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to October 7, 2020)

18.09.2020:

  • Kernel is compiled with the latest AOSP Clang v11.0.4
  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to September 18, 2020)
  • Removed AnyKernel android security level check
  • AnyKernel will now block installation on ROMs with 4.9 kernels.

19.08.2020:

  • Kernel is compiled with the latest AOSP Clang v11.0.4
  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to August 18, 2020)

08.08.2020:

  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to july 31, 2020)
  • Linux CFS improvements
  • Revert a new cpu input boost, and use the old boosting mechanism

30.07.2020 (All builds above and including this one are built blindly without device, but tested by my users/friends):

  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to July 28, 2020)
  • Switch to Cpu input boost with frame boosting
  • Use Interactive because input boost works best with this governor
  • Set boost frequency to 1.69GHz (most efficient freq)
  • Dynamic boosting. It doesn’t boost at fixed time (except for videos and apps without static UI to prevent drain)

Old non-github releases

11.02.2020:

  • Kernel is compiled with the latest AOSP Clang v10.0.3
  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to February 7, 2020).
  • Anykernel3 updates, again.
  • Picked some fixes from P and Q CAF tags
  • Linux CFS improvements
  • Updated spectrum/FKM profiles. Tweaked a gaming profile  

31.12.2019:

  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to December 30, 2019)
  • CFS improvements

20.12.2019:

  • Optimized thermal throttling for all spectrum/FKM profiles, especially Gaming spectrum profile (or FKM performance profile). Don’t flash this kernel if you don’t use Magisk! Without magisk, thermal zones are not configured. Thermal configuration is applied with Magisk on boot.
  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to December 19, 2019)
  • GPU overclocked to 725MHz (configuration taken from sdm632 SoC). 725MHz is only used in gaming spectrum profile (or FKM performance profile). It replaced old 700MHz GPU step.
  • FKM now displays correct min GPU freq when you change spectrum/fkm profile.
  • Installation for Android 10 is disabled because kernel ramdisk init modifiations can’t be applied for now thanks to SAR (incorrect kernel settings, no thermal driver and kernel profiles etc).

01.12.2019:

  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to November 28, 2019)
  • Kernel is compiled with the latest AOSP Clang v10.0.1
  • Latest iommu/ion changes from kerneltoast
  • Removed a buggy GPU driver change that caused graphical glitches
  • CFS optimizations
  • Updated DTS Eeagle driver from Zenfone 5Z
  • Updated spectrum/FKM profiles. Gaming profile improved
  • Anykernel3 updates
  • I recommend you to use the FKM per-app profiles :)

23.09.2019:

  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to September 21, 2019)
  • Performance improvements, reverted some unneeded commits.

18.09.2019:

  • Enabled Sony DS support (DS4 v1 old revisions should work fine)
  • Kernel is compiled with the latest AOSP Clang v9.0.7
  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to September 16, 2019)
  • Merged latest Oreo CAF tag

LA.UM.6.6.r1-12000-89xx.0

  • Avoided more dynamic memory allocation
  • CFS improvements (hackbench score: 9-10 seconds)
  • Refactored ramdisk init scripts
  • Tweaked spectrum gaming (FKM's performance) profile: Use higher GPU power level, kernel will also swap less.
  • Anykernel: Allow kernel installation on Android 10
  • Use 1GB zRAM for all Oreo & Pie ROMs.

30.08.2019:

  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to August 29, 2019)
  • Latest Anykernel3 updates

27.08.2019:

  • Kernel compiled with the latest Clang v9.0.6
  • Switched to vanilla Linux CFS scheduler. It reduces UI jitter and improves hackbench score (task migration). It should work better on msm8953 because we don't have big.LITTLE architecture
  • Latest Sultan's ion & iommu changes (Improved frame rendering latency)
  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to August 27, 2019)
  • Latest Anykernel3 updates
  • You won't be able to flash this kernel on ROMs with SP level older than 2018.09

04.08.2019:

  • Latest ion & iommu improvements from Sultanxda (eliminate buffer races without hurting the iommu driver's performance.)
  • Removed fence name struct and unneeded tracing. (this change reduced scrolling speed)
  • Anykernel3 updates
  • You won't be able to flash this kernel on ROMs with SP level older than 2019.01
  • Latest Linux kernel updates from android-3.18 common tree (synced with sources up to July 29, 2019)
  • Disabled some kernel debugging
  • Some binder improvements
  • Free pgtbl ops when domain contexts are destroyed (cleanup)

01.08.2019: Deleted

18.07.2019:

  • Added FKM profiles support (FKM performance profile is using spectrum gaming setup)
  • Slightly tweaked profile init script (make sure we use msm-adreno-tz GPU governor)
  • msm: mdss: Don't allocate memory dynamically for small layer buffers
  • Anykernel3 updates

15.07.2019:

  • ANDROID: sdcardfs: Allocate temporary name buffer on the stack
  • ext4: Allocate allocation-context on the stack
  • kobject_uevent: Allocate environment buffer on the stack
  • scatterlist: Don't allocate sg lists using __get_free_page
  • ion: system_heap: Speed up system heap allocations
  • ion: Remove unneeded validation safety checks

11.07.2019:

  • Kernel compiled with the latest Clang v9.0.5
  • Fixed offline charging battery indicator (it was caused by ramdisk script)
  • Latest Linux kernel updates from android-3.18 common (synced with sources up to July 10, 2019)
  • fbdev: msm: check the length of the external input buffer properly (fix buffer overflow)
  • ion: Fix panic when ion_handle_add fails
  • ion: Speed up scatterlist duplication when chaining isn't used
  • SELinux and audit improvements
  • msm: kgsl: Dispatch commands using a master kthread
  • msm: kgsl: Don't try to wait for fences that have been signaled
  • Revert dma device coherent check (because it is not backported completely)
  • mm: kmemleak: Don't die when memory allocation fails
  • ALSA: control_compat: Don't dynamically allocate single-use structs
  • ion: Clean out custom sg alloc and free now that sg uses vmalloc
  • scatterlist: Use vmalloc instead of chaining
  • Many performance improvements (avoided dynamic memory allocation) thanks to kerneltoast in ion, mbcache2, ext4, ext4 crypto, selinux, binftm_elf, xattr)
  • staging: sync: Use an on-stack allocation for fence info ioctl
  • staging: sync: Remove 64-byte name from sync_fence struct
  • iommu: msm: Fix lethal race condition and code inconsistencies
  • Fixed few memory leaks (thanks to kerneltoast)
  • ion: Overhaul egregious lock usage
  • ion: Reserve caches for sg allocations
  • ion: Overhaul to improve clarity, performance, and stability
  • staging: android: ashmem: Get rid of the big mutex lock
  • binder: Reserve caches for small, high-frequency memory allocations
  • msm: kgsl: Don't allocate memory dynamically for temp command buffers
  • msm: kgsl: Avoid dynamically allocating small command buffers
  • kernfs: Avoid dynamic memory allocation for small write buffers
  • selinux: Avoid dynamic memory allocation for small context buffers
  • ext4 crypto: Use a larger on-stack file name buffer
  • msm: camera: Avoid dynamic memory allocation for small buffers
  • media: v4l2-ioctl: Use a larger on-stack video copy buffer
  • ALSA: control: Don't dynamically allocate a single struct instance
  • iommu: arm-smmu: Free pgtbl ops when domain contexts are destroyed
  • mm/slab_common: Align all caches' objects to hardware cachelines
  • Anykernel3 updates
  • Binder updates from common android kernel
  • SDCardFS updates from common android kernel
  • Increased vmstat interval to 20 seconds

10.06.2019:

  • Merged latest Oreo CAF tag LA.UM.6.6.r1-11300-89xx.0
  • binder: Fix concurrency issue in target_thread wakeup
  • Updated to Anykernel3

05.06.2019:

  • Merged latest Oreo CAF tag LA.UM.6.6.r1-11200-89xx.0
  • Faster display wake-up for ft5435 touchscreen
  • iommu: msm: Rewrite to improve clarity and performance
  • bus_arb: disable debug logging (This debug logging consumes 10% of all the cpu cycles in the drivers communicating with the dsp)

01.06.2019:

  • Updated sdFAT to v2.1.8 (fixed exFAT problem on some sdcards)
  • Set default readahead to 2048KB (This patch will make readahead bigger by default so early boot can benefit from it (100ms faster booting). Readahead will be reset (to 128KB) by init script on boot_complete.
  • Enable BLK and CFQ cgroup support
  • camera: Undo pm_qos request upon error (Make sure pm_qos request gets unset in the error path to fix this.)

16.05.2019:

  • Kernel upstreamed to v3.18.140

14.05.2019:

  • Kernel upstreamed to v3.18.139
  • Reduce significant overhead from needlessly scanning the large array for UBWC formats
  • Removed unnecessary commits
  • Updated anykernel2 tools

25.04.2019:

  • Fixed wake-up delay thanks to nichcream
  • Kernel compiled with the latest Clang v9.0.3
  • Fixed FB/Instagram video playback
  • Tweaked mincpubw cpufreq governor boosting level
  • Enabled DTS Eagle
  • Better sound quality
  • Slightly tweaked battery profile
  • Fixed cpu power calculation

03.04.2019: (reuploaded, fixed conservative governor spectrum init):

  • Kernel upstreamed to v3.18.138
  • Merged latest Oreo CAF tag LA.UM.6.6.r1-11000-89xx.0

29.03.2019:

  • Kernel compiled with latest Clang v9.0.2
  • TCP/Westwood improvements
  • Battery and balance proffile improvements (Less battery drain)
  • Tweaked DDR boosting and max freq for mentioned profiles

26.03.2019:

  • Kernel upstreamed to v3.18.137
  • Rebased on Franco-custom r18.1
  • Ditched maple I/O-scheduler
  • Kernel compiled with latest Clang v9.0.1
  • Updated anykernel2 script
  • Wireguard updated
  • One unified kernel zip for Oreo and Pie ROMs
  • Hopefully fixed touchscreen problems on some panels
  • CFQ is the default I/O scheduler now
  • CFQ I/O sched/block mainline improvements
  • Slightly tweaked DDR cpubw freq again
  • Tweaked Spectrum profile boost durations and governor thresholds
  • Disabled power_efficient workqueue for Gaming profile
  • Disabled slice_idle in kernel for CFQ and BFQ I/O schedulers (if/when the user switches schedulers, slice_idle gets set to 1 again… we don’t want that. Disabling slice_idle improves throughput on SSD/eMMC)
  • Ignore sensor -19 dmesg “errors”
  • lib/int_sqrt optimizations
  • stdin/stdout speed improvements
  • File bitmap scanning improvements
  • simplified devfreq_boost screen-awake check.


Old - Feather Based

24.02.2019 (reuploaded):

  • Kernel upstreamed to v3.18.136
  • Limit how frequently fg data can be queried
  • Fixed offline charging

22.02.2019:

  • Kernel upstreamed to v3.18.135
  • arm64: lib: memory utilities optimization (achieve 15% memcpy speed improvement)
  • Updated anykernel2 scripts

19.02.2019:

  • OC GPU to 700MHz (it is the max value for Gaming spectrum profile only)
  • mdss: Convert to wakeup sources
  • Add toggle for disabling newly added USB devices
  • Don't cap request size based on read-ahead setting
  • Do not allow readahead to limit IO size
  • Switch to cpufreq governor for Gaming spectrum profile. It should use cpubw DDR 844.8 MHz with 1.6GHz CPU boost freq and max 931.2 MHz with higher freqs

14.02.2019:

  • Updated lz4 zRAM decompression algorithm to latest v1.8.3 (20% faster decompression speed!) It is better for our battery.
  • Kernel is compiled with latest Clang v8.0.8 (same as previous release)
  • Use 1GB zRAM for all device targets (2GB, 3GB, 4GB) on pie kernel version.
  • Fix writeback cache thrashing
  • PCI / PM: Avoid resuming devices during system suspend
  • preempt optimizations
  • Make msm_serial_hs RT to improve bluetooth performance
  • Use real time scheduling when hot plugging a CPU
  • Fix pageblock heuristic
  • Some cpu_idle optimizations
  • Disable cross_hotplug for l2 cache pmu
  • cpufreq: use memcpy() to copy policy
  • Take primary panel framebuffer unblank

11.02.2019:

  • Kernel upstreamed to v3.18.134
  • Revert power calculation optimizations (scrolling is now more lively, like stock)
  • Switch to cpufreq mincpubw governor and optimize performance (it was performance governor before)
  • perf arm64 optimizations: Added CPU_PM notifier, some rcu usage fixes
  • Fix task-priority when using SCHED_RESET_ON_FORK
  • synchronize_rcu() when using POLLFREE
  • Fixed some memory leaks
  • Use 8 zram compression streams.
  • Slightly tweaked spectrum profiles, added mincpubw and cpubw tunables and optimizations.

27.01.2019:

  • Kernel upstreamed to v3.18.133
  • Fixed gt9xx slow wakeup
  • Fixed massive Kernel leaks in cpufreq_stats
  • I/O performance improvements
  • Massive CFQ I/O scheduler update
  • Enabled high-res preemption tick
  • Enabled RCU Boost and real-time priority
  • Enabled RCU Boost delay
  • Massive RCU Boost update
  • Massive sched update
  • High load average fixes
  • Fixed CPU Input boost latency
  • Set 1GB zRAM for 2GB targets. Set 512MB for 3GB and 4GB targets.
  • Merged zRAM changes from linux-stable upstream

14.01.2019:

  • Kernel upstreamed to v3.18.132
  • Compiled with latest Clang 8.0.7
  • Merged zRAM changes from linux-stable upstream
  • Enabled NTFS and EXFAT
  • Enabled TTL

09.01.2019:

  • Kernel upstreamed to v3.18.131
  • Merged latest Oreo CAF tags LA.UM.6.6.r1-10100-89xx.0 -> LA.UM.6.6.r1-10500-89xx.0 (same tag in my Pie kernel)
  • Compiled with latest Clang 8.0.6
  • AnyKernel updates (updated files to latest versions)
  • drivers: mmc, usb: Pull missing 3.18.{20->115} changes
  • netfilter: x_tables: add unmerged changes
  • devfreq_boost freq is 556.8 MHz now, with 64ms duration (it is boosting with each new frame: so if you scroll 300ms it will boost defreq for 300ms)
  • Set CONFIG_HZ to 300 (Improves overall interactivity and UX with no power cost)
  • Power on display as early as possible
  • Display wakeup/FP delay reduced (it is faster, but not like on MIUI (MIUI doesn’t have unlock animation))
  • Boost CPU and devfreq (500ms) to the max when any app becomes a top-app (boost when apps get opened from recents, or when you switch to last app by double tapping recents button = this should give less animation stutternig on some Pie ROMs)
  • Removed unused MSM_SMP2P_TEST (deprecated with new CAF tags)
  • moved mmc to SCHED_FIFO thread for better IO Performance
  • Added Pie kernel zip version for new Pie ROMs with zeelog sources (Magisk is needed to apply all kernel tweaks and ramdisk changes - I didn’t find solution for init script sepolicy without editing device trees)

28.11.2018:

  • Kernel upstreamed to v3.18.127
  • Merged latest oreo CAF tag LA.UM.6.6.r1-10100-89xx.0
  • Compiled with latest Clang 8.0.4
  • Removed 15mV undervolt
  • Set CPU max freq to 2GHz for Balance profile (without Magisk and Spectrum app, Balance is default profile, so default CPU max is 2GHz)
  • Fixed OC: Max unlocked CPU freq is still 2.2Ghz (it is used with Performance and Gaming spectrum profiles)
  • devfreq_boost freq is 422.4 MHz now, with 1250ms duration.
  • devfreq: Use high priority workqueue
  • devfreq optimizations
  • Use common linux 3.18 Low Memory Killer
  • Swappiness set to 100, and applied custom LMK values for better multitasking
  • zRAM optimizations
  • Fixed applying saved conservative thresholds from selected profile after reboot (Magisk needed). Spectrum profile switching now works perfectly.
  • Slightly tweaked spectrum profiles again
  • Enable MAPLE

14.10.2018:

  • Kernel upstreamed to v3.18.124
  • Merged LA.UM.6.6.r1-09600-89xx.0 -> LA.UM.6.6.r1-09900-89xx.0 tags 
  • Spectrum profile adjustments (Gaming profile now uses one step higher idle GPU freq)
  • Changed kernel name
  • Disabled MAPLE scheduler, BFQ is default now
  • sdcardfs updates.
  • Updated anykernel files.

27.09.2018:

  • Kernel upstreamed to v3.18.123
  • Spectrum profile adjustments.

15.09.2018:

  • CPU overclocked to 2.2GHz
  • Applied 15mV undervolt (thanks to RaphielScape)
  • Added Spectrum profiles. (properly configured Balanced, Performance, Battery and Gaming profiles).

10.09.2018:

  • Kernel upstreamed to v3.18.122

09.09.2018:

  • Kernel upstreamed to v3.18.121
  • Conservative tweaked to be less aggressive (It is default governor now)
  • Reverted all LMK changes
  • Updated sdfat to v2.0.8
  • Updated wireguard
  • Optimized the generic idle loop
  • Horrible use of stack is avoided now
  • ipa3: fixed redundant wakelock

30.08.2018:

  • Kernel upstreamed to v3.18.120
  • New Interactive governor configuration (hispeed freq is 1.6GHz now)
  • Updated Conservative governor (unlock sampling rate and decrease freq faster)
  • Use common 3.18.y linux lmk without adaptive LMK
  • Enabled NTFS and exfat
  • Updated LZ4 to v1.7.3 with some optimizations
  • Enabled 512MB zRAM (thanks to thapaavijet) with some optimizations
  • Added USB HID gadget suport
  • Cpufreq code optimization
  • Use arm64 optimized memcmp
  • Update mdss perf when changing refresh rate.

24.08.2018:

  • Kernel upstreamed to v3.18.119
  • Added cpu_input_boost driver by sultanxda
  • Added cpubw devreq boost driver by sultanxda
  • Properly configured boost drivers
  • Disabled CPU boost when a new frame is ready to be committed (if you use a stopwatch or play some videos, it will always use an input boost freq: we don’t need unnecessary drain), same commit for devfreq boost is not disabled.
  • Devreq boost freq is 556.8MHz, 64ms duration
  • Input boost freq is 1GHz, 1500ms duration.

12.08.2018

  • Kernel upstreamed to v3.18.118
  • Updated bfq scheduler to v8r12 (it's default now)
  • Sdcardfs update.

28.07.2018

  • Kernel upstreamed to v3.18.117
  • Fixed some kernel memory leaks (thanks to sultanxda again)
  • Fixed touch screen IRQ warnings (thanks to krasCGQ)
  • Use default initial 320MHz GPU freq. (Report that freq in sysfs)
  • CPU Boost enabled. (1GHz, 1250 ms duration)
  • White flashlight (not completely blue)
  • Enabled KCAL values for burn in fix by default.