yashsingh1/xdaforums huggingface dataset:
[Lenovo ZUK Z2 (Plus) ROMs, Kernels, Recoveries, & ] PdyLZY:
bug:

no

But the camera is not available, please use a third-party camera

And no browser, please solve it yourself

- Backup your personal data (Important)

- Download the Zip

- Boot to recovery (/vendor according to port)

- Restart recovery

- Wipe the System, Cache, Data and ART/Dalvik cache.

- Flash the ROM

- Flash Oreo ARM64 Gapps

- Flash the root solution of your choice

- Reboot your device.

ROM OS Version: 8.1 Oreo

ROM Kernel: 3.18.X

The kernel comes from:Nameless

Kernel source code：https://github.com/xzr467706992/android_kernel_zuk_msm8996

ROM Firmware Required: ZUI 2.5

Based On: AOSP

Since my region is China, the screenshot is Chinese.

Screenshot:
[Lenovo ZUK Z2 (Plus) ROMs, Kernels, Recoveries, & ] PdyLZY:
ROM:

https://mega.nz/#!8UVzCYoB!RFSncgcYGVecEZHfRHcy8oeQGC-DbnBG89LY0GRmlnE

vendor:

https://mega.nz/#!AANWVQyB!xJudIQsDU1pjg6isu6nBvmgYq6TC7ZkY2dEReXhFogg
[Lenovo ZUK Z2 (Plus) ROMs, Kernels, Recoveries, & ] seking:
Volte does not work
[Lenovo ZUK Z2 (Plus) ROMs, Kernels, Recoveries, & ] PdyLZY:
ok
[Xiaomi Mi A2 Lite Guides, News, & Discussion] rossarnie:
Thanks. Could you upload or indicate where we can get the necessary files?
[Xiaomi Mi A2 Lite Guides, News, & Discussion] dr.bahaeddin:
Will i loose all user data and internal storage wiped if i do this?
[Xiaomi Mi A2 Lite Guides, News, & Discussion] Txatxiquesi:
Thanks for sharing, looks complicated, also i think you should use a fixed twrp, since the official dont have acces to sdcard.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
If you have Magisk, you should already have the vanilla and patched boot.img files.

Of you don't already have Magisk, just follow the install procedure here. https://xdaforums.com/mi-a2-lite/how-to/guide-install-magisk-proper-support-ota-t3836952

If you're running 10.0.4.0 without magisk and need to extract your vanilla boot.img. Use fastboot to boot into twrp and then you can do the DD command to extract boot. Use adb pull to save it to PC.

I used official TWRP from here.

https://xdaforums.com/mi-a2-lite/development/official-twrp-daisy-t3855396

Apparently there's a different twrp that can access the external SD card. I don't have an external SD card so I don't need it.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I didn't lose any data.

I've never had a problem with Magisk. TWRP does tend to bootloop after install, which is why I install magisk again.

You should be able to flash the patched or vanilla boot if twrp is boot looping to fix it too. Just won't have twrp anymore.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
Mind you. I have a backup of my apps and data that's off of my phone so even if I do need to factory reset I can get it back. That's a longer and more complicated guide.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
Before I had twrp the standard Magisk ota process was enough. But that loses twrp and with twrp in my magsik backup, the uninstall didn't work. So extra steps are needed. Plus some extra steps to make backups of important files for the next OTA :)
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
Hmm... This may not be the case. I'm careful to make backups but it's easy to skip this.

If you don't have a patched boot image you can backup your current boot partition from a root shell. You need to find out if you are booting a or b slot. Then

dd if=/dev/block/by-name/boot_a of=/sdcard/patched_boot.img bs=1024k

Magisk puts old stock backups into /data. I had 4 files in there which makes it hard to know what each file is.

That's why I made sure to backup my vanilla boot image immediately.

If you're stuck without a vanilla 10.0.4.0 boot you can't do the OTA. I can upload mine somewhere when I get home tonight if it's not already online.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] FunkmasterC:
This would be very helpful, please :)
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
Here is the backup I made of the 10.0.4.0 vanilla boot.img. You'll need to decompress this before flashing.

URL REMOVED
[Xiaomi Mi A2 Lite Guides, News, & Discussion] minh150293:
What's new on 10.0.7.0 bro? Should me wait for 10.1 update if im on 10.0.4.0 rooted?
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
10.0.7.0 has the March security patches. I haven't noticed any actual changes.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] coolwei1:
Thank you, your Linux commands are sick, I never know I can get the vanilla and patched boot.img like that.

Cheer~
[Xiaomi Mi A2 Lite Guides, News, & Discussion] Irwan's:
is there an update for file version 10.0.8.0??
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I only just got the notification this morning. I'll do the upgrade tonight but I expect the same process will work.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I just used the same process to go from 10.0.7.0 to 10.0.8.0. This time I was installing to slot b instead of slot a, but otherwise, things were the same.

A side note... I hadn't got around to installing TWRP 3.3.0 so I did that but it couldn't mount /data. TWRP 3.2.3 can mount /data, so I installed that again.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] grufty47:
I have successfully updated to 10.0.8.0 with Magisk 18.1, now on Magisk 19.1, everything is running fine. I'd like to also install TWRP but refrain from doing so because of the problems (bootloops, crashes, etc) the official TWRP 3.2.3 shows with decryption in Pie and mounting external or even internal sdcard. I wonder if the latter is fixed in the inofficial fixed version. I think the benefit of TWRP is not worth the effort of repeating a1291762 wonderful tricky procedure on the monthly OTA update basis.

However the procedure is very smart, a back-to-the-roots approach of former days... great, I like it.

But I don't understand how a patched_boot.img can be created from an empty file (boot_a)?

[dd if=/dev/block/by-name/boot_a of=patched_boot.img bs=1024k] Locating the boot_a in </dev/block/by-name/> reveals a boot_a file with 0 bytes. Moreover, to unzip the zipped stock boot Image in </data/stock_boot*.img> or </sbin/.magisk/mirror/data/> I am looking for a command that just returns the boot file rather than expanding it to the full partition. Weird, can anybody help?

Thanks again to a1291762

grufty47

It appears that it is not possible to add some boot.img as attachment
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I use official TWRP 3.2.3. Only really to fix bootloop problems.

I don't have a SD and no problems mounting data.

Lots of people following the TWRP install guide seem to get bootloop. I solve that by patching boot with Magisk. Some people recommend installing an old about image.

If you have a backup of boot you can at least restore that if you have problems.

Welcome to Unix, where nearly everything is a file.

Hard disk? /dev/sda

Partition? /dev/sda1

File? /mnt/sda1/file.txt

In this case, boot_a is a way to access a partition on the phone's flash. Actually a link (shortcut) to /dev/mmcblk0p52. Partition number 53 on flash chip 1. The size can't be seen because it's a device and not a file.

dd is a command to read a device. The partition is 64M big so that's the size of the file. gzip can compress well because the actual image is only 24M big and the rest is empty.

Magisk knows how to do it. A tool called magiskboot but I don't know where it lives or how to run it.

I found this header from magiskboot. It shows how the boot.img is structured.

https://github.com/topjohnwu/Magisk/blob/master/native/jni/magiskboot/bootimg.h
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I just did the 10.0.9.0 OTA. I added a section of updating your patched_boot.img (since the Magisk updates I did made my old one useless) and I changed the backup instructions due to changes in Magisk 19. If you know where the stock boot lives before reboot, please let me know.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] grufty47:
I am on vacation, hence away from my Computer, eg away from ADB Platform Tools and Fastboot. I let Magisk secure the (Stock?) Boot Image and downloaded the 10.0.9.0 OTA. Playing with my Terminal Emulator my Smartphone crashed and needed to be rebooted . Now I am still on 10.0.8.0 and permanently notified to reboot to complete the OTA. No TWRP or system affecting Apps installed I Wonder If a reboot will end Up in a mess/bootloop. Though I have all necessary Files (Patched boot 10.0.9.0, Stock boot, boot_a, boot_b from 10.0.8.0) I have No Computer and No Fastboot and No root any more. Guess I better wait for another Week in order Not to jeopardize my Navigation Smartphone to find my way Home...

Regards frohe Alto Adige (Südtirol), Italy

Grufty47
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
It sounds like the other slot is ready to go but until you click reboot in the OTA or Magisk install, you're on the current slot, which had Magisk removed.

If you installed Magisk to the other slot then in theory allowing the ota to reboot will be OK...

I wouldn't touch anything until I was near a computer if it was me.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
Apparently when I installed 10.0.9.0 I didn't actually check that TWRP was still working... turns out it does not (phone just shows the SYSTEM IS DESTROYED message instead of starting TWRP).

I flashed the patched_boot.img so I have a "working" recovery, though since it's the stock one it's not very useful :(

Now to find a TWRP or recovery that works with 10.0.9.0. Maybe orange fox? (though I think there were reports that it didn't work).
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I updated the post. I have been using TWRP 3.2.3 since forever because it worked for me (could mount /data, at least after being installed).

Today, I figured out that TWRP 3.3.1-dees_troy (from the official TWRP site) works with 10.0.9.0. What's more, it works (can decrypt /data) if you fastboot boot it, not just after install. So you could in theory simply not install TWRP and fastboot boot if in the event that you actually need it.

I am glad to have TWRP back :)
[Xiaomi Mi A2 Lite Guides, News, & Discussion] grufty47:
Today, I figured out that TWRP 3.3.1-dees_troy (from the official TWRP site) works with 10.0.9.0. What's more, it works (can decrypt /data) if you fastboot boot it, not just after install. So you could in theory simply not install TWRP and fastboot boot if in the event that you actually need it.

I am glad to have TWRP back :)[/QUOTE]

As already shared in the <Install Magisk with proper support of OTA...> thread:

Now I am fine again...! After factory reset I successfully restored Magisk root on my MIA2L with a 27.456 Kbytes <patched_boot_10_0_9_0.img> (re #885). The data directory now showed 2 stock_boot images (*.img.gz), the original one dated 31.12.79, 19,26MB and a stock_boot created by Magisk, dated yesterday, 11.06.19, 17,7 MB. I then booted TWRP 3.3.1_dees-troy and had it installed to both slots. Everything went fine... access to externalsd, saving of partitions works, no problem with encryption (no passwords used). TRWP told me I am rooted but I was not, hence Magisk needed to be reinstalled. Another stock_boot*.img.gz file was created, 26,56 MB, obviously including the TWRP functionality. Unzipping the Magisk created stock_boot files give the size of the full boot partion (64 MB) Let's see what the effort will be at the next update to remove everthing and then to reinstall Magisk and TWRP again... but I am also glad to have TWRP and Magisk!

17.06.2019

... but guess what I have discovered after complaints from my wife being unavailable on the phone: When being called the phone ringed and vibrated but on the display I was not offered to accept the call! Calls had been routed to the mailbox, always a "missed call" notification! After deleting all the updates from the standard Google phone app the normal operation could be restored (Phone app shrinked from >26 MB to <2 MB!).

I don't know if this phenomen is related to the OTA update/TWRP /Magisk installation or an individual misbehaviour of my phone. Hence my advice if you also applied 10.0.9.0 OTA update/TWRP 3.3.1/Magisk 19.2 installation: check if you can accept mobile phone calls, the basic functionality of a phone!!!

Thanks

Grufty47
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I finally did the 10.0.10.0 OTA. For some reason, both my system and vendor partitions failed the OTA checksum. The OTA actually tells you this in logcat. I've added a section to the guide with an example.

Luckily 10.0.9.0 had a full fastboot image available so I could flash those partitions to allow the OTA to complete. I could have just flashed the 10.0.10.0 fastboot image but I was curious to see what the OTA didn't like (there have been lots of reports from people of OTA problems for 10.0.10.0).
[Xiaomi Mi A2 Lite Guides, News, & Discussion] grufty47:
As already said in the thread <Install Magisk with proper OTA support> I could only update to V10.0.10.0 from scratch and restore Magisk with Tech0308 patched_boot for V10.0.10.0.

Unfortunately I got so courageous by this success that I went on installing a Magisk module for <twrp retention on OTA for a/b> Installation of twrp_3.3.1 dees-troy followed with no problems but, as expected, removed the magisk root. As far as I remember I then installed Magisk to the inactive slot... and the desaster started: Password issue, no chance to load android. Same issue on the the other slot. Flashing with V10.0.9.0 boot and system images failed. Flashing with original V10.0.9.0 with flash_all_but_storage failed, still the password issue. Flashing with original V10.0.9.0 with flash_all failed, but the device recovered with factory settings. Ok, system rebuilt with Google and Titanium recovery, OTA to V10.0.10.0 done and Magisk rooted with the patched_boot once again. Puh, a lot of work. Happy again but for the time being I don't dare to install twrp again (though there were no problems on V10.0.9.0).

Any clue why the flashing processes with with V10.0.9.0 system and boot images did not work and the MiFlash20181115 proceeded flashing until the process eventually completed failed=red (after 190s). However, the flash_all at least gave the factory setting to start anew.

What does the notification "err:" mean in the last lines of the flash log:

[21:38:17 adb696bb0505]:err:rebooting...

[21:38:17 adb696bb0505]:err:finished. total time: 0.048s

[21:38:17 adb696bb0505]:error:Not catch checkpoint (\$fastboot -s .* lock),flash is not done

[21:38:17 adb696bb0505]:process exit.

[21:38:17 adb696bb0505]:flashSuccess False

[21:38:17 adb696bb0505]:isFactory False CheckCPUID False

[21:38:17 adb696bb0505]:before:flashSuccess is False set IsUpdate:True set IsDone True

[21:38:17 adb696bb0505]:after:flashSuccess is False set IsUpdate:false set IsDone true

Greetings

grufty47
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
Yeah, I saw that post and replied to it. I'll refrain from doing so again :)

It definitely doesn't mean error... it's printed before just about every line.

The last "error" there is just because the flash you did rebooted and didn't lock the bootloader but the script thought it should have seen the bootloader get locked. Probably a bug in the script. The device rebooted so the error is harmless.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] agbadino:
i appreciate all the time and effort u applied to all this.

my question then is: i believe the "boot.img" file in the stock rom folder is actually a "vanilla boot.img" of the device, or am i wrong?

Thanks.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
Yes. If you have a fastboot ROM for your current version, the boot.img in there is what I call vanilla.

Not every OTA has had a fastboot ROM though, which is why I like to backup my vanilla boot when doing an OTA.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] kevinccce:
hello! thanks for this guide. i'm assuming this will work also on A2?
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I have no idea. I don't have an A2.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] Dorisnov:
My OTA is not installing as you advice in first post. This is the log:

E/update_engine(2281): [0722/142121.995053:ERROR:delta_performer.cc(990)] The hash of the source data on disk for this operation doesn't match the expected value. This could mean that the delta update payload was targeted for another version, or that the source partition was modified after it was installed, for example, by mounting a filesystem.
E/update_engine(2281): [0722/142121.995282:ERROR:delta_performer.cc(995)] Expected: sha256|hex = 8D7D42B848CD0D1364272E16E757919C2D17DFE4303E6AA9D39BDAA50183814A
E/update_engine(2281): [0722/142121.995344:ERROR:delta_performer.cc(998)] Calculated: sha256|hex = CB9F31AD57CAAEBDA0603B4D367E189A1355619C87870E028F2279642C65B3FA
E/update_engine(2281): [0722/142121.995413:ERROR:delta_performer.cc(1009)] Operation source (offset:size) in blocks: 0:5221,5461:405,5869:1,5873:304,6181:629
E/update_engine(2281): [0722/142121.995500:ERROR:delta_performer.cc(1191)] ValidateSourceHash(source_hash, operation, source_fd_, error) failed.
E/update_engine(2281): [0722/142121.995563:ERROR:delta_performer.cc(298)] Failed to perform BROTLI_BSDIFF operation 200, which is the operation 0 in partition "boot"
E/update_engine(2281): [0722/142121.995626:ERROR:download_action.cc(337)] Error ErrorCode::kDownloadStateInitializationError (20) in DeltaPerformer's Write method when processing the received payload -- Terminating processing

As I see, this seems like boot partition is the one I have to restore. Am I right?

Thanks!
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
Yes. It's complaining about the boot partition.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] Dorisnov:
Can't find a 10.0.8.0 fastboot room to recover the partitions, I only found it in recovery update. Can I flash the recovery updates trough TWRP?
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I have no idea. I know that otas have patches to apply to the previous version. So you can in theory find the last full image and patch to get to your version.

It might be easier to get a full image that's newer (eg. 10.0.10.0) and flash that without wiping data.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] Dorisnov:
Flash a new version from fastboot like with XiaomiFlashTool or from recovery? It will be an update or a clean install without loosing data?
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I mean these images:

https://xdaforums.com/mi-a2-lite/how-to/fastboot-xiaomi-mi-a2-fastboot-images-t3824871

Normally you'd use one to recover a dead device, but if you don't erase the data partition, you can use them to upgrade.

I have never needed to do this, but I have seen other people on these forums doing this when they can't get an OTA to install.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] sebadamus:
Hi [MENTION=4964062]a1291762[/MENTION],

Have just followed the steps to update to OTA 10.0.12.0 without loosing Magisk/TWRP and it worked with out any problem!

I only had to re-flash dsp.img, modem.img, and system.img as each time I tried to apply the OTA it gave the logcat error "The hash of the source data on disk for this operation doesn't match the expected value...".

First with dsp then modem then system (seems the OTA does not check every partition for modifications, instead it checks one by one and stops when it find modifications)

I only had two modules installed with Magisk: Busybox for Android NDK and Systemless Hosts.

w

Do I had to reinstall these two again? (the "systemless" modules I know are supposed not to touch the system, but Busybox?)

Thanks, great tutorial!!!
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I had no issue going from 10.0.10.0 to 10.0.12.0, but I did have to reflash some partitions to get to 10.0.10.0...

I guess if an OTA doesn't touch a partition it won't complain if it's modified?

It does make me wonder how partitions are getting modified though...

The whole point of Magisk modules is that they live on /data and get put in place on every boot (using a temporary overlay). So you shouldn't have to reinstall the modules after OTA.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] sebadamus:
Two days ago I decided to OTA update from 10.0.10.0 to 10.0.12.0... now there is the August 10.0.13.0 update (palmface here)

I tried the same steps as before, but also got "The hash of the source data on disk for this operation doesn't match the expected value" in logcat... so again had to re-flash dsp, modem, and system (but mistakenly I took 10.0.10.0 imgs because those where the latest I could find in miui official site... so after system.img reflash, black screen telling there is a problem Houston...)

Here the roms:

https://xdaforums.com/mi-a2-lite/how-to/fastboot-xiaomi-mi-a2-fastboot-images-t3824871

So I re-reflashed dsp, modem, and system (now the correct versions) OTA could be applied and everything is back and working Magisk/TWRP.

Hope to help, great thread!
[Xiaomi Mi A2 Lite Guides, News, & Discussion] Goncalodoom:
Can you upload the boot.img of the latest OTA update so I can patch it with magisk?
[Xiaomi Mi A2 Lite Guides, News, & Discussion] sebadamus:
I think you are looking for this https://xdaforums.com/mi-a2-lite/how-to/fastboot-xiaomi-mi-a2-fastboot-images-t3824871 if not I will try to post but there is a strict upload limit.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
If you trust me, I just did the 10.0.13.0 OTA.

#link removed#

You need to uncompress those before flashing/booting them.

If you're reading this thread though you shouldn't need them...

Fastboot boot twrp 3.3.1-dees_troy.

Use dd to read the current boot (vanilla).

Reboot.

Use Magisk Manager to patch the image (doesn't need root).

Now you've made your own images!
[Xiaomi Mi A2 Lite Guides, News, & Discussion] minh150293:
How to keep root after reboot? It last only on first boot and lost then.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] sebadamus:
If you follow the steps from post #1, root remains after each reboot! you might be skiping some steps.

---------- Post added at 09:55 PM ---------- Previous post was at 09:42 PM ----------

As I wrote before on https://xdaforums.com/showpost.php?p=80104842&postcount=41, every seemd to work fine but there is a strange behaviour, hope to be able to explain and it might not be because of TWRP or Magisk... but hope it sounds a bell if not will keep looking somewhere else.

I have fingerprint and pattern locking setup and the device is encrypted (I think this is default as I cant remember selecting that myself), also an external SD card 64gb.

On last post after everything was ok (magisk, twrp and root) I decided to create a compressed backup of the entire phone, I mean each partition TWRP offers to backup (excluding external sdcard). I did that and save to external sdcard.

On next reboot, the phone took about 10 minutes to boot until it shows the black screen with the pattern dots to "unlock" or I think is to continue booting with the encryption. After entering the pattern (really lagged) it reboots, showes MIUI orange logo white screen, androidone wait wait about 1 minute, and then my sim unlock 4 numbers, I entered it (really lagged everything again) wait wait... start appearing my screen wallpapper and stuff/icons... but lagged, cant move to other screen or menus. Wait some more, about 1 minute... shows "System process not responding" wait/close... I do wait, then Poco Launcher does the same, I do wait some more and seems back to normal.

So, what could it be? the latest OTA 10.0.13.0? something about re-encryption after OTA?

I have rebooted 5 times since last days and each boot takes forever, thing that didt happend on 10.0.12.0, there it rebooted really fast.

Thanks for reading! any clue? (logcat? its really a trashcan, dont know what to look for)