mirror of
				https://github.com/topjohnwu/Magisk
				synced 2025-10-31 10:40:52 +01:00 
			
		
		
		
	Compare commits
	
		
			124 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | e8302dfbe2 | ||
|   | 558f95cf7e | ||
|   | 18f6ead891 | ||
|   | 10bd25be52 | ||
|   | 65511845d2 | ||
|   | 1c743839ea | ||
|   | bcae9dec41 | ||
|   | 482c9af41f | ||
|   | 2bf2e7461f | ||
|   | 7d1082b1cb | ||
|   | 0dbae83aec | ||
|   | f927c1b997 | ||
|   | 89ec7dad2b | ||
|   | 4fd61345af | ||
|   | 66cca24453 | ||
|   | e733484fab | ||
|   | e5c3183025 | ||
|   | 930c82316a | ||
|   | 3dc22db265 | ||
|   | d8c51cb286 | ||
|   | 2f79d0c3b3 | ||
|   | d8bb3af06b | ||
|   | e139e8777b | ||
|   | d52d7cfbd9 | ||
|   | 4f74a259e3 | ||
|   | 74da6e1dc0 | ||
|   | 84ffdf0ed5 | ||
|   | 022b18c8ce | ||
|   | b92b1dcddb | ||
|   | 1472dbb291 | ||
|   | d58a8dc868 | ||
|   | e94be0b70e | ||
|   | f6ae7e1bf1 | ||
|   | f7b4935677 | ||
|   | a3c49de6a5 | ||
|   | e8dd1b292f | ||
|   | d21264d01b | ||
|   | b0567eadfd | ||
|   | 5fc2058336 | ||
|   | d0567d29d2 | ||
|   | 4db0ad32f0 | ||
|   | d065040321 | ||
|   | 17f0fea3fc | ||
|   | 8ca1e43533 | ||
|   | bd01c314dc | ||
|   | e404476609 | ||
|   | 942c870981 | ||
|   | baff9256c5 | ||
|   | b4c0a255fc | ||
|   | 9f6a27c20d | ||
|   | 742dc137ed | ||
|   | 39a6bd33ce | ||
|   | 4672a5fad6 | ||
|   | e649b0a2df | ||
|   | fd8dbe3eff | ||
|   | bb97cc594d | ||
|   | 70a322263e | ||
|   | c6f144d482 | ||
|   | 3709489b3a | ||
|   | 145ef32e28 | ||
|   | 2212800a23 | ||
|   | 2e25431bb6 | ||
|   | 32c8e7522f | ||
|   | a5e4f3cc6b | ||
|   | a30777bd9f | ||
|   | e989195a68 | ||
|   | 997d58932e | ||
|   | b4015f877f | ||
|   | d15fff95b9 | ||
|   | 687e3b13ea | ||
|   | 8c6bb383b7 | ||
|   | bc592c1d13 | ||
|   | 968bd8be67 | ||
|   | d8b8adb88c | ||
|   | f42d820891 | ||
|   | bc21a1fb71 | ||
|   | 3bc31374ac | ||
|   | 858e7bae2b | ||
|   | 8c02d120a2 | ||
|   | 07e353f4ff | ||
|   | bb33d9e600 | ||
|   | 68eb0bdec9 | ||
|   | 32ee8e462c | ||
|   | e79aa54b70 | ||
|   | 9a95652034 | ||
|   | 912c188b53 | ||
|   | e9d0f615ba | ||
|   | 9136573596 | ||
|   | 2487ec94e6 | ||
|   | 811489f157 | ||
|   | b438cc9335 | ||
|   | 1d3d30fa45 | ||
|   | 72b5985398 | ||
|   | 2db60e0a6b | ||
|   | e710848345 | ||
|   | 8d6f3c2450 | ||
|   | f863d127e7 | ||
|   | a831110816 | ||
|   | e97bdb53f4 | ||
|   | fe1439fbac | ||
|   | 2bc30e5c22 | ||
|   | 7244c02a0d | ||
|   | 6c229ffa68 | ||
|   | cdc5d983f3 | ||
|   | 96688e4dac | ||
|   | 28a945fee9 | ||
|   | c7e777255a | ||
|   | 2dd4cf040e | ||
|   | d1b9eca5eb | ||
|   | 594a67fe28 | ||
|   | cddeaffada | ||
|   | 2a8898e7c3 | ||
|   | ce3f3b09b4 | ||
|   | fe4b3df7e9 | ||
|   | 25bdbcf526 | ||
|   | df7eaa5598 | ||
|   | bb7099376b | ||
|   | 0327fd9710 | ||
|   | e645c6e465 | ||
|   | 78a3d36ccc | ||
|   | 3942858ccd | ||
|   | 03c8d716cc | ||
|   | 60181c4fcb | ||
|   | c215447405 | 
							
								
								
									
										15
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,7 +1,16 @@ | ||||
| obj/ | ||||
| libs/ | ||||
| out | ||||
| *.zip | ||||
| *.jks | ||||
| *.apk | ||||
|  | ||||
| # Copied binaries | ||||
| # Built binaries | ||||
| ziptools/zipadjust | ||||
|  | ||||
| # Android Studio / Gradle | ||||
| *.iml | ||||
| .gradle | ||||
| /local.properties | ||||
| /.idea | ||||
| /build | ||||
| /captures | ||||
| .externalNativeBuild | ||||
|   | ||||
							
								
								
									
										24
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							| @@ -1,21 +1,27 @@ | ||||
| [submodule "jni/selinux"] | ||||
| 	path = jni/external/selinux | ||||
| 	path = core/jni/external/selinux | ||||
| 	url = https://github.com/topjohnwu/selinux.git | ||||
| [submodule "jni/su"] | ||||
| 	path = jni/su | ||||
| 	path = core/jni/su | ||||
| 	url = https://github.com/topjohnwu/MagiskSU.git | ||||
| [submodule "jni/ndk-compression"] | ||||
| 	path = jni/external/ndk-compression | ||||
| 	url = https://github.com/topjohnwu/ndk-compression.git | ||||
| [submodule "jni/magiskpolicy"] | ||||
| 	path = jni/magiskpolicy | ||||
| 	path = core/jni/magiskpolicy | ||||
| 	url = https://github.com/topjohnwu/magiskpolicy.git | ||||
| [submodule "MagiskManager"] | ||||
| 	path = MagiskManager | ||||
| 	path = app | ||||
| 	url = https://github.com/topjohnwu/MagiskManager.git | ||||
| [submodule "jni/busybox"] | ||||
| 	path = jni/external/busybox | ||||
| 	path = core/jni/external/busybox | ||||
| 	url = https://github.com/topjohnwu/ndk-busybox.git | ||||
| [submodule "jni/external/dtc"] | ||||
| 	path = jni/external/dtc | ||||
| 	path = core/jni/external/dtc | ||||
| 	url = https://github.com/dgibson/dtc | ||||
| [submodule "jni/external/lz4"] | ||||
| 	path = core/jni/external/lz4 | ||||
| 	url = https://github.com/lz4/lz4.git | ||||
| [submodule "jni/external/bzip2"] | ||||
| 	path = core/jni/external/bzip2 | ||||
| 	url = https://github.com/nemequ/bzip2.git | ||||
| [submodule "jni/external/xz"] | ||||
| 	path = core/jni/external/xz | ||||
| 	url = https://github.com/xz-mirror/xz.git | ||||
|   | ||||
 Submodule MagiskManager deleted from 773c24b7fc
									
								
							
							
								
								
									
										78
									
								
								README.MD
									
									
									
									
									
								
							
							
						
						
									
										78
									
								
								README.MD
									
									
									
									
									
								
							| @@ -2,34 +2,30 @@ | ||||
|  | ||||
| ## How to build Magisk | ||||
|  | ||||
| #### Building has been tested on 3 major platforms: | ||||
| #### Building has been tested on 3 major platforms: macOS, Ubuntu, Windows 10 | ||||
|  | ||||
| **macOS 10.12**   | ||||
| **Ubuntu 17.04 x64**   | ||||
| **Windows 10 x64** | ||||
|  | ||||
| #### Environment Requirements | ||||
| ### Environment Requirements | ||||
|  | ||||
| 1. A 64-bit machine: `cmake` for Android is only available in 64-bit | ||||
| 2. Python 3.5+: to run the build script | ||||
| 3. Java Development Kit (JDK) 8: To compile Magisk Manager and sign zips | ||||
| 4. C compiler (Unix only): To build `zipadjust`. Windows users can use the pre-built `zipadjust.exe` | ||||
| 5. Android SDK: `ANDROID_HOME` environment variable should point to the Android SDK folder | ||||
| 6. Android NDK: Install NDK via `sdkmanager`, or via Android SDK Manager in Android Studio | ||||
| 2. Python 3.5+: run `build.py` script | ||||
| 3. Java Development Kit (JDK) 8: Compile Magisk Manager and sign zips | ||||
| 4. Latest Android SDK: `ANDROID_HOME` environment variable should point to the Android SDK folder | ||||
| 5. Android NDK: Install NDK along with SDK (`$ANDROID_HOME/ndk-bundle`), or specify custom path `ANDROID_NDK` | ||||
| 6. (Windows Only) Python package Colorama: Install with `pip install colorama`, used for ANSI color codes | ||||
| 7. (Unix only) C compiler: Build `zipadjust`. Windows users can use the pre-built `zipadjust.exe` | ||||
|  | ||||
| #### Instructions and Notes | ||||
|  | ||||
| 1. The easiest way to setup a working environment is to open Magisk Manager with Android Studio. The IDE will download required components and construct the environment for you. Don't forget to set `ANDROID_HOME` environment variable to the SDK path. | ||||
| 2. Windows users: while installing Python 3 on Windows, allow the installer to add Python to `PATH`, or you'll have to add it manually afterwards. By default, the Python executable is setup as `python`, not `python3` like most Unix environment. If you have both Python 2 and Python 3 installed, you'll have to deal with the executable name and `PATH` yourself. To double check the Python version, call `python --version`. | ||||
| 3. To run the script, on Windows call `python build.py [args...]`; on Unix call `python3 build.py [args...]`, or simply `./build.py [args...]`. To see the built-in help message, call the script with `-h` as an argument. The `-h` option also works for each supported actions to see the help message for the specific action. | ||||
| 4. By default, the script will build binaries and Magisk Manager in debug mode, which will enable verbose debugging messages. If you want to build Magisk Manager in release mode (through the flag `--release`), you will need to place your Java Keystore file in `release_signature.jks` to sign Magisk Manager's APK. For more information, check out [Google's Official Documentation](https://developer.android.com/studio/publish/app-signing.html#signing-manually). | ||||
| 5. The python build script uses ANSI color codes to change the color of the terminal output. For Windows, this **only** works on Windows 10, as previous Windows console do not support them. If you use an older Windows version, a quick Google search should provide many workarounds. | ||||
| ### Instructions and Notes | ||||
| 1. Magisk can be built with the latest NDK (r16 as of writing), however binaries released officially will be built with NDK r10e due to ELF incompatibilities with the binaries built from the newer NDKs. | ||||
| 2. The easiest way to setup the environment is by importing this folder as an Android Studio project. The IDE will download required components and construct the environment for you. You still have to set the `ANDROID_HOME` environment variable to point to the SDK path. | ||||
| 3. Run `build.py` with argument `-h` to see the built-in help message. The `-h` option also works for each supported actions, e.g. `./build.py binary -h` | ||||
| 4. Build everything with `build.py`, don't directly call `gradlew` or `ndk-build`, since most requires special setup / dependencies. | ||||
| 5. By default, `build.py` will build binaries and Magisk Manager in debug mode. If you want to build Magisk Manager in release mode (through the flag `--release`), you will need to place a Java Keystore file at `release_signature.jks` to sign Magisk Manager's APK. For more information, check out [Google's Official Documentation](https://developer.android.com/studio/publish/app-signing.html#signing-manually). | ||||
|  | ||||
|  | ||||
| ## License | ||||
|  | ||||
| ``` | ||||
| Magisk, including all subprojects (git submodule) is free software: | ||||
| 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. | ||||
| @@ -45,51 +41,41 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  | ||||
| ## Credits | ||||
|  | ||||
| **MagiskManager** (`MagiskManager`) | ||||
| **MagiskManager** (`app`) | ||||
|  | ||||
| * Copyright 2016-2017, John Wu (@topjohnwu) | ||||
| * All contributors and translators | ||||
| * Copyright 2016-2018, John Wu (@topjohnwu) | ||||
| * All contributors and translators on Github | ||||
|  | ||||
| **MagiskSU** (`jni/su`) | ||||
| **MagiskSU** (`core/jni/su`) | ||||
|  | ||||
| * Copyright 2016-2017, John Wu (@topjohnwu) | ||||
| * Copyright 2016-2018, John Wu (@topjohnwu) | ||||
| * Copyright 2015, Pierre-Hugues Husson (phh@phh.me) | ||||
| * Copyright 2013, Koushik Dutta (@koush) | ||||
| * Copyright 2010, Adam Shanks (@ChainsDD) | ||||
| * Copyright 2008, Zinx Verituse (@zinxv) | ||||
|  | ||||
| **MagiskPolicy** (`jni/magiskpolicy`) | ||||
| **MagiskPolicy** (`core/jni/magiskpolicy`) | ||||
|  | ||||
| * Copyright 2016-2017, John Wu (@topjohnwu) | ||||
| * Copyright 2016-2018, John Wu (@topjohnwu) | ||||
| * Copyright 2015, Pierre-Hugues Husson (phh@phh.me) | ||||
| * Copyright 2015, Joshua Brindle (@joshua_brindle) | ||||
|  | ||||
| **MagiskHide** (`jni/magiskhide`) | ||||
| **MagiskHide** (`core/jni/magiskhide`) | ||||
|  | ||||
| * Copyright 2016-2017, John Wu (@topjohnwu) | ||||
| * Copyright 2016, Pierre-Hugues Husson (phh@phh.me) (original hidesu) | ||||
| * Copyright 2016-2018, John Wu (@topjohnwu) | ||||
| * Copyright 2016, Pierre-Hugues Husson (phh@phh.me) | ||||
|  | ||||
| **resetprop** (`jni/resetprop`) | ||||
| **resetprop** (`core/jni/resetprop`) | ||||
|  | ||||
|  * Copyright 2016-2017 John Wu (@topjohnwu) | ||||
|  * Copyright 2016-2018 John Wu (@topjohnwu) | ||||
|  * Copyright 2016 nkk71 (nkk71x@gmail.com) | ||||
|  | ||||
| **SELinux** (`jni/selinux`) | ||||
| **External Dependencies** (`core/jni/external`) | ||||
|  | ||||
| * Makefile for NDK: Copyright 2016-2017, John Wu (@topjohnwu) | ||||
| * Maintained by many developers in SELinux project | ||||
|  | ||||
| **ndk-compression** (`jni/ndk-compression`) | ||||
|  | ||||
| * Makefile for NDK: Copyright 2017, John Wu (@topjohnwu) | ||||
| * Each library has its own copyright message in corresponding directories | ||||
|  | ||||
| **ndk-busybox** (`jni/busybox`) | ||||
|  | ||||
| * Makefile for NDK, generated by [ndk-busybox-kitchen](https://github.com/topjohnwu/ndk-busybox-kitchen): Copyright 2017, John Wu (@topjohnwu) | ||||
| * Patches for NDK: Many contributors along the way, all placed in [osm0sis/android-busybox-ndk](https://github.com/osm0sis/android-busybox-ndk) | ||||
| * The copyright message for busybox should be included in its own directory | ||||
| * Makefile for busybox, generated by [ndk-busybox-kitchen](https://github.com/topjohnwu/ndk-busybox-kitchen) | ||||
| * Each dependencies has its own license/copyright information in each subdirectory.   | ||||
| All of them are either GPL or GPL compatible. | ||||
|  | ||||
| **Others Not Mentioned** | ||||
|  | ||||
| * Copyright 2016-2017, John Wu (@topjohnwu) | ||||
| * Copyright 2016-2018, John Wu (@topjohnwu) | ||||
|   | ||||
							
								
								
									
										1
									
								
								app
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								app
									
									
									
									
									
										Submodule
									
								
							 Submodule app added at 759e905c3c
									
								
							
							
								
								
									
										27
									
								
								build.gradle
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								build.gradle
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| // Top-level build file where you can add configuration options common to all sub-projects/modules. | ||||
|  | ||||
| buildscript { | ||||
|      | ||||
|     repositories { | ||||
|         google() | ||||
|         jcenter() | ||||
|     } | ||||
|     dependencies { | ||||
|         classpath 'com.android.tools.build:gradle:3.0.1' | ||||
|          | ||||
|  | ||||
|         // NOTE: Do not place your application dependencies here; they belong | ||||
|         // in the individual module build.gradle files | ||||
|     } | ||||
| } | ||||
|  | ||||
| allprojects { | ||||
|     repositories { | ||||
|         google() | ||||
|         jcenter() | ||||
|     } | ||||
| } | ||||
|  | ||||
| task clean(type: Delete) { | ||||
|     delete rootProject.buildDir | ||||
| } | ||||
							
								
								
									
										3
									
								
								core/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								core/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| /build | ||||
| obj | ||||
| libs | ||||
							
								
								
									
										20
									
								
								core/build.gradle
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								core/build.gradle
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| apply plugin: 'com.android.library' | ||||
|  | ||||
| android { | ||||
|     compileSdkVersion 27 | ||||
|  | ||||
|     externalNativeBuild { | ||||
|         ndkBuild { | ||||
|             path 'jni/Android.mk' | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     defaultConfig { | ||||
|         externalNativeBuild { | ||||
|             ndkBuild { | ||||
|                 // Passes an optional argument to ndk-build. | ||||
|                 arguments "GRADLE=true" | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -1,52 +1,48 @@ | ||||
| LOCAL_PATH := $(call my-dir) | ||||
|  | ||||
| # Some handy paths | ||||
| JNI_ROOT := jni | ||||
| SELINUX_PATH := jni/external/selinux | ||||
| COMPRESS_LIB := jni/external/ndk-compression | ||||
| DTC_PATH := jni/external/dtc | ||||
| LIBSELINUX := $(SELINUX_PATH)/libselinux/include | ||||
| LIBSEPOL := $(SELINUX_PATH)/libsepol/include $(SELINUX_PATH)/libsepol/cil/include | ||||
| LIBZ := $(COMPRESS_LIB)/zlib | ||||
| LIBLZMA := $(COMPRESS_LIB)/xz/src/liblzma/api | ||||
| LIBLZ4 := $(COMPRESS_LIB)/lz4/lib | ||||
| LIBBZ2 := $(COMPRESS_LIB)/bzip2 | ||||
| LIBFDT := $(DTC_PATH)/libfdt | ||||
| EXT_PATH := jni/external | ||||
| SE_PATH := $(EXT_PATH)/selinux | ||||
| LIBSELINUX := $(SE_PATH)/libselinux/include | ||||
| LIBSEPOL := $(SE_PATH)/libsepol/include $(SE_PATH)/libsepol/cil/include | ||||
| LIBLZMA := $(EXT_PATH)/xz/src/liblzma/api | ||||
| LIBLZ4 := $(EXT_PATH)/lz4/lib | ||||
| LIBBZ2 := $(EXT_PATH)/bzip2 | ||||
| LIBFDT := $(EXT_PATH)/dtc/libfdt | ||||
| UTIL_SRC := utils/cpio.c \ | ||||
|             utils/file.c \ | ||||
|             utils/img.c \ | ||||
|             utils/list.c \ | ||||
|             utils/misc.c \ | ||||
|             utils/pattern.c \ | ||||
|             utils/vector.c \ | ||||
|             utils/xwrap.c | ||||
|  | ||||
| ######################## | ||||
| # Binaries | ||||
| ######################## | ||||
|  | ||||
| ifneq "$(or $(PRECOMPILE), $(GRADLE))" "" | ||||
|  | ||||
| # magisk main binary | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := magisk | ||||
| LOCAL_STATIC_LIBRARIES := libsepol | ||||
| LOCAL_SHARED_LIBRARIES := libsqlite libselinux | ||||
|  | ||||
| LOCAL_C_INCLUDES := \ | ||||
| 	jni/include \ | ||||
| 	jni/external \ | ||||
| 	$(LIBSELINUX) \ | ||||
| 	$(LIBSEPOL) | ||||
| 	jni/external/include \ | ||||
| 	$(LIBSELINUX) | ||||
|  | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	daemon/magisk.c \ | ||||
| 	daemon/daemon.c \ | ||||
| 	daemon/socket_trans.c \ | ||||
| 	daemon/log_monitor.c \ | ||||
| 	daemon/bootstages.c \ | ||||
| 	utils/misc.c \ | ||||
| 	utils/vector.c \ | ||||
| 	utils/xwrap.c \ | ||||
| 	utils/list.c \ | ||||
| 	utils/img.c \ | ||||
| 	core/magisk.c \ | ||||
| 	core/daemon.c \ | ||||
| 	core/log_monitor.c \ | ||||
| 	core/bootstages.c \ | ||||
| 	core/socket.c \ | ||||
| 	magiskhide/magiskhide.c \ | ||||
| 	magiskhide/proc_monitor.c \ | ||||
| 	magiskhide/hide_utils.c \ | ||||
| 	magiskpolicy/magiskpolicy.c \ | ||||
| 	magiskpolicy/rules.c \ | ||||
| 	magiskpolicy/sepolicy.c \ | ||||
| 	magiskpolicy/api.c \ | ||||
| 	resetprop/resetprop.cpp \ | ||||
| 	resetprop/system_properties.cpp \ | ||||
| 	su/su.c \ | ||||
| @@ -54,58 +50,69 @@ LOCAL_SRC_FILES := \ | ||||
| 	su/db.c \ | ||||
| 	su/pts.c \ | ||||
| 	su/su_daemon.c \ | ||||
| 	su/su_socket.c | ||||
| 	su/su_socket.c \ | ||||
| 	$(UTIL_SRC) | ||||
|  | ||||
| LOCAL_CFLAGS := -Wno-implicit-exception-spec-mismatch -DIS_DAEMON | ||||
| LOCAL_CPPFLAGS := -std=c++11 | ||||
| LOCAL_CFLAGS := -DIS_DAEMON -DSELINUX | ||||
| LOCAL_LDLIBS := -llog | ||||
| include $(BUILD_EXECUTABLE) | ||||
|  | ||||
| endif | ||||
|  | ||||
| ifndef PRECOMPILE | ||||
|  | ||||
| # magiskinit | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := magiskinit | ||||
| LOCAL_STATIC_LIBRARIES := libsepol liblzma | ||||
| LOCAL_C_INCLUDES := \ | ||||
| 	jni/include \ | ||||
| 	jni/magiskpolicy \ | ||||
| 	../out/$(TARGET_ARCH_ABI) \ | ||||
| 	$(LIBSEPOL) \ | ||||
| 	$(LIBLZMA) | ||||
|  | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	core/magiskinit.c \ | ||||
| 	core/socket.c \ | ||||
| 	magiskpolicy/api.c \ | ||||
| 	magiskpolicy/magiskpolicy.c \ | ||||
| 	magiskpolicy/rules.c \ | ||||
| 	magiskpolicy/sepolicy.c \ | ||||
| 	$(UTIL_SRC) | ||||
|  | ||||
| LOCAL_LDFLAGS := -static | ||||
| include $(BUILD_EXECUTABLE) | ||||
|  | ||||
| # magiskboot | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := magiskboot | ||||
| LOCAL_STATIC_LIBRARIES := libz liblzma liblz4 libbz2 libfdt | ||||
| LOCAL_STATIC_LIBRARIES := liblzma liblz4 libbz2 libfdt | ||||
| LOCAL_C_INCLUDES := \ | ||||
| 	jni/include \ | ||||
| 	$(LIBZ) \ | ||||
| 	jni/external/include \ | ||||
| 	$(LIBLZMA) \ | ||||
| 	$(LIBLZ4) \ | ||||
| 	$(LIBBZ2) \ | ||||
| 	$(LIBFDT) | ||||
|  | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	external/sha1/sha1.c \ | ||||
| 	magiskboot/main.c \ | ||||
| 	magiskboot/bootimg.c \ | ||||
| 	magiskboot/hexpatch.c \ | ||||
| 	magiskboot/compress.c \ | ||||
| 	magiskboot/boot_utils.c \ | ||||
| 	magiskboot/cpio.c \ | ||||
| 	magiskboot/sha1.c \ | ||||
| 	magiskboot/types.c \ | ||||
| 	magiskboot/dtb.c \ | ||||
| 	utils/xwrap.c \ | ||||
| 	utils/vector.c | ||||
| LOCAL_CFLAGS := -DZLIB_CONST | ||||
| include $(BUILD_EXECUTABLE) | ||||
| 	magiskboot/ramdisk.c \ | ||||
| 	$(UTIL_SRC) | ||||
|  | ||||
| # magiskinit | ||||
| ifeq ($(TARGET_ARCH_ABI), arm64-v8a) | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := magiskinit | ||||
| LOCAL_STATIC_LIBRARIES := libsepol | ||||
| LOCAL_C_INCLUDES := jni/include $(LIBSEPOL) | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	magiskinit.c \ | ||||
| 	magiskboot/boot_utils.c \ | ||||
| 	utils/xwrap.c \ | ||||
| 	magiskpolicy/rules.c \ | ||||
| 	magiskpolicy/sepolicy.c \ | ||||
| 	magiskpolicy/api.c | ||||
| LOCAL_LDFLAGS := -static | ||||
| LOCAL_CFLAGS := -DXWRAP_EXIT | ||||
| LOCAL_LDLIBS := -lz | ||||
| include $(BUILD_EXECUTABLE) | ||||
| endif | ||||
|  | ||||
| # 32-bit static binaries | ||||
| ifndef GRADLE  # Do not run gradle sync on these binaries | ||||
| ifneq ($(TARGET_ARCH_ABI), x86_64) | ||||
| ifneq ($(TARGET_ARCH_ABI), arm64-v8a) | ||||
| # b64xz | ||||
| @@ -120,6 +127,10 @@ include $(BUILD_EXECUTABLE) | ||||
| include jni/external/busybox/Android.mk | ||||
| endif | ||||
| endif | ||||
| endif | ||||
|  | ||||
| # Precompile | ||||
| endif | ||||
|  | ||||
| ######################## | ||||
| # Externals | ||||
| @@ -1,2 +1,4 @@ | ||||
| APP_ABI := x86 x86_64 armeabi-v7a arm64-v8a | ||||
| APP_PLATFORM := android-21 | ||||
| APP_CFLAGS := $(MAGISK_FLAGS) -std=gnu99 | ||||
| APP_CPPFLAGS := -std=c++11 | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										313
									
								
								core/jni/core/daemon.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										313
									
								
								core/jni/core/daemon.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										178
									
								
								core/jni/core/log_monitor.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										178
									
								
								core/jni/core/log_monitor.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,178 @@ | ||||
| /* log_monitor.c - New thread to monitor logcat | ||||
|  * | ||||
|  * A universal logcat monitor for many usages. Add listeners to the list, | ||||
|  * and the pointer of the new log line will be sent through pipes to trigger | ||||
|  * asynchronous events without polling | ||||
|  */ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <pthread.h> | ||||
| #include <unistd.h> | ||||
| #include <sys/wait.h> | ||||
|  | ||||
| #include "magisk.h" | ||||
| #include "utils.h" | ||||
|  | ||||
| extern int is_daemon_init; | ||||
|  | ||||
| static int am_proc_start_filter(const char *log) { | ||||
| 	return strstr(log, "am_proc_start") != NULL; | ||||
| } | ||||
|  | ||||
| static int magisk_log_filter(const char *log) { | ||||
| 	char *ss; | ||||
| 	return (ss = strstr(log, " Magisk")) && (ss[-1] != 'D') && (ss[-1] != 'V'); | ||||
| } | ||||
|  | ||||
| static int magisk_debug_log_filter(const char *log) { | ||||
| 	return strstr(log, "Magisk") != NULL; | ||||
| } | ||||
|  | ||||
| struct log_listener log_events[] = { | ||||
| 	{	/* HIDE_EVENT */ | ||||
| 		.fd = -1, | ||||
| 		.filter = am_proc_start_filter | ||||
| 	}, | ||||
| 	{	/* LOG_EVENT */ | ||||
| 		.fd = -1, | ||||
| 		.filter = magisk_log_filter | ||||
| 	}, | ||||
| 	{	/* DEBUG_EVENT */ | ||||
| 		.fd = -1, | ||||
| 		.filter = magisk_debug_log_filter | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| #ifdef MAGISK_DEBUG | ||||
| static int debug_log_pid, debug_log_fd; | ||||
| #endif | ||||
|  | ||||
| static void *logger_thread(void *args) { | ||||
| 	int log_fd = -1, log_pid; | ||||
| 	char line[4096]; | ||||
|  | ||||
| 	LOGD("log_monitor: logger start"); | ||||
|  | ||||
| 	while (1) { | ||||
| 		// Start logcat | ||||
| 		log_pid = exec_command(0, &log_fd, NULL, "logcat", "-b", "events", "-b", "main", "-v", "threadtime", "-s", "am_proc_start", "-s", "Magisk", NULL); | ||||
| 		while (fdgets(line, sizeof(line), log_fd)) { | ||||
| 			for (int i = 0; i < (sizeof(log_events) / sizeof(struct log_listener)); ++i) { | ||||
| 				if (log_events[i].fd > 0 && log_events[i].filter(line)) { | ||||
| 					char *s = strdup(line); | ||||
| 					xwrite(log_events[i].fd, &s, sizeof(s)); | ||||
| 				} | ||||
| 			} | ||||
| 			if (kill(log_pid, 0)) | ||||
| 				break; | ||||
| 		} | ||||
|  | ||||
| 		// Cleanup | ||||
| 		close(log_fd); | ||||
| 		log_fd = -1; | ||||
| 		kill(log_pid, SIGTERM); | ||||
| 		waitpid(log_pid, NULL, 0); | ||||
|  | ||||
| 		// Clear buffer before restart | ||||
| 		exec_command_sync("logcat", "-b", "events", "-b", "main", "-c", NULL); | ||||
| 	} | ||||
|  | ||||
| 	// Should never be here, but well... | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
| static void *magisk_log_thread(void *args) { | ||||
| 	// Buffer logs before we have data access | ||||
| 	struct vector logs; | ||||
| 	vec_init(&logs); | ||||
|  | ||||
| 	int pipefd[2]; | ||||
| 	if (xpipe2(pipefd, O_CLOEXEC) == -1) | ||||
| 		return NULL; | ||||
|  | ||||
| 	// Register our listener | ||||
| 	log_events[LOG_EVENT].fd = pipefd[1]; | ||||
|  | ||||
| 	LOGD("log_monitor: magisk log dumper start"); | ||||
|  | ||||
| 	FILE *log = NULL; | ||||
| 	for (char *line; xxread(pipefd[0], &line, sizeof(line)) > 0; free(line)) { | ||||
| 		if (!is_daemon_init) { | ||||
| 			vec_push_back(&logs, strdup(line)); | ||||
| 		} else { | ||||
| 			if (log == NULL) { | ||||
| 				// Dump buffered logs to file | ||||
| 				log = xfopen(LOGFILE, "w"); | ||||
| 				setbuf(log, NULL); | ||||
| 				char *tmp; | ||||
| 				vec_for_each(&logs, tmp) { | ||||
| 					fprintf(log, "%s", tmp); | ||||
| 					free(tmp); | ||||
| 				} | ||||
| 				vec_destroy(&logs); | ||||
| 			} | ||||
| 			fprintf(log, "%s", line); | ||||
| 		} | ||||
| 	} | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
| static void *debug_magisk_log_thread(void *args) { | ||||
| 	FILE *log = xfopen(DEBUG_LOG, "a"); | ||||
| 	setbuf(log, NULL); | ||||
| 	int pipefd[2]; | ||||
| 	if (xpipe2(pipefd, O_CLOEXEC) == -1) | ||||
| 		return NULL; | ||||
|  | ||||
| 	LOGD("log_monitor: debug log dumper start"); | ||||
|  | ||||
| 	// Register our listener | ||||
| 	log_events[DEBUG_EVENT].fd = pipefd[1]; | ||||
|  | ||||
| 	for (char *line; xxread(pipefd[0], &line, sizeof(line)) > 0; free(line)) | ||||
| 		fprintf(log, "%s", line); | ||||
|  | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
| /* Start new threads to monitor logcat and dump to logfile */ | ||||
| void monitor_logs() { | ||||
| 	pthread_t thread; | ||||
|  | ||||
| 	// Start log file dumper before monitor | ||||
| 	xpthread_create(&thread, NULL, magisk_log_thread, NULL); | ||||
| 	pthread_detach(thread); | ||||
|  | ||||
| 	// Start logcat monitor | ||||
| 	xpthread_create(&thread, NULL, logger_thread, NULL); | ||||
| 	pthread_detach(thread); | ||||
|  | ||||
| } | ||||
|  | ||||
| void start_debug_full_log() { | ||||
| #ifdef MAGISK_DEBUG | ||||
| 	// Log everything initially | ||||
| 	debug_log_fd = xopen(DEBUG_LOG, O_WRONLY | O_CREAT | O_CLOEXEC | O_TRUNC, 0644); | ||||
| 	debug_log_pid = exec_command(0, &debug_log_fd, NULL, "logcat", "-v", "threadtime", NULL); | ||||
| 	close(debug_log_fd); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void stop_debug_full_log() { | ||||
| #ifdef MAGISK_DEBUG | ||||
| 	// Stop recording the boot logcat after every boot task is done | ||||
| 	kill(debug_log_pid, SIGTERM); | ||||
| 	waitpid(debug_log_pid, NULL, 0); | ||||
| 	// Start debug thread | ||||
| 	start_debug_log(); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void start_debug_log() { | ||||
| #ifdef MAGISK_DEBUG | ||||
| 	pthread_t thread; | ||||
| 	// Start debug thread | ||||
| 	xpthread_create(&thread, NULL, debug_magisk_log_thread, NULL); | ||||
| 	pthread_detach(thread); | ||||
| #endif | ||||
| } | ||||
| @@ -4,6 +4,7 @@ | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include <unistd.h> | ||||
| #include <libgen.h> | ||||
|  | ||||
| #include "utils.h" | ||||
| #include "magisk.h" | ||||
| @@ -11,11 +12,7 @@ | ||||
|  | ||||
| char *argv0; | ||||
|  | ||||
| char *applet[] = | ||||
| 	{ "su", "resetprop", "magiskpolicy", "supolicy", "magiskhide", NULL }; | ||||
|  | ||||
| int (*applet_main[]) (int, char *[]) = | ||||
| 	{ su_client_main, resetprop_main, magiskpolicy_main, magiskpolicy_main, magiskhide_main, NULL }; | ||||
| int (*applet_main[]) (int, char *[]) = { su_client_main, resetprop_main, magiskhide_main, NULL }; | ||||
|  | ||||
| int create_links(const char *bin, const char *path) { | ||||
| 	char self[PATH_MAX], linkpath[PATH_MAX]; | ||||
| @@ -32,10 +29,6 @@ int create_links(const char *bin, const char *path) { | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| // Global error hander function | ||||
| // Should be changed each thread/process | ||||
| __thread void (*err_handler)(void); | ||||
|  | ||||
| static void usage() { | ||||
| 	fprintf(stderr, | ||||
| 		"Magisk v" xstr(MAGISK_VERSION) "(" xstr(MAGISK_VER_CODE) ") (by topjohnwu) multi-call binary\n" | ||||
| @@ -47,18 +40,20 @@ static void usage() { | ||||
| 		"   -c                        print current binary version\n" | ||||
| 		"   -v                        print running daemon version\n" | ||||
| 		"   -V                        print running daemon version code\n" | ||||
| 		"   --list                    list all availible applets\n" | ||||
|         "   --install [SOURCE] DIR    symlink all applets to DIR. SOURCE is optional\n" | ||||
| 		"   --list                    list all available applets\n" | ||||
| 		"   --install [SOURCE] DIR    symlink all applets to DIR. SOURCE is optional\n" | ||||
| 		"   --createimg IMG SIZE      create ext4 image. SIZE is interpreted in MB\n" | ||||
| 		"   --imgsize IMG             report ext4 image used/total size\n" | ||||
| 		"   --resizeimg IMG SIZE      resize ext4 image. SIZE is interpreted in MB\n" | ||||
| 		"   --mountimg IMG PATH       mount IMG to PATH and prints the loop device\n" | ||||
| 		"   --umountimg PATH LOOP     unmount PATH and delete LOOP device\n" | ||||
| 		"   --[boot stage]            start boot stage service\n" | ||||
| 		"   --[init service]          start init service\n" | ||||
| 		"   --unlock-blocks           set BLKROSET flag to OFF for all block devices\n" | ||||
| 		"   --restorecon              fix selinux context on Magisk files and folders\n" | ||||
| 		"   --clone-attr SRC DEST     clone permission, owner, and selinux context\n" | ||||
| 		"\n" | ||||
| 		"Supported boot stages:\n" | ||||
| 		"   post-fs, post-fs-data, service\n" | ||||
| 		"Supported init services:\n" | ||||
| 		"   daemon, post-fs, post-fs-data, service\n" | ||||
| 		"\n" | ||||
| 		"Supported applets:\n" | ||||
| 	, argv0, argv0); | ||||
| @@ -71,15 +66,10 @@ static void usage() { | ||||
|  | ||||
| int main(int argc, char *argv[]) { | ||||
| 	argv0 = argv[0]; | ||||
| 	// Exit the whole app if error occurs by default | ||||
| 	err_handler = exit_proc; | ||||
| 	char * arg = strrchr(argv[0], '/'); | ||||
| 	if (arg) ++arg; | ||||
| 	else arg = argv[0]; | ||||
| 	if (strcmp(arg, "magisk") == 0) { | ||||
| 	if (strcmp(basename(argv[0]), "magisk") == 0) { | ||||
| 		if (argc < 2) usage(); | ||||
| 		if (strcmp(argv[1], "-c") == 0) { | ||||
| 			printf("%s\n", MAGISK_VER_STR); | ||||
| 			printf("%s (%d)\n", MAGISK_VER_STR, MAGISK_VER_CODE); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "-v") == 0) { | ||||
| 			int fd = connect_daemon(); | ||||
| @@ -146,6 +136,17 @@ int main(int argc, char *argv[]) { | ||||
| 		} else if (strcmp(argv[1], "--unlock-blocks") == 0) { | ||||
| 			unlock_blocks(); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--restorecon") == 0) { | ||||
| 			fix_filecon(); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--clone-attr") == 0) { | ||||
| 			if (argc < 4) usage(); | ||||
| 			clone_attr(argv[2], argv[3]); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--daemon") == 0) { | ||||
| 			if (xfork() == 0) | ||||
| 				start_daemon(); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--post-fs") == 0) { | ||||
| 			int fd = connect_daemon(); | ||||
| 			write_int(fd, POST_FS); | ||||
| @@ -162,16 +163,15 @@ int main(int argc, char *argv[]) { | ||||
| 			// It's calling applets | ||||
| 			--argc; | ||||
| 			++argv; | ||||
| 			arg = argv[0]; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// Applets | ||||
| 	for (int i = 0; applet[i]; ++i) { | ||||
| 		if (strcmp(arg, applet[i]) == 0) | ||||
| 		if (strcmp(basename(argv[0]), applet[i]) == 0) | ||||
| 			return (*applet_main[i])(argc, argv); | ||||
| 	} | ||||
|  | ||||
| 	fprintf(stderr, "%s: applet not found\n", arg); | ||||
| 	fprintf(stderr, "%s: applet not found\n", basename(argv[0])); | ||||
| 	return 1; | ||||
| } | ||||
							
								
								
									
										547
									
								
								core/jni/core/magiskinit.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										547
									
								
								core/jni/core/magiskinit.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,18 +1,22 @@ | ||||
| /* socket_trans.c - Functions to transfer data through socket | ||||
| /* socket.c - All socket related operations | ||||
|  */ | ||||
|  | ||||
| #include <unistd.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
| #include <limits.h> | ||||
| #include <fcntl.h> | ||||
| #include <errno.h> | ||||
| #include <sys/types.h> | ||||
| #include <sys/socket.h> | ||||
|  | ||||
| #include "magisk.h" | ||||
| #include "utils.h" | ||||
| #include "daemon.h" | ||||
| #include "logging.h" | ||||
| #include "utils.h" | ||||
| #include "magisk.h" | ||||
|  | ||||
| /* Setup the address and return socket fd */ | ||||
| int setup_socket(struct sockaddr_un *sun) { | ||||
|     int fd = xsocket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0); | ||||
|     memset(sun, 0, sizeof(*sun)); | ||||
|     sun->sun_family = AF_LOCAL; | ||||
|     memcpy(sun->sun_path, REQUESTOR_DAEMON_PATH, sizeof(REQUESTOR_DAEMON_PATH) - 1); | ||||
|     return fd; | ||||
| } | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Receive a file descriptor from a Unix socket. | ||||
							
								
								
									
										158
									
								
								core/jni/external/Android.mk
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								core/jni/external/Android.mk
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,158 @@ | ||||
| LOCAL_PATH:= $(call my-dir) | ||||
|  | ||||
| # libsqlite.so (stub) | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE:= libsqlite | ||||
| LOCAL_C_INCLUDES := jni/external/include | ||||
| LOCAL_SRC_FILES := stubs/sqlite3_stub.c | ||||
| include $(BUILD_SHARED_LIBRARY) | ||||
|  | ||||
| # libselinux.so (stub) | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE:= libselinux | ||||
| LOCAL_C_INCLUDES := $(LIBSELINUX) | ||||
| LOCAL_SRC_FILES := stubs/selinux_stub.c | ||||
| include $(BUILD_SHARED_LIBRARY) | ||||
|  | ||||
| # libfdt.a | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE:= libfdt | ||||
| LOCAL_C_INCLUDES := $(LIBFDT) | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	dtc/libfdt/fdt.c \ | ||||
| 	dtc/libfdt/fdt_addresses.c \ | ||||
| 	dtc/libfdt/fdt_empty_tree.c \ | ||||
| 	dtc/libfdt/fdt_overlay.c \ | ||||
| 	dtc/libfdt/fdt_ro.c \ | ||||
| 	dtc/libfdt/fdt_rw.c \ | ||||
| 	dtc/libfdt/fdt_strerror.c \ | ||||
| 	dtc/libfdt/fdt_sw.c \ | ||||
| 	dtc/libfdt/fdt_wip.c | ||||
| include $(BUILD_STATIC_LIBRARY) | ||||
|  | ||||
| # liblz4.a | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := liblz4 | ||||
| LOCAL_C_INCLUDES += $(LIBLZ4) | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	lz4/lib/lz4.c \ | ||||
| 	lz4/lib/lz4frame.c \ | ||||
| 	lz4/lib/lz4hc.c \ | ||||
| 	lz4/lib/xxhash.c | ||||
| include $(BUILD_STATIC_LIBRARY) | ||||
|  | ||||
| # libbz2.a | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := libbz2 | ||||
| LOCAL_C_INCLUDES += $(LIBBZ2) | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	bzip2/blocksort.c  \ | ||||
| 	bzip2/huffman.c    \ | ||||
| 	bzip2/crctable.c   \ | ||||
| 	bzip2/randtable.c  \ | ||||
| 	bzip2/compress.c   \ | ||||
| 	bzip2/decompress.c \ | ||||
| 	bzip2/bzlib.c | ||||
| include $(BUILD_STATIC_LIBRARY) | ||||
|  | ||||
| # liblzma.a | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := liblzma | ||||
| LOCAL_C_INCLUDES += \ | ||||
| 	$(EXT_PATH)/include/xz_config \ | ||||
| 	$(EXT_PATH)/xz/src/common \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/api \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/check \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/common \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/delta \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/lz \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/lzma \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/rangecoder \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/simple \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	xz/src/common/tuklib_cpucores.c \ | ||||
| 	xz/src/common/tuklib_exit.c \ | ||||
| 	xz/src/common/tuklib_mbstr_fw.c \ | ||||
| 	xz/src/common/tuklib_mbstr_width.c \ | ||||
| 	xz/src/common/tuklib_open_stdxxx.c \ | ||||
| 	xz/src/common/tuklib_physmem.c \ | ||||
| 	xz/src/common/tuklib_progname.c \ | ||||
| 	xz/src/liblzma/check/check.c \ | ||||
| 	xz/src/liblzma/check/crc32_fast.c \ | ||||
| 	xz/src/liblzma/check/crc32_table.c \ | ||||
| 	xz/src/liblzma/check/crc64_fast.c \ | ||||
| 	xz/src/liblzma/check/crc64_table.c \ | ||||
| 	xz/src/liblzma/check/sha256.c \ | ||||
| 	xz/src/liblzma/common/alone_decoder.c \ | ||||
| 	xz/src/liblzma/common/alone_encoder.c \ | ||||
| 	xz/src/liblzma/common/auto_decoder.c \ | ||||
| 	xz/src/liblzma/common/block_buffer_decoder.c \ | ||||
| 	xz/src/liblzma/common/block_buffer_encoder.c \ | ||||
| 	xz/src/liblzma/common/block_decoder.c \ | ||||
| 	xz/src/liblzma/common/block_encoder.c \ | ||||
| 	xz/src/liblzma/common/block_header_decoder.c \ | ||||
| 	xz/src/liblzma/common/block_header_encoder.c \ | ||||
| 	xz/src/liblzma/common/block_util.c \ | ||||
| 	xz/src/liblzma/common/common.c \ | ||||
| 	xz/src/liblzma/common/easy_buffer_encoder.c \ | ||||
| 	xz/src/liblzma/common/easy_decoder_memusage.c \ | ||||
| 	xz/src/liblzma/common/easy_encoder.c \ | ||||
| 	xz/src/liblzma/common/easy_encoder_memusage.c \ | ||||
| 	xz/src/liblzma/common/easy_preset.c \ | ||||
| 	xz/src/liblzma/common/filter_buffer_decoder.c \ | ||||
| 	xz/src/liblzma/common/filter_buffer_encoder.c \ | ||||
| 	xz/src/liblzma/common/filter_common.c \ | ||||
| 	xz/src/liblzma/common/filter_decoder.c \ | ||||
| 	xz/src/liblzma/common/filter_encoder.c \ | ||||
| 	xz/src/liblzma/common/filter_flags_decoder.c \ | ||||
| 	xz/src/liblzma/common/filter_flags_encoder.c \ | ||||
| 	xz/src/liblzma/common/hardware_cputhreads.c \ | ||||
| 	xz/src/liblzma/common/hardware_physmem.c \ | ||||
| 	xz/src/liblzma/common/index.c \ | ||||
| 	xz/src/liblzma/common/index_decoder.c \ | ||||
| 	xz/src/liblzma/common/index_encoder.c \ | ||||
| 	xz/src/liblzma/common/index_hash.c \ | ||||
| 	xz/src/liblzma/common/outqueue.c \ | ||||
| 	xz/src/liblzma/common/stream_buffer_decoder.c \ | ||||
| 	xz/src/liblzma/common/stream_buffer_encoder.c \ | ||||
| 	xz/src/liblzma/common/stream_decoder.c \ | ||||
| 	xz/src/liblzma/common/stream_encoder.c \ | ||||
| 	xz/src/liblzma/common/stream_encoder_mt.c \ | ||||
| 	xz/src/liblzma/common/stream_flags_common.c \ | ||||
| 	xz/src/liblzma/common/stream_flags_decoder.c \ | ||||
| 	xz/src/liblzma/common/stream_flags_encoder.c \ | ||||
| 	xz/src/liblzma/common/vli_decoder.c \ | ||||
| 	xz/src/liblzma/common/vli_encoder.c \ | ||||
| 	xz/src/liblzma/common/vli_size.c \ | ||||
| 	xz/src/liblzma/delta/delta_common.c \ | ||||
| 	xz/src/liblzma/delta/delta_decoder.c \ | ||||
| 	xz/src/liblzma/delta/delta_encoder.c \ | ||||
| 	xz/src/liblzma/lz/lz_decoder.c \ | ||||
| 	xz/src/liblzma/lz/lz_encoder.c \ | ||||
| 	xz/src/liblzma/lz/lz_encoder_mf.c \ | ||||
| 	xz/src/liblzma/lzma/fastpos_table.c \ | ||||
| 	xz/src/liblzma/lzma/fastpos_tablegen.c \ | ||||
| 	xz/src/liblzma/lzma/lzma2_decoder.c \ | ||||
| 	xz/src/liblzma/lzma/lzma2_encoder.c \ | ||||
| 	xz/src/liblzma/lzma/lzma_decoder.c \ | ||||
| 	xz/src/liblzma/lzma/lzma_encoder.c \ | ||||
| 	xz/src/liblzma/lzma/lzma_encoder_optimum_fast.c \ | ||||
| 	xz/src/liblzma/lzma/lzma_encoder_optimum_normal.c \ | ||||
| 	xz/src/liblzma/lzma/lzma_encoder_presets.c \ | ||||
| 	xz/src/liblzma/rangecoder/price_table.c \ | ||||
| 	xz/src/liblzma/rangecoder/price_tablegen.c \ | ||||
| 	xz/src/liblzma/simple/arm.c \ | ||||
| 	xz/src/liblzma/simple/armthumb.c \ | ||||
| 	xz/src/liblzma/simple/ia64.c \ | ||||
| 	xz/src/liblzma/simple/powerpc.c \ | ||||
| 	xz/src/liblzma/simple/simple_coder.c \ | ||||
| 	xz/src/liblzma/simple/simple_decoder.c \ | ||||
| 	xz/src/liblzma/simple/simple_encoder.c \ | ||||
| 	xz/src/liblzma/simple/sparc.c \ | ||||
| 	xz/src/liblzma/simple/x86.c | ||||
| LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=c99 | ||||
| include $(BUILD_STATIC_LIBRARY) | ||||
|  | ||||
| # libsepol.a | ||||
| include $(SE_PATH)/libsepol/Android.mk | ||||
							
								
								
									
										1
									
								
								core/jni/external/busybox
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								core/jni/external/busybox
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule core/jni/external/busybox added at e3a1a4d91f
									
								
							
							
								
								
									
										1
									
								
								core/jni/external/bzip2
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								core/jni/external/bzip2
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule core/jni/external/bzip2 added at 67d818584d
									
								
							
							
								
								
									
										1
									
								
								core/jni/external/dtc
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								core/jni/external/dtc
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule core/jni/external/dtc added at 22a65c5331
									
								
							
							
								
								
									
										498
									
								
								core/jni/external/include/xz_config/config.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										498
									
								
								core/jni/external/include/xz_config/config.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1
									
								
								core/jni/external/lz4
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								core/jni/external/lz4
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule core/jni/external/lz4 added at c10863b98e
									
								
							
							
								
								
									
										1
									
								
								core/jni/external/selinux
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								core/jni/external/selinux
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule core/jni/external/selinux added at 8e849a5639
									
								
							
							
								
								
									
										1
									
								
								core/jni/external/xz
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								core/jni/external/xz
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule core/jni/external/xz added at 3d566cd519
									
								
							
							
								
								
									
										60
									
								
								core/jni/include/cpio.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								core/jni/include/cpio.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | ||||
| #ifndef _CPIO_H_ | ||||
| #define _CPIO_H_ | ||||
|  | ||||
| #include <stdint.h> | ||||
|  | ||||
| #include "vector.h" | ||||
|  | ||||
| typedef struct cpio_entry { | ||||
| 	// uint32_t ino; | ||||
| 	uint32_t mode; | ||||
| 	uint32_t uid; | ||||
| 	uint32_t gid; | ||||
| 	// uint32_t nlink; | ||||
| 	// uint32_t mtime; | ||||
| 	uint32_t filesize; | ||||
| 	// uint32_t devmajor; | ||||
| 	// uint32_t devminor; | ||||
| 	// uint32_t rdevmajor; | ||||
| 	// uint32_t rdevminor; | ||||
| 	// uint32_t namesize; | ||||
| 	// uint32_t check; | ||||
| 	char *filename; | ||||
| 	void *data; | ||||
| 	int remove; | ||||
| } cpio_entry; | ||||
|  | ||||
| typedef struct cpio_newc_header { | ||||
| 	char magic[6]; | ||||
| 	char ino[8]; | ||||
| 	char mode[8]; | ||||
| 	char uid[8]; | ||||
| 	char gid[8]; | ||||
| 	char nlink[8]; | ||||
| 	char mtime[8]; | ||||
| 	char filesize[8]; | ||||
| 	char devmajor[8]; | ||||
| 	char devminor[8]; | ||||
| 	char rdevmajor[8]; | ||||
| 	char rdevminor[8]; | ||||
| 	char namesize[8]; | ||||
| 	char check[8]; | ||||
| } cpio_newc_header; | ||||
|  | ||||
| // Basic cpio functions | ||||
| void cpio_free(cpio_entry *e); | ||||
| int cpio_find(struct vector *v, const char *entry); | ||||
| int cpio_cmp(const void *a, const void *b); | ||||
| void parse_cpio(struct vector *v, const char *filename); | ||||
| void dump_cpio(struct vector *v, const char *filename); | ||||
| void cpio_vec_insert(struct vector *v, cpio_entry *n); | ||||
| void cpio_vec_destroy(struct vector *v); | ||||
| void cpio_rm(struct vector *v, int recursive, const char *entry); | ||||
| void cpio_mkdir(struct vector *v, mode_t mode, const char *entry); | ||||
| void cpio_ln(struct vector *v, const char *target, const char *entry); | ||||
| void cpio_add(struct vector *v, mode_t mode, const char *entry, const char *filename); | ||||
| int cpio_mv(struct vector *v, const char *from, const char *to); | ||||
| int cpio_extract(struct vector *v, const char *entry, const char *filename); | ||||
| void cpio_extract_all(struct vector *v); | ||||
|  | ||||
| #endif | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user