Jump to content

Xiaomi Mi 6 (xiaomi-sagit)

From postmarketOS Wiki
Revision as of 08:55, 4 November 2024 by LongnoseRob (talk | contribs) (change to MR template)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Xiaomi Mi 6
Xiaomi Mi 6
Xiaomi Mi 6
Manufacturer Xiaomi
Name Mi 6
Codename xiaomi-sagit
Released 2017
Type handset
Hardware
Chipset Qualcomm Snapdragon 835 (MSM8998)
CPU Octa-core (4x 2.45GHz Kryo 280 + 4x 1.9GHz Kryo 280)
GPU Adreno 540
Display 1920x1080 IPS LCD
Storage 64/128 GB
Memory 6 GB
Architecture aarch64
Software
Original software Android (MIUI)
Original version 7.1.1
postmarketOS
Category testing
Pre-built images no
Mainline yes
Features
Flashing
Works
USB Networking
Works
Internal storage
No data
SD card
No data
Battery
Works
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Works
Camera Flash
No data
Connectivity
WiFi
Works
Bluetooth
Works
GPS
Works
NFC
Works
Modem
Mobile data
No data
Miscellaneous
FDE
Works
USB OTG
Partial
HDMI/DP
No data
Sensors
Magnetometer
No data
Ambient Light
No data
Proximity
No data
Hall Effect
No data
Haptics
No data
Barometer
No data


Contributors

  • Hacker420
  • MayeulC
  • Illen
  • Degdag (mainlining)

Users owning this device


How to enter flash mode

  • Power + Volume Down buttons or use TWRP reboot bootloader, or adb reboot bootloader

Installation

Use pmbootstrap flasher.

Virtual terminal

Virtual terminal is broken in downstream, causing early reboot without logs in pstore. This patch is needed to make virtual terminal working properly.

Input

Touchscreen works well on gnome. All the buttons except for home button (which is is integrated with fingerprint scanner) are working.

Display

Seems to work well. Currently only xfce4 and mate and gnome have been tested.

USB OTG

Tested USB Hub with ethernet adapter, USB Audio device, and HID peripherals. Everything works well. NB: only on downstream, on mainline you need to use edk2 UEFI as a bootloader if you want OTG support

Mainline kernel

Here's a list of stuff that is currently (Linux 5.15.0-rc5) known to be working (in at least some capacity):

  • The kernel itself stays booted (i.e. no random panics) and is "stable"
  • UFS internal storage (CONFIG_PHY_QCOM_UFS=y)
  • Display (via Panel via JDI FHD R63452 (not on upstream yet))
  • Touchscreen using mainline RMI4
  • Xorg & Wayland (tested with MATE & Weston respectively)
  • Bluetooth
  • Power button
  • Volume up
  • Volume down
  • USB Networking
  • GPU
  • GPS
  • Haptics
  • WiFi
  • NFC


Check the links below for source code.

Building

It's easiest to build mainline (for pmOS anyway) with pmbootstrap, so get that setup and remember the install location (in this guide ~/pmOS/pmbootstrap is an example).

After you've run through the installation steps found on this site at least once please pmbootstrap extract & save the produced downstream boot.img to a known location as we'll reuse the initramfs found inside later.

Next start following the instructions below:

 git clone https://github.com/degdag/W.I.P_sagit_mainline.git
 cd W.I.P_sagit_mainline/
 source ~/pmOS/pmbootstrap/helpers/envkernel.sh     # adjust to match where you've cloned PMB yourself
 make sagit_defconfig
 make -j`nproc`

Boot image generation

Now that the kernel image and DTBs have been built we can assemble a bootable Android-friendly boot.img (assuming you're still in the root of the cloned kernel dir):

 pmbootstrap chroot -- apk add abootimg android-tools mkbootimg dtbtool
 export DEVICE=`pmbootstrap config device | cut -d'-' -f2` WORK=`pmbootstrap config work` PMOS_BOOT_IMG_PATH="~/pmOS/downstream-boot.img"
 export TEMP="$WORK/chroot_native/tmp/mainline/" DTB="$PWD/.output/arch/arm64/boot/dts/qcom/msm8998-$DEVICE.dtb"
 rm -r "$TEMP"; mkdir -p "$TEMP"
 cat .output/arch/arm64/boot/Image.gz "$DTB" > "$TEMP/Image.gz-dtb"
 cp "$PMOS_BOOT_IMG_PATH" "$TEMP/boot.img"          # replace "$PMOS_BOOT_IMG_PATH" with the known location of a pmOS downstream boot.img
 pmbootstrap chroot -- abootimg -u /tmp/mainline/boot.img -k /tmp/mainline/Image.gz-dtb -c "bootsize=67108864"

At this point you get to choose whether to boot the new kernel image or more "permanently" flash it on the device's boot partition instead ^^

Boot: pmbootstrap chroot -- fastboot boot /tmp/mainline/boot.img

Flash: pmbootstrap chroot -- fastboot flash boot /tmp/mainline/boot.img

Bootloader

An EDK-II port exists.

UART

The UART test point is 0.5 mm and is located on different sides of the motherboard. The default baudrate is 115200


Xiaomi Mi 6 bootloader logs

See also