From fedb16e75dca2173bb6ecd012ec7ff1358e24c77 Mon Sep 17 00:00:00 2001 From: MeexReay Date: Sat, 31 May 2025 21:09:50 +0300 Subject: [PATCH] device now booting --- README.md | 145 ++++++++---------- device-xiaomi-angelican/APKBUILD | 1 - prebuilt/boot.img | 3 - prebuilt/dtbo.img | 0 prebuilt/flash.sh | 12 -- prebuilt/system.img | 3 - prebuilt/update.sh | 5 - ssh_config | 2 + ...vbmeta_disabled.img => vbmeta_disabled.img | 0 9 files changed, 69 insertions(+), 102 deletions(-) delete mode 100644 prebuilt/boot.img delete mode 100644 prebuilt/dtbo.img delete mode 100755 prebuilt/flash.sh delete mode 100644 prebuilt/system.img delete mode 100755 prebuilt/update.sh rename prebuilt/vbmeta_disabled.img => vbmeta_disabled.img (100%) diff --git a/README.md b/README.md index 5fa3cf8..f6da1ec 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # PostmarketOS for Xiaomi Angelican (Redmi 9C NFC) This port also might work on angelica (without NFC) and other phones on MT6765 processors (like Redmi 9A). -If you want to develop it together, or maybe you have a working port, please write me in discord/telegram: @meexreay. Also you can find more about me on my site: [meex.lol](https://meex.lol/about) ## Roadmap @@ -11,12 +10,13 @@ If you want to develop it together, or maybe you have a working port, please wri - [x] Framebuffer + boot logo - [x] PMOS booting - [x] SSH (use `ssh 172.16.42.1`) -- [x] X11 loading -- [ ] Wayland loading -- [ ] ... +- [x] Display + Toucscreen (i3wm works) +- [ ] Built-in llvmpipe ## How to install +Run these commands to add the device to pmaports: + ```bash git clone https://github.com/MeexReay/pmos-xiaomi-angelican.git cd pmos-xiaomi-angelican @@ -25,92 +25,26 @@ ln -s $PWD/linux-xiaomi-angelican $PMAPORTS/device/testing ln -s $PWD/device-xiaomi-angelican $PMAPORTS/device/testing ``` -## How to flash +## How to prepare a phone -Firstly, you need to unlock bootloader [(See section below)](https://github.com/MeexReay/pmos-xiaomi-angelican?tab=readme-ov-file#how-to-unlock-bootloader). \ -If you have already manipulated partitions, it is recommended to [flash MIUI back](https://github.com/MeexReay/pmos-xiaomi-angelican?tab=readme-ov-file#how-to-flash-stock-firmware), and flash PMOS above it. +### Unlock bootloader -### Flash with prebuilt images +Here is described the unofficial method with mtkclient -Enter fastboot mode (hold vol- and pwr buttons while turned off), and run this command: +#### Drivers -```bash -cd prebuild && ./flash.sh -``` - -Password: 1234 -UI: surprise - -### Flash manually - -1. Build images - -```bash -pmbootstrap init -pmbootstrap install -``` - -2. Disable VerifiedBoot and flash boot partition - -Enter fastboot mode (hold vol- and pwr buttons while turned off), and run this commands: - -```bash -fastboot flash vbmeta prebuilt/vbmeta_disabled.img -fastboot flash vbmeta_system prebuilt/vbmeta_disabled.img -fastboot flash vbmeta_vendor prebuilt/vbmeta_disabled.img -pmbootstrap flasher flash_dtbo -pmbootstrap flasher flash_kernel -``` - -3. Flash system - -```bash -fastboot reboot fastboot # enter fastbootd mode -pmbootstrap flasher flash_rootfs # flash system -``` - -4. Reboot - -```bash -fastboot reboot -``` - -## How to flash stock firmware - -It is recommended to flash stock firmware before doing anything. - -[Download Firmware](https://xmfirmwareupdater.com/miui/angelican/stable/V12.0.16.0.QCSMIXM/) (MIUI v12.0.16.0) and unpack it - -### Windows - -1. Download [MiFlashTool](https://cdn.alsgp0.fds.api.mi-img.com/micomm/MiFlash2020-3-14-0.rar) -2. Unpack firmware.tgz to some folder and copy its path -3. Launch MiFlash.exe and paste the path of firmware folder to that lonely input entry -4. Click refresh, then flash button -5. That's all, close the window - -### Linux/MacOS - -Install Windows and follow the guide above - -TODO: Write how to do that on linux - -## How to unlock bootloader - -### Drivers - -#### Windows +- **For Windows:** Install usb drivers: - [https://mtkdriver.com/](mtkdriver.com) - [https://github.com/daynix/usbdk/releases](usbdk) -#### Linux/MacOS +- **For Linux/MacOS:** TODO: write about usb drivers, but they seem to be preinstalled -### Unlocking +#### Unlocking ```bash git clone https://github.com/bkerler/mtkclient @@ -120,7 +54,62 @@ git clone https://github.com/coloredmarble/redmi_9a_mtkclient cp redmi_9a_mtkclient/* . python mtk.py da seccfg unlock --preload preloader_k62v1_64_bsp.bin --loader n.bin # power off the phone, hold vol+ and vol- at same time and connect usb cable -# i did it with test point, but it isnt required +# i did it with test point, but it isnt required at all +``` + +### Flash stock firmware + +It is recommended to flash stock firmware before doing anything. + +[Download Firmware](https://xmfirmwareupdater.com/miui/angelican/stable/V12.0.16.0.QCSMIXM/) (MIUI v12.0.16.0) and unpack it + +- **For Windows:** + +1. Download [MiFlashTool](https://cdn.alsgp0.fds.api.mi-img.com/micomm/MiFlash2020-3-14-0.rar) +2. Unpack firmware.tgz to some folder and copy its path +3. Launch MiFlash.exe and paste the path of firmware folder to that lonely input entry +4. Click refresh, then flash button +5. That's all, close the window + +- **For Linux/MacOS:** + +Install Windows and follow the guide above + +TODO: Write how to do that on linux + +### Disable vbmeta + +```bash +fastboot flash vbmeta vbmeta_disabled.img +fastboot flash vbmeta_system vbmeta_disabled.img +fastboot flash vbmeta_vendor vbmeta_disabled.img +``` + +## How to flash + +1. Build images + +```bash +pmbootstrap init +pmbootstrap install +``` + +2. Flash partitions + +Enter fastboot mode (hold vol- and pwr buttons while turned off), and run these commands: + +```bash +pmbootstrap flasher flash_kernel # flash kernel to boot +fastboot reboot fastboot # enter fastbootd mode +pmbootstrap flasher flash_rootfs # flash rootfs to userdata +# in some cases its good to flash rootfs to system partition too: +# pmbootstrap flasher flash_rootfs --partition system +``` + +3. Reboot + +```bash +fastboot reboot ``` ## See also diff --git a/device-xiaomi-angelican/APKBUILD b/device-xiaomi-angelican/APKBUILD index 44197b2..3560bea 100644 --- a/device-xiaomi-angelican/APKBUILD +++ b/device-xiaomi-angelican/APKBUILD @@ -12,7 +12,6 @@ depends=" mkbootimg postmarketos-base msm-fb-refresher - postmarketos-base-mesa " makedepends="devicepkg-dev" source=" diff --git a/prebuilt/boot.img b/prebuilt/boot.img deleted file mode 100644 index 36ce063..0000000 --- a/prebuilt/boot.img +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:71309266cca377bd6b0058e2d084aa690d731d7e4908ec14532486c0f6c334f5 -size 21757952 diff --git a/prebuilt/dtbo.img b/prebuilt/dtbo.img deleted file mode 100644 index e69de29..0000000 diff --git a/prebuilt/flash.sh b/prebuilt/flash.sh deleted file mode 100755 index ddf31b9..0000000 --- a/prebuilt/flash.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -fastboot flash vbmeta vbmeta_disabled.img -fastboot flash vbmeta_system vbmeta_disabled.img -fastboot flash vbmeta_vendor vbmeta_disabled.img -fastboot flash dtbo dtbo.img -fastboot flash boot boot.img # kernel - -fastboot reboot fastboot # fastbootd mode -# fastboot delete-logical-partition product -fastboot flash userdata system.img # rootfs -fastboot reboot diff --git a/prebuilt/system.img b/prebuilt/system.img deleted file mode 100644 index ae5f896..0000000 --- a/prebuilt/system.img +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:75a93cfd7ea94fe42645c4e62812a4009eaafe4468f6bb92fdddc962b3911150 -size 586879684 diff --git a/prebuilt/update.sh b/prebuilt/update.sh deleted file mode 100755 index ebece76..0000000 --- a/prebuilt/update.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -pmbootstrap export -cp /tmp/postmarketOS-export/boot.img boot.img -cp /tmp/postmarketOS-export/xiaomi-angelican.img system.img diff --git a/ssh_config b/ssh_config index ecce289..320c0a3 100644 --- a/ssh_config +++ b/ssh_config @@ -2,3 +2,5 @@ Host pmos HostName 172.16.42.1 User user StrictHostKeyChecking no + ServerAliveInterval 3 + ConnectTimeout 60 diff --git a/prebuilt/vbmeta_disabled.img b/vbmeta_disabled.img similarity index 100% rename from prebuilt/vbmeta_disabled.img rename to vbmeta_disabled.img