We will be using Chainfires methodes he originally postet here. Make sure you selected your model number, because if you have a different model number this methode will not work and you may brick your device. This methode will increase your flash counter and will trip the KNOX warranty flag.
1. What you need
Download CF-Autoroot for SM-G900M [http://download.chainfire.eu/403/CF-Root1/CF-Auto-Root-klte-klteub-smg900m.zip]
2. Flash the CF-Auto-Root package as PDA in ODIN
– Download and unzip the CF-Auto-Root-….zip file
– If you end up with a recovery.img and cache.img file, you’ve extracted twice. You need to end up with a .tar.md5 file
– If your phone is connected to your computer disconnect it – Make sure Kies is not running
– Start Odin3-vX.X.exe
– Click the PDA button, and select CF-Auto-Root-….tar.md5
– Put your phone in Download mode [turn off your phone, then hold VolDown+Home+Power to boot – if it asks you to press a button to continue, press the listed button]
– (USB) Connect the phone to your computer
– Make sure Repartition is NOT checked, this is really important….
– Click the Start button
– Wait for Android to boot
– Done, welcome, you should now have root
If your device doesn’t bootinto recovery and won’t be rooted, do the procedure again and start over. If that doesn’t help make sure Auto Reboot is unchecked in Odin. After flashing has finished, pull the battery and boot manually into Recovery using the VolUp+Home+Power buttons. The installation will then start automaticaly.
Now that you are rooted, you may want to install a cusom recovery.