FORUMS
Remove All Ads from XDA

[M.O.D. KERNEL] Mi9 Android9 GPU830mhz F2FS data/cache DynamicFsync LZ4 WLblocker V2

123 posts
Thanks Meter: 115
 
By mslezak, Senior Member on 24th August 2019, 12:29 AM
Post Reply Email Thread
[M.O.D. KERNEL] Mi9 Android9 GPU830mhz F2FS data/cache Dynamic Fsync LZ4 WLblocker V2 [STABLE]

***New features added! Dynamic Fsync replaces the Fsync toggle (credits to author Paul Reioux aka Faux123 <[email protected]>), and Boeffla Wakelock blocker 1.1.0 (credits to author: andip71 <[email protected]>) has been added. Download the new zip things are simplified! The GPU830mhz runs on a higher regulator now so even 3DMark runs without issue, this is as stable as it gets. A battery saving Magisk Module has been added for longer life and scored 422.5K still on AnTuTu! It will throttle and hotplug (idle) cores as needed to save battery (to use, uninstall the Optimal settings one in Magisk Manager, reboot, install battery savings one in Magisk Manager, reboot 2x after all apps fully load and you login. That way changes will stick. The new update includes less files and is a TWRP restore only variant already patched with Magisk 19.3. TWRP fstab flash files to auto mount F2FS /vendor/etc/fstab.qcom are included as well. ***

Super tweaked kernel for the Mi 9. Best AnTuTu Benchmark 432K thus far, expect 420K-430K in daily operation with good battery life. This will vary based on the ROM selected. Stock AnTuTu is 370K. So you can run your phone faster than any production 855+ at the moment. This kernel is setup on purpose to allow anything from stock to maximum performance, you can set parameters that work for you.

MOD-KERNEL-TOOLS_v2.zip -> kernel and all software to use the features of the kernel [DOWNLOAD FIRST and UNZIP to your computer]:
https://mega.nz/#!TtognIiQ!387cpAqZJ...6UmM1liL656ZF0

GitHub Source: https://github.com/mrslezak/Xiaomi_Kernel_OpenSource branch: cepheus-p-oss
Telegram Group: https://t.me/joinchat/NNTe_E9G4ZcZKXCUrajFYQ
Telegram Name: MattoftheDead
PayPal donations: [email protected] (added upon XDA forum user request)

M.O.D. Kernel (MattoftheDead). This is a kernel project that has been going on for months now behind the scenes. It is STABLE, everything works, it runs on any MIUI based ROM (MIUI Global Dev, MIUI China Dev, MiGlobe, Xiaomi.eu, AOSP, etc.). Android 9 (Pie) only since Android 10 source code has not been released and Xiaomi decided to change the kernel components. ***If you install this kernel and don't follow the tweak instructions, it runs exactly like stock. There is now a Magisk module that will run with the optimal settings to make this easy! *** So read up. You can apply any tweaks you'd like. These include:

GPU 830mhz overclock - stable and smooth. The GPU will throttle down when not being used to a lower mhz. The Magisk Modules (2 choices) will enable the max 830mhz clock for you. Or you can go without if you have a dialcode supported GPU MaxFreq OC mode *#*#8106#*#*

FSync toggle (enable/disable) - disable gives higher memory speed at the risk of data corruption if a system crash occurs. Note I've used this 4 months with no issues, if you use stable software you are less likely to run into problems. Dynamic Fsync has been added (writes to disk when screen is off, safer than just disabling fsync).

ZRAM LZ4 data encryption enabled - fastest encryption method, smaller ZRAM sizes (512mb is good) work very well [2GB is the stock ZRAM default, LZO is the default kernel compression which is slow]. ZRAM is in-memory swap so it is ultra fast. This allows you to have more free RAM for apps to run.

F2FS data and cache partition support - full ICE AES 256bit encryption. Note only @mauronofrio TWRP 3.3.1-39 + supports F2FS partition mounting so you MUST use this TWRP recovery!!!

F2FS has been tested on MIUI Global Dev 9.6.27 and Xiaomi.eu 9.7.22, 9.8.1, MiGlobe, RevOS, AOSP, Havoc thus far (more added daily) and read/write speeds and app access are definitely fast. Support was enabled by working directly with @mauronofrio on XDA (thanks Mauro) so we originated F2FS support for Mi9 - there are also F2FS kernel tweaks that help the speed in the kernel.

BOEFFLA Wakelock Blocker 1.1.0 - blocks wakelocks and allows you to change what gets blocked that is waking up your phone and preventing deep sleep. There are defaults blocked already in this build that are known to be blockable safely. If you want to add more, use SmartPack Kernel manager under Wakelocks. It will also show you what apps are causing them and the frequency so you can disable the ones that are not needed.

If you want to join in the discussion and see updates in realtime, here is the Telegram Link: https://t.me/joinchat/NNTe_E9G4ZcZKXCUrajFYQ -> XDA MI9 Optimization and Overclocking

Step 1: [KERNEL REQUIRED FILES]
First download the Mega.nz zip file at the beginning of this post which comes with a bunch of tools and the kernel so you can get up and running. It comes with the modified fstab.qcom file for encrypted F2FS support, fstab_patch_F2FS_MI9.zip for most devices (encrypted partitions) which will automatically patch that file for you from TWRP, as well as fstab_patch_F2FS_unencrypted_MI9.zip for the few who use it (developers mostly), the Mauronofrio TWRP version required for F2FS twrp-3.3.1-41-cepheus-mauronofrio.img, Magisk-v19.3, MagiskManager-v7.3.2.apk, SmartPack Kernel Manager SmartPack_Kernel_Manager_v8.7.apk to set tweaks - just follow the pictures in this thread to setup SP in 5 minutes, or use the Magisk Module of your choice. As mentioned, a Magisk Module [Magisk-Module]MOD-Kernel-Optimal-Settings-GPU830.zip can be flashed in Magisk Manager under Modules to give you the best performance settings everything up on boot for you! (credit goes to PapaSmurf OP7 dev XDA eoghan2t7 for assistance with the GPU commands to make 830mhz possible without a kernel manager or dial code) and a new [Magisk-Module]MOD-Kernel-OC-Battery-Saver-Settings-GPU830.zip for optimal battery life with still great performance (422.5K AnTuTu). A Franco Kernel Manager CPU Profile is included FK_Kernel_Manager_Profile-Maxfreq-CPUs if you use FK, as well as a more battery friendly FK_Kernel_Manager_Profile-Maxfreq-Less-Aggressive-CPUs. Also the latest Windows Minimal ADB and Fastboot minimal_adb_fastboot_v1.4.3_setup.exe is included. And there is only 1 TWRP restore file to make installation easier [TWRP-Restore]830GPUMaxReg-DynamicFsync-BOEFFLA-WL-Blocker.zip that is already patched with Magisk 19.3.

Step 2: [ROM SELECTION]
If you already have a MIUI based ROM installed, you can continue to use it. If you want to use a new MIUI based ROM, download it and setup the device. If you are clean flashing everything, don't bother restoring all the apps - they will be deleted when you switch to F2FS. Just set it up so you can login and get to the default menu with the default apps displayed. Either way, you will have to setup the device as a new phone. So back up all your user data (photos, downloads, etc), apps, etc. using Google Drive, Xiaomi Cloud, Titanium Backup Pro, or any other app that backs up apps and settings. It's often easiest to put them on your PC since you will be plugged into it during this install process with your USB cable.

Step 3: [MAURO TWRP INSTALLATION FOR F2FS SUPPORT]:
Boot Mi9 holding Power + Volume Down
Hook up to your phone to the PC with the charging cable
Open a command prompt. Go to your Minimal ADB and Fastboot folder.
Type: fastboot devices
And hopefully you see your device ID pop up. If not you don't have the right driver, the cable is bad, or something else is wrong. Search Google.

Next flash Mauro TWRP:
fastboot flash recovery twrp-3.3.1-41-cepheus-mauronofrio.img (or use his latest from the link at the bottom of this thread)
Hopefully you see it flash to the device in a few seconds successfully and it's ready to go.

Booting to TWRP:
Turn off your phone. Now hold down power + volume up. Once the boot Logo appears, let go of the power button but keep holding volume up. TWRP should boot. If not, try again. I usually have to remove the phone case. Now enter your password and proceed to the next section. If it asks you if you want to keep the system read only SAY NO! You will be modifying system components, keep it writable to avoid installation issues. Now to get your [deviceID] and to ensure you can reflash the original files in case of any issues with installing the kernel, in TWRP select Backup, check mark Boot, DTBO, and Vendor. Then create a backup. You can call it STOCK or whatever you'd like.

Step 4: [FLASHING THE M.O.D. KERNEL]
In the MOD-KERNEL-TOOLS zip file, unzip [TWRP-Restore]830GPUMaxReg-DynamicFsync-BOEFFLA-WL-Blocker.zip to internal storage: \TWRP\BACKUPS\[deviceID]\ or to an OTA SD card or USB drive with the same directory structure. This can be done from your PC directly once TWRP is booted - it should let you copy and paste to the internal device. Then click Restore, and click restore boot and dtbo. It is already patched with Magisk (you have root access). Next you need to install the fstab.qcom which will enable you to boot either EXT4 or F2FS. So flash the next zip file from the MOD-KERNEL-TOOLS file - copy fstab_patch_F2FS_MI9.zip to internal storage , select Install in TWRP, and flash the zip file. If you are on an unencrypted partition (very few, usually developers), use the fstab_patch_F2FS_unencrypted_MI9.zip instead. Now reboot and ensure you get back to your startup screen / welcome screen etc.

Step 5: [CONVERT EXT4 TO F2FS}:
Converting EXT4 data and cache partitions to F2FS:

***Note flashing TWRP / Install / fstab_patch_F2FS_MI9.zip MUST be repeated any time you change ROMs or you won't have access to your data!!! So back this up!!!!***

Boot back into TWRP. You will need to go to Wipe, Advanced Wipe, Click Data, Repair or Change File System, Change File System, and click F2FS. Swipe to change. It will format and you'll have nothing on your data partition. Next format cache. Go to Wipe, Advanced Wipe, Click Cache, Repair or Change File System, Change File System, now click F2FS. Swipe to change. Again it will format and be wiped.

Step 6: [SETTING UP YOUR "NEW" PHONE]:
Next, reboot to System. The device should boot up and welcome you to your "new" device. It has no data apps so it has to be new. You will have to login to your Xiaomi account if it is associated with the device. Then you can choose to restore from a Google Backup and next from Xiaomi Cloud. You can do either one to get your apps back. I would suggest Xiaomi Cloud after Google completes all its downloads - it will place icons in the right places and install your root apps if you had them. And after setting up your apps, now boot back to TWRP and make a Backup. Now for this Nandroid backup you should backup data, boot, dtbo, and vendor partitions (vendor has the fstab.qcom file that allows your F2FS supported partition to boot now). Even if you save to your internal device initially, be sure to put it on a PC for safe keeping. Then If you accidentally wipe your partition later, you can skip importing, get to the main screen after minimal setup completes, enable file transfer from the connected PC, and then copy the Nandroid backup to your Internal Memory. Boot into TWRP and restore the backup and you're back in business.

Step 7: [INSTALLING MAGISK MANAGER AND KERNEL MANAGER]:
So now you install the MagiskManager-v7.3.2.apk to enable all root functions. If you want Google Pay and anything else setup posts are here in the Mi9 forum that show you how. Generally hide all banking apps, trading apps, Google Pay, GMS, etc. And I suggest installing GMS doze for better battery life and the Mi9 Auto Brightness fix. Now for the best settings, go to Modules in Magisk Manager, click the + button, select and flash the included MOD-Kernel-Optimal-Settings.zip. This is the best setup for performance. Pictures are included below. EVEN THE GPU CLOCKS TO THE MAX 830MHZ NOW WITH NO KERNEL MANAGER INSTALLED!

If you would like to change the settings, you need a kernel manager. So next you can install the Smart Pack APK SmartPack_Kernel_Manager_v8.7.apk to enable or disable all the tweaks you desire.

Pictures are attached below to show the TWRP screens for flashing and F2FS partition conversion. Also the settings of best performance using Smart Pack kernel manager are here. If you want to change any of the best settings after flashing the Magisk Module, do it in the kernel manager of your choice and set on boot - where to change those options is in the pictures below for SmartPack.

Enjoy!

Links to XDA files included in the MOD-KERNEL-TOOLS_v2.zip:

Mauro TWRP
https://forum.xda-developers.com/Mi-...-mi-9-t3905825

SmartPack Kernel Manger
https://forum.xda-developers.com/and...nager-t3854717

FK Kernel Manager CPU Profile
https://play.google.com/store/apps/d...ernel&hl=en_US

Magisk
https://forum.xda-developers.com/app...mless-t3473445

Minimal ADB and Fastboot
https://forum.xda-developers.com/sho....php?t=2317790

And one last thing. I have been working with some of the most well known devs out there on XDA on Telegram, Private Messaging, and other channels to get this kernel where it is - but I have no XDA presence. I've helped hundreds of people on Telegram setup their systems or diagnose their issues. If you find this post useful, helpful, innovative, or install my kernel and like it, please click the Thanks button to acknowledge the work that I've done to get the Mi9 to this point. It would be greatly appreciated to get some thank yous for all the hours I've put into this development work for the Mi9, and provides some motivation to keep improving. Other kernels are on the way as well for more Xiaomi / Redmi devices if I feel some love from the community. Much appreciated!

Thanks goes out to @smeroni68 and @mauronofrio for helping fix the fstab.qcom zip that cost several hours of pain yesterday for users and I on Telegram that did not have the Vendor partition mounted when flashing the old fstab.zip file - it will flash now mounted or not from TWRP. And thanks to @ilia1985 for providing a Magisk Module template for the kernel manager settings, now OC setup doesn't even need a kernel manager!

***DISCLAIMER - APPLYING ANY ROOT MODS IS ALWAYS AT YOUR OWN RISK! I AM NOT RESPONSIBLE FOR BRICKED DEVICES, DAMAGE OR OTHER THAT MAY OTHERWISE OCCUR. THIS HAS BEEN TESTED EXTENSIVELY BUT USE AT YOUR OWN RISK***
Attached Thumbnails
Click image for larger version

Name:	TWRP_WIPE_Advanced.png
Views:	4136
Size:	91.6 KB
ID:	4809965   Click image for larger version

Name:	TWRP_Wipe_AdvancedWipe_RepairorChange_FileSystemCache.png
Views:	3974
Size:	81.7 KB
ID:	4809966   Click image for larger version

Name:	TWRP_Wipe_AdvancedWipe_RepairorChange_FileSystemData.png
Views:	3464
Size:	82.7 KB
ID:	4809967   Click image for larger version

Name:	TWRP_Wipe_AdvancedWipe_RepairorChangeFileSystem_ChangeFileSystem_Cache.png
Views:	3320
Size:	80.0 KB
ID:	4809968   Click image for larger version

Name:	TWRP_Wipe_AdvancedWipe_RepairorChangeFileSystem_ChangeFileSystem_Data.png
Views:	3288
Size:	79.3 KB
ID:	4809969   Click image for larger version

Name:	TWRP-Install-Image.png
Views:	3370
Size:	209.6 KB
ID:	4809970   Click image for larger version

Name:	TWRP-Install-ZIP.png
Views:	3332
Size:	181.0 KB
ID:	4809971   Click image for larger version

Name:	TWRP-Main.png
Views:	3284
Size:	74.4 KB
ID:	4809972   Click image for larger version

Name:	Screenshot_2019-08-23-08-48-11-928_com.smartpack.kernelmanager.jpg
Views:	3520
Size:	100.6 KB
ID:	4809977   Click image for larger version

Name:	Screenshot_2019-08-23-08-48-21-607_com.smartpack.kernelmanager.jpg
Views:	3450
Size:	96.4 KB
ID:	4809978   Click image for larger version

Name:	Screenshot_2019-08-23-08-52-55-684_com.smartpack.kernelmanager.jpg
Views:	3432
Size:	173.2 KB
ID:	4809979   Click image for larger version

Name:	Screenshot_2019-08-23-08-53-16-170_com.smartpack.kernelmanager.jpg
Views:	3300
Size:	159.1 KB
ID:	4809980   Click image for larger version

Name:	Screenshot_2019-08-23-08-53-56-484_com.smartpack.kernelmanager.jpg
Views:	3264
Size:	149.4 KB
ID:	4809981   Click image for larger version

Name:	Screenshot_2019-08-23-14-50-19-392_com.android.contacts.jpg
Views:	3230
Size:	100.6 KB
ID:	4809982   Click image for larger version

Name:	Screenshot_2019-08-23-14-50-24-518_com.miui.cit.jpg
Views:	3254
Size:	111.4 KB
ID:	4809983   Click image for larger version

Name:	Screenshot_2019-08-23-14-53-07-408_ru.andr7e.deviceinfohw.jpg
Views:	3308
Size:	162.0 KB
ID:	4809984   Click image for larger version

Name:	MOD_best_AnTuTu.jpg
Views:	3126
Size:	76.0 KB
ID:	4810456   Click image for larger version

Name:	Screenshot_2019-08-26-23-26-37-260_com.topjohnwu.magisk[1].jpg
Views:	2444
Size:	171.9 KB
ID:	4811573   Click image for larger version

Name:	Screenshot_2019-08-26-23-26-51-154_com.topjohnwu.magisk[1].jpg
Views:	2362
Size:	172.9 KB
ID:	4811574   Click image for larger version

Name:	MODKernel_Battery_Saver.jpg
Views:	1438
Size:	240.2 KB
ID:	4813906  
The Following 27 Users Say Thank You to mslezak For This Useful Post: [ View ] Gift mslezak Ad-Free
 
 
24th August 2019, 12:42 AM |#2  
hiperglyde's Avatar
Senior Member
Chattanooga, TN
Thanks Meter: 114
 
More
First.. that's the first time.

Huge thanks to the dev for their contribution!
The Following User Says Thank You to hiperglyde For This Useful Post: [ View ] Gift hiperglyde Ad-Free
24th August 2019, 02:10 AM |#3  
Junior Member
Thanks Meter: 0
 
More
Awesome work!

What does "miui based rom" mean?

Is Havoc OS miui based?
24th August 2019, 02:19 AM |#4  
hiperglyde's Avatar
Senior Member
Chattanooga, TN
Thanks Meter: 114
 
More
Quote:
Originally Posted by Troomak

Awesome work!

What does "miui based rom" mean?

Is Havoc OS miui based?


Nah, it's aosp
24th August 2019, 03:17 AM |#5  
Looks like it's base on last one version of android9 MIUI DEV 9.8.1 to modify its kernel, doesn't it ?
So it's not base on linux kernel 4.14.139 to develop ?

Kris
24th August 2019, 03:52 AM |#6  
OP Senior Member
Flag Houston
Thanks Meter: 115
 
Donate to Me
More
Quote:
Originally Posted by Kris Chen

Looks like it's base on last one version of android9 MIUI DEV 9.8.1 to modify its kernel, doesn't it ?
So it's not base on linux kernel 4.14.139 to develop ?

Kris

4.14.83 per the hardware device settings. Q is already upstreamed to the latest Linux and CAF so just waiting on a source release so kernels can be made. No need to spend time upstreaming unless another dev wants to (I'm in contact with the other kernel dev here on XDA we're working together now, he may upstream). He upstreamed his to 4.14.139 and will pull my source repo soon to fix bugs in his build so he may just upstream this kernel or fix bugs in his kernel in the process. Collaboration is a good thing. I've been waiting for assistance for a long time and it's good to team up with others devs. We don't get paid we do this as a hobby.
The Following 2 Users Say Thank You to mslezak For This Useful Post: [ View ] Gift mslezak Ad-Free
24th August 2019, 04:44 AM |#7  
Thanks !

Can I use Ex kernel manager to tune kernel parameters ?
In another one - Will there CPU/GPU frequency table exist to choose which one of frequency combination I want to use base on condition of phone usage - Gaming, multimedia application, and general usage !

Quote:
Originally Posted by mslezak

4.14.83 per the hardware device settings. Q is already upstreamed to the latest Linux and CAF so just waiting on a source release so kernels can be made. No need to spend time upstreaming unless another dev wants to (I'm in contact with the other kernel dev here on XDA we're working together now, he may upstream).

24th August 2019, 05:04 AM |#8  
OP Senior Member
Flag Houston
Thanks Meter: 115
 
Donate to Me
More
Quote:
Originally Posted by Kris Chen

Thanks !

Can I use Ex kernel manager to tune kernel parameters ?
In another one - Will there CPU/GPU frequency table exist to choose which one of frequency combination I want to use base on condition of phone usage - Gaming, multimedia application, and general usage !

Yes EX Kernel Manager is a good one to use. You will have to experiment with if it can lock in frequencies. Follow the guide for CPU settings they are optimal. You could by app adjust if needed and if it is supported by EX. Some support per app some don't. I think SmartPack does. The issue is that the 830gpu clock is an additional clock. The others are all stock clocks. This is for maximum battery life and compatibility. The highest 830GPU is only fully settable via dial code *#*#8106#*#* at this time - try in your ROM to see if it is supported. In some KM you can set max and min to 830mhz and it will lock in the frequency (FK) although this was only tested for 1 day on an unstable build (too hot thermals). More tests are needed, feel free to try and post what you observe.
The Following 2 Users Say Thank You to mslezak For This Useful Post: [ View ] Gift mslezak Ad-Free
24th August 2019, 05:12 AM |#9  
OP Senior Member
Flag Houston
Thanks Meter: 115
 
Donate to Me
More
Quote:
Originally Posted by hiperglyde

Nah, it's aosp

Many AOSP builds are still on Xiaomi underlying code. The test would be to install the TWRP mentioned and take a backup of boot and dtbo partitions. Stay on EXT4. Then flash the restore TWRP provided and see if it boots. I user has already made it to the logo screen on AOSP using this method. He is using an unencrypted partition though. If you are on an encrypted partition the likelihood of it working is higher. The TWRP is bootable from fastboot as well so you will be able to access recovery. Advise you save the backup to removeable media / computer before flashing. Report back your results please.
The Following User Says Thank You to mslezak For This Useful Post: [ View ] Gift mslezak Ad-Free
24th August 2019, 06:34 AM |#10  
Senior Member
Flag Christchurch
Thanks Meter: 24
 
More
Hey There.
I am trying to mount the fsqtab.qcom an do not get how to do it on my Mi9 using these directions?


The fstab.qcom included MUST be placed in /vendor/etc/ OR YOUR PHONE WILL NOT BE ABLE TO MOUNT THE DATA PARTITION!!!! So your next step is to copy the fstab.qcom via a root browser or from Minimal ADB and Fastboot. Boot to Recovery (hold power + volume up, release power button when the boot logo appears), then run from a terminal: adb push fstab.qcom /vendor/etc/fstab.qcom

How do you do whats listed above 'precisely'?

I can make everything else work. I just cannot seem to get this file inserted in Vendor?

Can you help please

(my profile says senior member but I am really not )
24th August 2019, 06:48 AM |#11  
*justintime*'s Avatar
Senior Member
Thanks Meter: 468
 
More
Great work!! Thanks for the kernel.

Any chance Kcal will be possible?
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