Jump to content

Xiaomi Mi 9 (xiaomi-cepheus): Difference between revisions

From postmarketOS Wiki
No edit summary
Remove dead links
 
(20 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[[Category:Devices with known UART pinout]]
{{Infobox device
{{Infobox device
| manufacturer = Xiaomi
| manufacturer = Xiaomi
| name = Mi 9
| name = Mi 9
| codename = xiaomi-cepheus
| codename = xiaomi-cepheus
| image = File:xiaomi-cepheus.jpg
| image = File:Xiaomi-cepheus-netboot.jpg
| imagecaption = Mi 9
| imagecaption = Mi 9
| releaseyear = 2019
| releaseyear = 2019
| category = testing
| category = testing
| originalsoftware = Android 9.0, up to 10, MIUI 11
| originalsoftware = Android (MIUI)
| chipset = Qualcomm SM8150 Snapdragon 855
| originalversion = 9.0
| cpu = 8-core (1x 2.84 GHz Kryo 485 & 3x 2.42 GHz Kryo 485 & 4x 1.78 GHz Kryo 485)
| extendedversion = 10 (MIUI 11)
| chipset = Qualcomm Snapdragon 855 (SM8150)
| cpu = Octa-core (1x2.84GHz Kryo 485 + 3x2.42GHz Kryo 485 + 4x1.78GHz Kryo 485)
| gpu = Adreno 640
| gpu = Adreno 640
| storage = 64/128/256 GB
| storage = 64/128/256 GB
Line 15: Line 19:
| memory = 6/8 GB
| memory = 6/8 GB
| architecture = aarch64
| architecture = aarch64
| status_usbnet =  
| type = handset
| status_flashing =  
| status_usbnet = Y
| status_touch =  
| status_flashing = Y
| status_screen =  
| status_touch = Y
| status_screen = P
| status_wifi =  
| status_wifi =  
| status_xwayland =  
| status_xwayland =  
| status_fde =  
| status_fde = -
| status_mainline =  
| status_mainline = P
| status_battery =  
| status_battery = Y
| status_3d =  
| status_3d =  
| status_accel =  
| status_accel =  
Line 34: Line 39:
| status_calls =  
| status_calls =  
| status = none
| status = none
| booting = no
| booting = yes
| pmoskernel =  
| pmoskernel =  
| whet_dhry =  
| whet_dhry = 7735.4
| status_otg =  
| status_otg =  
}}
| status_irtx = -
}}{{Based on SoC|Qualcomm_Snapdragon_855_(SM8150)|Snapdragon 855}}
 
__TOC__


== Contributors ==
== Contributors ==
<!-- * ''[[user:handle|Nick name]]'' -->
<!-- * ''[[user:handle|Nick name]]'' -->
''[[user:Alexeymin|Alexey Min]]''


== Maintainer(s) ==
== Maintainer(s) ==
<!-- * ''[[user:handle|Nick name]]'' -->
<!-- * ''[[user:handle|Nick name]]'' -->
''[[user:Alexeymin|Alexey Min]]''


== Users owning this device ==
== Users owning this device ==
Line 64: Line 74:
* Same as recovery, but this time hold the {{button|Volume Down}} and {{button|Power}} keys.
* Same as recovery, but this time hold the {{button|Volume Down}} and {{button|Power}} keys.


The device supports booting images using <code>fastboot boot</code> / <code>pmbootstrap flasher boot</code>.
== Installation ==
To boot mainline kernel you need to erase dtbo partition and disable vbmeta.
{{note|first make sure you have backups of the following partition images (or you have them in your stock Android or Lineage ROM): <code>boot.img</code>, <code>dtbo.img</code>, <code>vbmeta.img</code>}}
{{note|mainline port currently does not contain any useful features!}}


== Getting logs through debug UART ==
* pmbootstrap init    # select xiaomi, cepheus, console ui (currently you probably don't need anything else)
Tested! It works extremely well and the TX pin is easily accessible even without soldering.
* pmbootstrap install --no-firewall
For the ground you can force a breadboard pin into some metal shield. Be careful not to break the back being of a glassy material, so use a piece of plastic such as a credit card (not to scratch the metal edges) to unstick the glue in the edges. To get the credit card into the edges you must first heat them with a phono or with a gas stove and then with a suction cup lift the back (opposing the strength of the glue). Never bend the back too much to avoid the risk of breaking it, but it is relatively flexible and always keeping in mind that it is a glassy material you will not have to leave defects, let alone cracks. If you care about aesthetics and plan to combine a mess, I recommend you put a spare back on the cart, they have a paltry price. The image below indicates which are the serial pins, this is the upper board.<br />
* pmbootstrap initfs hook_add debug-shell / netboot  # optional
[[File:Xiaomi-cepheus_UART_pins.jpg|457px]]
* fastboot erase dtbo
[[File:Xiaomi-cepheus-UART-pins-schematic.jpg|600px]]
* pmbootstrap flasher flash_vbmeta    # this flashes vbmeta with verity disabled flag
* pmbootstrap flasher flash boot && fastboot reboot / pmbootstrap flasher boot # ?
 
== Installation (downstream port) ==
Unlike with mainline kernel, here you don't need to erase dtbo partition.
{{note|first make sure you have backups of vbmeta partition (or you have it in your stock Android or Lineage ROM)}}
 
* pmbootstrap init    # select xiaomi, cepheus-downstream, confirm Y, select console ui (currently you probably don't need anything else)
* pmbootstrap install --no-firewall
* pmbootstrap flasher flash_vbmeta    # this flashes vbmeta with verity disabled flag
* pmbootstrap flasher flash_rootfs
* pmbootstrap flasher flash_kernel
* fastboot reboot


== Extra information ==
== Extra information ==
Line 176: Line 204:
lrwxrwxrwx 1 root root 15 1971-12-18 13:45 xbl_configbak -> /dev/block/sdc1
lrwxrwxrwx 1 root root 15 1971-12-18 13:45 xbl_configbak -> /dev/block/sdc1
lrwxrwxrwx 1 root root 15 1971-12-18 13:45 xblbak -> /dev/block/sdc2
lrwxrwxrwx 1 root root 15 1971-12-18 13:45 xblbak -> /dev/block/sdc2
$ sudo busybox fdisk -l
Note: sector size is 4096 (not 512)
Found valid GPT with protective MBR; using GPT
Disk /dev/sdf: 65536 sectors,  256M
Logical sector size: 4096
Disk identifier (GUID): fead433a-45f5-7b1c-4f17-9e5a276e3c76
Partition table holds up to 32 entries
First usable sector is 6, last usable sector is 8186
Number  Start (sector)    End (sector)  Size Name
    1              6              69  256K fsc
    2              70            255  744K bk51
    3            256            511 1024K bk52
    4            512            1023 2048K imagefv
    5            1024            3071 8192K modemst1
    6            3072            5119 8192K modemst2
    7            5120            8186 11.9M last_parti
Note: sector size is 4096 (not 512)
Found valid GPT with protective MBR; using GPT
Disk /dev/sda: 112214016 sectors, 64.0M
Logical sector size: 4096
Disk identifier (GUID): 6bf2d432-e5e3-d03b-e45c-737163689e9a
Partition table holds up to 32 entries
First usable sector is 6, last usable sector is 14026746
Number  Start (sector)    End (sector)  Size Name
    1              6              7  8192 switch
    2              8              15 32768 ssd
    3              16              23 32768 dbg
    4              24              31 32768 bk01
    5              32              63  128K bk02
    6              64            127  256K bk03
    7            128            255  512K bk04
    8            256            383  512K keystore
    9            384            511  512K frp
    10            512            1023 2048K bk05
    11            1024            2047 4096K misc
    12            2048            3071 4096K vm-data
    13            3072            4095 4096K bk06
    14            4096            6143 8192K logfs
    15            6144            8191 8192K bk07
    16            8192          12287 16.0M oops
    17          12288          16383 16.0M devinfo
    18          16384          20479 16.0M oem_misc1
    19          20480          24575 16.0M metadata
    20          24576          32603 31.3M bk08
    21          32604          40959 32.6M splash
    22          40960          49151 32.0M bk09
    23          49152          65535 64.0M persist
    24          65536          81919 64.0M persistbak
    25          81920          98303 64.0M logdump
    26          98304          131071  128M minidump
    27          131072          163839  128M rawdump
    28          163840          180223 64.0M recovery
    29          180224          245759  256M cache
    30          245760          507903 1024M cust
    31          507904        14026746 51.5G userdata
Note: sector size is 4096 (not 512)
Found valid GPT with protective MBR; using GPT
Disk /dev/sdb: 16384 sectors, 64.0M
Logical sector size: 4096
Disk identifier (GUID): 8492cc0f-bc06-ccf4-503c-12506a977b64
Partition table holds up to 32 entries
First usable sector is 6, last usable sector is 2042
Number  Start (sector)    End (sector)  Size Name
    1              6            133  512K xbl_config
    2            134            1925 7168K xbl
    3            1926            2042  468K last_parti
Note: sector size is 4096 (not 512)
Found valid GPT with protective MBR; using GPT
Disk /dev/sdc: 16384 sectors, 64.0M
Logical sector size: 4096
Disk identifier (GUID): 20d6b4ac-e894-aa85-f848-30ef7a612310
Partition table holds up to 32 entries
First usable sector is 6, last usable sector is 2042
Number  Start (sector)    End (sector)  Size Name
    1              6            133  512K xbl_configbak
    2            134            1925 7168K xblbak
    3            1926            2042  468K last_parti
Note: sector size is 4096 (not 512)
Found valid GPT with protective MBR; using GPT
Disk /dev/sdd: 65536 sectors,  256M
Logical sector size: 4096
Disk identifier (GUID): c56e2ee2-0467-b3c1-b445-8ccafb33c002
Partition table holds up to 32 entries
First usable sector is 6, last usable sector is 8186
Number  Start (sector)    End (sector)  Size Name
    1              6              13 32768 bk31
    2              14              45  128K cdt
    3              46            261  864K bk32
    4            262            517 1024K ddr
    5            518            773 1024K bk33
    6            774            8186 28.9M last_parti
Note: sector size is 4096 (not 512)
Found valid GPT with protective MBR; using GPT
Disk /dev/sde: 12582912 sectors,    0
Logical sector size: 4096
Disk identifier (GUID): bf0ad734-2424-987e-e115-25eb5eb0690b
Partition table holds up to 64 entries
First usable sector is 6, last usable sector is 1572858
Number  Start (sector)    End (sector)  Size Name
    1              6              13 32768 multiimgoem
    2              14              21 32768 multiimgqti
    3              22              29 32768 secdata
    4              30              37 32768 limits
    5              38              63  104K bk41
    6              64              95  128K qupfw
    7              96            127  128K qupfwbak
    8            128            191  256K apdp
    9            192            255  256K msadp
    10            256            287  128K vbmeta
    11            288            319  128K storsec
    12            320            383  256K bk42
    13            384            447  256K devcfg
    14            448            511  256K devcfgbak
    15            512            639  512K aop
    16            640            767  512K aopbak
    17            768            895  512K uefivarstore
    18            896            1023  512K catefv
    19            1024            1279 1024K cmnlib
    20            1280            1535 1024K cmnlibbak
    21            1536            1791 1024K cmnlib64
    22            1792            2047 1024K cmnlib64bak
    23            2048            2303 1024K bk43
    24            2304            2559 1024K keymaster
    25            2560            2815 1024K keymasterbak
    26            2816            3071 1024K bluetooth
    27            3072            3327 1024K dip
    28            3328            3583 1024K catecontentfv
    29            3584            5631 8192K bk44
    30            5632            6143 2048K bk44
    31            6144            6655 2048K cateloader
    32            6656            7167 2048K uefisecapp
    33            7168            7679 2048K uefisecappbak
    34            7680            8191 2048K toolsfv
    35            8192            8703 2048K abl
    36            8704            9215 2048K ablbak
    37            9216          10239 4096K tz
    38          10240          11263 4096K tzbak
    39          11264          12287 4096K bk45
    40          12288          14335 8192K fsg
    41          14336          16383 8192K spunvm
    42          16384          18431 8192K hyp
    43          18432          20479 8192K hypbak
    44          20480          24575 16.0M gsort
    45          24576          32767 32.0M dtbo
    46          32768          49151 64.0M ifaa
    47          49152          65535 64.0M logo
    48          65536          81919 64.0M dsp
    49          81920          114687  128M boot
    50          114688          120319 22.0M bk47
    51          120320          163839  170M core_nhlos
    52          163840          245759  320M modem
    53          245760          638975 1536M vendor
    54          638976        1556479 3584M system
    55        1556480        1572858 63.9M last_parti
</pre>
</pre>
</div>
</div>
</div>
</div>
=== Getting logs through debug UART ===
Tested! It works extremely well and the TX pin is easily accessible even without soldering.
For the ground you can force a breadboard pin into some metal shield. Be careful not to break the back being of a glassy material, so use a piece of plastic such as a credit card (not to scratch the metal edges) to unstick the glue in the edges. To get the credit card into the edges you must first heat them with a phono or with a gas stove and then with a suction cup lift the back (opposing the strength of the glue). Never bend the back too much to avoid the risk of breaking it, but it is relatively flexible and always keeping in mind that it is a glassy material you will not have to leave defects, let alone cracks. If you care about aesthetics and plan to combine a mess, I recommend you put a spare back on the cart, they have a paltry price. The image below indicates which are the serial pins, this is the upper board.<br />
[[File:Xiaomi-cepheus_UART_pins.jpg|457px]]
[[File:Xiaomi-cepheus-UART-pins-schematic.jpg|600px]]
=== Other xiaomi phones on sm8150 ===
* xiaomi-raphael (Mi 9T Pro / Redmi K20 Pro)
* xiaomi-andromeda (Mi Mix 3 5G)
* xiaomi-vayu (POCO X3 Pro) (sm8150-ac aka Snapdragon 860)


== Links ==
== Links ==
<!-- * {{MR|1095|pmaports}} Initial merge request -->
<!-- * {{MR|1095|pmaports}} Initial merge request -->
* [https://www.gsmarena.com/xiaomi_mi_9-9507.php GSMARENA]
* [https://www.gsmarena.com/xiaomi_mi_9-9507.php GSMARENA]
* [http://www.deviceinfohw.ru/devices/item.php?item=94479 Deviceinfo HW page for cepheus] (for [http://www.deviceinfohw.ru/devices/item.php?item=89041 raphael])

Latest revision as of 04:07, 19 March 2025


Xiaomi Mi 9
Mi 9
Mi 9
Manufacturer Xiaomi
Name Mi 9
Codename xiaomi-cepheus
Released 2019
Type handset
Hardware
Chipset Qualcomm Snapdragon 855 (SM8150)
CPU Octa-core (1x2.84GHz Kryo 485 + 3x2.42GHz Kryo 485 + 4x1.78GHz Kryo 485)
GPU Adreno 640
Display 1080 x 2340
Storage 64/128/256 GB
Memory 6/8 GB
Architecture aarch64
Software
Original software Android (MIUI)
Original version 9.0
Extended version 10 (MIUI 11)
postmarketOS
Category testing
Pre-built images no
Mainline partial
Unixbench Whet/Dhry score 7735.4
Features
Flashing
Works
USB Networking
Works
Internal storage
No data
SD card
No data
Battery
Works
Screen
Partial
Touchscreen
Works
Multimedia
3D Acceleration
No data
Audio
No data
Camera
No data
Camera Flash
No data
Connectivity
WiFi
No data
Bluetooth
No data
GPS
No data
NFC
No data
Modem
Calls
No data
SMS
No data
Mobile data
No data
Miscellaneous
USB OTG
No data
HDMI/DP
No data
Sensors
Accelerometer
No data
Magnetometer
No data
Ambient Light
No data
Proximity
No data
Hall Effect
No data
Haptics
No data
Barometer
No data

Contributors

Alexey Min

Maintainer(s)

Alexey Min

Users owning this device

  • Alexeymin (Notes: I'll have to give up on this port temporarily)
  • Frankwalter (Notes: Used as main, but a phone is of no use to me. I aim to make it completely mainline. UPDATE: I broke it sorry)
  • R


How to enter flash mode

Bootloader Unlocking

Like other Xiaomi devices, the user will have to acquire the bootloader unlock key: https://en.miui.com/unlock

The device will not unlock if the device isn't 7 days old (from the time when your device connects to internet and powered on, and linked with Mi Account)

Recovery mode

  • Turn the device off (or restart also works)
  • Hold Volume Up and Power button
  • Once you feel vibration and phone turns on, release Power button
  • Keep holding Volume Up until you get to recovery.

Flashing (Download, Fastboot) mode

  • Same as recovery, but this time hold the Volume Down and Power keys.

The device supports booting images using fastboot boot / pmbootstrap flasher boot.

Installation

To boot mainline kernel you need to erase dtbo partition and disable vbmeta.

Note first make sure you have backups of the following partition images (or you have them in your stock Android or Lineage ROM): boot.img, dtbo.img, vbmeta.img
Note mainline port currently does not contain any useful features!
* pmbootstrap init     # select xiaomi, cepheus, console ui (currently you probably don't need anything else)
* pmbootstrap install --no-firewall
* pmbootstrap initfs hook_add debug-shell / netboot   # optional
* fastboot erase dtbo
* pmbootstrap flasher flash_vbmeta    # this flashes vbmeta with verity disabled flag
* pmbootstrap flasher flash boot && fastboot reboot / pmbootstrap flasher boot # ?

Installation (downstream port)

Unlike with mainline kernel, here you don't need to erase dtbo partition.

Note first make sure you have backups of vbmeta partition (or you have it in your stock Android or Lineage ROM)
* pmbootstrap init     # select xiaomi, cepheus-downstream, confirm Y, select console ui (currently you probably don't need anything else)
* pmbootstrap install --no-firewall
* pmbootstrap flasher flash_vbmeta    # this flashes vbmeta with verity disabled flag
* pmbootstrap flasher flash_rootfs
* pmbootstrap flasher flash_kernel
* fastboot reboot

Extra information

Partition layout

Partition layout:

Getting logs through debug UART

Tested! It works extremely well and the TX pin is easily accessible even without soldering. For the ground you can force a breadboard pin into some metal shield. Be careful not to break the back being of a glassy material, so use a piece of plastic such as a credit card (not to scratch the metal edges) to unstick the glue in the edges. To get the credit card into the edges you must first heat them with a phono or with a gas stove and then with a suction cup lift the back (opposing the strength of the glue). Never bend the back too much to avoid the risk of breaking it, but it is relatively flexible and always keeping in mind that it is a glassy material you will not have to leave defects, let alone cracks. If you care about aesthetics and plan to combine a mess, I recommend you put a spare back on the cart, they have a paltry price. The image below indicates which are the serial pins, this is the upper board.

Other xiaomi phones on sm8150

  • xiaomi-raphael (Mi 9T Pro / Redmi K20 Pro)
  • xiaomi-andromeda (Mi Mix 3 5G)
  • xiaomi-vayu (POCO X3 Pro) (sm8150-ac aka Snapdragon 860)

Links