ANDROID
in linux we have a command called su ( switch user).
When you type only su (without a username), it defaults to switching to the root user.
and in android we have 2kind of rooting system.
1. Traditional root (system root) (we go to /system folder and enter there su executeable file)
2. Systemless root (e.g., Magisk):
(1).Traditional root
1.Flash a custom recovery (e.g., TWRP)
2.Mount /system as read-write
3.Copy su binary to /system/bin/ or /system/xbin/ (Android does not contain su by default.)
4.Set correct permissions (chmod 755)
5.Modify boot scripts (like init.rc) if needed
(2)
Boot-Time Modifications:
-
Bootloader loads patched
boot.img-
This contains original kernel + Magisk-injected
initramfs
-
-
Kernel boots and unpacks
initramfs-
Instead of the stock
init, Magisk’smagiskinitruns
-
-
magiskinit:
-
Sets up:
-
Virtual filesystem overlays (/system,/system/bin,
tmpfs,overlayfs)(Overlay Filesystem (overlayfs) হলো একটি লিনাক্স ফাইলসিস্টেম ফিচার, যা দিয়ে আপনি একটি read-only ফাইলসিস্টেমের উপরে একটি writable স্তর বসাতে পারেন, যেন বাইরের দুনিয়ায় মনে হয় আপনি ফাইলগুলো পরিবর্তন করছেন — কিন্তু আসলে মূল ফাইলগুলো অপরিবর্তিত থাকে।) -
Root namespace (for hiding root)
-
Injected
subinary into a mounted location(/system) -
Loads Magisk modules (mounts overlays into
/system,/vendor, etc.)
-
-
Then it chains to original
init, so normal boot continues
-
-
magiskd (Magisk Daemon)( deamon means which process run in bacgrund):
-
Starts in background
-
Manages:
-
Root access requests
-
susession handling -
Dynamic policy control (like DenyList, Zygisk)
-
Modules and updates
In modern Android (especially Android 10+):
-
Partitions Structure:
-
/system,/vendor,/product, etc., are often dynamic partitions inside a super partition (super). -
These are mounted as read-only during boot.
-
-
Rooting Process:
-
Rooting does not modify
/systemor/vendordirectly anymore. -
Instead, tools like Magisk use overlay techniques (like initramfs modifications and bind mounts) to make it look like
/system/bin/suor other root binaries exist.
-
-
Overlay & Mounting:
-
During boot, the root image or boot partition is patched to inject a modified initramfs.
-
This patched initramfs:
-
Mounts system partitions.
-
Applies overlay or bind mount changes using Magisk.
-
This gives the illusion that
/systemis modified, while it remains untouched (read-only).
-
-
-
SU Access:
-
After boot, the Magisk daemon (
magiskd) runs. -
It handles
surequests, manages root permissions, and keeps SafetyNet/Play Integrity passing (if possible).
-
Comments
Post a Comment