arter97 Pie Software Collection for the Mi Pad 4

3,745 posts
Thanks Meter: 33,981
Post Reply Email Thread

arter97 Pie Software Collection for the Mi Pad 4

/* Summary */

Stock software stack on this Mi Pad 4 is horrendous and full of retarded junks top to bottom.
This is a project to replace most of the software stack on the Mi Pad 4.

This is done by reworking the entire kernel and the vendor image, and providing a custom TWRP recovery with f2fs support.

Please read the entire post to get an idea how to use as this ain’t like other ROMs/kernels on this forum.

(Please don’t quote this entire post and spam the thread.)

/* System */

You may use Android Pie-based GSI images. Oreo is not supported. MIUI is obviously not supported. (Are you f***ing serious?) Compatibilities between other source-built ROMs targeting clover(Mi Pad 4) specifically is not guaranteed and most likely to cause issues.

You can also use Paranoid Android for Mi Pad 4, which is recommended for best performance.

/* Kernel */

The kernel is fully rebased to the latest Pie CAF tag, which is a different base from the stock Oreo CAF tag, not to mention most of Xiaomi’s ultra-poor-quality codes are gone.

- To mitigate the horrendous touch latency, numerous touch panel optimizations were made.
- Mi Pad 4 is using eMMC instead of UFS. Numerous changes were made to improve its performance including the enforcement of f2fs filesystem and optimizations to CFQ I/O scheduler.
- 3/4 GB of RAM is quite insufficient these days. zram is activated with updated LZ4 compression algorithm to provide a better memory management along side revamped lowmemorykiller.
- Touch boost is set aggressively due to the reality of most ROMs lacking QPerformance. This improves responsiveness.
- Kernel module support is disabled to make it a bit lighter.
- WireGuard is supported.
- Automatically sets correct Android version and security level to prevent booting issues caused by keymaster.
- Double-tap-to-wake is enabled by default.
- A whole lot more that I forgot.

/* Vendor */

For the best compatibility with Pie ROMs, Pie vendor must be used. To make this happen, the entire vendor firmware is ported from the Mi A2. This process took me weeks to debug and make it stable to this point.

Since this is the only one of its kind on the Mi Pad 4, the software experience with this vendor image will be quite different from other ROMs.

Also, an overlay is integrated to give the correct corner overlay for rounded corners.

Unfortunately, it’s not bug-free, but way beyond usable. Bugs will be listed below.

/* Recovery */

As I said, f2fs is enforced. Reason for this will be explained below.
You must format your userdata partition(erasing everything on the device) to f2fs before using this project.

You cannot use existing TWRP for 2 reasons:
a) The TWRP kernel won’t support f2fs.
b) TWRP’s mkfs.f2fs tool is outdated.

A custom TWRP is also provided, powered by my kernel and the latest mkfs.f2fs tool. You must use it to format /data to f2fs before using this project.

/* Harmony */

The whole kernel and the vendor image is meant to be used together. If you mix one another(e.g. using my kernel on other vendor image or vice versa), you will definitely encounter issues. Please don’t.

To make the experience consistent and since you’re locked with the kernel/vendor combination anyways, I decided to force f2fs. Please be extremely cautious when you want to test out other kernels that claims to support f2fs. If the f2fs version isn’t inline with my kernel, you may experience random panics, or even worse - data corruption.

It’s extremely recommended for you to wipe the entire /data back to ext4 if you want to switch from using this project.

/* Instructions */

You must be familiar with fastboot.

- Download kernel, vendor and TWRP from the link below.
*.img.xz is for fastboot. Extract the .xz files before feeding it to fastboot. *.zip is for TWRP.
- Download an Android Pie based GSI of your choosing.
- Flash kernel by ‘fastboot flash boot /path/to/kernel/image’.
- Flash TWRP by ‘fastboot flash recovery /path/to/recovery/image’.
- Flash vendor by ‘fastboot flash vendor /path/to/vendor/image’. This process will take about 5 minutes(it took 275 seconds for me).
- Enter TWRP by ‘fastboot boot /path/to/recovery/image’.
- Do ‘Wipe > Format Data’. This will automatically wipe to f2fs.
- Follow the instructions you got from the GSI ROM developer and flash system image.
- Reboot.
- Leave feedback.

Note about Magisk

Due to a (supposed) Magisk bug with f2fs. You must flash Magisk after the first initial setup to avoid memory leaks(which ultimately causes the kernel to shutdown). After Magisk is installed, reboot again after confirming Magisk Manager is installed.

/* Disclaimer */

Your warranty is now void.
I am not responsible for bricked devices, dead SD cards, thermonuclear war, or you getting fired because the alarm app failed. Please do some research if you have any concerns about features included in this project before flashing it! YOU are choosing to make these modifications, and if you point the finger at me for messing up your device, I will laugh at you. Hard. A lot.

/* Warning */

I won’t be granting permissions to redistribute or extract files from this project to serve others, without actually contributing something to this project.
You will be reported to XDA forum moderators.

Making mirrors, re-uploading to another servers are also prohibited with no exceptions.

/* Thanks to */

jjajjaroni - for reporting bugs ahead of public release
nathanchance - for android-linux-stable

/* Downloads and links */
Kernel source

XDA:DevDB Information
arter97 Pie Software Collection for the Mi Pad 4, ROM for the Xiaomi Mi Pad 4

ROM OS Version: 9.x Pie

Version Information
Status: Beta

Created 2019-01-13
Last Updated 2019-03-07
The Following 58 Users Say Thank You to arter97 For This Useful Post: [ View ]
13th January 2019, 08:05 PM |#2  
arter97's Avatar
OP Recognized Developer
Flag Seoul
Thanks Meter: 33,981
Donate to Me
/* Bugs */

- Phone calls won't work
- Fingerprint sensor and GPS on the Mi Pad 4 Plus doesn't work

- For the Wi-Fi variant, the device may get confused and think it’s a phone. Not a big deal.
- Didn’t notice anything else.
The Following 16 Users Say Thank You to arter97 For This Useful Post: [ View ]
13th January 2019, 08:06 PM |#3  
arter97's Avatar
OP Recognized Developer
Flag Seoul
Thanks Meter: 33,981
Donate to Me
/* Changelog */

This update is made with Paranoid Android in mind.
Go checkout the updated Paranoid Android thread.
Vendor image:
Base firmware updated from V10.0.8.0.PDIMIXM to V10.0.10.0.PDIMIXM
Camera hacks removed and reworked to fix camera on many ROMs

Fixed a commit mismerge that broke deep-sleep
Linux v4.4.188 merged
Wi-Fi drivers updated to
Bunch of memory allocations from various subsystems were reworked to perform much better (thanks to Sultan)
32-bit vDSO added for improving performance on arm32 programs
Backported speculative page fault to improve system performance
Latest f2fs-stable merged
Switched to zswap/vnswap approach
- Ditched conventional zram swap approach and taken zswap+vnswap for more efficient memory operations
- Backported zsmalloc memory allocator from mainline
- Backported zswap compressed page cache from mainline
- Samsung's Galaxy S9 memory modifications merged for better swapping efficiency tuned for Android
- This new kernel's memory management will be drastically different from existing kernels

Vendor image:
Base firmware updated from V10.0.1.0.PDIMIFJ to V10.0.8.0.PDIMIXM
Added missing goodix touch firmware
General LTE network stability improvements

Various changes from Proton kernel by kdrag0n
- Use flatmem to save kernel memory usage
- Use optimized memcmp
- Optimize rbtree
- Disable erratum 843419 properly
- Delay vmstat updating interval to avoid jitter
- Disable I/O stat accounting completely for lower overheads
- Reverted a cpuidle change for possible fix for power consumption regression during sleep
- Faster crypto algorithms ported(chacha20, sha2, crc32)
A bit lower power consumption by using WFE for long delays
Add accelerated crc32 routines
Use -O3 for input drivers for avoiding overheads
Various changes made to f2fs rapid GC to make it more efficient
dirty_expire_centisecs set to 30 seconds to reduce flash wearouts and power consumption
Various changes merged from the Razer Phone 2 and Snapdragon 855
Kernel is now built with -O3 optimization flag
Use CONFIG_HZ = 300
- This changes context switching interval from 10ms to 3.33ms
- Pixel used this for years and Google recommends other vendors to do the same for fewer jitters
Removed RTB(interrupt) logging entirely
Wi-Fi drivers updated to
Linux v4.4.179 merged
ExFAT support added(ROM-side support required too)
Idle power consumption improved
Camera drivers stability improved
LA.UM.7.2.r1-06700-sdm660.0 merged
LV.HB.1.1.5-10310-8x96.0 merged
LA.HB.1.1.8-03910-8x96.0 merged

Fixed an issue causing kernel panics to enter dump mode
Fixed a f2fs merge durp causing issues from the recovery and potentially long-term performance on daily usage
RWSEM priority-aware enhancement merged from CAF
Added CIFS(SMB) support (requested by @currowth)
LA.HB.1.1.5-11310-8x96.0 merged (some minor bug fixes)

Paranoid Android breakage from 20190128 fixed

A totally new kernel base merged - LV.HB.1.1.5-10010-8x96.0
- Total of 471 commits and about 20,000 lines of code difference
- A lot has changed ranging from scheduler, memory management, GPU and panel handling, MMC device driver, ION, audio subsystem, cpuidle, binder and a whole lot more

Kernel configuration fixed for proper scheduler operation
Background Wi-Fi HAL scanning issue fixed
LA.UM.7.2.r1-05900-sdm660.0 merged
Linux v4.4.175 merged
Mainline f2fs fixes merged
WireGuard updated to 20190123
seccomp disabled in favor of less system-call overheads
Minor issue with f2fs rapid GC fixed
IRQ balancer settings updated to include MMC and USB interrupts for better overall smoothness

Bunch of stuffs missed from previous port were applied
Fixed video recording
Booting issues fixed for ROMs with 2019 security patch level
MTP fixed
Wi-Fi drivers' inconsistencies fixed
Merged Linux 4.4.172
Enabled ULPS for lower power consumption
Merged several changes from Sultan's kernel
- GPU performance improved with corrected priority
- Faster display wake-up
- Lower power consumption

Fixed an error causing Wi-Fi to not function for some users
Merged Linux 4.4.171
Disabled MMC SPI CRC for better eMMC performance
Removed brightness remapper to fix adaptive brightness
Compiler updated to GCC 2019.01

Initial release
The Following 9 Users Say Thank You to arter97 For This Useful Post: [ View ]
13th January 2019, 08:06 PM |#4  
arter97's Avatar
OP Recognized Developer
Flag Seoul
Thanks Meter: 33,981
Donate to Me
/* Fundraiser */

After consulting with 2 forum moderators, I got a clarification that fundraiser is acceptable with some terms like transparency and a rough timeline.

A fundraiser is opened for me to purchase a Mi Pad 4 Plus LTE. This particular variant was chosen since it's extremely likely for me to make Mi Pad 4 non-Plus LTE and Mi Pad 4 Plus Wi-Fi model supported during the process.
Within a month after the goal is met and the device is shipped, I'll work to make the current kernel and vendor image working on the Mi Pad 4 Plus LTE. After this is done, I anticipate other variants to be supported as well. In the unlikely event that it ends up otherwise, I'll work on some members on the community to get logs and test. It'll be way easier then since both LTE and fingerprint sensor will be working on my project.

While I will try my best to keep up with my goal, do note that it is entirely possible that it could not be done(which is extremely unlikely). You're making a donation after all. Just note that donation doesn't give you rights to force me to do anything with the received device.

The price for the lowest end Mi Pad 4 Plus LTE seems to be around $295 with a seller that would actually use DHL for shipment, which is required as the standard Ali-Express shipping usually takes 20~30 days.
There's another 10% importing tax in Korea on top of $295 which would make the total around $330. I've opened a fundraiser for $350 to avoid possible headaches like PayPal and bank's fee for withdrawing the money back to my credit card.

With that said, here's a fundraiser's link.
You can see the progress of the fundraiser as well.
The Following 6 Users Say Thank You to arter97 For This Useful Post: [ View ]
13th January 2019, 08:06 PM |#5  
arter97's Avatar
OP Recognized Developer
Flag Seoul
Thanks Meter: 33,981
Donate to Me
Reserved 4
The Following User Says Thank You to arter97 For This Useful Post: [ View ]
13th January 2019, 08:21 PM |#6  
arter97's Avatar
OP Recognized Developer
Flag Seoul
Thanks Meter: 33,981
Donate to Me
This device took an enormous amount of my time that it clearly didn't deserve.
The Following 16 Users Say Thank You to arter97 For This Useful Post: [ View ]
13th January 2019, 08:23 PM |#7  
stunned's Avatar
Senior Member
Thanks Meter: 341
To my knowledge Mipad4 will someday get MIUI Pie. Does that effect the vendor then or are you already decided sticking with ported one?
13th January 2019, 08:35 PM |#8  
arter97's Avatar
OP Recognized Developer
Flag Seoul
Thanks Meter: 33,981
Donate to Me
Originally Posted by stunned

To my knowledge Mipad4 will someday get MIUI Pie. Does that effect the vendor then or are you already decided sticking with ported one?

I'm certain that general experience will be still better with mine even after Mi Pad 4 gets official Pie release.

It'll allow me to fix some bugs though.
The Following User Says Thank You to arter97 For This Useful Post: [ View ]
14th January 2019, 01:06 AM |#9  
Senior Member
Thanks Meter: 68
Thanks arter. That is why I made a small donation to u knowing that u were working on clover.

Hope more people do the same to keep the motivation alive!

P.S. very nice thread title 😂
The Following User Says Thank You to xzr3b0rnzx For This Useful Post: [ View ] Gift xzr3b0rnzx Ad-Free
14th January 2019, 02:26 AM |#10  
Senior Member
Thanks Meter: 68
@arter97 few bugs i found

1)wifi seems to be broken, it's turning off by itself and can't find any networks. (broken on both PA & pixelexp GSI)
2)file transfer broken, only charging is permitted, it keeps going back to charging only (able to test only on PA, on Pixel experience GSI, cant get pass the WIFI set up)
14th January 2019, 04:28 AM |#11  
Senior Member
Thanks Meter: 41
Originally Posted by arter97

And since the vendor image is rebased, this means anything other than what I’ve used is not supported.
Mi Pad 4 LTE, Mi Pad 4 Plus, Mi Pad 4 Plus LTE model is not supported. Only Mi Pad 4 Wi-Fi model is supported.

Hope you will have time and possibility to support mi pad 4 plus version in near future nice done.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes