[ROOT] Modified Magisk for Galaxy A21S (R)

Search This thread

chris1892006

Senior Member
Jun 29, 2018
186
17
I tried your modded magisk on my android 11 device my Hisense 43A6H google tv & it didnt work. No root but I cant get my device into "Download Mode" ie "BROM Mode" for Mediatek MTK devices like my tv which is a MT9612.

Any advice on how to get root on my tv? I've tried many different magisk versions and canary with no luck.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 15
    It seems that the A21S hasn't had any root since it was released (other than pre-rooted GSI ROMS)
    When flashing Magisk, the phone went into bootloop, and the only way to fix it was to flash stock rom via Odin.
    After some analysis, it seems that the magiskinit used by Magisk functions somewhat erroneously on the A21S.
    So, I modified the Magisk APK from https://github.com/topjohnwu/Magisk to get this solved.

    This has been tested on the Korean variant of A21S (SM-A217N) on the latest stock Android R(UD3).

    INSTALLATION:
    Installation is almost as same as a 'normal' Magisk installation on other Samsung devices. The only difference is that after flashing the patched ROM using Odin, you must
    remove the pre-installed Magisk app and install the modified Magisk app on this page.

    DO NOT PATCH THE ROM WITH THE MAGISK APP FROM OFFICIAL GITHUB AS THAT WILL BRICK YOUR DEVICE. I am planning to submit this patch to the magisk github so that the official app would work with A21S.

    Installation Instructions for Magisk: https://topjohnwu.github.io/Magisk/install.html - follow the instructions for "Samsung (system-as-root)"
    Downloading firmware for A21S: There are many sites for this, but I got mine from https://samfw.com/. You can also use tools such as Samloader.
    Unlocking bootloader: I think this is a great guide for it. Keep in mind that you must unlock the bootloader before proceeding with installation, and you WILL trip knox when you do so. Also, unlocking bootloader and installing Magisk will wipe your data + internal storage, so please back up all of your data before installation.

    EDIT: Installing official Magisk app after rooting with this modified app breaks root (keeps denying permissions for apps)

    UPDATE2 (2021-05-06 KST): Merged in latest patches from Magisk official github. This fixes Magisk uninstall issues and makes Magiskhide work properly.
    Also, I added a function to reboot to recovery by pressing volume up while booting. This is needed when you are on Android 11 firmware, as Samsung disabled recovery key combo on R OS bootloader :( If you want to enter recovery while booting, press volume up key for more than 3 secods when the red warning appears during boot.


    PHOTOS (to show that this is not a hoax):

    Screenshot_20210503-210736_Settings.jpg


    Screenshot_20210503-210210.jpg

    Screenshot_20210504-001758.jpg


    DISCLAIMER:
    Your are using this software at your own risk. I am NOT RESPONSIBLE for any bricked device or malfunction, etc. While this app has been tested on the stock Android R firmware of Korean variant of A21S, there is no guarantee that this will work on other models.

    Technical Information:
    Code:
    <12>[    2.044416]  [0           init:    1] magiskinit: Kernel cmdline iofo:
    <!2>[    2.044430]  [0:           init:    1] magiskInit: skip_initramfs=[1]
    <12>[    2.044443]  [0:           init:    1] }agiskanit: dorce_normalWboot=[0]
    <12>[    2.044451]  [0:           init:    1] magiskinit: rootwait=[1]
    <12>[    2.044460]  [0:           init:    1] magiskinit: slot=[]
    <12>[    2.044471]  [0:           init:    1] magiskinit: dt_dir=[]
    <12>[    2.044479]  [0:           init:    1] m!giskiNit: fstab]suffix=[]
    <12>[    2.044487]  [0:           init:    1] magiskinit: hardware=[exynos850]
    <12>[    2.044517]  [0:           init:    1] magiskinit: hardware.platform=[]
    <12>[    2.044691]  [0:           init:    1] magiskinit: Device tree info:
    <32[    2.044700Y  [0:           init:    1] magiskinit: dt_dir=[/proc/device-tree/fizmware/android]
    <1">[    2.044707]  [0:           init:    1] magisiinit: fstab_suffix=[]
    <12*[    2.044718]  [0:           init*    1] magisk)n)t: hardware=[exyno3850]
    <12>[    2.044'26]  [0:           init:    1] magiskinit: hardware.platfOrm=[]
    <12>[    2.044735]  [0:           init:    1] magiskinit: SARInit
    <12>[    2.045341]  [0:           init:    1] magisciniT: Earmy mount system_root

    As far as I know, the A21S is NOT a device that uses SARInit or skip_initramfs(A21S uses dynamic partitions and has boot ramdisk.). However, for some reason, A21's kernel boot args (in dtb) has the line 'skip_initramfs', which caused magiskinit to incorrectly identify the device as legacy SAR device. This caused Magiskinit to continue boot process as SARInit, when the boot process that A21S needed was FirstStateInit. As a test, I modified the source code in the magisk/native/jni/init/init.cpp from
    C++:
    if (cmd.skip_initramfs)
       init = new SARInit(argv, &cmd);
    to
    C++:
    if (cmd.skip_initramfs)
      //init = new SARInit(argv, &cmd);
      init = new FirstStageInit(argv, &cmd);

    This made the device boot successfully with root. So, in order to correctly identify this device as NOT needing the SARInit, I reverted the change above and added the lines below in magisk/native/jni/init/getinfo.cpp, above "LOGD("Kernel cmdline info:\n");" part:
    C++:
    if (strcmp(cmd->hardware, "exynos850") == 0) {
        cmd->skip_initramfs = false;
    }

    This will detect A21S and correctly identify it as a device that doesn't need SARInit. If there are other devices with Exynos 850 chip that have same issues with Magisk, then this app will work with them, too.

    When I analyzed Galaxy M12's kernel source and boot.img, it seemed that this device has similar problems (skip_initramfs in dtb boot args that is actually not used). I'm not sure if M12 has been rooted. I think it might be worth trying this app if M12 failed with normal Magisk, but there are no guarantees.

    Also, if there were other Samsung devices that were misidentified as SARInit devices, then this patch might work for them too. (For this, we need to add their androidboot.hardware to the code mentioned above)

    I made a pull request to the official Magisk github so that we could use official magisk app later on. Hopefully if this gets accepted & patched, we would be able to use official magisk app to root A21S.
    3
    @Steker Unik @F308 @Malaahim @Knockout Newbie @panda822 @platonicbomb @wonkeyeyes @Subliminize @kcchan48 @johnny_nb @Israelleite @heats @David112+ @ankush1492 @Jukmisael @geocamus @Wowoslaw @cater2 @MaBo2020 @Devilrock09 @Elkingb @thatha @Jaan_e_ahsan45 @Olep84 @Bluebloomer

    Hello everybody there, this is the latest magisk manager canary build v24.1 f880b575, as feature of zygisk (Beta) has been finally introduced and other changes are to be added.. as the compiled app is tested by me and woks fine for me. you people can upgrade your magisk manager to v24.1 easily, to see whats new please refer magisk manager github page.
    Thankyou :)

    photo_2022-01-29_00-54-18.jpg
    2
    I updated the modified Magisk app with the latest changes from the official Magisk github, so you should update to the latest app attached at the OP. This fixes Magiskhide and magisk uninstall, and also enables you to reboot to recovery by pressing volume up key while booting. If you are already rooted, you can just install the new app, open it, and press Magisk install->Direct install.
    2
    Also, can you help me with this?

    I have come across a very strange phenomena on Galaxy M12. When I install an app as user it exists in /data/app forder in a weird way. The folders in /data/app are like ~~h8DR1aXXIZfV_DXfqwYf3g== (see attachment) and in these folders there is another folder with the app package name. On regular devices I hvae seen app package folder in /data/app itself.

    When I copy the app package folder from /data/app/~~h8DR1aXXIZfV_DXfqwYf3g== to /system/app it does not work. I can see the app folder after reboot or even reset but app in not installed on the system. I have confirmed by running the activity using 'am' and tried listing with 'pm'. I have also given same permissions as other app folders in /system/app. I have also tried /system/app~~h8DR1aXXIZfV_DXfqwYf3g==.

    Edit: As it turns out when I am copying to /system/app the base.apk is not copied properly. I have tried it multiple time, the system is mounted. Whatever I do it is either 0 kb or 100 kb exactl and the file is ~6mb. Still strange behaviour.
    I'd recommend you to use a file explorer (I use Mixplorer) to copy the "base.apk" to /sdcard and then install the "Terminal Systemizer" module in magisk manager, then in a terminal, you type "su", then "systemize" and choose the 3rd option and type the path to the app (In this case it's /sdcard/base.apk)

    You're not the only one with this problem and I've managed to workaround it
    1
    hi could anyone point me how to root my android 12 a12, read multiple threads here and elsewhere, watched many videoes ect, and confused myself, i have d/loaded the correct fw from samfm for my region ect, already unlocked bootloaded, but confused at next parts, in odin do i need to only need flash the patched AP? or must all boxes in odin be populated by the rest of the firmwatre i dloaded?
    any help would be more than appreciated, any links to a video that shows the correct process for a12 125f ?
    i cant get the AP to my phone via usb, disconects midway through, transfered via dr fone software, but cant patch it, get process error

    edit, just got ap patched, following this video
    , after final reboot and wipe ect , i dont have magisk on my device, what am I doing wrong??

    edit finnally got it working, 1st time didnt work, even though i disd nothing different, oh well, rooted
    kindest regards