[GUIDE / HOWTO] Install Custom (odex/deodexed) rom with RETAINING Knox 0x0 !!!
running X-Note 5 on my Note 3 with Knox warranty still intact. This method should work for any custom rom out there (at least those which are TW based). Here is what I did:
Although it worked for me I cannot guarantee that it works for everyone and you can end up with tripped knox and/or bootloops - so do it at your own risk!!!!
If I write "fix permissions" or smth - this means BY HAND you fix those permissions like they should be, not running the fix_permissions binary (is that even on the device?)
Not sure if that matters BUT I am still on the old bootloader which my phone shipped with - MI6 afaik, used RDLV since that on all updates and skipped bootloaders
This is an "advanced" guide so I am not going to write every detail - this stuff should be only done if you know what youre doin anyway.
1.) Install the same BASE STOCK rom as the rom you're trying to install. (so for X-Note which is MJ7 based, install this - just to be sure there are no version conflicts or smth)
2.) Phone needs to be rooted with RDLV (or some other method which allows full root with knox 0x0)
3.) Extract the rom zip somewhere onto internal or external sd on the phone.
4.) Check out the extracted rom and compare it to your system folder - there are sometimes new folders that dont exist yet on your device - just copy those over for now with file explorer. (prolly need to remount system rw for this)
5.) Check out the CSC folder - usually the others.xml there of the custom rom differs and includes many tweaks, so copy that one over from the extracted rom to your /system/csc folder and fix the permissions to root:root 644. You can but dont have to reboot, some tweaks will already be running then.
6.) now what I did, just to make sure there are no odexed apps left that will not be replaced by the custom roms apps was to run the bloatware remover script. I posted a version to run from shell in that thread, so head over there and run that script - just to make sure. (If you want to be really careful make a full Titanium backup before you run the script - but those will be the odexed versions and incompatible once you finished the process as far as I understand this odex/deodex thing)
7.) So with the cleaned and rebooted phone I then proceeded to copy over the /system/lib folder from the custom rom without overwriting anything. Afterwards you need to fix permissions. (I also ran the remove bloat script once more to remove all the prior deleted libs once again - since they wont be used anyway..)
8.) From adb shell run "stop" command.
9.) Then copy over all the /system/app files from the extracted custom roms folder to the your system, this time with overwriting everything, so just issue cp from console and ship it. Once done, delete all the *.odex files in /system/app.
10.) Repeat the copy and odex removal process for /system/framework and fix up all the permissions that are left unfixed and reboot the damn phone finally to enjoy your "new" rom.
Basically it's just a cheesy tactic to install the rom onto the device without needing to flash anything - and you will be deodexed too in the process. (could be reversed again with odex script if you prefer).
So now I'm running X-Note 5 with stock kernel and stock recovery and knox still at 0x0.
Theoretically if I dump my system.img.ext4 and put it in an odin tar, this could be installed right onto other devices without tripping knox right?
System status is "custom" off course, but knox 0x0 and binary official etc.
Hope this is is interesting for you guys =)
Some things are left to copy for me - some extra binaries in /system/bin or xbin, init.d scripts etc. (but init.d is already installed on my phone, so you might want to do it too before doin all this - check out my other guide for that or send pm.
TLDR METHOD: Just install the rom yourself without beeing lazy and using a custom recovery!