Jump to content

Xiaomi Redmi Note 8 Pro (xiaomi-begonia): Difference between revisions

From postmarketOS Wiki
Add unbricking guide
Halamix2 (talk | contribs)
mNo edit summary
 
(18 intermediate revisions by 7 users not shown)
Line 6: Line 6:
| imagecaption = Redmi Note 8 Pro running Weston
| imagecaption = Redmi Note 8 Pro running Weston
| releaseyear = 2019
| releaseyear = 2019
| originalsoftware = Android 9.0, MIUI 11
| originalsoftware = Android
| chipset = Mediatek MT6785 (Helio G90T)
| originalversion = 9.0 (MIUI 11)
| chipset = MediaTek Helio G90T (MT6785)
| cpu = Octa-core (2x2.05 GHz Cortex-A76 & 6x2.0 GHz Cortex-A55)
| cpu = Octa-core (2x2.05 GHz Cortex-A76 & 6x2.0 GHz Cortex-A55)
| gpu = Mali-G76 MC4
| gpu = Mali-G76 MC4
Line 14: Line 15:
| memory = 6/8 GB
| memory = 6/8 GB
| architecture = aarch64
| architecture = aarch64
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) -->
| type = handset
| status_usbnet = Y
| status_usbnet = Y
| status_flashing = Y
| status_flashing = Y
| status_touch = Y
| status_touch = Y
| status_screen = Y
| status_screen = Y
| status_wifi = P
| status_wifi = N <!-- Technically possible -->
| status_xwayland = Y
| status_xwayland = Y
| status_fde =  
| status_fde = N
| status_mainline = N
| status_mainline = N
| status_battery =  
| status_battery = N
| status_3d = N
| status_3d = N
| status_accel = N
| status_accel = N
Line 45: Line 46:


== Maintainer(s) ==
== Maintainer(s) ==
* [[User:Michaelskyf|Michaelskyf]]


== Users owning this device ==
== Users owning this device ==
{{Device owners}}
{{Device owners}}
== LED/Torch/Screen brightness/Vibrator ==
(all files below are in <code>/sys/class/leds</code>)
* Notification LED: <code>white/</code>
* Torch: <code>torch-light0/</code> and <code>torch-light1/</code>
* Screen brightness: <code>lcd-backlight/</code>
* Vibrator: <code>vibrator/</code>


== How to enter flash mode ==
== How to enter flash mode ==
Line 73: Line 65:


== Installation ==
== Installation ==
=== !!! Install CFW 2.0 ===
Redmi Note 8 Pro doesn't quite like custom ROMs normally, so you have to flash a few blank files to get different custom ROMs to work.
* Download [https://drive.google.com/file/d/1ot4PWR-cPSPPau5gGkVrS49Ofto1yiSf/view CFW2.0] and unzip it.
* Go to a folder with your device's codename in it.
* Run <code>!_FLASH_IT_L.sh</code> on Linux/macOS or <code>!_FLASH_IT_W.bat</code> on Windows.
* After this, follow the next steps.
=== Via fastboot ===
=== Via fastboot ===
* <code>pmbootstrap init</code>
* <code>pmbootstrap init</code>
Line 101: Line 87:
* Python3: <code>pyusb pyserial json5</code>
* Python3: <code>pyusb pyserial json5</code>
* SP Flash Tool (tested with version 5.2208)
* SP Flash Tool (tested with version 5.2208)
* [https://github.com/MTK-bypass/bypass_utility Mediatek Bypass utility]
* Known working partitions (from backup or [https://forum.xda-developers.com/t/rom-10-0-unofficial-lineageos-17-1-begonia-begoniain.4072137/ Android ROM])
* Known working partitions (from backup or [https://forum.xda-developers.com/t/rom-10-0-unofficial-lineageos-17-1-begonia-begoniain.4072137/ Android ROM])
* MT6785 scatter file
* [https://gist.github.com/michaelskyf/eff1894ec531e659f2a2ec393ba61697 MT6785 scatter file]


Steps:
Steps:
Line 109: Line 96:
# When "Protection disabled" message appears, open SP Flash Tool
# When "Protection disabled" message appears, open SP Flash Tool
# Select partition images that you want to write and click Download
# Select partition images that you want to write and click Download
# After green checkmark image appears, restart your phone  
# After green checkmark image appears, restart your phone
 
== Mainline kernel ==
 
To boot mainline kernel you need:
# Non-CFW based Android boot.img
# Non-CFW firmware
# [https://github.com/osm0sis/mkbootimg osm0sis/mkbootimg]
# [https://github.com/AgentFabulous/begonia/tree/android-12.0 Android kernel] (For dtb)
# [https://gist.github.com/michaelskyf/078a8bd679925f7ea5d8a22fda3010c8 This simple script] (Remember to modify it)
 
Remember to enable pstore console<br>
If you don't get current logs in /proc/last_kmsg, try building the output.img without ramdisk (that will force kernel panic)<br>
You also need to patch drivers/watchdog/mtk_wdt.c to support "mediatek,mt6785-toprgu", otherwise the phone will reboot after a while<br>
The goal is to enable framebuffer or usb, so we can progress with mainlining


== Misc ==
== Misc ==


=== Andoid memory map ===
=== Andoid memory map ===
<source lang="shell-session">
<div class="toccolours mw-collapsible mw-collapsed">
$ sudo cat /proc/iomem
<code>$ sudo cat /proc/iomem</code>
<div class="mw-collapsible-content">
<syntaxhighlight lang="shell-session">
0011bb80-0011bbff : /qos@0011bb80
0011bb80-0011bbff : /qos@0011bb80
10001000-10001fff : /scpsys@10001000
10001000-10001fff : /scpsys@10001000
Line 226: Line 229:
c0000000-ffdfffff : System RAM
c0000000-ffdfffff : System RAM
fff00000-1bfffefff : System RAM
fff00000-1bfffefff : System RAM
</source>
</syntaxhighlight>
</div>
</div>
 
=== Partition table ===
<div class="toccolours mw-collapsible mw-collapsed">
<code>$ sudo parted<br>
(parted) list</code>
<div class="mw-collapsible-content">
<syntaxhighlight lang="shell-session">
Model: SAMSUNG KM2H7001CM-B518 (scsi)
Disk /dev/block/sdc: 64.0GB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt
Disk Flags:
 
Number  Start  End    Size    File system  Name      Flags
1      32.8kB  67.1MB  67.1MB              recovery  msftdata
2      67.1MB  71.3MB  4194kB              misc      msftdata
3      71.3MB  71.9MB  524kB                para      msftdata
4      71.9MB  92.8MB  21.0MB              expdb      msftdata
5      92.8MB  93.9MB  1049kB              frp        msftdata
6      93.9MB  102MB  8389kB              vbmeta    msftdata
7      102MB  136MB  33.6MB  ext4        nvcfg      msftdata
8      136MB  203MB  67.1MB  ext4        nvdata    msftdata
9      203MB  236MB  33.6MB  ext4        metadata  msftdata
10      236MB  310MB  73.9MB  ext4        persist    msftdata
11      310MB  319MB  8389kB  ext4        protect1  msftdata
12      319MB  327MB  8389kB  ext4        protect2  msftdata
13      327MB  336MB  8389kB              seccfg    msftdata
14      336MB  386MB  50.3MB              otp        msftdata
15      386MB  388MB  2097kB              sec1      msftdata
16      388MB  391MB  3146kB              proinfo    msftdata
17      391MB  392MB  524kB                efuse      msftdata
18      392MB  459MB  67.1MB              nvram      msftdata
19      459MB  616MB  157MB                md1img    msftdata
20      616MB  643MB  27.3MB              boot_para  msftdata
21      643MB  644MB  1049kB              spmfw      msftdata
22      644MB  649MB  4194kB              audio_dsp  msftdata
23      649MB  655MB  6291kB              scp1      legacy_boot, msftdata
24      655MB  661MB  6291kB              scp2      msftdata
25      661MB  662MB  1049kB              sspm_1    legacy_boot, msftdata
26      662MB  663MB  1049kB              sspm_2    msftdata
27      663MB  679MB  15.7MB              cam_vpu1  msftdata
28      679MB  695MB  15.7MB              cam_vpu2  msftdata
29      695MB  710MB  15.7MB              cam_vpu3  msftdata
30      710MB  744MB  33.6MB              gz1        legacy_boot, msftdata
31      744MB  778MB  33.6MB              gz2        msftdata
32      778MB  780MB  2097kB              lk        legacy_boot, msftdata
33      780MB  782MB  2097kB              lk2        msftdata
34      782MB  849MB  67.1MB              boot      msftdata
35      849MB  916MB  67.1MB              logo      msftdata
36      916MB  949MB  33.6MB              dtbo      msftdata
37      949MB  955MB  5243kB              tee1      legacy_boot, msftdata
38      955MB  965MB  9961kB              tee2      msftdata
39      965MB  2575MB  1611MB  ext2        vendor    msftdata
40      2575MB  6333MB  3758MB  ext4        system    msftdata
41      6333MB  6786MB  453MB  ext4        cache      msftdata
42      6786MB  6803MB  16.8MB              gsort      msftdata
43      6803MB  6820MB  16.8MB              oem_misc1  msftdata
44      6820MB  6954MB  134MB                exaid      msftdata
45      6954MB  7827MB  872MB  ext4        cust      msftdata
46      7827MB  64.0GB  56.1GB  ext4        userdata  msftdata
47      64.0GB  64.0GB  16.8MB              flashinfo  msftdata
</syntaxhighlight>
</div>
</div>


=== Booting process ===
=== Booting process ===
Line 243: Line 312:


== Additional info ==
== Additional info ==
* For now WIFI works only with proprietary tools found in /vendor partition.
* [[Xiaomi Redmi Note 7 (xiaomi-lavender)]]
** These tools can be run using android runtime's linker64 and its libraries
* [[Xiaomi Redmi Note 8T (xiaomi-willow)]]
* [https://wiki.postmarketos.org/wiki/Xiaomi_Redmi_Note_7_(xiaomi-lavender) Xiaomi_Redmi_Note_7_(xiaomi-lavender)]
* [https://wiki.postmarketos.org/wiki/Xiaomi_Redmi_Note_8T_(xiaomi-willow) Xiaomi_Redmi_Note_8T_(xiaomi-willow)]


== See also ==
== See also ==
Line 254: Line 321:


* [https://github.com/AgentFabulous/begonia Kernel sources]
* [https://github.com/AgentFabulous/begonia Kernel sources]
[[Category:Mediatek]]

Latest revision as of 11:47, 1 February 2025

Xiaomi Redmi Note 8 Pro
Redmi Note 8 Pro running Weston
Redmi Note 8 Pro running Weston
Manufacturer Xiaomi
Name Redmi Note 8 Pro
Codename xiaomi-begonia
Released 2019
Type handset
Hardware
Chipset MediaTek Helio G90T (MT6785)
CPU Octa-core (2x2.05 GHz Cortex-A76 & 6x2.0 GHz Cortex-A55)
GPU Mali-G76 MC4
Display 1080 x 2340
Storage 64/128/256 GB
Memory 6/8 GB
Architecture aarch64
Software
Original software Android
Original version 9.0 (MIUI 11)
postmarketOS
Category testing
Pre-built images no
Mainline no
postmarketOS kernel 4.14.218
Unixbench Whet/Dhry score 5577.1
Features
Flashing
Works
USB Networking
Works
Internal storage
No data
SD card
No data
Battery
Broken
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Broken
Audio
Broken
Camera
Broken
Camera Flash
No data
Connectivity
WiFi
Broken
Bluetooth
Broken
GPS
Broken
NFC
No data
Modem
Calls
Broken
SMS
Broken
Mobile data
Broken
Miscellaneous
FDE
Broken
USB OTG
Works
HDMI/DP
No data
Sensors
Accelerometer
Broken
Magnetometer
No data
Ambient Light
No data
Proximity
No data
Hall Effect
No data
Haptics
No data
Barometer
No data


Contributors

Maintainer(s)

Users owning this device


How to enter flash mode

Unlocking the bootloader

Sign up for a Mi Account, register your device in the settings, and wait for a week. More info

Before you go any further

Please read Redmi Note 8 Pro XDA Megathread

Entering recovery

Volume Up + Power

Entering fastboot

Volume Down + Power

Installation

Via fastboot

  • pmbootstrap init
  • pmbootstrap install
  • pmbootstrap flasher flash_rootfs
  • pmbootstrap flasher flash_kernel
  • fastboot reboot

Via zip

  • pmbootstrap init
  • pmbootstrap install --android-recovery-zip
  • pmbootstrap export
  • Transfer the zip to the device
    • adb push /tmp/postmarketOS-export/pmos-xiaomi-begonia.zip /sdcard
  • Flash the zip
  • Reboot

Unbricking

If something went terribly wrong (eg. boot.img doesn't contain valid DTB) your device will hard-brick. Fortunately these days it's pretty easy to unbrick the device.

Requirements (GNU/Linux):

Steps:

  1. Run the exploit
  2. Connect the device via USB and hold Volume Up (+)
  3. When "Protection disabled" message appears, open SP Flash Tool
  4. Select partition images that you want to write and click Download
  5. After green checkmark image appears, restart your phone

Mainline kernel

To boot mainline kernel you need:

  1. Non-CFW based Android boot.img
  2. Non-CFW firmware
  3. osm0sis/mkbootimg
  4. Android kernel (For dtb)
  5. This simple script (Remember to modify it)

Remember to enable pstore console
If you don't get current logs in /proc/last_kmsg, try building the output.img without ramdisk (that will force kernel panic)
You also need to patch drivers/watchdog/mtk_wdt.c to support "mediatek,mt6785-toprgu", otherwise the phone will reboot after a while
The goal is to enable framebuffer or usb, so we can progress with mainlining

Misc

Andoid memory map

$ sudo cat /proc/iomem

Partition table

$ sudo parted
(parted) list

Booting process

More info

1. BROM (Boot ROM)

Boots when power is applied to SoC. Initializes flash storage and starts preloader

2. PL (Preloader)

Initializes basic devices like usb, gpio, timers, etc. If Volume Up (+) is held, PL will hand controll back to BROM wth EDL (Emergency Download Mode).

3. LK (Little Kernel)

Displays logo and verifies some partitions (TODO: which partitions). If it fails to verify partition, it won't continue.
!IMPORTANT! LK WILL USE DTB (Device Tree Blob) FOUND IN BOOT.IMG which means that if DTB is invalid, the device will be hard-bricked

4. Linux

Additional info

See also