Galaxy S7EDGE Random Reboots Two months back from now I installed LightROM oreo, it was fine then but after two months it started to get slow. So I decided to flash pie or Q rom, but from my previous experience whenever I install a pie or Q port of note or some else model it started to get hot or lag. This time I for some reason thought, lets try NOUGAT but it ended up horribly as my phone now keeps on restarting and rom is either not flashed. It stucked in bootloop so I flashed stock rom with REPARTITION OPTION checked in Odin with pit file. Tried every trick in the book that I knew of but it keeps on restarting, meaning if I go to recovery(TWRP flashed via Odin from AP tab) it restarts after couple of moments or became hang in recovery mode. In OS mode keeps restarting after every couple of moments. I have attached the last_kmsg file.
last_kmsg file
What things I have tried;
Flashing BL separately.
Flashing CP separately.
Flashing them together.
Trying old TWRP versions.
Using moro TWRP.
MODEL

SM-G935FD

CSC By default XSG(UAE) changed to PAK(Pakistan).
I posted the same question in xda but didn't get any response so far. I have seen few errors in last_kmsg but can't figure out what they are.
EDIT: got hold of logcat during random reboot logcat.txt
SOLVED it by myself;
So the problem was with recovery partition size, now when I installed nougat rom it tried to install bootloader and modem and somehow messed up recovery partition, samsung phones has a restriction for that meaning you can't downgrade either your Binary or Kernel via odin or any other flashing tool for that matter. Not even with twrp, sometime back I also tried another nougat rom but that had an option of if you want to upgrade but this ROM just tried to do without prior asking and it wasn't also mentioned in the OP. So how did I figured it out after three days is by going through last_kmsg and logcat.
This is a guide for only for Samsung phones
How did I solve it is by doing the following things in order;

Download latest or same binary version of your device firmware. Mine
at this time is 8 (B=8. K=7), you can find it by going into download
mode (by pressing HOME + VOL-Down + POWER Button) and looking on
top left corner after few lines.

Select all the files BL,CP,AP,CSC, and Home USER DATA and then go to second tab in odin check following options: NAND Erase, Re Partition and F.Reset Time, uncheck all other like auto reboot and everything else.

Now plug in your Phone (assuming you have already installed USB Drivers) and click start/flash.

After it is done, reboot your phone again into download mode by holding HOME+VOLDOWN+POWER key first it shutdowns then it reboots again into Download Mode.

Now reset odin by clicking on reset button or closing and reopening it, then load TWRP .tar file in AP Tab and check all the previous flags except NAND Erase and choose your PIT file. Google this for your Phone and Carrier. Inmy case it is PAK and is bundled with XSG(UAE) OMC.

After recovery is flashed, reboot to recovery mode by pressing HOME+VOLUP+POWER key and go to Wipe&gt;format and after that flash your phone's specific mods/zips like DM-Verity disabler and any other. Now you have your stock ROM, install Magisk/SuperSU or flash any other custom ROM.


Now the problems that can be solved by this way are if you have messed up your Boot Loader by trying some boot-splash or boot-animation mod (Do all the same things explained above except load your BL*.tar.md5 file at BL tab not AP tab and same goes for modem(cp) at CP Tab), messed up recovery partition by trying to flash old rom after upgrading your Binary or any other partition related problem.