[Magisk] Root for the Galaxy S10 Series

1,846 posts
Thanks Meter: 60,705
By topjohnwu, Senior Recognized Developer / Recognized Contributor on 6th April 2019, 07:53 AM
Post Reply Email Thread
Here comes official Magisk support for the Galaxy S10!
Let's get Magisk to kick start the development of these Samsung devices!

Link to Instructions
Carefully read through everything in the page linked above! Follow the instructions closely so you don't end up bricking your device

Technical Details
Google enforces all devices that ships with Android 9.0 to use system-as-root in part of "Project Treble", so Samsung finally introduced their own "flavor" of the implementation. More details regarding system-as-root can be found in the official Google dev site. Samsung is using the A-only system-as-root setup, meaning that its boot image will only contain the kernel binary without ramdisk included. Similar setup has already been deployed on many new devices, and the solutions for those devices are rather simple: add a new ramdisk section into the boot image and hexpatch the kernel to always use ramdisk as rootfs. However in Samsung's case, the bootloader simply does not load anything other than the kernel binary to the memory, meaning no matter what we do the kernel will always use the system partition as root directory. This leaves us no option but to install Magisk onto the recovery partition.

Installing to the recovery partition have its own issues: first is that a service called "flash_recovery" will run when the system starts up, which will restore the recovery image back to stock on startup. This is unacceptable because not only does it uninstall Magisk in the process, the data encryption key will also be changed due to fact that Samsung's data encryption keys are tied to the bootloader status and boot/recovery image signatures, and thus causing the device unable to boot in following reboots unless factory reset. The solution to this problem is to simply repack the boot image to remove the binary integrity and also the signature of the partition. The second issue is that since Magisk and recovery shares the same partition, how can we actually boot into recovery? (e.g. to factory reset your device, or have custom recovery co-exist with Magisk) Fortunately a solution that detects button key presses is introduced, which details are already provided in instructions.

To make matters even worse, Samsung introduced a "VaultKeeper" service, which adds another "lock" on top of the OEM lock of the bootloader. By default the service will "relock" the bootloader after data is wiped. Only after the initial setup will it verify the OEM lock option and changes the bootloader state accordingly. If you are running custom firmware with stock system, DO NOT try to wipe data or else you might end up bricking your device due to vaultkeeper locking your bootloader up, which will eventually lead to bootloader refusing to boot because unofficial partitions are detected.

For custom ROM developers, the first few things you would want to remove is VaultKeeper to protect your users from bricking their devices. For stock ROM users, just make sure to always boot to Magisk after a data wipe, or never power off your device before finishing the initial setup and verify OEM lock is enabled.

For those who don't know, I bought a Galaxy S10 just for adding Magisk support and for future Samsung related development.
This particular release is extremely difficult. Tons of effort is poured in to figure out ways to workaround these Samsung crazy setups.
If you appreciate my effort, show some love and support
The Following 226 Users Say Thank You to topjohnwu For This Useful Post: [ View ]
6th April 2019, 08:04 AM |#2  
Thanks Meter: 14
The Following 4 Users Say Thank You to mansonstein For This Useful Post: [ View ] Gift mansonstein Ad-Free
6th April 2019, 08:10 AM |#4  
aussiesausage's Avatar
Senior Member
Flag Australia
Thanks Meter: 146
The best day of my life!!
The Following 2 Users Say Thank You to aussiesausage For This Useful Post: [ View ] Gift aussiesausage Ad-Free
6th April 2019, 08:12 AM |#5  
pug1's Avatar
Senior Member
Flag Sheffield
Thanks Meter: 192
Can I ask, when we install Magisk what sammy stuff will be broken? I understand Knox will be tripped but what 'features' will still be available.

Does the fingerprint still work for instance

Amazing work though, well done buddy
The Following User Says Thank You to pug1 For This Useful Post: [ View ] Gift pug1 Ad-Free
6th April 2019, 08:18 AM |#6  
poczynek's Avatar
Senior Member
Flag Sydney
Thanks Meter: 790

I hope people carefully read those instructions!
6th April 2019, 08:25 AM |#7  
Junior Member
Flag Amsterdam
Thanks Meter: 4
ok, who's trying it first on an European S10+ ?
The Following User Says Thank You to Ralph.Lemarechal For This Useful Post: [ View ] Gift Ralph.Lemarechal Ad-Free
6th April 2019, 08:30 AM |#8  
white7561's Avatar
Senior Member
Flag Somewhere
Thanks Meter: 532
The Following User Says Thank You to white7561 For This Useful Post: [ View ] Gift white7561 Ad-Free
6th April 2019, 08:49 AM |#10  
ooonea's Avatar
Flag Siena
Thanks Meter: 21
Donate to Me
S9 Exynos not install
On S9 the installation does not give error, but on restart Magisk is no longer installed.
6th April 2019, 08:52 AM |#11  
OP Senior Recognized Developer / Recognized Contributor
Flag Taipei
Thanks Meter: 60,705
Donate to Me
Originally Posted by ooonea

On S9 the installation does not give error, but on restart Magisk is no longer installed.

I'm aware of this issue
The Following User Says Thank You to topjohnwu For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes