This document is a guide for installing Ubuntu Linux on your Xiaomi Mi Pad 5 with the latest mainline kernel.
PLEASE READ SLOWLY AND CAREFULLY!! BE SURE TO UNDERSTAND THE ENTIRE GUIDE BEFORE STARTING!!
Don’t run all commands at once and don’t rerun the commands if you interrupt the process. You need to be familiar with command line interfaces beforehand and you must not commit any typo with any commands. You may permanently break your device!
Download images
You can get a copy of Ubuntu image in the "Download" section for free.
Download them and continue reading...
Partition the UFS
This procedure will not erase your Android data files, since Android will automatically fixing the userdata partition.
To modify the partitions on the UFS, we'll need to download a 3rd-party recovery environment called "Orangefox Recovery" Link is here below:
Once you've downloaded, open a terminal and type the following commands:
This will start booting recovery image. Once the screen is on, use the terminal to continue processing. We well use adb shell command to finish the rest of this guide. Enter this command in your terminal, it well help you to check the userdata partition's location:
ls-l/dev/block/bootdevice/by-name/|grepuserdatalrwxrwxrwx1rootroot161971-06-2205:04userdata ->/dev/block/sda31#Example output will like this.
In this example, the userdata partition is located in the 31st partition of the whole disk. It has the biggest size, compared with other partitions. So this is the key for requiring new space for our Ubuntu installation.
To resize the userdata partition, we'll need to use the parted command tools to do this. Now let's open adb shell again and start typing parted in the terminal.
Enter print command to list all partitions for /dev/block/sda :
If you are using newer recovery like TWRP or PBRP Recovery, you need to download parted and use adb command to copy it to internal storage. Run these commands to finish this:
Note the end of the last partition in the above list, 10.9GB, this number will be used as the start of the new userdata partition, followed by the end of the partition. Let say that we want to make an approx 40GB userdata partititon using the following command:
(parted) mkpartuserdata10.9GB50GBmkpart userdata 10.9GB 50GB #If you added "ext4" behind the "userdata" text, your data will be erased when you reboot.
Between userdata and 10.9GB are 3 spaces, one of them replace the partition type flag, it is important to use 3 spaces at this step.
Now userdata resizing is done. Restart your tablet to apply changes.
Here comes a fun thing:
Android stores your data inside the userdata partition. When you reset your Android device to its factory default settings, your data will be erased. This is because factory reset is equal to format the userdata partition using ext4 filesystem. However, if you delete the userdata partition and recreate it without formating, your data will be saved after a reboot. Probably because Android can fix this problem automatically.
If you added "ext4" behind the "userdata" text, your data will be erased when you reboot.
Now we need to check which slot Android is installed.
NOTE: The concept of "slot" probably unfamiliar for you, since it was included in Android 10 as a feature, which called "Dynamic Partitions". Dynamic partitions are a userspace partitioning system for Android. About its further infomations, located here.
You can check this infomation via fastboot . Command is listed below:
Now, we are ready to flash the system image. But before we start, we need to disable Android Verified Boot (AVB) feature, otherwise it will pervent booting Ubuntu system.
AVB is implementation of verified boot process, current version (since Android 8 Oreo) is called AVB 2.0. Verified boot is a process of assuring the end user of the integrity of the software running on a device. It typically starts with a read-only portion of the device firmware which loads code and executes it only after cryptographically verifying that the code is authentic. It also helps in implementing rollback protection.
More infomations and technical details, located here.
Flash the vbmeta with vbmeta_disabled.img to disable this feature: