yashsingh1/xdaforums huggingface dataset:
[Upgrading, Modifying and Unlocking] kinghell:
Hello everyone!

Why am I writing this?

I would like to ask help regarding this DAP rooting process. I didn't find any method to root this device, so I tought, why not, let's try to make one from a "scratch".

The modding its self is not new for me, I've changed kernels, custom roms and done other tweaks on several sony and samsung device earlier, so I've worked with pre-made stuff, maybe my knowledge has been faded a bit, it was around Andorid 4-5-6-7. But this dev side of modding is absolutely new for me, however this isn't an issue, I'm willing to learn new things.

Red a lot of materials here and other sites, and tried to figured it how it works tens of hours before started to write this thread.

Here's where I've looked for already:

-[Tutorial] Building Your First Kernel: https://xdaforums.com/showthread.php?t=1748297

-[GUIDE]Building a Kernel from source{Mediatek}: https://xdaforums.com/showthread.php?t=2754513

-AlaskaLinuxUser AKLU's youtube channel, there are a bunch of good education stuff (he made several post on xda aswell):https://www.youtube.com/c/AlaskaLinuxUserAKLU/playlists

- Followed/studied the AOSP guidelines, started from here: https://source.android.com/setup

-...and from other comments/threads over the internet :D

Based on these, here's what I've found:

Should I create a custom kernel or is just enough to make a recovery? My only goal only the root permission. I've tried both, but maybe I'm mixing things ups, so first I've summarise what I've done so far:

Tried the kernel:

-Got the kernel source of the Walkman: https://oss.sony.net/Products/Linux/Audio/NW-A105.html

- Got the manifest to build TWRP: https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni/tree/twrp-9.0

- Pulled the config.gz out from the device: https://drive.google.com/file/d/1MRbf1uciNEb5VJ2hVEqtEmZfAOEbGpI4/view?usp=sharing

Tried with only recovery building:

-[DEV]How to compile TWRP touch recovery: https://xdaforums.com/showthread.php?t=1943625

Here, I didn't found the BoardConfig.mk for ex.

My problem is, that all of the mentioned tutorials, there was always a point, where I've just saw a totally different things and lost the "track". I know, isn't will be the same process as mine and will be differences, but those were just too significant for me :eek:

Final thougts:

I'm really interested in this process, but ran out of ideas. Where do I miss? How should I proceed? Maybe I'm not seeing the whole picture and there are missing basic knowledge?

What I missed from those tutorials, to write down the big picture, the steps without any modell specific examples, if this makes sense :confused:

I'm looking forward to learn this and make it happen, not I'm the only one who would be happy to root this device :o

If there are (I'm sure it is) grammar problems, sorry for those, english is not my main language.

Any help would be appreciated!

Thank You!
[Upgrading, Modifying and Unlocking] kinghell:
Update #1

Since I wasn't able to proceed with the downloaded source, I thougt maybe I can extract the boot.img from the device. My problem is, that there are 2 boot partitions (I guess this is the "A/B partition" )

I've reached the destinaiton where I saw 2 boot items:

icx1293:/dev/block/platform/30b60000.mmc/by-name $

[B]boot_a[/B] bootloader_a dtbo_b m4_os_a misc opt2 rca system_b vbmeta_a vendor_b
[B]boot_b [/B] bootloader_b fbmisc m4_os_b nvp opt3 rsv_boot userdata vbmeta_b
boot_logo dtbo_a idd metadata opt1 presistdata system_a var vendor_a

But I wasn't able to copy those, since I doesn't have permisison ( rooted device needed?)

So there is another showstopper...
[Upgrading, Modifying and Unlocking] kinghell:
Update #2

I've managed to find the right defconfig file in the source folder. I followed this Sony AOSP article(I cannot post links, my account too fresh): developer.sony.com/develop/open-devices/guides/kernel-compilation-guides/how-to-build-and-flash-a-linux-kernel-for-aosp-supported-devices#AutoLinuxKernell

On the "How to manually build the Linux kernel for 64 bit devices" part:

-got trough 2,3 points

-skipped the 4th, I have the source,

-skipped the 5th, I've found the defconfig file (the "How to Build".txt told me, which one I need):

-at the 6th step I've tried to configure the kernel with the :

make ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE android_dmp1_defconfig

but I got this:

make: Nothing to be done for 'android_dmp1_defconfig'.

Any Ideas?
[Upgrading, Modifying and Unlocking] kinghell:
Update #3

At the end, I was able to start the build process. It turned out, I was in the wrong folder however even if I was in the right folder, I had issues with the compiler (GCC 4.9) so switched back to 4.8. (aarch64-linux-android-)

The build was sucessfull, however I cannot find the image file. As I see, there isn't any...
[Upgrading, Modifying and Unlocking] Chosimise:
Hi there, while I do not have much experience on what you're trying to achieve here, I do want to show my support to your project. DAPs do not have a lot lf attention here on XDA but I can totally see the massive potential to improve the platform via rooting and magisk. Please keep up the good work and if there's anything I can participate, i am eager to help.

Best
[Upgrading, Modifying and Unlocking] Sharkuel:
Hey there.

It has been a while, but have you got any updates on this?
[Upgrading, Modifying and Unlocking] Mentalmuso:
I can help with this if anyone can simply enlighten me on how to get into fastboot mode? Or reboot to bootloader? I'm using adb reboot bootloader but it's jamming at the sony splash screen

Edit... I should've googled. I had to setup dev is all
[Upgrading, Modifying and Unlocking] Mentalmuso:
does anyone have a stock boot.img? or has anyone been able to extract or find firmware packages that can be extracted?
[Upgrading, Modifying and Unlocking] Mentalmuso:
@kinghell can you dm me back please?
[Upgrading, Modifying and Unlocking] jutley:
It would be amazing if this gets twrp and a clean cfw :) some day.
[Upgrading, Modifying and Unlocking] bgm92:
There is no boot.img available from Sony.

They are shipping the update.zip in an encrypted .UPG file, which we can't decrypt.

The only solution I see is building a custom boot image or something, which we can then flash it to the device.
[Upgrading, Modifying and Unlocking] ttwards:
Hi there.

I've managed to access fastboot, but it's not a complete one. @Mentalmuso it's using imx8mm chip, so after rebooting to bootloader, you can use NXP's uuu tool to access fastboot like uuu FB: oem unlock, uuu FB: flash recovery x.img

However, its uboot doesn't support "ucmd" or "fastboot fetch", so I found no way to get boot.img, I'm planning to make a dump of the whole emmc directly from the chip.
[Upgrading, Modifying and Unlocking] juandx:
could you unlock the bootloader?
[Upgrading, Modifying and Unlocking] ttwards:
Yep, turn on OEM unlock in developers option, then download the latest uuu tools from GitHub (nxp-imx/mfgtools), adb reboot bootloader, then type uuu FB: oem unlock. You can use uuu FB: flash xx.img, etc to flash it.Here I uploaded its system images, including boot.img
[Upgrading, Modifying and Unlocking] ttwards:
Guys I have the images now, but met problems when installing magisk.... I need help.issue
[Upgrading, Modifying and Unlocking] tequiero2003:
how did you flash the boot.img system.img ?
[Upgrading, Modifying and Unlocking] MoJoe42:
Hi There! I bricked mine, while debloating. But I mistakenly left the Bootloader locked. Is there something I can do?
[Upgrading, Modifying and Unlocking] ra1eigh:
Did you ever get anywhere with this? I am trying to figure out how to root the NW-A306 which is very similar.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AkashNP:
Thank you

Thank you very much for this. I just bought the device last week :). Since i am upgrading from a lenovo vibe k5 plus (which also had a decent amountt of development support) i have a few questions. With the vibe k5 plus, installing a custom rom was very simple. flash cutsom recovery-factory reset (i used to wipe the internal storage too)-flash custom rom-flash magisk and you're done. My question(s) are 1) What is this "Force encryption" that we have to disable/keep enabled. 2) what are vendors and firmwares. I'm currently on MIUI10 (Got a Nov 2019 unit), it's pretty decent for now.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Since, I think, Android Marshmallow, Google have added forced encryption. Before this you had the security menu option to encrypt your phone storage, which required a separate password to be entered on every reboot. Now encryption is done as standard and uses your lockscreen security PIN/password as the key.

Initially your phone will be unencrypted, but as soon as you first set-up lockscreen security the phone will be automatically encrypted.

Many people see this as a good thing. Should you lose the phone, you data is secure and cannot be accessed without the lockscreen PIN/password. Other people don't care about this and so prefer to disable encryption, as it makes life a little easier when flashing custom ROMs.

Some people, incorrectly, believe that disabling encryption is necessary when flashing custom ROMs, or that disabling encryption is the only solution to problems seen when flashing. This is not true and disabling encryption should only be about a users personal choice to be unencrypted.

Think of vendor and firmware as the equivalent to device drivers for PC components. They are a collection of compiled code files, provided by component manufacturers and the phone manufacturer, to allow Android to communicate with the hardware components in a standard way. Occasionally these files might get updated, as part of a MIUI update, to fix a bug or to add extra functionality. When these files are updated, custom ROM devs will include them so that they get the bug fixes or extra functionality. When this happens they will update the minimum vendor and firmware version requirements for their custom ROM - the version will be the actual MIUI version in which the vendor and firmware files were updated.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AkashNP:
Thanks that was a really good explanation. I have one last question, so right now I'm on MIUI10 I've got the MIUI12 update notification but I want to try MIUI11 first. I've got the ROM file from the xiaomifirmwareupdater website, how do I flash it?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Follow this guide, assuming you've downloaded the recovery ROM.

https://c.mi.com/oc/miuidownload/detail?guide=1

If you view this on a mobile, it might be a blank page. In this case, you need to change the mobile browser to desktop mode when viewing this page.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] pio80:
The most simplest and right guide on the xda forum, well done! Thank You
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] jaydeep0712:
Noob here

Are decrypted devices faster? Also please suggest stable roms. Also has anyone used 81hz extensively? Does it damage screen? Does it drain more battery?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
As far as I'm aware, there shouldn't be any noticeable difference in speed. The whole data partition is encrypted as a block, so, in use, accessing files is done on an already unencrypted partition. The individual files are not encrypted/decrypted on demand on an individual basis.

All of the popular ROMs will be stable enough for daily use. Which one to go for depends on what you prefer - more AOSP, more Pixel Phone, more heavily customisable, etc., etc.

I've never gone for the screen refresh rate mods, so can't comment on them.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] jaydeep0712:
Thanks for replying.

Which custom rom do you use? Does it have any bugs (Like under screen fingerprint not working)?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
I'm currently using LOS. It's mostly bug free. There seems to be a current issue with wired headphones - on calls it is using the phone mic instead of the headphone mic. For my use, I don't see any other issues, but there could be other things around functionality I don't use.

Fingerprint recognition is about as good as it gets on custom ROMs. Not quite as good as MIUI, but good enough.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Shinichi Kudo:
Thank you so much for busting so many myths, I was dying for someone to speak up but couldn't muster the courage myself. Hats off, and I support everything you said 100%.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] XXXLR8:
Good Day!

I installed Pixel Experience over MIUI and its stuck on Loading with Google Logo in it, it has been 30mins aprox after i first booted the device, any suggestion?

Or should i continue waiting?

Thanks in advance
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
The first boot will take a bit longer, but only a minute or 2 at most. Something has gone wrong. Make sure you follow the guide exactly.

The most common issue is not formatting the data partition. This is not the same as wiping the partition. When formatting TWRP will ask you to type 'yes' to continue. When flashing over MIUI this is necessary to fully remove encryption before flashing.

Another common problem is wiping partitions unnecessarily. There is no need to wipe anything. Just do the factory reset, this wipes what's needed and nothing more, then format data.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] XXXLR8:
I did the TWRP format (which prompted me to type yes to continue) and wipe data partition,but didnt wipe the partition itself, rebooted, installed pixel experience, and still same, i even got into a boot loop, which i got out to, by forcing my way out by fastboot, and reinstalled MIUI,

Im currently at MIUI, currently stable.

So Im going to try again some other time about this, when i have another available device to use while i reinstall pixel experience in Mi9T Pro

But, your guide is helpful, it failed on me probably because of a mistake I made.

Thanks anyways!

Best Regards.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] FuriousFrodo:
hi,

in your guide, you do not have added a step for flashing the vendor.

is this intended ?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Flashing over MIUI, I've made the assumption that you'll be on the latest version of MIUI and the original region, which should therefore already have an appropriate vendor and firmware for the new ROM.

If you've not kept MIUI up to date or have flashed a different region of MIUI, then you may need to flash the correct vendor and firmware file(s)
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] FuriousFrodo:
thanks for that. i followed as you said and i was able to flash Evolution X

however, while flashing i got a warning in TWRP E:Unable to decrypt FBE device. The ROM booted fine but I think I have made a mistake. Additionally the folder I had created to transfer the ROM is gone after the phone booted.

What could be the issue ? and how to resolve this ?

FYI, I'm using Mauroonofrio's TWRP
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
I've had that error a few times. It's normally from when your first boot into TWRP. All output from TWRP gets written to the same output screen, so when it is shown you are not seeing output from just the last command but for the whole session. If you had looked in more detail, you would have probably realised that the error was from before you started flashing.

With the ROM files going missing, that is a known problem. Actually anything copied before flashing gets lost. The first time it happened to me I had copied all my backed up data at the same time as the ROMs and it all got wiped. I can't remember exactly the details now, it's just something I've got used to. But if I remember correctly, the data disappears when you first boot into the new ROM. After it happened the first time, I checked in TWRP the next time, after flashing, but before booting the new ROM and the files were still there. It was only after booting to the ROM that they disappeared. (My memory is a bit vague now as it was over a year ago, but I think it might actually happen when you set up lockscreen security and the phone is encrypted in the new ROM for the first time). Maybe someone else can confirm or give the correct explanation.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] FuriousFrodo:
So what you are saying is its quite normal, is it?

fearing I may have to do the whole process again, I haven't set anything up.[emoji3]
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Yes, both things are normal. You should be good to go with your new ROM. No need to reinstall it.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
What version of TWRP are you using. I remember seeing that message regularly for a short time, even though TWRP was successfully decrypting the data partition. I think it was a bug introduced in one version and fixed again later (it's too big a thread to check). I've just booted TWRP, to check, and I'm not getting that message now.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] FuriousFrodo:
TWRP 3.4.0-0 Unofficial by mauronofrio

Should I change it to another?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
No, that's the best one to use.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] billamin:
use orangefox revovery. that works best for our device. twrp at times face unexplained bugs.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] mauam:
Can you mention which unexplained bugs are you referring to?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] stanlin salu:
Thanks for this guide, one more concern, is there any way to stop the automatic popup of camera when a Google Duo or WhatsApp call come..

Answers much appreciated.. Thanks!!
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
I don't use either of those apps, so have no knowledge of that problem sorry.

Try asking the question in the questions sub-forum, that section appears to have more users reading it.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Vishakh:
Encryption

Is format data needed everytime when switching roms, if we don't flash dfe?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
No, just remove lockscreen security before flashing a new ROM.

Formatting data is only needed when flashing over MIUI or a MIUI based ROM.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Vishakh:
Okay.. most of the roms for raphael are miui vendor based. So in that case we have to format data everytime when flashing new roms, right?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
No. When I say MIUI based, I mean customised versions of MIUI, such as xiaomi.eu ROMs and the like.

Going from one AOSP based ROM to another just remove lockscreen security first, irrespective of the vendor.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Vishakh:
Thanks for the reply.. I'm using aosp now. My concerns were backing up internal storage files like images, docs etc everytime. Most ppl in the community recommends flashing dfe everytime to stay decrypted & avoid formatting data. But it's a security issue.

So, when we flash a new aosp rom, just remove the security, boot into recovery, wipe caches, system & data then flash the rom+gapps, right? I'm currently decrypted & using ofox
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
There's no need to wipe system. There's no need to be decrypted. If you're using AOSP ROMs, there's no need to use OFox.

Most ppl in the 'Telegram' community appear to be promoting incorrect, unnecessary procedures.

If you're using AOSP ROMs, TWRP by mauronofrio is the best option, OFox is only worth using with MIUI and MIUI customised ROMs.

There is never any need to flash dfe, other than personal preference to be decrypted. There is rarely any need to go into the advanced wipe menu. A normal factory reset is all you need (plus format data when flashing over MIUI) when flashing a ROM.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Vishakh:
I've decrypted bcoz I didn't want to format data & erase all media in internal memory, as per the guide in telegram channel.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Correct, just remove lockscreen security, flash, then restore lockscreen security.

Basically follow the steps in my OP of this thread.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Vishakh:
I'm currently decrypted. Is the encryption option in settings> security enough or do I need to format data again to encrypt?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
You will need to remove the effects of the dfe script. Easiest way is to flash vendor and firmware from here.

https://downloads.akhilnarang.dev/MIUI/raphael

Choose the same version you are currently on and download it.

Remove lockscreen security and flash it.

When you add lockscreen security again it should automatically encrypt your phone.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AnishAcharya07:
Great thread, I followed all the steps you mentioned and was able to successfully flash pixel experience rom on my device.

Now I want to try the paranoid android rom, it says it runs under OOS vendor. What is OOS vendor ? Are there any extra steps involved while flashing roms based on OOS vendor ?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
OOS vendor is an open source vendor, not the official Xiaomi vendor files. This means that you do not need to worry about making sure you have the correct Xiaomi vendor installed, because it will install the OSS vendor that is required, every time you flash the ROM. There are no extra steps needed to flash Paranoid Android. The ROM will automatically flash the required OSS vendor, as part of the normal flash install.

Just follow my steps to flash a new custom ROM over an existing custom ROM (factory reset in TWRP, then normal flash), and don't worry about vendor updates, as it is already taken care of with the OSS vendor that will be automatically installed.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] FuriousFrodo:
What are the steps I need to take while flashing a new ROM?

I'm currently on Evolution X
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Just follow the steps in the last section of my OP

https://xdaforums.com/k20-pro/how-to/simple-guide-flipkart-owners-t4151007/post83329343
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] FuriousFrodo:
I always get confused about flashing / not flashing vendor.

Do I need to flash it only if I'm planning to flash MIUI based ROM?

What if I'm flashing a11 rom when I'm on a10 rom?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] rangapsr:
Thanks so much for the tutorial. I thought I will stick with MIUI, but it keeps killing my background apps even after disabling battery saver.