Skip to content

Commit

Permalink
Magisk Delta 26.1 COUI first release
Browse files Browse the repository at this point in the history
Signed-off-by: Col_or <color597@qq.com>
  • Loading branch information
color597 committed Aug 24, 2023
0 parents commit d44a691
Show file tree
Hide file tree
Showing 15 changed files with 362 additions and 0 deletions.
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Magisk Delta

This repo hosts Magisk delta related files

![Delta](https://user-images.githubusercontent.com/84650617/222942594-63336f63-6a26-492e-a1d1-a356b5f777b3.png)

## Introduction

**This is not an officially supported [topjohnwu](https://github.com/topjohnwu) project**.

> If you are looking for official Magisk source, you are in the wrong place, please [go to this page and download Official Magisk](https://github.com/topjohnwu/Magisk)
- [Internal Documents](./docs/internal-guide.md)
- [Frequently asked questions (FAQ)](./docs/faq.md)

## Download

### Stable / Beta

- [Download Magisk v26.1](https://github.com/HuskyDG/magisk-files/raw/X/v26.1-delta.apk)

### Canary / Debug

> ⚠ Only accept bugreports from Magisk Delta debug variant. Canary and Debug are built from the same source code. Debug builds have more detailed logs and are suitable for debugging. Canary builds have less logs, are more stable than Debug, and are suitable for most common uses
#### Download

- [Download Canary](https://huskydg.github.io/magisk-files/app-release.apk)
- [Download Debug](https://huskydg.github.io/magisk-files/app-debug.apk)
- [Changelog](https://github.com/HuskyDG/magisk-files/blob/main/note.md)

#### Source code

- Magisk Delta is [open source under GNU v3](#license). The `source-code.zip` will be published along with released build here: <https://github.com/HuskyDG/magisk-files/releases>
- The process to build Magisk Delta is same as [Official Magisk](https://github.com/topjohnwu/magisk#building-and-development). Remember to add `-delta` prefix into `versionName` in `config.prop`.

## Donate me

- Paypal: [paypal.me/huskydg](http://paypal.me/huskydg)
- You can now donate me if you want. Remember, I will not make this as a monetization tool and donate is not obligated. Thanks for all your supports and hope you have a good day! 👍

## Other links

- [Telegram group](https://t.me/magiskdelta)

## Credits

- Magisk author: [topjohnwu](https://github.com/topjohnwu/magisk)
- Magisk contributors: [vvb2060](https://github.com/vvb2060), [yujincheng08](https://github.com/yujincheng08), [RikkaW](https://github.com/RikkaW), [canyie](https://github.com/canyie)
- SuList idea: [MagiskLite](http://t.me/magisklite)
- Maru (zygisk native bridge): [5ec1cff](https://github.com/5ec1cff)
- Other: [osm0sis](https://github.com/osm0sis), [diareuse](https://github.com/diareuse),...
- Monet design: [HardcodedCat](https://github.com/HardcodedCat), [datnerdguy](https://github.com/datnerdguy)

## License

Our license obviously is the same as [Magisk's license](https://github.com/topjohnwu/Magisk#License)

```
Magisk, including all git submodules are free software:
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```
Binary file added app-debug.apk
Binary file not shown.
Binary file added app-release.apk
Binary file not shown.
12 changes: 12 additions & 0 deletions beta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"magisk": {
"version": "v26.1-delta",
"versionCode": "26100",
"link": "https://github.com/HuskyDG/magisk-files/raw/X/v26.1-delta.apk",
"note": "https://huskydg.github.io/magisk-files/note_stable.md"
},
"stub": {
"versionCode": "36",
"link": "https://github.com/HuskyDG/magisk-files/raw/X/v26.1-delta.apk"
}
}
12 changes: 12 additions & 0 deletions canary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"magisk": {
"version": "26.1-delta-coui",
"versionCode": "26105",
"link": "https://color597.github.io/magisk-files/app-release.apk",
"note": "https://color597.github.io/magisk-files/note.md"
},
"stub": {
"versionCode": "36",
"link": "https://color597.github.io/magisk-files/stub-release.apk"
}
}
12 changes: 12 additions & 0 deletions debug.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"magisk": {
"version": "26.1-delta-coui",
"versionCode": "26105",
"link": "https://color597.github.io/magisk-files/app-debug.apk",
"note": "https://color597.github.io/magisk-files/note.md"
},
"stub": {
"versionCode": "36",
"link": "https://color597.github.io/magisk-files/stub-debug.apk"
}
}
86 changes: 86 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
## FAQ

### How to install Magisk Delta from start?

- Process like installing Magisk: <https://topjohnwu.github.io/Magisk/install.html>

### How to switch from current Magisk to Magisk Delta and vice versa?

Just do like when you update Magisk!

#### Direct Install (Recommended)

1. Install, open and then grant root acccess to Magisk Delta.
2. In **Magisk** section, tap "Install" and then "Direct Install". If you don't see this, try close and open the app.

#### Just flash Magisk Delta from current Magisk app

1. Rename the extension `magisk.apk` to `magisk.zip`
2. Open Magisk app, click "Modules" tab -> "Install from storage" and choose `magisk.zip`

#### Install Magisk directly to `/system` (Not recommended)

> Please only use this method on ROM with Permissive SELinux mode or Enforcing SELinux with permissive "u:r:su:s0" context in sepolicy rules such as userdebug ROM like LineageOS. You should have a backup of your ROM in case system can't boot and do not use broken Custom Recovery. Your ROM must be able to mount read-write and your kernel must support dynamic SeLinux rules patch. Process this method at your own risk!

For some reasons, you don't want to install Magisk in regular way (patch boot imge), you can install Magisk directly to `/system`.

1. Restore to stock boot image if you already have Magisk installed
2. Boot to recovery, rename `magisk.apk` to `systemmagisk.zip` and flash it.
3. If you want to update Magisk, please use **Direct Install into system partition** instead of **Direct Install**

### How to install Magisk into Android-x86 project or Android emulator

#### Before start:

1. Only Magisk Delta support Magisk installation into system partition.
2. Although emulator has ramdisk image, patching ramdisk is not used because ramdisk is stored in seperate partition with very SMALL disk size that is not enough to store Magisk binaries.
3. Latest Magisk Delta Canary has been adopted to support Bluestacks, ~~but need [app_process wrapper](https://github.com/HuskyDG/app_process_wrapper/releases) to run Zygisk.~~
4. List of emulators have been tested: NoxPlayer, LDPlayer, MEmu.
5. List of Android x86 project has been tested: BlissOS, PrimeOS
6. Waydroid is supported on Canary build.

#### Step to step to install Magisk into emulator like NoxPlayer, LDPlayer, MemuPlayer,...

1. Enable Root access in emulator settings
2. Install and open Magisk Delta
3. Grant root access to Magisk Delta, click "Install" under Magisk field and use "Direct Install into system partition" option instead of "Direct Install" option (If you don't see this option, close and re-open Magisk Delta app) Don't restart now!
4. ~~Disable Root access in emulator settings.~~ Backup built-in `su` (`/system/bin/su` and `/system/xbin/su`) and delete them (in case you want to uninstall Magisk and restore to built-in `su`), then reboot. Because emulators like LDPlayer will remove all `su` after disable ROOT from settings, **DO NOT** disable Root access in emulator settings.
5. Enjoy Magisk!

#### Step to step to install Magisk into Bluestacks

1. Download Bluestacks Tweaker from [here](https://bstweaker.tk/)
2. Use Bluestacks Tweaker and click "Unlock" to unlock Bluestacks instance and then launch it, overwise you can't install Magisk
3. When the instance starts up successfully, click "Patch" to open root access, install Magisk Delta and execute "Direct Install into system partition" action
4. When you are done, click "UnPatch" and then relanch the instance.
5. Enjoy Magisk!

#### Step to step to install Magisk into Android-x86 project

- You can use [initrd-magisk](https://github.com/HuskyDG/initrd-magisk) or directly install Magisk into system partition like guide above.

#### Step to step to install Magisk on Waydroid

- Please check <https://github.com/nitanmarcel/waydroid-magisk> or <https://github.com/casualsnek/waydroid_script> for more information.

### After enabling MagiskHide, why my app/game can still detect emulator?

MagiskHide is not emulator-detection bypass

### How to manually trigger Core-only mode from Recovery?

Create a empty file named `.disable_magisk` in these location: `/cache`, `/persist` or `/metadata`

### Why not restore Magisk modules online repo?

The official Magisk modules repository is dead and no longer maintained. Due to that, add them back is meanless. However, [Fox2Code](https://github.com/Fox2Code) has developed [Magisk Modules Manager](https://github.com/Fox2Code/FoxMagiskModuleManager) app which allows you to download Magisk modules online.

### Should I install Shxxxxo module to hide root?

- It is not recommended, you should uninstall it. If not, don't complain me about crashing. MagiskHide should be enough.
- If you really want to use Shxxxxo, then uninstall Magisk Delta and use Official Magisk ¯\_(ツ)_

### Why some modules are broken after enabling SuList?

SuList means MagiskSU and modules are not mounted by default, only the those apps in the list will have Magisk mounted, so the functionality of the modules is not fully supported because most of them must be mounted in all apps, which is equivalent to be detected. More information about SuList, please [read this](./internal-guide.html#magiskhide-sulist)
83 changes: 83 additions & 0 deletions docs/internal-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Magisk Delta Internal Documentation

This document explains some of the advanced features of Magisk Delta, a systemless root solution for Android devices. Magisk Delta allows you to modify your device without altering the original boot image, and provides a unified interface for managing modules, root access, and more.

## Early mount

Some files need to be mounted as early as possible in the boot process, before the `init` process is executed. Magisk Delta provides a way to mount files in the `pre-init` stage, using the `early-mount.d` directory.

- To check if Magisk Delta supports `early-mount.d/v2`, use this code:

```
EARLYMOUNTV2=false
if grep "$(magisk --path)/.magisk/early-mount.d" /proc/mounts | grep -q '^early-mount.d/v2'; then
EARLYMOUNTV2=true
fi
```

- To find the `early-mount.d` directory (Magisk v26+), use this code:

```
$(magisk --path)/.magisk/early-mount.d
```

### General

- The general early-mount partition will be mounted at `$MAGISKTMP/.magisk/early-mount.d` due to the new sepolicy rules implementation in Magisk Delta v26.0+ with `early-mount.d/v2`. The early-mount partition is the same as the preinit partition, which could be one of these: `data`, `cache`, `metadata`, `cust`, `persist`, etc. Magisk will hardcode the preinit partition while patching the boot image.

> (*) Be careful when using `persist` or `metadata` for early-mount, as these partitions have very limited size. Filling them up might cause the device to fail to boot.
- You can place your files into the corresponding location under the `early-mount.d` directory. For example, if you want to replace `/vendor/etc/vintf/manifest.xml`, copy your `manifest.xml` to `$MAGISKTMP/.magisk/early-mount.d/system/vendor/etc/vintf/manifest.xml`. Magisk Delta will mount your files in the next reboot. Other files that are not in `early-mount.d/system` will be ignored.

### Module

- Since Magisk Delta v26.0+ with `early-mount.d/v2`, you can also place your early-mount files in `/data/adb/modules/<module_id>/early-mount`.

**Note: Early-init mount only supports simple mount, which means it can replace files but cannot add new files, folders or replace folders**

## init.rc inject

### General

If you want to inject custom `*.rc` scripts into your device without repacking the boot image, Magisk Delta provides a way to do that systemlessly. You can use the `initrc.d` directory to store your custom scripts, and Magisk Delta will inject them into `init.rc` every boot.

- The location of custom `*.rc` scripts is `$PRENITDIR/early-mount.d/initrc.d`. Magisk Delta will inject all scripts in this folder into `init.rc` every boot.
- You can use `${MAGISKTMP}` to refer to Magisk's tmpfs directory. Every occurrence of the pattern `${MAGISKTMP}` in your `*.rc` scripts will be replaced with the Magisk tmpfs directory when magiskinit injects it into `init.rc`.
- Magisk's mirror will not be available while booting, so you need to use this pattern `${MAGISKTMP}/.magisk/early-mount.d` to access the copy of the `early-mount.d` directory.

- Here is an example of a custom script named `custom.rc` that you can use with `initrc.d`:

```
# Use ${MAGISKTMP} to refer to Magisk's tmpfs directory
on early-init
setprop sys.example.foo bar
insmod ${MAGISKTMP}/.magisk/early-mount.d/libfoo.ko
start myservice
service myservice ${MAGISKTMP}/.magisk/early-mount.d/myscript.sh
oneshot
```

### Module

- Since Magisk Delta v26.0+ with `early-mount.d/v2`, you can also place your initrc.d files in `/data/adb/modules/<module_id>/early-mount/initrc.d`.

## Remove files and folders

- Using Magisk module is the easy way to modify system partitions without actually making changes to the system partitions, and the changes can be easily. Magisk modules can replace and add any file or folder to system. However, removing files by Magisk modules is still not allowed.

- In Magisk documentation:

> It is complicated to actually remove a file (possible, not worth the effort). Replacing it with a dummy file should be good enough
> It is complicated to actually remove a folder (possible, not worth the effort). Replacing it with an empty folder should be good enough. Add the folder to the replace list in "config.sh" in the module template, it will replace the folder with an empty one
- In some case, replacing file or folder with empty one is not enough and might cause issue, some modding require files to be disappeared in order to take effect. So Magisk Delta has added removal support for modules: Create the broken symlink which points to `/xxxxx` into the corresponding location of module directory

- Example creating symbolic link as `/data/adb/modules/mymodule_id/system/vendor/etc/thermal-engine-normal.conf`, the target `/vendor/etc/thermal-engine-normal.conf` will be ignored and disappeared

```
ln -s "/xxxxx" /data/adb/modules/mymodule_id/system/vendor/etc/thermal-engine-normal.conf
```

Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions note.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## d2a66567-delta Nightly build

- Do not use local socket path
- Fix root loss after zygote restarted with "Unmount modules by default" enabled

Canary and Debug are built from the same source code. Debug builds have more detailed logs and are suitable for debugging. Canary builds have less logs, are more stable than Debug, and are suitable for most common uses

If you like my work, you can donate me at [PayPal/HuskyDG](http://paypal.me/huskydg)

### Diffs to official Magisk

- [General] Use "Unmount modules" to manage the visibility of modified files by module
- [Manager] Support installing into system partition for emulator
- [General] Copy required files to `/system` for `addon.d`
- [Manager] Show all supported languages in Language settings for Chinese ROM
- [Module] Support systemless deleting files or folders for modules
- [General] Built-in Bootloop Protection to protect system from bootloop by magisk module
- [General] Tune F2FS driver to fix problem on unencrypted f2fs `/data`
- [MagiskInit] Support Pre-Init mount that replaces system files before `init` starts
- [MagiskInit] Support loading custom rc script from pre-init directory
- [Modules] Support magic mount more partitions (`my_*`, `odm`, `optics`, `prism`)
- [Zygisk]: Switch to use native bridge by 5ec1cff
- [Module] Live patch `sepolicy.rule` if it is not found in `sepolicy.rules` directory
- [MagiskSU] Do not use local socket path
- [Module] Always inject magisk bins
- [MagiskInit] Introduce `early-mount.d/v2` to support pre-Init mount per module

### Magisk upstream

- Sync upstream source code to 350d0d600

21 changes: 21 additions & 0 deletions note_beta.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## v26.1-delta (31fbbbfc3)

- [General] Use MagiskHide/SuList to manage the visibility of modified files by module
- [Manager] Support installing into system partition for emulator
- [General] Copy required files to `/system` for `addon.d`
- [Manager] Show all supported languages in Language settings for Chinese ROM
- [Module] Support systemless deleting files or folders for modules
- [General] Built-in Bootloop Protection to protect system from bootloop by magisk module
- [General] Tune F2FS driver to fix problem on unencrypted f2fs `/data`
- [MagiskInit] Support Pre-Init mount that replaces system files before `init` starts
- [MagiskInit] Support loading custom rc script from pre-init directory
- [Modules] Support magic mount more partitions (`my_*`, `odm`, `optics`, `prism`)
- [Zygisk]: Switch to use native bridge by 5ec1cff
- [Module] Live patch `sepolicy.rule` if it is not found in `sepolicy.rules` directory
- [MagiskSU] Do not use local socket path
- [Module] Simplify inject magisk bins

### Magisk upstream

- Sync upstream source code to official Magisk v26.1 (eddc862fa)

21 changes: 21 additions & 0 deletions note_stable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## v26.1-delta (31fbbbfc3)

- [General] Use MagiskHide/SuList to manage the visibility of modified files by module
- [Manager] Support installing into system partition for emulator
- [General] Copy required files to `/system` for `addon.d`
- [Manager] Show all supported languages in Language settings for Chinese ROM
- [Module] Support systemless deleting files or folders for modules
- [General] Built-in Bootloop Protection to protect system from bootloop by magisk module
- [General] Tune F2FS driver to fix problem on unencrypted f2fs `/data`
- [MagiskInit] Support Pre-Init mount that replaces system files before `init` starts
- [MagiskInit] Support loading custom rc script from pre-init directory
- [Modules] Support magic mount more partitions (`my_*`, `odm`, `optics`, `prism`)
- [Zygisk]: Switch to use native bridge by 5ec1cff
- [Module] Live patch `sepolicy.rule` if it is not found in `sepolicy.rules` directory
- [MagiskSU] Do not use local socket path
- [Module] Simplify inject magisk bins

### Magisk upstream

- Sync upstream source code to official Magisk v26.1 (eddc862fa)

12 changes: 12 additions & 0 deletions stable.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"magisk": {
"version": "v26.1-delta",
"versionCode": "26100",
"link": "https://github.com/HuskyDG/magisk-files/raw/X/v26.1-delta.apk",
"note": "https://huskydg.github.io/magisk-files/note_stable.md"
},
"stub": {
"versionCode": "36",
"link": "https://github.com/HuskyDG/magisk-files/raw/X/v26.1-delta.apk"
}
}
Binary file added stub-debug.apk
Binary file not shown.
Binary file added stub-release.apk
Binary file not shown.

0 comments on commit d44a691

Please sign in to comment.