after many try's here the Guide:
!!! I am not responsible for any loss and damage to your device. Apply the below steps with your own risk.
!!! You will loose all your data on the phone
1. Unlocking Bootloader
2. download the firmware zip
(must be the same Firmware then on the Phone!!!)
* * * PLEASE UNDERSTAND WHAT YOU ARE INSTALLING TO YOUR DEVICES AT ALL TIMES AND ME AND THE DEVELOPER ARE NOT RESPONSIBLE FOR ANY SORT OF DAMAGE TO YOUR DEVICE * * * Hey Guys :) Frija is a new tool (successor of now depreciated tool SamFirm)...
forum.xda-developers.com
3. Unzip Firmware and Copy AP file to Device
Unzip the firmware and copy the AP tar file to your device. It is named as AP_A515F...............tar.md5
4. Install Magisk APK
5. Patch the AP Firmware File with Magisk App
Open the Magisk app from the app drawer.
Tap on the “INSTALL” button.
“Select and Patch a File.”
Navigate to the internal storage and select the AP firmware file that you previously copied to the phone.
Once the file is selected, tap on “LET’S GO.”
Wait until Magisk patches the file.
6. Copy Patched file to Computer and unzip with 7Zip
The patched image file can be found in the “Downloads folder.”
Now connect your phone to the PC and copy the magisk_patched.tar file to the Computer
Unzip the file in the Folder "magisk_patched"
7. unzip the Original AP file and extract the img file
Unzip (with 7zip) the AP file to a new Folder
You will find recovery.img.lz4 and vbmeta.img.lz4 in the folder
Extract img with LZ4 (move the lz4 file to the lz4.exe)
8. make a new .Tar file called boot.tar
put the boot.img from Magisk inside the tar
put the extracted recovery.img and vbmeta.img inside same TAR
9. FLASH Magisk with Odin
Boot your Samsung Galaxy into Download Mode
First, power off your Samsung Galaxy device.
Connect your smartphone to your PC while holding the Volume Down + Power keys together.
You will now see the Download Mode screen.
run Odin3 xxx.exe
- BL: Select the firmware file starting “BL”
- AP: Select the Patched AP firmware file (boot.tar)
- CP: Select the firmware file starting “CP”
- CSC: Select the firmware file starting “CSC” (Not Home)
Once done finally, click “Start” to begin the flashing process.
10. Recovery Mode
Now once the Galaxy A51 boots into stock recovery mode follow the below steps.
Go to Wipe data/factory reset. (Use Volume keys to navigate between the options and Power key to select an option.)
Select “Factory data reset.”
Once done select “Reboot system now.”
The first boot will take some time.
That’s it! You have successfully rooted Samsung Galaxy A51 using Magisk.
11. Configure ur Phone
12. Install Magisk and launch the app
It should show a dialog asking for additional setup.
Let the app do its job and automatically reboot the device.
Voila!
Thanks to:
https://magiskapp.com/how-to-root-samsung-galaxy-a02s/
https://github.com/topjohnwu/Magisk/blob/master/docs/install.md
https://forum.xda-developers.com/t/tool-frija-samsung-firmware-downloader-checker.3910594/