Jump to content

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

From postmarketOS Wiki
m Add Android memory map
Halamix2 (talk | contribs)
mNo edit summary
 
(21 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 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 93: Line 79:
* Flash the zip
* Flash the zip
* Reboot
* 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):
* Kernel patched with [https://github.com/amonet-kamakiri/kamakiri/blob/master/kernel.patch this patch]
* Python3: <code>pyusb pyserial json5</code>
* 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])
* [https://gist.github.com/michaelskyf/eff1894ec531e659f2a2ec393ba61697 MT6785 scatter file]
Steps:
# Run the exploit
# Connect the device via USB and hold Volume Up (+)
# When "Protection disabled" message appears, open SP Flash Tool
# Select partition images that you want to write and click Download
# 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 209: 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 ===
[https://medium.com/swlh/modding-the-redmi-note-8-pro-an-adventure-e473e84d4d14 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.<br>
!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 ==
== 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 223: 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

0011bb80-0011bbff : /qos@0011bb80
10001000-10001fff : /scpsys@10001000
1000d000-1000dfff : pwrap
10012000-10012fff : /dvfsrc@10012000
10017000-10017fff : sys_timer_base
1020e000-1020efff : /emi@10219000
10219000-10219fff : /emi@10219000
1021a000-1021afff : /device_mpu_low@1021a000
10226000-10226fff : /emi@10219000
10228000-1022bfff : /gce_mbox@10228000
10230000-10231fff : /dramc@10230000
10234000-10234fff : /dramc@10230000
10235000-10235fff : /emi@10219000
10236000-10236fff : /dramc@10230000
10238000-10239fff : /dramc@10230000
10240000-10241fff : /dramc@10230000
10244000-10244fff : /dramc@10230000
10245000-10245fff : /emi@10219000
10246000-10246fff : /dramc@10230000
10248000-10249fff : /dramc@10230000
10400000-10427fff : sspm_base
10440000-1044ffff : cfgreg
10450000-104500ff : mbox0_base
10451000-10451007 : mbox0_ctrl
10460000-104600ff : mbox1_base
10461000-10461007 : mbox1_ctrl
10470000-104700ff : mbox2_base
10471000-10471007 : mbox2_ctrl
10480000-104800ff : mbox3_base
10481000-10481007 : mbox3_ctrl
10500000-105bffff : /scp@10500000
105c0000-105c2fff : /scp@10500000
105c4000-105c4fff : /scp@10500000
105d4000-105d9fff : /scp@10500000
10600000-1060ffff : /adsp@10600000
10610000-10617fff : /adsp@10600000
10630000-10638fff : /adsp@10600000
11000080-110000ff : /i2c0@11007000
11000100-1100017f : /i2c1@11008000
11000180-110002ff : /i2c2@11009000
11000300-1100037f : /i2c3@1100f000
11000380-110004ff : /i2c4@11011000
11000500-1100057f : /i2c5@11016000
11000580-1100067f : /i2c6@11005000
11000680-1100077f : /i2c7@1101a000
11000780-110007ff : /i2c8@1101b000
11000800-1100087f : /i2c9@11015000
11000880-110008ff : /dma-controller@11000880
11000900-1100097f : /dma-controller@11000880
11000980-110009ff : /dma-controller@11000880
11000a00-11000a7f : /dma-controller@11000880
11001000-11001fff : /auxadc@11001000
11002000-1100201f : serial
11003000-1100301f : serial
11005000-11005fff : /i2c6@11005000
11007000-11007fff : /i2c0@11007000
11008000-11008fff : /i2c1@11008000
11009000-11009fff : /i2c2@11009000
1100a000-1100afff : /spi0@1100a000
1100f000-1100ffff : /i2c3@1100f000
11010000-11010fff : /spi1@11010000
11011000-11011fff : /i2c4@11011000
11012000-11012fff : /spi2@11012000
11013000-11013fff : /spi3@11013000
11015000-11015fff : /i2c9@11015000
11016000-11016fff : /i2c5@11016000
11018000-11018fff : /spi4@11018000
11019000-11019fff : /spi5@11019000
1101a000-1101afff : /i2c7@1101a000
1101b000-1101bfff : /i2c8@1101b000
1101d000-1101dfff : /spi6@1101d000
1101e000-1101efff : /spi7@1101e000
11201000-11203fff : mac
11210000-11210fff : /mt6785-afe-pcm@11210000
11270000-112722ff : /ufshci@11270000
13040000-1304ffff : 13040000.mali
14017000-14017fff : /smi_larb0@14017000
14018000-14018fff : /smi_larb1@14018000
14019000-14019fff : /smi_common@14019000
15021000-15021fff : /smi_larb5@15021000
1502f000-1502ffff : /smi_larb4@1502f000
16000000-16000fff : /vdec_gcon@16000000
16010000-16010fff : /smi_larb2@16010000
16025000-16025fff : /vdec_gcon@16000000
17010000-17010fff : /smi_larb3@17010000
17020000-17020fff : /venc_gcon@17000000
18000000-180fffff : AXI-BUS
19180000-19180fff : /apu_dvfs@19180000
1a001000-1a001fff : /smi_larb6@1a001000
1a002000-1a002fff : /smi_larb7@1a002000
40000000-4c3fffff : System RAM
  40080000-415fffff : Kernel code
  41b70000-4281cfff : Kernel data
4c800000-4cdfffff : System RAM
4d000000-55ffffff : System RAM
56700000-6fffffff : System RAM
74240000-77feffff : System RAM
78000000-7bdbffff : System RAM
7e010000-7eebffff : System RAM
7ffc0000-8bffffff : System RAM
8d100000-8effffff : System RAM
8f300000-8f3fffff : System RAM
90000000-9f7effff : System RAM
9ff00000-bbffffff : System RAM
bc400000-bcffffff : System RAM
bd000000-bd2fffff : AXI-BUS
bd300000-bd55ffff : System RAM
bfff0000-bfffafff : System RAM
c0000000-ffdfffff : System RAM
fff00000-1bfffefff : System RAM

Partition table

$ sudo parted
(parted) list

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

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