Debloating Xiaomi Mi Max

After finally having my bootloader unlock request granted, I recently went on a ROOT and ROM spree with my Xiaomi Mi Mix. Initially I started with the ROMs which are supposedly less heavy and bloated compared to the Xiaomi natives. Whilst this is true, there is still a lot of bloat in them which I really do not need. I’m not Chinese and I do not rely on any of the Xiaomi apps, so I’ve compiled a list of all apps I removed that didn’t kill the phone:

  • Notes
  • Bookmark Provider
  • Mi Remote
  • UniPlay Service
  • Wallpaper Carousel
  • Weather
  • Weather Provider
  • Yellow Pages
  • Browser
  • Cloud Print
  • Gboard
  • Mail
  • App Vault
  • Cleaner
  • com.miui.antispam
  • Direct Service
  • Content Catcher
  • Documents
  • Feedback
  • FM Radio
  • Hybrid Accessory
  • Music
  • Screen Recorder
  • Secure Spaces Agent
  • DO NOT DELETE!!!! Security
  • Security Core Component
  • DO NOT DELETE!!!! Security Service Plugin
  • SpacesCore
  • SpacesManagerService
  • com.xiaomi.joyose
  • Scanner
  • Mi Drive
  • Mi Cloud
  • Mi Cloud Backup
  • Hardware Tests
  • Android System Webview

Hope this helps someone (probably just me…) when debloating their Xiaomi device. It really does help reduce RAM consumption, almost to stock Android 7 level… but not quite

Anyhow, my ROM adventures have brought me to XenonHD and I have to say, this is now my favourite ever ROM. So stock and clean, but with some handy customizations that really make the Mi Max a pleasure to use again.

Use ‘Compact’ utility to save space & boost performance

SSDs are great, aren’t they? Super-fast and very reliable. But they’re also very expensive for relatively small sizes when compared to hard disks. I mean, a 1TB SSD is around the same price as a 6TB HDD! Saving as much space as possible, whilst retaining high levels of performance, is an ultimatum in anyone’s book; and that’s exactly what we’re going to achieve today.

First, the requirements! You need to be running Windows 10, and ideally the latest build, to get the best performance and reliability. You need to understand this is a risky job and your data could be corrupted or otherwise lost. And, you could fuck it up entirely and require an OS reinstall. Assuming you’re good…

  1. Launch Command Prompt with administrative privileges
  2. cd “c:\your\directory\here” to the place you want to compress
  3. compact /c /s /a /f /q /i /exe:xpress16k *

Basically what we’re doing here is using the new Compact utility to compress files on your drive – in the same way as NTFS compression. Except, we’re using newer compression algorithms that save more space and potentially increase performance over NTFS. It might take a while to complete. There are lots of flags available but these are the best I’ve found. If you want to experiment, type compact /? at the command line to see the juicy details.

There’s also a CompactGUI which is, as of typing, in development and not quite production ready yet. But it’ll be good, quick and easy to use in future!

Nameserver hosting – Two IPs per NS A record?

This crazy mind of mine was wondering whether it was technically possible to have two IPs per NS record, when hosting DNS data. Example:
Pointing to nameservers:

Crude example, but hopefully you get the point. points to ns1 and whose corresponding A records return multiple IPs.

But what about GLUE? How can, assuming that its nameservers are “itself,” use multiple IPs on GLUE records? Well, GLUE records are basically just another DNS record type in their own right. There aren’t any specific RFCs I can find that say you can’t use more than 1 IP for a GLUE record; but that does not mean to say you necessarily should and whether it would even work!

But wait – I found an example in the wild!

;; ANSWER SECTION: 172800 IN A 172800 IN A


dig ns
;; AUTHORITY SECTION: 172800 IN NS 172800 IN NS 172800 IN NS 172800 IN NS 172800 IN NS

;; ADDITIONAL SECTION: 172800 IN A 172800 IN A 172800 IN AAAA 2001:630:0:8::14 172800 IN AAAA 2001:630:0:9::14 172800 IN A 172800 IN AAAA 2001:630:0:44::e2 172800 IN A 172800 IN AAAA 2001:630:0:45::11 172800 IN A 172800 IN AAAA 2001:630:0:47::42

So, yeah, have multiple I records for and they are pointing back themselves. Their GLUE records are reflecting those multiple IPs for ns0, and the domain is fully resolvable over many DNS clients without throwing any issues or errors.

As I say, I’m not sure of the legalities of such setup, so to speak, but it’d be an interesting way to add redundancy to an existing set of nameservers without mass updates – providing it works!

Fixing broken LTE / 4G / 3G networking on Mediatek devices

Recently, after swapping SIM cards and then not being patient long enough to allow LTE to connect, I made the mistake of changing ‘Set preferred network type’ in Android settings. It was already selected on 4G, but I chose 3G thinking I could swap back to 4G and force it… but boy was I wrong!

For some reason, especially on UMI or UMIDIGI handsets, once you change this setting in a dual-SIM phone it ‘locks’ the network type and you’re unable to change it. For me, going back into that list would only ever show 3G. I couldn’t even see or select 2G.

I followed a guide to enter ‘Testing’ mode (entering *#*#4636#*#* in the dialler), then Phone Information, and using the dropdown under the statistics to change the network band. This does not work. The Mediatek background network service overrides this setting so it is useless.

But after searching forums for hours, I eventually found a solution, props to this post on Giffgaff forums.

  1. Open dialler
  2. Enter *#*#3646633#*#*
  3. Under Telephony tab, scroll to Network Selecting
  4. Choose the applicable SIM card number, if more than 1
  5. Select ‘4G/3G/2G(auto)’  as the network type
  6. Wait a moment for network to reconnect – fixed

Another useful hidden menu is ‘Testing’ mode, which is accessed through *#*#4636#*#*

Intel Kaby Lake experience and thoughts so far

I’ve used three Kaby Lake systems so far, two of which I’ve built. Not too sure about the platform. I’ll split this into two parts, about a mobile “U” series CPU and two desktop series CPUs.

1. Mobile Kaby Lake CPUs

This is where I feel Intel are lightyears ahead of AMD and spot on the mark. I’ve a Dell Inspiron 1560 (a cheaper XPS 15, basically) powered by Intel Core i7 7500U (2.7GHz / 3.5GHz turbo) 16GB DDR4 2400MHz RAM, 256GB mSATA + 1TB 2.5″ SSDs. This machine was a replacement for my older Gigabyte P34w v3, a Core i7 “Haswell” quad core at 2.6GHz / 3.6GHz turbo, 16GB DDR3 1866MHz RAM and 1TB 2.5″ SSD.

1.1 Haswell quad core vs. Kaby Lake dual core?

Elephant in the room. I downgraded from a quad to dual core CPU. Yes, I lost quite a lot of CPU power… But I’m totally okay with it!

Core i7 4720HQ gets a CPU Benchmark score of 8030
that’s a single core score of 1915

Core i7 7500U gets a CPU Benchmark score of 5246
that’s a single core score of 1942

Straight away we can see I’ve lost 1/3rd of performance from my laptop “upgrade” but on the other hand; I’ve only lost 1/3rd of performance by halving my core count. Plus, my single core speed is a smidgen higher now!

1.2 Real-world non-gaming performance

Directly comparing my Haswell i7-4720HQ to the Kaby Lake i7-7500U, my day-to-day performance is faster. I have less cores, but with refined instruction sets and shrunken dies (22nm vs 14nm) those cores are now much faster. I have the same amount (16GB) of RAM, but again DDR3 1866 vs DDR4 2400 it’s much faster. Interestingly, RAM latency is a little higher but it doesn’t seem to make a difference. Web browsing in Chrome is massively improved when compared side-by-side and I feel that has a lot to do with the single-core/single-thread performance of actually processing the page content. The Kaby Lake on-chip graphics is much faster than the Haswell, which probably helps here too.

Both Gigabyte and Dell laptops have discrete video cards in them. The Gigabyte has a still-to-this-day mammoth GTX 970M with 3GB GDDR5 and I’m sure it sings like a choirboy during games, but let me tell you, Nvidia Optimus forcing Chrome onto this GPU fucking sucks. Chrome just crawls. GPU-Z shows much higher GPU load than comparable with the Intel on-chip. Same with the Dell, which has a GeForce 940MX. So always, always use Intel graphics for web browsing.

1.3 Graphics performance

The Intel HD 620 graphics on the Kaby Lake effortlessly plays back every type of video content I’ve tried, all the way up to 4K HD H.265 videos. Video playback is cool and quiet – the fan doesn’t spin up at all. Trying the same 4K HD video on the Haswell quad core quickly leads to noisy fan syndrome although the video plays smoothly. FWIW, I always use PotPlayer.

Video encoding is great with Kaby Lake, too; Handbrake can use QuickSync to quicken H.265 encoding and it really does fly. Fastest encoding of H.265 I’ve ever seen so far. It beats my Ryzen 7 1800X by about 4x speed!

1.4 Power consumption & thermals

This is the interesting part! I have to say, I’m astonished at how far Intel have come with Kaby Lake mobile CPUs. The 7500u is a 15w TDP chip, and Dell have a reasonably meaty heatsink on this thing. Crazy part? The fan hardly ever spins up! Typical usage; Chrome, Spotify/Winamp, Mail client, Skype, Slack, IRC, Notepad++, Word (or some productivity). I have CoreTemp running in the tray to monitor temps and frequencies. I turbo to the full 3.5GHz a lot, and my temperatures sit typically 45-55C. Fan kicks in if >70C for 3 seconds, or >60C for 10 seconds. This rarely ever happens – probably less than 5% of the time.

Right now, with all of the above applications (plus a few more) open, writing this blog, listening to music, my power consumption for the whole CPU package (that’s CPU cores, GPU, Uncore (Northbridge) and RAM) is hovering 2.1w-3.4w of power. I’m really sorry but how the fuck?! Intel, I bloody love you! I don’t know how this is possible but I can’t smile enough at how cool and quiet Kaby Lake laptops are!

When you’re flogging the CPU, i.e. batch encoding music, the power consumption sits “flat” at 15w and I almost always see full turbo of 3.5GHz on both cores. Prime95 sees the same 15w flat power consumption, but clock speeds vary between 2.9GHz-3.1GHz. Thermals are awesome; the fan runs of course, but it’s quiet, and the CPU stays under 75C at all times. The fan isn’t noticeable and the laptop as a whole is cool to the touch, even directly under/over the CPU area. Using it on a lap vs desk doesn’t make any difference, it’s still cool and quiet.

2. Desktop Kaby Lake CPUs

Separate section here because ultra-mobile vs desktop CPUs are obviously very different animals. The ultra-mobile CPUs are built with every possible power saving method in mind, rather than squeezing the maximal performance out of a chip.

2.1 Kaby Lake desktop in 1u rackmount servers?

Yes, it’s true. I’ve built two 1u Kaby Lake “servers” now, simply because the comparable Xeon performance isn’t anywhere near the same price range, plus right now, Kaby Lake Xeon chips cannot be bought for love nor money.

Xeon E3-1270 v5 @ 3.6GHz / 4.0GHz turbo
Built on Skylake, 80w TDP, 8MB cache, 64GB DDR4 max. Non-ECC
CPU Passmark multi core 10186, single core 2138
Total price inc. CPU, board, RAM, SSDs, chassis, PSU = £1982

Intel Core i7 7700 @ 3.6GHz / 4.2GHz turbo
Built on Kaby Lake, 65w TDP, 8MB faster cache, 64GB DDR4 max. Non-ECC
CPU Passmark multi core 10787, single core 2327
Total price inc. CPU, board, RAM, SSDs, chassis, PSU = £1622

It’s £360 cheaper to build a system with newer, faster and lower power components. It’s not “server” grade, but neither is the Xeon E3 series if we’re honest, since it does not accept ECC RDIMM modules. Do not be fooled by ECC UDIMM; they are Unbuffered, not Registered, so you don’t get the true benefits of ECC.

2.2 Kaby Lake thermal performance

Although power consumption is a concern when we’re talking racks on racks of servers, the home user doesn’t care much about this. Nonetheless, I can confirm, the actual power draw between Xeon E3 v5 (Skylake) and i7 Kaby Lake chips are as-good-as identical. I tested idle consumption vs load and they vary by <5 watts. Thermal output and handling is a total different story however.

Choose your Kaby Lake motherboard wisely! Testing two 1u rackmount builds with the same chassis, same power supply, same RAM, same heatsink had a massive difference of temperatures between different motherboards.

Asus PRIME B250M-PLUS with Core i7 7700
33C idle, 94C full load with Prime 95

ASRock Fatal1ty Z270 Gaming K6 with Core i7 7700
29C idle, 81C full load with Prime 95

That’s right. It’s crazy! Both running latest BIOSes and I even swapped the CPUs between the machines, but it made no difference. Why? Because the Z270 board has masses of power filtering around the CPU and the B250M-PLUS has very little. The power is properly regulated and very clean on the ASRock board compared to the ASUS one. Make sure you spend a little extra on a decent board, especially if you’re thinking about overclocking!

2.3 Kaby Lake i7 vs. Xeon E3 v5 performance

I did quite a lot of testing here to gather real world performance of a server environment between the desktop i7 versus “server” E3 chips.

MySQL performance
I imported the same large 8.9GB MySQL database onto a VM on both servers. The VM image was the same and the test was repeated twice and averaged.
Intel Xeon E3-1270 v5 – MySQL import took 434 seconds
Intel Core i7 7700 – MySQL import took 392 seconds

PHP performance
Using the same VM image, I ran a test generating 50,000 PHP queries to be handled by the CMS. Same image, same configuration, just different hardware.
Intel Xeon E3-1270 v5 – 188 PHP requests per second
Intel Core i7 7700 – 201 PHP requests per second

For the detail dudes out there; same RAM modules & speed, same SSDs, same RAID config, CentOS host nodes, both same OS version, same kernel. KVM virtualisation with stock settings. KVM CPU tuned to ‘passthrough’ and 8 cores to match host node. Identical VM image clone, same MySQL and PHP-FPM configuration on both servers. No other VMs running. The difference is purely from architecture.

3. Final thoughts on Kaby Lake?

It’s good! Buy one! Intel are progressing nicely, much better than AMD (sorry fanboys, but it’s fucking true!).

Mobile chips, especially the ultra mobile series, are just mindblowing. I can’t understand how they’re so quick and snappy yet run so cool! Even though I had a “downgrade” from quad to dual core, there’s nothing I can’t do on the dual core that I could on the quad, and daily tasks are faster when I take the two machines side by side.

Desktop, meh, same thermal performance compared to Skylake although my benchmarks show they are faster at the same power/thermal usage. So I guess we’re making progress there, too. It’d be nice to see the same kind of breathtaking low power consumption when idle on the desktop chips, but I do understand that’s not what they’re made for. Still, Intel, help us save the earth ey! 🙂