Guide-Linux-Nabu/guide/English/prepare-en.md

120 lines
3.1 KiB
Markdown
Raw Normal View History

2024-01-15 17:08:16 +00:00
<img align="right" src="../../assets/nabu.png" width="425" alt="Linux Running On A Xiaomi Pad 5">
# Running Linux on the Xiaomi Pad 5
2024-01-15 18:35:43 +00:00
## Preparing your device [→](install-en.md)
2024-01-15 17:08:16 +00:00
### Prerequisites
- Brain
2024-01-15 18:26:50 +00:00
- [Vbmeta image](https://github.com/timoxa0/Guide-Linux-Nabu/releases/download/v0.0.1/vbmeta_disabled.img)
2024-01-15 18:19:20 +00:00
2024-01-15 18:26:50 +00:00
- [Recovery Image](https://github.com/timoxa0/Guide-Linux-Nabu/releases/download/v0.0.1/orangefox.img)
2024-01-15 17:08:16 +00:00
- [ADB & Fastboot](https://developer.android.com/studio/releases/platform-tools)
### Notes:
> [!Warning]\
> All your data will be erased! Backup now if needed.
>
> These commands have been tested.
>
> Ignore `udevadm` warnings
>
2024-01-15 18:56:34 +00:00
> Do not run the same command twice
2024-01-15 17:08:16 +00:00
>
> Do not run all commands at once, execute them in order!
#### Flash vbmeta_disabled.img via fastboot
2024-01-15 18:19:20 +00:00
```sh
2024-02-19 13:15:07 +00:00
fastboot flash vbmeta_ab <vbmeta_disabled.img>
2024-01-15 17:08:16 +00:00
```
2024-02-19 13:15:07 +00:00
> Replace <vbmeta_disabled.img> with path to vbmeta_disabled.img
2024-01-15 17:08:16 +00:00
#### Boot Orange Fox recovery through PC
```sh
fastboot boot <recovery.img>
```
2024-02-19 13:15:07 +00:00
> Replace <recovery.img> with path to recovery.img
2024-01-15 17:08:16 +00:00
#### Start ADB shell
```sh
adb shell
```
#### Unmount all partitions
```sh
twrp unmount /data
```
#### Resize partition table
```sh
sgdisk --resize-table 64 /dev/block/sda
```
#### Run parted partition editor
```sh
parted /dev/block/sda
```
#### List partitions with `print` and remember userdata number
```
...
31 10.9GB 126GB 126GB userdata
...
```
> In this cae userdata has number 31
#### Remove userdata with `rm <номер>`
> If userdata has number 31, command looks like `rm 31`
#### Create userdata partition
- Calculate userdata size using equation: X = 10.9 + [userdata size in GB]
- Run command `mkpart userdata ext4 10.9GB XGB` (replace X with calculated vaule)
> If userdata size is 16 GB, then X = 10.9 + 16 = 26.9 \
> So command is `mkpart userdata ext4 10.9GB 26.9GB`
2024-02-19 13:57:55 +00:00
#### Create efi partition
```
mkpart esp fat32 XGB YGB
```
> Replace X with value calculated in prevous paragraph \
> Replace Y with X+1 \
> If userdata size is 16 GB, then command is `mkpart esp fat32 26.9GB 27.9GB`
2024-02-19 14:01:02 +00:00
#### Create partition for linux
- for 128 GB model: `mkpart linux ext4 YGB 126GB`
- for 256 GB model: `mkpart linux ext4 YGB 254GB`
> Replace Y with X+1 \
> If userdata size is 16 GB, then command is \
> `mkpart linux ext4 27.9GB 126GB` for 128 GB model \
> `mkpart linux ext4 27.9GB 254GB` for 256 GB model
2024-02-19 13:52:18 +00:00
#### Quit from parted
```
quit
```
#### Format created ESP patition
```
2024-02-19 14:01:02 +00:00
mkfs.fat -F32 -s1 /dev/block/sda32 -n ESPNABU
2024-02-19 13:52:18 +00:00
```
2024-02-19 14:01:02 +00:00
#### Выйдите из консоли recovery
2024-02-19 13:53:33 +00:00
```
exit
```
2024-02-19 13:15:07 +00:00
#### Create dtbo backup
```
2024-02-19 13:21:04 +00:00
adb shell "dd if=/dev/block/platform/soc/1d84000.ufshc/by-name/dtbo$(getprop ro.boot.slot_suffix) of=/tmp/normal_dtbo.img"; adb pull /tmp/normal_dtbo.img
2024-02-19 13:15:07 +00:00
```
> Backup will be saved to current directory
2024-01-15 17:08:16 +00:00
#### Check if Android still starts
2024-02-19 13:21:04 +00:00
Just restart the tablet, and see if Android still works. If isn't boot or looping or animation, wipe data in recovery.
2024-01-15 17:08:16 +00:00
### [Next step: Installing Linux](/guide/English/install-en.md)