Jump to content

Xiaomi Pad 6 (xiaomi-pipa)

From Nura Wiki
Xiaomi Pad 6
Xiaomi Pad 6 running GNOME with a mainline kernel
Xiaomi Pad 6 running GNOME with a mainline kernel
Manufacturer Xiaomi
Name Pad 6
Codename xiaomi-pipa
Released 2023
Type tablet
Hardware
Chipset Qualcomm Snapdragon 870 (SM8250-AC)
CPU Octa-core (1x3.2 GHz Kryo 585
3x2.42 GHz Kryo 585
4x1.80 GHz Kryo 585)
GPU Adreno 650
Display 1800 x 2880 (144Hz 11.0" IPS LCD)
Storage 128/256 GB
Memory 6/8 GB
Architecture aarch64
Software
Original software
The software and version the device was shipped with.
Android 13
Extended version
The most recent supported version from the manufacturer.
Android
FOSS bootloader partial
Nura
Category testing
Mainline
Instead of a Linux kernel fork, it is possible to run (Close to) Mainline.
yes
Unixbench score
Unixbench Whetstone/Dhrystone score. See Unixbench.
9461.5
Device package device-xiaomi-pipa
Kernel package linux-xiaomi-pipa
Firmware package firmware-xiaomi-pipa
Features
Flashing
Whether it is possible to flash the device with pmbootstrap flasher.
Works
USB Networking
After connecting the device with USB to your PC, you can connect to it via telnet (initramfs) or SSH (booted system).
Works
Internal storage
eMMC, SD cards, UFS...
Works
Battery
Whether charging and battery level reporting work.
Works
Screen
Whether the display works; ideally with sleep mode and brightness control.
Works
Touchscreen
Works
Stylus
Works
Multimedia
3D Acceleration
Works
Audio
Audio playback, microphone, headset and buttons.
Works
Camera
Partial
Camera Flash
Works
Connectivity
Wi-Fi
Works
Bluetooth
Works
Miscellaneous
FDE
Full disk encryption and unlocking with unl0kr.
Works
USB OTG
USB On-The-Go or USB-C Role switching.
Works
HDMI/DP
Video and audio output with HDMI or DisplayPort.
Works
Sensors
Accelerometer
Handles automatic screen rotation in many interfaces.
Partial
Ambient Light
Measures the light level; used for automatic screen dimming in many interfaces.
Partial
Hall Effect
Measures magnetic fields; usually used as a flip cover sensor
Works
U-Boot
Primary Bootloader
Whether it is possible to replace stock bootloader with U-Boot.
Broken
Secondary Bootloader
Whether it is possible to chainload U-Boot from stock bootloader.
Works
Mainline
Whether latest upstream versions of U-Boot are not broken and it is possible to use them.
Works
Internal Storage
Whether it is possible to boot from internal storage (e.g. eMMC or UFS).
Works
USB Host
Whether it is possible to boot from a USB storage or connect a keyboard.
Broken
USB Peripheral
Whether it is possible to use device as a peripheral in U-Boot, e.g. for fastboot mode.
Broken
Display
Works
Buttons
Whether it is possible to navigate in boot menu or grub with volume and power buttons.
Works

How to enter flash mode

  • Fastboot: Power on the device by holding down Power and Volume Down.
  • Recovery: Power on the device by holding down Power and Volume Up. (Only for Android, will not work after installing Nura.)

Preparation

Unlock the bootloader

Notice If you are still on MIUI 14, don't update to HyperOS before unlocking, as it will make the process much harder.

Unlocking_Bootloaders#Xiaomi

Boot a custom recovery once

You will have to boot a custom recovery once to identify your panel variant and create a backup of the current OS. Download the Orange Fox Recovery Project image for xiaomi-pipa and rename it to recovery.img. Reboot into fastboot mode and start the recovery:

$ fastboot boot recovery.img

Identify your panel variant

This device uses one of two display panels: CSOT or Tianma.

$ adb shell grep -o 'msm_drm[^ ]*' /proc/cmdline

The output will be one of the following. Remember your panel variant and select the correct option during pmbootstrap init.

CSOT
msm_drm.dsi_display0=qcom,mdss_dsi_m82_42_02_0b_dual_dphy_video:
Tianma
msm_drm.dsi_display0=qcom,mdss_dsi_m82_36_02_0a_dual_dphy_video:

Back up the existing OS

You may want to back up the existing operating system in case you decide to go back later.

$ adb pull /dev/block/by-name/super super.img
$ adb pull /dev/block/by-name/boot_a boot_a.img
$ adb pull /dev/block/by-name/boot_b boot_b.img
$ adb pull /dev/block/by-name/dtbo_a dtbo_a.img
$ adb pull /dev/block/by-name/dtbo_b dtbo_b.img

Erase the DTBO

Reboot into fastboot again and erase the device tree overlay (dtbo) partition of the current boot slot. If it is not erased, mainline Linux will not boot at all.

$ fastboot erase dtbo

Installation

U-Boot

U-Boot should be installed to the Android boot partition as a secondary bootloader. It provides UEFI for booting Linux. You can build it by following the guide below.

Set up a build environment with common utilities (fastboot, make, mkbootimg, etc.) and an aarch64 cross compiler. Below example is for Alpine Linux and derivatives.

# apk add android-tools build-base gcc-aarch64-none-elf bison flex openssl-dev gnutls-dev

Clone upstream U-Boot source and cd into it.

$ git clone --depth=1 https://source.denx.de/u-boot/u-boot.git
$ cd u-boot

Patch qcom-phone.env to map subpartitions in userdata during preboot stage.

$ sed -i "s/^preboot=.*\$/preboot=scsi scan; part start scsi 0 userdata userdata_start; part size scsi 0 userdata userdata_size; blkmap create root; blkmap map root 0 0x\${userdata_size} linear scsi 0 0x\${userdata_start}/" board/qualcomm/qcom-phone.env

Make default qcom configs as .config. Enable blkmap and set the device tree.

$ make qcom_defconfig qcom-phone.config
$ ./scripts/config --enable CONFIG_BLKMAP --enable CONFIG_CMD_BLKMAP
$ ./scripts/config --set-str CONFIG_DEFAULT_DEVICE_TREE "qcom/sm8250-xiaomi-pipa"

Build a U-boot binary that can be flashed to the device.

$ CROSS_COMPILE=aarch64-none-elf- make -j$(nproc)
$ gzip -f u-boot-nodtb.bin
$ cat u-boot-nodtb.bin.gz u-boot.dtb > u-boot-xiaomi-pipa.bin
$ mkbootimg --kernel u-boot-xiaomi-pipa.bin -o u-boot-xiaomi-pipa.img

Flash the built image with fastboot and reboot.

$ fastboot flash boot u-boot-xiaomi-pipa.img
$ fastboot reboot

Nura

Warning WARNING: Never use pmbootstrap flasher flash_kernel, even if pmbootstrap suggests you to do so. It will overwrite U-Boot and make the device unbootable.

Pre-built images are not available at the moment. Follow the installation guide with pmbootstrap. Below are the examples for building your own image.

If you don't like having full-disk encryption, omit --fde.

$ pmbootstrap init
$ pmbootstrap install --fde

Reboot into fastboot mode and flash the rootfs:

$ pmbootstrap flasher flash_rootfs

Reboot into Nura:

$ fastboot reboot

Current status of features

Notice If you would like to help upstream the patchset, please join #sm8250-mainline:matrix.org. Thanks!

The upstream dts from torvalds/linux is very basic. Only core features like USB networking and UFS work. For this reason, we currently package a close-to-mainline kernel. It is built on the latest stable release from https://kernel.org, with out-of-tree patches. Ideally, all these patches should be sent upstream, so that any generic aarch64 distribution can boot.

Component status

This is the status of the git source tree. In most cases, you may need to build the kernel from source to get all features working as described below.

Component Model Mainline (https://kernel.org) Close-to-mainline (linux-xiaomi-pipa)
SoC Qualcomm SM8250-AC Snapdragon 870 Y Y
Power button pm8150 Y Y
Volume down pm8150 Y Y
Volume up GPIO6 Y Y
Display Novatek NT36532 Y
Touchscreen Novatek NT36532 Y
Backlight Kinetic KTZ8866 Y Y
GPU Adreno 650 Y Y
UFS Internal storage UFS 3.1 (SKhynix) Y Y
Main camera OmniVision OV13B10 (13MP) Y
Wide camera Sony IMX563 (12MP)
Front camera SK Hynix Hi-846 (8MP)
Camera flash pm8150l_flash Y
Audio codec Awinic AW88261 Y
Sound qcom,sm8250-sndcard Y
Microphones WCD9380 Y
WiFi Qualcomm QCA6390 (WiFi-6 802.11ax) Y
Bluetooth Qualcomm QCA6390 (BT 5.1) Y
Accelerometer, Ambient light sensor Qualcomm Hexagon DSP P
Hall Effect Sensor GPIO110 Y
Fuel gauge pm8150b_fg Y
Charger pm8150b_charger Y
Fast charger bq2597x-standalone Y
USB OTG pm8150b_typec Y

Partial features

Camera

The rear camera works, but its quality is poor.

Accelerometer, Ambient light

These sensors are connected via the Qualcomm Hexagon DSP. In older kernels, they usually work after boot but break later. As a workaround, you can restart the service:

$ sudo systemctl restart hexagonrpcd-sdsp

Troubleshooting

HDMI/DP monitor not detected

Disconnect the monitor from the power supply before connecting the HDMI cable.

Settings opens slowly in Phosh

The Settings app in Phosh opens slowly because it attempts to access a modem via rmtfs.service. As a workaround, you can mask it:

$ sudo systemctl mask rmtfs

Unbrick after using qbootctl

Using qbootctl to switch the ABL boot slot from userspace can cause a brick, leaving the device stuck in an endless fastboot loop. Fortunately, it is possible to unbrick without using EDL by downloading the Xiaomi fastboot firmware archive (usually a .tgz file) and reflashing the GPT partition blobs inside images/:

$ fastboot flash partition:1 gpt_both1.bin
$ fastboot flash partition:2 gpt_both2.bin
$ fastboot flash partition:3 gpt_both3.bin
$ fastboot flash partition:4 gpt_both4.bin
$ fastboot flash partition:5 gpt_both5.bin
$ fastboot reboot

Photos

Contributors

Users owning this device

See also