Because my Note3 kept freezing, I erased the userdata and cache partitions in fastboot mode. After that, it has been stuck on the boot animation. Sadly, I didn't back up the recovery.img either, and ended up flashing a recovery that doesn't work.
Then I tried extracting the latest update.upx, but it turned out to be a differential update package. So I found a full ROM for Note3 here:
https://www.123865.com/s/FsnpTd-T4MSh .
It contains system.img, vendor.img, and persist.img... I removed the back cover and shorted the USB ground and D- pins, then used the Python edl tool to flash those images. After that, I ran edl e userdata, edl e cache, and then edl reset. However, it's still stuck on the boot animation.
Then I looked for a Xiaomi recovery image for the same CPU — twrp-3.7.0_9-0-nitrogen.img.
After flashing it via fastboot and running fastboot reboot recovery, the device immediately jumps back to fastboot mode.
However, after several attempts of repeatedly pressing the power button, there's a chance that the device will appear as a Xiaomi "nitrogen" device in lsusb, the screen still remains blank. But when I connect via adb shell, I get a root shell environment.
In that shell, I tried to format userdata and cache. I used mkfs.f2fs to reformat the userdata partition, then rebooted — but it's still stuck on the boot animation.
So I started trying to compile TWRP using the ramdisk from twrp-3.7.0_9-0-nitrogen.img.
As a beginner who's doing this for the first time, I followed the TWRP documentation. I extracted the kernel and kernel_dtb from the original boot.img, then combined them with the ramdisk from twrp-3.7.0_9-0-nitrogen.img to build TWRP.
After successfully compiling it, I flashed the new recovery image via fastboot. However, after running fastboot reboot recovery, the device stays on the logo for a few seconds, then returns back to fastboot mode again.
Now I'm completely out of options.