I already made a hastly "guide" for this yesterday but it got way too few love so far if you ask me, because this should be interesting to more people. So I decided to redo the guide with explaining things more deeply. I also redid the process from "scratch" once more so I can confirm it it safe and does not trip knox flag.
Still, I cant be made resposible if this does not work for you or if you mess up your phone during the process, but its pretty foolproof if you understand everything.
Before you start read the full guide to make sure you understand everything and better ask before you do anything you dont understand.
---
So here it goes:
IMPORTANT: You should either use a custom rom which fits your current stock roms version (MI6,MI7,MJ3,MJ7,etc)
or upgrade to the same stock version as the rom you want to install.
If you need to upgrade then please make sure you do not upgrade the bootloaders in the process as this could render URDLV useless on the new rom version leaving you with a non rooted phone =(
---
NOTE: There is alot of permission fixing needed with this install method. In 99% of the cases, unless otherwise noted, all the files and folders you copy over have to be owned by root:root. Directories need the permission 755 (rwxr-xr-x) and files 644 (rw-r--r--). Only binary files in /system/bin and /system/xbin need 755 permissions. (usually.... so the best thing you can do is to check out the files permissions before you copy over the new files, so you can set them exactly the same... just incase)
0.) Make sure your current roms version is the same as the custom roms version you are trying to install. You will also need to be rooted and be able to handle adb and shell commands. (use RDLV / URDLV method for root without tripping knox - do not install a custom recovery or kernel, or this process will trip knox!!!)
1.)
Extract the custom roms installer zip to your internal or external sd card. It should contain a folder called system - this will be the most important one for the rom "install" - so if i refer to your custom roms system folder, then I mean this one. It would normally just be copied over your existing folder during the rom installation in custom recovery, but since the system is running we cannot just do this - or this guide wouldnt be needed. Deep down in the folder META-INF you will find a file called "updater-script" - open this one up on your computer in a text editor to see what is actually done during the rom installation. Here you will find out if anything needs special permissions too. Like if there are folders your system folder does not yet contain - (for example photoreader has its own folder in system and needs the permissions fixed to what you find in the updater-script).
Just "get familiar" with the folders and files in the custom roms installer zip - if this all means nothing to you you should better not continue with the process! We are only interested in the system folder for now - do not try to install kernel or recovery files or something.
---
2.)
Now we actually start the "installation process":
Copy over the folders your system folder does not yet contain - like the photoreader example from above - and fix the permissions according to what you find in the updater-script.
---
3.)
For this step you need a file explorer which can handle root commands, because doing this with shell is a pain in the ass.
Once you have copied over all the "new" folders from your custom rom, we now copy over all the files in the "system/lib" folder from your custom rom to the /system/lib directory to ensure we got all the libs the rom needs.
This has to be done without overwriting any existing files - this is where the file explorer comes in. They usually have an option to skip the copy process if the file already exists. If you do this with shell you would have to type "n" and enter like 100 times.
If you just copy and overwrite existing files in this directory then you will break things and probably will get a bootloop and need to reflash with odin. (I tried it hehe - libc.so couldnt be fully copied over and then the device wouldnt boot anymore)
Fix permissions to root:root and 755 for directories and 644 for files inside the lib directory.
---
4.)
Repeat the process from 4.) with /system/bin and /system/xbin folder if they are included in your custom roms installer zip. Do not overwrite existing files and this time the files need to have root:root and 755 permission to be runnable.
---
5.)
Copy over the others.xml file from system/csc if it exists to your system and fix permissions. This file includes some modifications like sub-symbols on stock keyboard etc. So if you want the full rom experience you will need this file. Leave the other csc files untouched, just the others.xml is interesting. Fix permissions obviously.
---
6.)
Copy over the missing files from system/etc and system/etc/init.d if they exist in your custom rom. I think you could just copy over and overwrite the whole system/etc folder if you make sure you fix the permissions correctly afterwards, but I just copied over the missing files so far. (rest was identical anyway)
There is one file you most likely "want" to overwrite with the version of your custom rom: system/etc/install-recovery.sh - this file usually starts the su daemon for SuperUser and could be customized to also run init.d scripts or do other things.
---
7.)
If you did not reboot the device yet, do it now.
Once its fully booted make sure you did everything above: new folders, missing libs, others.xml in csc, etc folder.
If all this is done, we can now go on to the system apps.
For this you need to be connected over adb shell.
Run "stop" in the shell - this will stop the systemui and allows you to modify system apps without the phone suddenly rebooting or something.
---
8.)
Still in adb browse into the system/app folder of your extracted custom rom.
Now we gonna delete everything in /system/app to make it clean. So run " rm /system/app/* " to remove everything in that folder.
Right after it finishes, we copy over all the apps from the new rom. So run " cp * /system/app/ " to copy over all the files. (you must be inside the right folder for this!!!!)
After the copy is done fix permissions to root:root and 644 for all the files!
9.)
Repeat the process from step 8.) with the system/framework folder from your custom roms directory.
---
10.)
Delete the dalvik cache by running " rm -r /data/dalvik-cache ".
Youre done! Reboot the phone by issuing "reboot" through shell and your new rom should be booting up.
---
If you have done everything correctly you should basically have the same experience as if you had installed the rom through a custom recovery. It boils down to copying all the files by hand rather than relying on the zip installer - its the price you pay if you want to retain your warranty and have a custom rom. Maybe a tool or something could be created to ease up the process. You probably could just use "Flash Gordon" as long as you leave out the lib files (these are the only files I couldnt overwrite on the running device without crash so far) but I'm not sure if it can handle aroma installer scripts. Probably not, so you will end up messing up things more than you want.
With this install method you will have a "clean" install of the custom rom. Whats left maybe is to find out which lib's are actually not used since they tend to be kinda big and you could save some space by deleting. But we got plenty of space anyway... so who cares.
Hope this one gets some more love hehe - I was pretty exited when I was done with my first manual rom installation when I checked out knox and it was indeed still at 0x0.
If you have any questions or enhancements or so for this method then shoot.
Still, I cant be made resposible if this does not work for you or if you mess up your phone during the process, but its pretty foolproof if you understand everything.
Before you start read the full guide to make sure you understand everything and better ask before you do anything you dont understand.
---
So here it goes:
IMPORTANT: You should either use a custom rom which fits your current stock roms version (MI6,MI7,MJ3,MJ7,etc)
or upgrade to the same stock version as the rom you want to install.
If you need to upgrade then please make sure you do not upgrade the bootloaders in the process as this could render URDLV useless on the new rom version leaving you with a non rooted phone =(
---
NOTE: There is alot of permission fixing needed with this install method. In 99% of the cases, unless otherwise noted, all the files and folders you copy over have to be owned by root:root. Directories need the permission 755 (rwxr-xr-x) and files 644 (rw-r--r--). Only binary files in /system/bin and /system/xbin need 755 permissions. (usually.... so the best thing you can do is to check out the files permissions before you copy over the new files, so you can set them exactly the same... just incase)
0.) Make sure your current roms version is the same as the custom roms version you are trying to install. You will also need to be rooted and be able to handle adb and shell commands. (use RDLV / URDLV method for root without tripping knox - do not install a custom recovery or kernel, or this process will trip knox!!!)
1.)
Extract the custom roms installer zip to your internal or external sd card. It should contain a folder called system - this will be the most important one for the rom "install" - so if i refer to your custom roms system folder, then I mean this one. It would normally just be copied over your existing folder during the rom installation in custom recovery, but since the system is running we cannot just do this - or this guide wouldnt be needed. Deep down in the folder META-INF you will find a file called "updater-script" - open this one up on your computer in a text editor to see what is actually done during the rom installation. Here you will find out if anything needs special permissions too. Like if there are folders your system folder does not yet contain - (for example photoreader has its own folder in system and needs the permissions fixed to what you find in the updater-script).
Just "get familiar" with the folders and files in the custom roms installer zip - if this all means nothing to you you should better not continue with the process! We are only interested in the system folder for now - do not try to install kernel or recovery files or something.
---
2.)
Now we actually start the "installation process":
Copy over the folders your system folder does not yet contain - like the photoreader example from above - and fix the permissions according to what you find in the updater-script.
---
3.)
For this step you need a file explorer which can handle root commands, because doing this with shell is a pain in the ass.
Once you have copied over all the "new" folders from your custom rom, we now copy over all the files in the "system/lib" folder from your custom rom to the /system/lib directory to ensure we got all the libs the rom needs.
This has to be done without overwriting any existing files - this is where the file explorer comes in. They usually have an option to skip the copy process if the file already exists. If you do this with shell you would have to type "n" and enter like 100 times.
If you just copy and overwrite existing files in this directory then you will break things and probably will get a bootloop and need to reflash with odin. (I tried it hehe - libc.so couldnt be fully copied over and then the device wouldnt boot anymore)
Fix permissions to root:root and 755 for directories and 644 for files inside the lib directory.
---
4.)
Repeat the process from 4.) with /system/bin and /system/xbin folder if they are included in your custom roms installer zip. Do not overwrite existing files and this time the files need to have root:root and 755 permission to be runnable.
---
5.)
Copy over the others.xml file from system/csc if it exists to your system and fix permissions. This file includes some modifications like sub-symbols on stock keyboard etc. So if you want the full rom experience you will need this file. Leave the other csc files untouched, just the others.xml is interesting. Fix permissions obviously.
---
6.)
Copy over the missing files from system/etc and system/etc/init.d if they exist in your custom rom. I think you could just copy over and overwrite the whole system/etc folder if you make sure you fix the permissions correctly afterwards, but I just copied over the missing files so far. (rest was identical anyway)
There is one file you most likely "want" to overwrite with the version of your custom rom: system/etc/install-recovery.sh - this file usually starts the su daemon for SuperUser and could be customized to also run init.d scripts or do other things.
---
7.)
If you did not reboot the device yet, do it now.
Once its fully booted make sure you did everything above: new folders, missing libs, others.xml in csc, etc folder.
If all this is done, we can now go on to the system apps.
For this you need to be connected over adb shell.
Run "stop" in the shell - this will stop the systemui and allows you to modify system apps without the phone suddenly rebooting or something.
---
8.)
Still in adb browse into the system/app folder of your extracted custom rom.
Now we gonna delete everything in /system/app to make it clean. So run " rm /system/app/* " to remove everything in that folder.
Right after it finishes, we copy over all the apps from the new rom. So run " cp * /system/app/ " to copy over all the files. (you must be inside the right folder for this!!!!)
After the copy is done fix permissions to root:root and 644 for all the files!
9.)
Repeat the process from step 8.) with the system/framework folder from your custom roms directory.
---
10.)
Delete the dalvik cache by running " rm -r /data/dalvik-cache ".
Youre done! Reboot the phone by issuing "reboot" through shell and your new rom should be booting up.
---
If you have done everything correctly you should basically have the same experience as if you had installed the rom through a custom recovery. It boils down to copying all the files by hand rather than relying on the zip installer - its the price you pay if you want to retain your warranty and have a custom rom. Maybe a tool or something could be created to ease up the process. You probably could just use "Flash Gordon" as long as you leave out the lib files (these are the only files I couldnt overwrite on the running device without crash so far) but I'm not sure if it can handle aroma installer scripts. Probably not, so you will end up messing up things more than you want.
With this install method you will have a "clean" install of the custom rom. Whats left maybe is to find out which lib's are actually not used since they tend to be kinda big and you could save some space by deleting. But we got plenty of space anyway... so who cares.
Hope this one gets some more love hehe - I was pretty exited when I was done with my first manual rom installation when I checked out knox and it was indeed still at 0x0.
If you have any questions or enhancements or so for this method then shoot.
Last edited: