MediaTek Dimensity 7300 (MT6878)
Dimensity 7300 (MT6878) is a midrange MediaTek SoC released in 2024 and used in mid-range devices.
|
| |
| Manufacturer | MediaTek |
|---|---|
| Name | Dimensity 7300 |
| Model | MT6878 |
| Architecture | aarch64 |
| CPU |
4x ARM Cortex-A78 (2.5 GHz) 4x ARM Cortex-A55 (2.0 GHz) |
| GPU | ARM Mali-G615 MC2 |
| Year | 2024 |
| Process | 4nm |
| Mainline | yes |
| Kernel package |
|
Community Page A link to a git{hub,lab} organisation/repo where development happens. |
https://github.com/mt6878-mainline |
CPU SMP (bring up secondary CPU cores), CPU frequency scaling, CPUidle |
Works
|
|---|---|
UART |
Works
|
Storage eMMC, SD cards, UFS, ... |
Works
|
USB |
Works
|
Display |
Partial
|
GPU |
Broken
|
Pinctrl |
Works
|
I²C |
Works
|
SPI Serial Peripheral Interface |
Works
|
Audio |
Broken
|
Video Hardware-accelerated video de/encoding |
Broken
|
Thermal |
Broken
|
WiFi |
Broken
|
Bluetooth |
Broken
|
Modem Calls, SMS, Internet |
Broken
|
GPS |
Broken
|
Camera |
Broken
|
Suspend |
Broken
|
Devices
| Device | Codename | Chipset | Category |
|---|---|---|---|
| Nothing CMF Phone 1 | nothing-tetris | MediaTek Dimensity 7300 (MT6878) | testing |
| Unihertz Titan 2 | unihertz-titan-2 | MediaTek Dimensity 7300 (MT6878) |
U-Boot
The U-Boot port for MT6878 is pretty much complete, and recommended as the way to boot Mainline Linux on MT6878. You can find it at https://github.com/MT6878-Mainline/u-boot.
Porting U-Boot to a MT6878 device
This is a really easy process that should be the first step when porting postmarketOS for a MT6878 device.
| WARNING: If your device does not have a method of unbricking (i.e, the Nothing Flash Tool, or a way for mtkclient to work), it is NOT recommended to port U-Boot. This process may brick your device (temporarily). |
Check if your device verifies bl2_ext
This is the only real condition to if your device can have U-Boot as its primary bootloader. To check, under Android (or a custom recovery) run:
$ su
# dd if=/dev/block/by-name/expdb of=/sdcard/expdb.img
# chmod 666 /sdcard/expdb.img
# exit
$ exit
$ adb pull /sdcard/expdb.img
$ strings expdb.img > expdb.txt
$ rm expdb.img
Now feel free to open expdb.txt in a text editor, and look for img_auth_required. If your device does not verify bl2_ext, it will look something like this:
[PART] img_auth_required = 0 [PART] Image with header, name: bl2_ext, addr: FFFFFFFFh, mode: FFFFFFFFh, size:654944, magic:58881688h [PART] part: lk_a img: bl2_ext cert vfy(0 ms)
| WARNING: If you have img_auth_required 1, do NOT continue this process. You will not be able to use U-Boot. |
Thanks Roger for finding this out!
Port U-Boot
Now it's time to port. To start, clone the repo: https://github.com/MT6878-Mainline/u-boot
Device specific changes
The only real change involves making a new device tree. You can start by copying CMF Phone 1's, located at arch/arm/dts/mt6878-nothing-tetris.dts, to arch/arm/dts/mt6878-manufacturer-codname.dts.
Inside the file, you may need to edit the memory node, for more/less RAM. This is currently capped at 1 GB by U-Boot's starting code, but it's good to change it now, so it doesn't break if the entire RAM is enabled later.
memory {
device_type = "memory";
reg = <0x0 0x40000000 0x2 0x0>;
};
For example, if you have 4GB of RAM, change 0x2 to 0x1. The starting address (0x40000000) will not change.
Another node that may need to be changed is the framebuffer node.
simplefb@fe0d0000 {
compatible = "simple-framebuffer";
reg = <0x0 0xfe0d0000 0x0 0xa08c00>;
width = <1080>;
height = <2400>;
stride = <(1088 * 4)>;
format = "a8r8g8b8";
};
To get the base, you can look in your expdb.txt file, for "mblock" and find the framebuffer there. Copy and paste. Change width/height to your device's W/H values, and stride to your (width + 8) * 4.
| If you have a CMD-Mode panel, your display will not work in U-Boot. Not to worry, U-Boot will still work, you just won't see its logo and other text. |
You may also need to change the GPIO Key (other keys are via PMIC, which currently is not implemented) type or GPIO. For CMF Phone 1, it's the volume down key at GPIO 53. For another device, it might be the volume up key at GPIO 50.
voldown-key {
label = "Volume Down";
linux,code = <KEY_VOLUMEDOWN>;
gpios = <&pio 54 GPIO_ACTIVE_LOW>;
};
The type and value can be found in the device's downstream kernel device tree, under the gpio-keys node.
That's all when it comes to the device tree!
Configuration
Copy configs/mt6878_tetris_defconfig to configs/mt6878_codename_defconfig.
The only values that need to be changed are:
CONFIG_DEFAULT_DEVICE_TREE="mt6878-nothing-tetris" CONFIG_IDENT_STRING=" mt6878-tetris" CONFIG_DEFAULT_FDT_FILE="mt6878-nothing-tetris"
Obviously, change tetris to your device's codename.
Building
Congratulations! You're ready to build U-Boot for your device.
$ ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- make -j$(nproc) mt6878_codename_defconfig
$ ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- make -j$(nproc)
$ pip3 install --upgrade git+https://github.com/bengris32/liblk # we are downloading this in order to patch the lk image, to replace it with u-boot
$ cp <PATH_TO_YOUR_DEVICE'S_LK_IMG> lk.img
$ wget https://raw.githubusercontent.com/MT6878-Mainline/lplk/refs/heads/u-boot/lplk.py
$ python lplk.py
$ rm lplk.py
$ python gimme-uboot.py lplk_out.img u-boot.bin u-boot-mt6878-codename.img
You can now flash the u-boot-mt6878-codename.img as the lk partition. If everything went well, your device will boot, and you will see a new fastboot device on your PC. Feel free to PR!