Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save progzone122/d414579aee2d62ad045ffdf034e0e18d to your computer and use it in GitHub Desktop.
Save progzone122/d414579aee2d62ad045ffdf034e0e18d to your computer and use it in GitHub Desktop.
Installing PostMarket OS on Mi A2 Lite (xiaomi-daisy)

Detailed Guide for Installing PostMarket OS on Xiaomi Mi A2 Lite (xiaomi-daisy)

Written with 💖 by DiabloSat

Prerequisites

  • The device bootloader must be unlocked.
  • platform-tools installed on your PC.

Preperation

It is recommended to flash the latest stock firmware before installing PostMarket OS

  1. Select your desktop environment and download the prebuilt images (example 24.06/sxmo-de-sway/20241127-1248): Xiaomi-daisy 24.06 prebuild images link

  2. Extract all archives, rename files, and move them to a separate directory for convenience изображение

  3. Download the updated, modified lk2nd.img for your touchscreen and rename it to lk2nd-updated.img"

    You can download either of the two images, and if your touchscreen doesn't work, you can reflash the other image

    Repository link: lk2nd-xiaomi-daisy-sakura-prebuild releases link

    изображение

Flashing

  1. Enter fastboot mode and connect the device to your PC (POWER + VOLUME DOWN).
изображение изображение
  1. Load the lk2nd.img loader into RAM

[!] If you skip this step and directly flash the updated loader lk2nd-updated.img, you won't be able to flash the boot.img!

изображение изображение
  1. Flash boot.img to the boot partition
изображение
  1. Flash the updated loader with modifications for your touchscreen (lk2nd-update.img) to the lk2nd partition and reboot into it
изображение изображение
  1. Flash the system image (userdata.img) to the userdata partition and reboot
изображение

Fixing "mdtp image is corrupted" Error and Fastboot Bootloop

After step "Flashing (Step 5)", there is a high chance you'll encounter a fastboot bootloop and see the error "mdtp image is corrupted" when trying to load the lk2nd loader into RAM.

изображение изображение

What's the Problem?

When you flash the updated loader lk2nd-update.img, your active slot changes to Slot B (and Slot B has no valid data)

Simply switch the active slot back to Slot A in fastboot mode and reboot

изображение изображение

Default Root Password

147147

Подробный гайд по установке PostMarket OS на Xiaomi Mi A2 Lite (xiaomi-daisy)

Написано с 💖 от DiabloSat

Предварительные требования

  • Разблокирован загрузчик устройства
  • Установлен platform-tools

Подготовка

Рекомендуется установить последнюю стоковую прошику перед установкой PostMarket OS

  1. Выберите окружение рабочего стола и скачайте уже предварительно собранные образы (например 24.06/sxmo-de-sway/20241127-1248): Xiaomi-daisy 24.06 prebuild images link

  2. Разархивируем все архивы, переименовываем и перемещаем в отдельную директорию для удобства изображение

  3. Скачиваем обновленный, модифцированный образ lk2nd.img под ваш сенсор и перименовываем в "lk2nd-updated.img"

    Можно скачать любой из двух образов и если у вас не будет работать сенсор, то просто нужно будет повторно прошить другой образ

    Ссылка на репозиторий: lk2nd-xiaomi-daisy-sakura-prebuild releases link

    изображение

Прошивка

  1. Переходим в режим fastboot и подключаем к пк (POWER + VOLUMN DOWN)
изображение изображение
  1. Загружаем загрузчик lk2nd.img в ОЗУ

[!] Если вы пропускаете этот шаг и сразу загружаете/прошиваете обновленный загрузчик lk2nd-update.img, то вы не сможете прошить boot.img!

изображение изображение
  1. Прошиваем boot.img в раздел boot
изображение
  1. Прошиваем обновленный загрузчик с модифицией под ваш сенсор lk2nd-update.img в раздел lk2nd и перезагружаемся в него
изображение изображение
  1. Прошиваем образ с ситемой userdata.img в раздел userdata и перезагружаемся
изображение

Решение ошибки "mdtp image is corrupted" и бутлупа в fastboot

После шага "Прошивка (5 пункт)" есть большая вероятность, что вы получите бутлуп в fastboot, а при попытке загрузить загрузчик lk2nd в ОЗУ ошибку "mdtp image is corrupted"

изображение изображение

В чем же проблема?

Дело в том, что когда вы прошиваете обновленный загрузчик lk2nd-update.img у вам меняется активный слот на B (а в слоте B у нас ничего нету).

Просто поменяйте активный слот обратно на A в режиме fastboot и перезагрузитесь.

изображение изображение

Дефолтный пароль от root

147147

@otomay
Copy link

otomay commented Dec 9, 2024

Hey o/ Thanks for sharing ur knowlege. I'm stuck with pmbootstrap scripts for a couple days and never got it to work. The closer I got was using fastboot commands, but I can't get the touchscreen to work.

And then I found your guide and saw something I was doing different:

[!] If you skip this step and directly flash the updated loader lk2nd-updated.img, you won't be able to flash the boot.img!

I was flashing the boot img before loading lk2nd into ram or was not flashing the boot img at all.
So I tried your way, but the touch doest not work on none too. I was trying with phosh.

Now I tried with sxmo -- with goodix touch does not work and with edt the rom does not boot.

I flashed the stock rom using mi flash, but think it's not the latest. It's pretty hard to find those roms lately.
May u have some idea of what I have to do?

THX!

@progzone122
Copy link
Author

Hey o/ Thanks for sharing ur knowlege. I'm stuck with pmbootstrap scripts for a couple days and never got it to work. The closer I got was using fastboot commands, but I can't get the touchscreen to work.

And then I found your guide and saw something I was doing different:

[!] If you skip this step and directly flash the updated loader lk2nd-updated.img, you won't be able to flash the boot.img!

I was flashing the boot img before loading lk2nd into ram or was not flashing the boot img at all. So I tried your way, but the touch doest not work on none too. I was trying with phosh.

Now I tried with sxmo -- with goodix touch does not work and with edt the rom does not boot.

I flashed the stock rom using mi flash, but think it's not the latest. It's pretty hard to find those roms lately. May u have some idea of what I have to do?

THX!

As i understand you have touchscreen edt? I can make a build again for edt, maybe I made a mistake

@progzone122
Copy link
Author

Hey o/ Thanks for sharing ur knowlege. I'm stuck with pmbootstrap scripts for a couple days and never got it to work. The closer I got was using fastboot commands, but I can't get the touchscreen to work.

And then I found your guide and saw something I was doing different:

[!] If you skip this step and directly flash the updated loader lk2nd-updated.img, you won't be able to flash the boot.img!

I was flashing the boot img before loading lk2nd into ram or was not flashing the boot img at all. So I tried your way, but the touch doest not work on none too. I was trying with phosh.

Now I tried with sxmo -- with goodix touch does not work and with edt the rom does not boot.

I flashed the stock rom using mi flash, but think it's not the latest. It's pretty hard to find those roms lately. May u have some idea of what I have to do?

THX!

Follow here, I'm sure you just need to flash a modified lk2nd to get the touchscreen to work - progzone122/lk2nd-xiaomi-daisy-sakura-prebuild#1

@otomay
Copy link

otomay commented Dec 9, 2024

Thanks for answering!

I'm not sure what touch I have. When in lk2nd bootloader, I can see qcom,mdss_dsi_ili7807_fhdplus_video in panel line. Is this a good info?
But I don't think it's a issue with your pre-built version, because I can use both with phosh (even if I can't get touch working with none).

@progzone122
Copy link
Author

Thanks for answering!

I'm not sure what touch I have. When in lk2nd bootloader, I can see qcom,mdss_dsi_ili7807_fhdplus_video in panel line. Is this a good info? But I don't think it's a issue with your pre-built version, because I can use both with phosh (even if I can't get touch working with none).

Please write in issue replies, because it's not convenient to post here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment